Closed Jialin closed 5 years ago
g++ -Weverything would generate unused-macros warning
To confirm, is g++
here really clang
(as you're on macOS) ?
Clang does have this warning and neither libclang nor clangd completers honour it.
On 5 March 2019 22:10:10 CET, Ben Jackson notifications@github.com wrote:
g++ -Weverything would generate unused-macros warning
To confirm, is
g++
here reallyclang
(as you're on macOS) ?-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/Valloric/YouCompleteMe/issues/3337#issuecomment-469858192
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
I can imagine why. There are probably more unused macros in a given TU than used ones in most files. I suspect for that reason that this sort of warning is generated in a much later pass than the syntax-only checks run. But that would be a question for the clang developers.
It may be the "Incomplete" flag for example.
Anyway, yes clang
does report this:
clang -o test -Weverything test.cc
test.cc:1:9: warning: macro is not used [-Wunused-macros]
#define UNUSED(i) ++i
^
1 warning generated.
But so does c-index-test
:
BenMBP:test-unused-macro ben$ /Users/ben/Development/llvm/root/release/bin/c-index-test -cursor-at=test.cc:1:1 -Weverything test.cc
0:0 Invalid Cursor => NoDeclFound
test.cc:1:9: warning: macro is not used [-Wunused-macros]
Number FIX-ITs = 0
But can confirm that when using 'Editing' mode in libclang this warning is not produced:
bash-3.2$ CINDEXTEST_EDITING=1 /Users/ben/Development/llvm/root/debug/bin/c-index-test -cursor-at=test.cc:1:1 -Weveryth
ing test.cc
0:0 Invalid Cursor => NoDeclFound
Therefore, this is not a YCM bug, nor a libclang one, it's an intentional compromise to prove the best overall experience for code completion and semantic analysis in real time.
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.install.py
(orcmake
/make
/ninja
) including its invocationThank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
Seems unused-macros warnings are swallowed by YCM.
I added an unused macros in my code, but the vim doesn't highlight the unused code.
For the following code:
g++ -Weverything
would generate unused-macros warningBut seems YouCompleteMe swallow the warnings.
Diagnostic data
Output of
vim --version
Output of
YcmDebugInfo
Contents of YCM, ycmd and completion engine logfiles
OS version, distribution, etc.