c++ - How do I disable Unused Variable warnings in Eclipse in minGW? -
how can disable following warning in c++ in mingw?
warning: unused variable 'x' [-wunused-variable]
in eclipse cdt, can't locate warning number:
../src/subfolder/classtwo.cpp:20:8: warning: unused variable 'x' [-wunused-variable]
i tried doing this:
#pragma warning(push) #pragma warning(disable: ?) //which number? #include "subfolder/classtwo.h" #pragma warning(pop)
but didn't work.
my questions:
- how can warning number of in eclipse cdt?
- how should pragma directive written?
it looks output clang. can achieve same using clang using approach outlined here: http://clang.llvm.org/docs/usersmanual.html#controlling-diagnostics-via-pragmas:
#pragma clang diagnostic push #pragma clang diagnostic ignored "-wunused-variable" #include "subfolder/classtwo.h" #pragma clang diagnostic pop
if that's source file, fix warning.
for gcc, can use this: selectively disable gcc warnings part of translation unit?
#pragma gcc diagnostic push #pragma gcc diagnostic ignored "-wunused-variable" #include "subfolder/classtwo.h" #pragma gcc diagnostic pop
of course, leave amount of pragma noise -- debatable if bad thing =)
Comments
Post a Comment