[cfe-dev] Unexpected warning in -std=gnu89 -pedantic mode.

Eli Friedman eli.friedman at gmail.com
Wed Aug 26 13:28:36 PDT 2009


On Wed, Aug 26, 2009 at 12:57 PM, Enea Zaffanella<zaffanella at cs.unipr.it> wrote:
> Initially, I misread it and was assuming that gnu89 and gnu99 were
> considered to be "standards", as much as c89 and c99. Then I realized that
> each of them is just a "dialect of a standard". Under this interpretation,
> as far as diagnostic is concerned, there should be no difference at all
> between
>    -std=c89 -pedantic
> and
>    -std=gnu89 -pedantic
>
> Is that the intended behavior?

That's what we implement, and it isn't by accident, if that's what
you're asking.  http://clang.llvm.org/docs/UsersManual.html#c_modes is
a complete list of the differences between the modes.

> If it is ... then it still sounds a bit strange to me. In particular, what
> would then be the reason for allowing a combination such as
>    -std=gnu89 -pedantic-errors
> ?

Basically just copying gcc... you're right, it isn't really a useful
set of options.

The issue here is that arguably, almost everything which we print a
warning for with -pedantic is a GNU extension, since they're
violations of the standard and implemented by gcc.  Also, I'm not sure
what we would gain by classifying extension warnings into GNU
extensions and "generic" extensions.

-Eli




More information about the cfe-dev mailing list