Warnings in the C++ Front-End and GCC in General

Martin Knoblauch knobi@rocketmail.com
Mon Sep 7 16:21:00 GMT 1998


---Mark Mitchell <mark@markmitchell.com> wrote:
>
> 
> 
> As of yet, there is no way to turn off warnings in a particular block
> of code, although this was the main motivation for this work.  The
> reason is that I believe the logical way to do this is via `#pragma',
> e.g.:
>    
>   #pragma gcc_diable_warn (62)
>   ...
>   #pragma gcc_enable_warn (62)
> 
> However, I did *not* implement this (although it will now be trivial),
> because GCC has traditionally eschewed #pragma.  In fact, the GCC
> manual says:
> 
>   It is basically a mistake to use `#pragma' for *anything*.
> 
> I believe this to be an over-statement.  For this particular
> situation, I think `#pragma' is the way to go.  If I do not hear
> violent disagreement in the next few days, I will go ahead and
> implement this.
> 

 What is the problem (besides non-portability) of '#pragma'?
Anyway, in addition to the two pragma's you mentioned, a third
one:

#pragma gcc_warn_once (number)

 would be useful. It would allow to warn exactely once
for every occurence[/file]. For e.g. X-header files you
would see the warning, but would not be swamped.

Martin
===
------------------------------------------------------
Martin Knoblauch
email: knobi@knobisoft.de or knobi@rocketmail.com
www:   http://www.knobisoft.de

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the Gcc-patches mailing list