[Off-topic] Wrote the suppressing warnings for GCC section of boost wiki page on Warning Guidelines

Jonathan Wakely jwakely.gcc@gmail.com
Fri Jan 14 23:17:00 GMT 2011


On 14 January 2011 22:05, Patrick Horgan wrote:
> I added a section to the boost warnings guidelines page about suppressing
> warnings with GCC.  I think it's pretty good bringing together information I
> got on this list, from reading the source and from browsing through the
> documentation for various releases of GCC.  If anyone wants to check it for
> correctness I would be very appreciative.  I would in particular like to
> thank Jonathan Wakely for his willingness to help and for the great help he
> gave me on this list.
>
> https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines
>
> If you scroll to the bottom directly you'll see the end of the section on
> suppressing GCC warnings.

In the example:

    GCC_DIAG_OFF(sign-compare);
    if(a < b){
    GCC_DIAG_ON(sign-compare);

It might be worth mentioning that example assumes GCC 4.6, so the
macros work at function-scope (my fault for the bad example.)

And later on, it says "they risk future collision with GCC macros"
While I agree that macros should be named to avoid collisions, macros
defined by GCC will use the reserved namespace, i.e. begin with one or
two underscores followed by an uppercase letter, e.g. __GNUC__,
_GLIBCXX_DEBUG



More information about the Gcc-help mailing list