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: Tue, 2 Oct 2012 17:02:41 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Oct 01, 2012 at 03:40:31PM -0700, Paul Eggert wrote:
> On 10/01/2012 03:20 PM, Adrian Bunk wrote:
> > Not if they are set to default to C99 mode.
> 
> Ah.  True.  That may be a problem for future
> versions of these two compilers, though it's
> not a problem for current versions.

The same would be true for adding a __STDC_VERSION__ check to the 
current C11 test, since all compilers that currently pass the C11
test (only gcc 4.7) define it to the correct value...

> To some extent, when we're talking about future
> software, we're at the mercy of the future --
> we really can't predict for sure.  It'd be nice
> to have a more-plausible prediction than we currently
> have,

We can implement a stable solution that handles all general problems 
discussed in this thread so far, and that is what my algorithm does.

Or we do an emergency release of autoconf in a few years when people 
have started to use C11 on a wider scale and a new release of gcc that 
defaults to C99 won't be set into C11 mode by the current implementation 
of the C11 setting in autoconf (and then all the headers that check the
__STDC_VERSION__ value will do the wrong thing).

And that could also be hell for distributions, since due to the way 
autoconf works updating autoconf alone wouldn't help much.

> But I'm not sure this is a good idea:
> 
> for test in test1 test2 test3
>     for opt in '' -std=gnu11 -qlanglvl=extc1x
>         if (run(test,opt) == SUCCESS)
>             return opt
> return NOT_SUPPORTED
> 
> For one thing, it's an O(N**3) algorithm
> whereas we currently have O(N**2).

The algorithm we currently have is O(n).

And since there won't be a new test required for each compiler,
my algorithm would also be O(n).

But all that complexity discussion does anyway not matter, since looking 
at the number of compiler options in the C89 and C99 tests we will end 
up with something like

   3-4 tests * 5-10 C11 options = 15-40 compile attempts

in the worst case (no C11 support in the compiler).

Note that most of the compile attempts are quick "option not supported", 
so even 40 attempts might still be faster than what AC_INCLUDES_DEFAULT 
does.

> For another,
> the individual tests may yield results that are
> even less nice than what we have now.

What problems exactly do you fear?

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]