This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add a __nowarn__ keyword
> and use the typedef instead?
What, you don't like all those "structs" around? ;-)
> Is it correct that the "user interface" now is to say
>
> #pragma GCC push
$pragma GCC diagnostics push
> ?
Yes.
> If yes, is the "push" necessary? Can we make it implicit?
So, a pop with no corresponding push, restores to... what? The way
the code is now, if you don't push or save, it never even starts the
chain - it doesn't know the difference between a command line setting
and a #pragma without a push. Thus, a pop wouldn't do anything
anyway.
I think what you want is, an unmatched pop restores the command line
settings, yes? To do that, we'd need two things:
1. Something in gcc does the implicit save to start the chain, so that
all #pragma changes are in the chain and not the table.
2. An unmatched pop points you back at the head of the chain, which is
a no-op state created by that save.
But then, there would be no way to restore some project-wide settings
pulled in by a #include.
Or did you mean that a pop always pops just ONE #pragma? The current
structure allows that, easier if we move the state struct to
diagnostics.h. Then, you just restore to state->previous. But is
that a pop, or an undo?