This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Warning Supression Doesn't Work


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]