[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug: "gcc -std=gnu99" passes AC_PROG_CC_C11

From: Adrian Bunk
Subject: Re: bug: "gcc -std=gnu99" passes AC_PROG_CC_C11
Date: Wed, 26 Sep 2012 01:21:37 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Sep 25, 2012 at 03:53:43PM -0600, Eric Blake wrote:
> On 09/25/2012 03:22 PM, Adrian Bunk wrote:
> > On Tue, Sep 25, 2012 at 01:58:29PM -0700, Paul Eggert wrote:
> >> Sorry, I don't see a bug there.  "gcc -std=gnu99"
> >> accepts ISO C11, in the sense that it passes all the
> >> C11 tests that we have, if your version of GCC is
> >> sufficiently new.  This is because the GCC supports
> >> these C11 features even when running in C99 mode.
> > 
> > The only compiler for which autoconf currently knows how to set it into 
> > C11 mode passes the test in C99 mode.
> No, the only compiler for which autoconf currently knows how to require
> C11 compiler features happens to be gcc in 'gnu99' mode (C99 +
> extensions, where those extensions happen to include C11 compiler features).

No, gcc 4.7 does have C11 modes, and when the compiler fails
the C11 tests autoconf does try to put gcc into gnu11 mode.

> > That sounds a bit odd to me.
> No odder than the fact that you can use -std=gnu89 to get C99 compiler
> features on top of C89 requirements.

But when you want as much C99 support as possible (perhaps testing in 
macros for more exotic C99 features later) it would be wrong to have
gcc in gnu89 mode.

> >> If there's some C11 feature that is missing,
> >> a feature that it's reasonable to expect from C11
> >> compilers, we could add that to the test, and this
> >> will cause 'configure' to say "no" rather than "yes".
> >> I did briefly try to think of such a feature but
> >> came up dry.
> > 
> > What about
> > 
> > #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 201112L)
> > #error compiler is not in C11 mode
> > #endif
> That's not a compiler feature, but a feature of the system headers.

What do you base that statement on?

AFAIK it is a compiler feature, and in the glibc/gcc combination it is
gcc that defines __STDC_VERSION__ depending on the compiler mode.



       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

reply via email to

[Prev in Thread] Current Thread [Next in Thread]