bug-autoconf
[Top][All Lists]
Advanced

[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 22:20:59 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Sep 26, 2012 at 08:03:01AM -0700, Paul Eggert wrote:
> On 09/26/2012 06:24 AM, Adrian Bunk wrote:
> 
> > You assume gnu99 will always include all features of gnu11?
> 
> Yes.  I don't see why it wouldn't.  C11 is not incompatible
> with C99, the way that C99 was incompatible with C89.

That sounds like a description why the autoconf 2.70 change of putting 
the compiler into the highest possible mode in AC_PROG_CC could break 
existing software?

> (Again, except for 'gets'.)
> 
> As I understand it, the scenario you're worried about is that if a
> package really needs C11 features that -std=gnu99 would disable in
> future hypothetical versions of GCC, and if the package's builder
> then runs 'configure CC="gcc -std=gnu99"', then AC_PROG_CC won't
> replace that '-std=gnu99' with '-std=gnu11'.  But this scenario
> is so implausible that surely we need not worry about it.  Or
> possibly I'm misunderstanding you....

The CC="gcc -std=gnu99" is needed in my example, it is not a part of the 
scenario when the compiler defaults to C99 - which is neither for gcc 
nor for other compilers that implausible.

> > - currently gcc >= 4.7 is the only compiler supported for that in 
> >   autoconf
> 
> True, but I just now pushed this for IBM XL C.  And it will come
> in the other compilers.

Looking at the documentation on the internet IBM XL C 12.1:
- documents that __STDC_VERSION__ is defined
- does not seem to know the __STDC_VERSION__ value for C11
  (not surprising when it is old enough to name the option extc1x)
- does not support enough of C11 to pass the autoconf test anyway

I see the small window of a compiler predating the definition of the 
__STDC_VERSION__ for C11 but supporting enough of C11 for passing the 
rest of the autoconf test, but I wonder if there are actually examples
where happen in practice, since you need:
- autoconf >= 2.70 and
- a compiler old enough to not know the C11 value of __STDC_VERSION__
- but supporting enough of C11 to pass the rest of the autoconf test

The time window between the release of autoconf 2.70 and such compilers 
going extinct (if they exist at all) is pretty small, so I doubt that
this is a problem in practice.

> >From 97e027a8f736c9754212607cb01f87a5997699b0 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <address@hidden>
> Date: Wed, 26 Sep 2012 07:49:59 -0700
> Subject: [PATCH] AC_PROG_CC: try -qlanglvl=extc1x, for IBM XL C V12.1
> 
> * lib/autoconf/c.m4 (_AC_PROG_CC_C11): Add -qlanglvl=extc1x, for
> IBM XL C V12.1.  It shouldn't pass the C11 test yet, since it's not
> documented to support _Alignas, _Alignof, UTF-8 string literals,
> and duplicate typedefs, but presumably it will eventually.
> ---
>...
> +dnl IBM XL C -qlanglvl=extc1x (no extc11 or (unused) stdc11 in V12.1)
>  dnl with extended modes being tried first.
> -[[-std=gnu11]], [$1], [$2])[]dnl
> +[[-std=gnu11 -qlanglvl=extc1x]], [$1], [$2])[]dnl
>...

So autoconf is now trying an option that will fail the test with the 
current compiler, and will likely be deprecated in whatever version
of this compiler will be able to pass the test.

I'm not convinced that makes sense.

cu
Adrian

-- 

       "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]