[SERVER-67681] Create specific target for compile commands Created: 29/Jun/22 Updated: 29/Oct/23 Resolved: 28/Oct/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.1, 5.0.14, 6.0.3, 6.2.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Juan Gu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Backport Requested: |
v6.1, v6.0, v5.0
|
||||
| Participants: | |||||
| Description |
|
Can we get a target specifically for generating compile_commands.json? I always recommend having a dedicated config for it anyway. In particular, it should use clang, not use icecc or ccache, enable flags that maximize enabled code to improve find-references (especially --dbg=on but there are a few others), and --disable-warnings-as-errors (this plays nicer with its usage inside of IDEs/editors). |
| Comments |
| Comment by Githook User [ 28/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: (cherry picked from commit 5678e6188e7d3a6401b4bdc6aa3b46db949f2235) | |||
| Comment by Githook User [ 28/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: (cherry picked from commit 3a31638a3c0bc80fe03faf0bafba5aefaefc2b84) | |||
| Comment by Githook User [ 28/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: (cherry picked from commit 5678e6188e7d3a6401b4bdc6aa3b46db949f2235) | |||
| Comment by Githook User [ 27/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: (cherry picked from commit 3a31638a3c0bc80fe03faf0bafba5aefaefc2b84) | |||
| Comment by Githook User [ 27/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: (cherry picked from commit 5678e6188e7d3a6401b4bdc6aa3b46db949f2235) | |||
| Comment by Githook User [ 27/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: | |||
| Comment by Githook User [ 25/Oct/22 ] | |||
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: | |||
| Comment by Mathias Stearn [ 24/Oct/22 ] | |||
|
I'm using nvim + coc + clangd rather than vscode. At least with my setup, warnings get yellow rather than red squiggles. I thought vscode does something similar, but I'm not sure. And in the past, I've found that clang tends to "give up" once it sees errors, but doesn't for warnings. So it is nice when editing if transient warnings like unused vars (eg, because I haven't yet written the code that will consume it) don't mask actual errors in the code I'm currently typing. Have you verified that the compile_commands.json file doesn't have any -Werror flags in it? If your are seeing red squiggles, it might be worth double checking. Note that I've recently added the following to my ~/.config/clangd/config.yaml, so it isn't an issue for me personally anymore, but I think we should try to give a nicer OOTB experience for people who don't know to do this:
Edit: I forgot that I made unused warnings specifically give grey squiggles because they can be very noisy sometimes, in particular in some other languages and codebases. But other warnings do have yellow squiggles. | |||
| Comment by Juan Gu [ 14/Oct/22 ] | |||
|
I am doing tests with --disable-warnings-as-errors = configure/source/None, All of three different options give me red squiggles and messages from VSCode like the screen capture below. Could you share more details on how does --disable-warnings-as-errors plays nicer inside IDEs/editors
|