Warning Supression Doesn't Work

Lex Fridman lexfridman@gmail.com
Thu May 22 23:49:00 GMT 2008


Can anyone give an example statement that ignores a type of warning (for
example the "unused variable" warning") using the new #pragma GCC diagnostic
...? For the life of me, I can't figure out the proper syntax for this. The
only page I can find on #pragma GCC diagnostic is
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html

How would I use -fdiagnostics-show-option that the above link mentions?

What I've tried is to put one of the following in foo.cpp:
#pragma GCC diagnostic ignored -Wunused
#pragma GCC diagnostic warning -Wunused
#pragma GCC diagnostic ignored "-Wunused"
#pragma GCC diagnostic warning "-Wunused"

Do I need to have a later version of gcc than 4.1.3 for it to work? GCC
simply says warning: ignoring #pragma GCC diagnostic
-- 
View this message in context: http://www.nabble.com/Warning-Supression-Doesn%27t-Work-tp17330928p17415726.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list