[RFC] __extension__ and warnings

Neil Booth neil@daikokuya.co.uk
Wed Dec 11 15:54:00 GMT 2002


Zack Weinberg wrote:-

> The spec for pedwarn and pedantic, as I understand it, which may be a
> bit out of date, is:
> 
>  - If and only if the diagnostic in question is mandated by the
>    relevant standard (C89, C99, C++98, F77, etc) use pedwarn()
>    (unless you are using error() instead).
> 
>  - If, despite this, we do not think the warning should be on by
>    default, put the pedwarn call under if (pedantic) or possibly
>    if (pedantic||Wall).
> 
> The spec for __extension__ is, it asserts that the following
> expression makes deliberate use of GNU extensions under proper
> #ifdeffage, so don't bug the programmer about it.  Some, but not all,
> GNU extensions draw mandatory diagnostics; others are properly
> complained about by -Wtraditional and the like.  So the two properties
> are somewhat orthogonal.
> 
> I'm now imagining turning the DT_* enumeration into a set of bitflags,
> so that you could write e.g.
> 
>   diagnostic (DT_EXTENSION | DT_MANDATED | DT_WARNING, "...")
> 
> to achieve the effect of 'pedwarn but shut up under __extension__.'

I prefer this.  Fancy changing all error(), warning(), pedwarn(), ...,
calls?  8-)

Neil.



More information about the Gcc mailing list