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 EA5EB3858C20 for ; Wed, 10 May 2023 23:34:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA5EB3858C20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org References: <877cth66qb.fsf@oldenburg.str.redhat.com> <20230509102201.6aa2a7d14fdb2f1e7abff449@killthe.net> <87r0rp5uf8.fsf@aarsen.me> <83ttwla1ep.fsf@gnu.org> <83lehx9vix.fsf@gnu.org> <83fs859unu.fsf@gnu.org> <20230510143750.417de4d214583a398737337f@schemamania.org> User-agent: mu4e 1.10.3; emacs 29.0.90 From: Sam James To: "James K. Lowden" Cc: Jonathan Wakely , gcc@gcc.gnu.org Subject: Re: More C type errors by default for GCC 14 Date: Thu, 11 May 2023 00:33:13 +0100 In-reply-to: <20230510143750.417de4d214583a398737337f@schemamania.org> Message-ID: <87ttwjg3qr.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable "James K. Lowden" writes: > On Tue, 9 May 2023 23:45:50 +0100 > Jonathan Wakely via Gcc wrote: > >> On Tue, 9 May 2023 at 23:38, Joel Sherrill wrote: >> > We are currently using gcc 12 and specifying C11. To experiment >> > with these stricter warnings and slowly address them, would we need >> > to build with a newer C version? >>=20 >> No, the proposed changes are to give errors (instead of warnings) for >> rules introduced in C99. GCC is just two decades late in enforcing the >> C99 rules properly! > > This, it seems to me, is the crux of the question. Code that does not > conform to the standard should produce an error. Code that can be > compiled correctly, per the specification, but might not be what the > user intended, is a candidate for a warning.=20=20 > > If the proposed changes catch true errors -- not just dubious > constructs -- that were previously allowed, well, that's the price of > progress. That's the compiler getting better at distinguishing between > code conformant and not.=20=20 > > Section 2.1 "C Language" of the manual states that, with no option > specified on the command line, the default standard is -std=3Dgnu17.=20=20 > > Part of the proposal IIUC is to treat undeclared functions as an error. > Function prototypes have been required afaik since c99. If > that's correct, then letting them pass without error is a mistake for > -std=3Dc99 and above.=20=20 > > As to the default, is anyone suggesting that gnu17 -- i.e., c17 with > GNU extensions -- includes ignoring missing function prototypes? That > to me would be an odd definition of "extension".=20=20 > > The user who has old code that does not meet the c99 standard but Just > Works nonetheless has a direct route to compiling that code without > complaint: -std=3Dc90. It says so right there in the fine manual.=20=20 > > It's that simple. The code is either in spec and compiles without > error, or it is not and does not. The only debate is over what "the > spec" is, and what warnings the user might want for conforming code.=20=20 jwakely's already dispatched with these claims, but I'd note that if this were the case, we'd all be arguing about whether Clang is currently conformant. (There is a fair point in all of this about how much we want to consider some of these constructs extensions. I'm relieved to see that e.g. implicit func. decls weren't ever considered "real" GNU extensions, rather something which was added for compat. for a while, rather than something deliberately and explicitly supported as a GNU extension forever, even just for certain Cs.) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZFwqDF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZCJjgD+OsfnuKj49YgGUki+y0CA7dRywjVF5IqEsZcN /GALIMoBAMv5KmQZoHSN13dEGG7ptAAiht3NlrJmjRfW2YcQ4XQH =wZEu -----END PGP SIGNATURE----- --=-=-=--