Boost logo

Boost :

Subject: Re: [boost] [Wiki] Changes in information about gcc warnings.
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-01-11 05:14:55

> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> On Behalf Of Patrick Horgan
> Sent: Tuesday, January 11, 2011 12:05 AM
> To: boost_at_[hidden]
> Subject: [boost] [Wiki] Changes in information about gcc warnings.
> I did a first cut at adding information to the wiki
> for
> changes in GCC that let you suppress warnings locally. It's probably not
useful to
> you, since it's only in gcc version 4.x and the ability to push and pop
the current
> state is very recent, in 4.6.
> Nevertheless it needed documenting. There's a change to the behavior of
> #pragma GCC system_header as well. It previously had to be at file scope,
> now can be anywhere in the file and affects from that point forward. The
> pragma:
> #pragma GCC diagnostic <ignored|warning|error> "-
> used like:
> #pragma GCC diagnostic ignored "-Wdeprecated-declarations".
> Prior to 4.6 this also had to be at file scope. As of 4.6 it can be at
any line. With
> both it affects from that point forward.
> #pragma GCC diagnostic <push|pop>
> These two just showed up at 4.6 and can be at any line. Without them, the
> previous pragma is not that useful because if you affect the users flags
they will
> not like you! lol! With them you can do what you really want:
> #pragma GCC diagnostic push
> #pragma GCC diagnostic "-Wunitialized"
> // your code here
> #pragma GCC diagnostic pop
> 4.6 is the current development trunk, so consider this a heads up. I'm
trying to
> get from the gcc guys a good description of what preprocessor checks can
> done to determine what's available when. When I get it, I'll add it to
the wiki.
> Of course, almost all of the time warnings represent real issues and it's
better to
> change your code to get rid of the warning and make it more correct, than
> change your code to have ugly pragmas that suppress the warning.

Of course!

Thanks for this - please do not hesitate to update the wiki with this
valuable information.

You might like to enquire of GCC if there is a limit on the number of
push'n'pops - as we discovered with MSVC (which severely limits its
usefulness as with Boost libraries it would be easy to exceed the limit
(about 50). This limit increases the desirability of dealing the cause of
the warnings, rather than silencing them).


PS We have little or no information about other platforms. Are spurious
warnings a non-issue with them?

Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204

Boost list run by bdawes at, gregod at, cpdaniel at, john at