Re: How do I disable warnings across versions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012-05-14 15:59:27 -0700, Andy Lutomirski wrote:
> Unfortunately, the bogus warning is -Wuninitialized in gcc 4.6 and
> -Wmaybe-uninitialized in gcc 4.7.  The obvious way to silence the
> warning is to wrap it in:
> 
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wuninitialized"
> #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
> ...
> #pragma GCC diagnostic pop
> 
> It silences the original warning, but now gcc 4.6 says:
> warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
> 
> This seems to defeat the purpose, and adding
> #pragma GCC diagnostic ignored "-Wpragmas"
> is a little gross.  How am I supposed to do this?

I think that

#pragma GCC diagnostic ignored "-Wpragmas"

is exactly what you want. For instance,

#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wfoo"
#pragma GCC diagnostic warning "-Wpragmas"
#pragma GCC diagnostic ignored "-Wbar"

will just give a warning concerning -Wbar.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux