New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignore unknown compiler options #662
Comments
it seems like you've explicitly turned on that warning via |
We didn't, it's on by default apparently: https://godbolt.org/z/366vTv |
ah pardon my ignorance :/ then you can disable it by adding
|
This has been specifically requested: clangd/vscode-clangd#114 and various issues can be addressed with this as a workaround, e.g.: clangd/clangd#662 Differential Revision: https://reviews.llvm.org/D95349
This has been specifically requested: clangd/vscode-clangd#114 and various issues can be addressed with this as a workaround, e.g.: clangd/clangd#662 Differential Revision: https://reviews.llvm.org/D95349
This has been specifically requested: clangd/vscode-clangd#114 and various issues can be addressed with this as a workaround, e.g.: clangd/clangd#662 Differential Revision: https://reviews.llvm.org/D95349
For other googlers who found this issue and are needing to turn of GCC-specific compiler arguments like machine optimizations and whatnot, here's what I found. I'm running I get lots of "Unknown argument" warnings, with a
I found that adding the following to my CompileFlags:
Add: -Wno-unknown-warning-option
Remove: [-m*, -f*] (pretty sure I got this from somewhere else, but I can't seem to find it now. Will try to credit my source if I find it.) |
Remove unknown warnings when building the compile_commands.json with gcc. Courtesy to clangd/clangd#662 (comment).
This "works", but it's messy. It ignores compiler flags which can change the semantics of the code the LSP is analyzing. This can mean that you miss warnings or errors that the compiler will catch later when you run it, instead of your LSP telling you about them--or, worse, that the LSP understands the code incorrectly. There are two better solutions, depending on what you want to do.
|
Do you know how this ("selecting another compiler") works with ccls? My understanding is that ccls is also built on top of the clang libraries, like clangd. |
See the ccls documentation for the .ccls file, though this is getting offtopic for the |
I'm asking for the purpose of evaluating whether there is something clangd could be doing more like ccls. I've looked at that link, but I haven't seen anything to indicate ccls has capabilities of imitating gcc more closely than clangd does. Being able to specify the compiler driver as discussed in this section seems to be the equivalent of https://clangd.llvm.org/config.html#compiler. It does not imply supporting command-line arguments that clang doesn't recognize. Note that in the ccls FAQ, under Compiling with GCC, it says:
which again just seems like the equivalent of https://clangd.llvm.org/config.html#remove. |
When a project is configured for building with gcc it may enable options that are not supported by clang.
Then I get lots of errors in the editor and in the problems view, e.g.
System information
Output of
clangd --version
: 10.0.1 (https://github.com/llvm/llvm-project f79cd71e145c6fd005ba4dd1238128dfa0dc2cb6)Editor/LSP plugin: VSCode
Operating system: WSL
The text was updated successfully, but these errors were encountered: