How can Autoconf help with the transition to stricter compilation defaults?
Paul Eggert via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 16 10:17:18 PST 2022
On 2022-11-16 06:26, Michael Matz wrote:
> char foobar(void);
> int main(void) {
> return &foobar != 0;
> }
That still has undefined behavior according to draft C23, which says
behavior is undefined when foobar is (say) 'memset_explicit' because the
declaration 'char memset_explicit(void);' disagrees with draft C23's
declaration of 'memset_explicit'. It doesn't matter whether there's a
call to 'memset_explicit'. See draft C23 ยง6.2.7, which says "All
declarations that refer to the same object or function shall have
compatible type; otherwise, the behavior is undefined."
If Clang's threatened pickiness were of some real use elsewhere, it
might be justifiable for default Clang to break Autoconf. But so far we
haven't seen real-world uses that would justify this pickiness for
Autoconf's use of 'char memset_explicit(void);'.
More information about the cfe-commits
mailing list