From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 4A6A8395B469 for ; Wed, 16 Nov 2022 15:35:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A6A8395B469 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Content-Type: multipart/signed; boundary="Apple-Mail=_6CBEB47A-2714-479D-B040-A29DC401D735"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: How can Autoconf help with the transition to stricter compilation defaults? From: Sam James In-Reply-To: Date: Wed, 16 Nov 2022 15:35:08 +0000 Cc: Michael Matz , Alexander Monakov , Paul Eggert , Jonathan Wakely , Aaron Ballman , Zack Weinberg , c-std-porting@lists.linux.dev, Autoconf Development , GCC Development , cfe-commits@lists.llvm.org, Gnulib bugs Message-Id: <00C3EDCD-D2DA-4B0D-8A8A-08B76552D865@gentoo.org> References: <24ed5604-305a-4343-a1b6-a789e4723849@app.fastmail.com> <251923e7-57be-1611-be10-49c3067adf0d@cs.ucla.edu> <7ef0ce03-d908-649a-a6ee-89fea374d2b1@cs.ucla.edu> <9cb106e9-16ff-65ec-6a44-6567c77521dc@cs.ucla.edu> <06a5d2cd-44eb-7404-17f3-ff64dd505427@cs.ucla.edu> <27264d94-9496-d7ef-6716-f43db86f38e2@ispras.ru> To: Richard Biener , Aaron Ballman X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_6CBEB47A-2714-479D-B040-A29DC401D735 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 16 Nov 2022, at 15:27, Richard Biener = wrote: >=20 > On Wed, Nov 16, 2022 at 4:02 PM Michael Matz via Gcc = wrote: >>=20 >> Hey, >>=20 >> On Wed, 16 Nov 2022, Alexander Monakov wrote: >>=20 >>>> The idea is so obvious that I'm probably missing something, why = autoconf >>>> can't use that idiom instead. But perhaps the (historic?) reasons = why it >>>> couldn't be used are gone now? >>>=20 >>> Ironically, modern GCC and LLVM optimize '&foobar !=3D 0' to '1' = even at -O0, >>> and thus no symbol reference remains in the resulting assembly. >>=20 >> Err, right, *head-->table*. >> Playing with volatile should help: >>=20 >> char foobar(void); >> char (* volatile ptr)(void); >> int main(void) { >> ptr =3D foobar; >> return ptr !=3D 0; >> } >=20 > using printf for foobar this works even with GCC 2.95.2 and with trunk > and -Wall diagnoses >=20 > t.c:1:6: warning: conflicting types for built-in function 'printf'; > expected 'int(const char *, ...)' [-Wbuiltin-declaration-mismatch] > 1 | char printf(void); > | ^~~~~~ > t.c:1:1: note: 'printf' is declared in header '' > +++ |+#include > 1 | char printf(void); >=20 > so without -Werror this should be fine. >=20 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, and it's got a very obvious usecase (this one) whereas = implicit func decls are too hard to justify. > Richard. --Apple-Mail=_6CBEB47A-2714-479D-B040-A29DC401D735 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iNUEARYKAH0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCY3UDLF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MAAKCRBzhAn1IN+R kBCXAP9BdX2hjbcXRqMriNr3kyJZDWBGzB3la2YEKTaQudXIrgD/evpVBl5ulRGC YyuE53QVS/jN7AtnhcodJFt0q5cJJg8= =3Llf -----END PGP SIGNATURE----- --Apple-Mail=_6CBEB47A-2714-479D-B040-A29DC401D735--