-
Notifications
You must be signed in to change notification settings - Fork 113
generate.py doesn't filter out unsupported flag #93
Comments
If the compiler does not support the flag, then bazel should not be using the flag. And if bazel is not using the flag, then compile_commands.json would not have it. Is that not the case? Can you check the exact command line as used by bazel and compare with what is in compile_commands.json? |
We are using gcc to compile our codebase, so Bazel is using it - and of course the flag is supported in gcc. |
I see. I think the proper solution here would be to generate the compile commands file with a clang toolchain instead of gcc, because we don't want to get into the business of maintaining a list of supported flags or unsupported flags. You can do this by exporting the This specific flag that you are referring to, looks like should not really be in use except for very old gcc compilers (see this issue and this change). |
Makes sense. I'm working on a project that can be compiled only with a specific version of gcc, I cannot change compiler at will (because of a dependency). Without the flag filtering, this generates an error message in each file when using clangd. Using my fork removing the flag there's no such error, of course. |
Thanks for the response. Closing this issue because the recommended solution here would be to generate the compile_commands.json file with Alternatively, this could be set as the default env when calling bazel inside |
As of version 13.0.1,
clang
doesn't support the flag-fno-canonical-system-headers
.The generated compile_commands.json might contain this flag, since the generation script doesn't filter it out.
We should filter out this flag.
The text was updated successfully, but these errors were encountered: