[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can Autoconf help with the transition to stricter compilation de
From: |
Michael Matz |
Subject: |
Re: How can Autoconf help with the transition to stricter compilation defaults? |
Date: |
Wed, 16 Nov 2022 16:34:37 +0000 (UTC) |
User-agent: |
Alpine 2.20 (LSU 67 2015-01-07) |
Hello,
On Wed, 16 Nov 2022, Jonathan Wakely wrote:
> > > Unrelated but I was a bit tempted to ask for throwing in
> > > -Wbuiltin-declaration-mismatch to default -Werror while Clang 16 was at
> > > it, but I suppose we don't want the world to burn too much,
> >
> > :-) It's IMHO a bug in the standard that it misses "if any of its
> > associated headers are included" in the item for reservation of external
> > linkage identifiers; it has that for all other items about reserved
> > identifiers in the Library clause. If that restriction were added you
> > couldn't justify erroring on the example at hand (because it doesn't
> > include e.g. <stdio.h> and then printf wouldn't be reserved). A warning
> > is of course always okay and reasonable. As is, you could justify
> > erroring out, but I too think that would be overzealous.
>
>
> I think that's very intentional and not a defect in the standard.
>
> If one TU was allowed to define:
>
> void printf() { }
>
> and have that compiled into the program, then that would cause
> unexpected behaviour for every other TU which includes <stdio.h> and
> calls printf. They would get the non-standard rogue printf.
True. But suppose the restriction would be added. I could argue that
then your problem program (in some other TU) _does_ include the header,
hence the identifier would have been reserved and so the above definition
would have been wrong. I.e. I think adding the restriction wouldn't allow
the problematic situation either.
I'm aware that the argument would then invoke all the usual problems of
what constitutes a full program, and if that includes the library even
when not including headers and so on. And in any case currently the
standard does say they're reserved so it's idle speculation anyway :)
Ciao,
Michael.
- Re: How can Autoconf help with the transition to stricter compilation defaults?, (continued)
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Alexander Monakov, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Richard Biener, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Sam James, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?,
Michael Matz <=
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jeffrey Walton, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/17
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Zack Weinberg, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/17
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Bruno Haible, 2022/11/17
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/17
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/17
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Aaron Ballman, 2022/11/15