#pragma push and pop (actually it's pragma warning push(...) and pop(...) )

Kevin Buettner kev@primenet.com
Tue, 5 Sep 2000 13:58:06 -0700


On Sep 5,  1:31pm, Lucas Vogel wrote:

> 	Unless there is a different (or even standard) way to produce the
> same results I kind of think the gcc reason that you mentioned doesn't seem
> to be a very strong argument. I border on not knowing what I'm talking about
> here, but it seems as though the implementation of such a keyword/macro
> wouldn't be such a hard thing to do, and would even be useful to some
> extent. I have compiled many a program that spits out all kinds of different
> warnings; it would be nice if those warnings could be hidden from view if
> they're not something I need to worry about. 
> 
> Any comments from anyone on this?
> 
> 	FYI, what it allows you to do with the push and pop is disable
> certain warning messages and change warning levels at compile time for
> certain headers. I can post the explanation and example, if anyone is
> interested.

AFAIK, there's no way (in GCC/G++) to disable warning messages for a
particular section of code and then reenable them again at a later
time.

I have found that you can get reasonably good results with picking and
choosing which -W switches you pass to the compiler.  In particular, I
find that disabling -Wunused is usually a good idea since this warning
switch will complain about unused parameters (which IMO is perfectly
acceptable) in addition to complaining about unused variables.  I know
of someone who has some patches to fix this problem, but I have no
idea if the patch has been accepted.

Kevin