On 01/11/2011 05:20 PM, Patrick Horgan wrote:
... elision by patrick ...
This is great, and supports the use to turn warnings off wonderfully.
From reading this I assume that 4.5 is the point at which the pragmas
were able to be put at any scope instead of just file scope. Is this
also true for #pragma GCC system_header as well, that prior to 4.5 it
had to be at file scope, but from 4.6 forward it can be at any scope?
Ok. I get it. It has to be 4.6 to be at any scope, not 4.5
... elision by patrick ...
Also is there an implementation defined nesting limit to #pragma GCC
diagnostic push as there is in the similar microsoft compiler #pragma
warning push? (Their limit is about 50 I think). That seems like it
would be plenty, but it's been hit in boost code that was doing tmp.
I read the source and found that the only limit is available memory for
the stack, since each time something is pushed the stack is xrealloc'd
(the libiberty version of realloc that prints an error to stderr and
exits on failure), one bigger, and by the size of an index to that stack
that can be held in a signed integer. Funny they didn't use unsigned
integer, so the limit would be higher. It's one of my pet peeves, when
someone means something to function as a counter from 0-N positive, but
uses an int. It lacks elegance. Oh, well, I wouldn't like people
dissecting my code! lol!
Also, what if there are too many pops? Is that an error, or ignored?
Also reading the source, reverts to state as set by command line
arguments when the diagnostic stack is empty.
Patrick