Re: How can Autoconf help with the transition to stricter compilation defaults?

Paul Eggert <[email protected]> Wed, 16 Nov 2022 10:17:18 -0800
Newsgroups dev.linux.lists.c-std-porting
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 2022-11-16 06:26, Michael Matz wrote:
> char foobar(void);
> int main(void) {
>    return &foobar !=3D 0;
> }

That still has undefined behavior according to draft C23, which says=20
behavior is undefined when foobar is (say) 'memset_explicit' because the=20
declaration 'char memset_explicit(void);' disagrees with draft C23's=20
declaration of 'memset_explicit'. It doesn't matter whether there's a=20
call to 'memset_explicit'. See draft C23 =C2=A76.2.7, which says "All=20
declarations that refer to the same object or function shall have=20
compatible type; otherwise, the behavior is undefined."

If Clang's threatened pickiness were of some real use elsewhere, it=20
might be justifiable for default Clang to break Autoconf. But so far we=20
haven't seen real-world uses that would justify this pickiness for=20
Autoconf's use of 'char memset_explicit(void);'.