[Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 7 18:04:00 GMT 2007



------- Comment #3 from joseph at codesourcery dot com  2007-03-07 18:04 -------
Subject: Re:  -std=c89 doesn't warn about gcc's "?:" extension

On Wed, 7 Mar 2007, manu at gcc dot gnu dot org wrote:

> The documentation says that you should use -pedantic to warn about GCC
> extensions[*], so I am not sure whether this is valid. But honestly, from the
> description of "-std=", I would understand that GNU extensions are disabled
> when using -std=c89 or that pedantic does not warn for them when using
> -std=gnu89, but neither of those are true.

The key concept is that of base standard, as described in this passage 
from invoke.texi:

Where the standard specified with @option{-std} represents a GNU
extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
corresponding @dfn{base standard}, the version of ISO C on which the GNU
extended dialect is based.  Warnings from @option{-pedantic} are given
where they are required by the base standard.  (It would not make sense
for such warnings to be given only for features not in the specified GNU
C dialect, since by definition the GNU dialects of C include all
features the compiler supports with the given option, and there would be
nothing to warn about.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368



More information about the Gcc-bugs mailing list