From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) by sourceware.org (Postfix) with ESMTPS id 4520C3858D1E for ; Fri, 9 Feb 2024 23:07:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4520C3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=pfeifer.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pfeifer.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4520C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.68.5.143 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707520069; cv=none; b=aShjTY3cWQyU9W/gFh7s+maexYYzRIDpjtnzOBwInLGXghoBe/3HBr9wOpJ6vsro4c2gmhGMDt0fqZlf31D2awoGZFDSFJNm8uNnrFzzA1omSk8eYWN5z0NC6NWIjtOxq9re/relLNw2DXIr2WPkHyGbZaLXcRl0UYw86wgS2bQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707520069; c=relaxed/simple; bh=MhbJAJOic1VQdwaAaIjPZrCcDrbLGRh6kIHxZTbW0X0=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=aIraWxnkUoxe+8NAmJgm1puqapambjI8rl7gwVqGwqp8T6KAYA9TUfQvDX3u/Yd6yuPL7VMKOGd2Q7D8ARgAcQfE0wmuVU7vALphY7vze9mXCeXSKX+6ry9m0FTVrmM96KvRJwygLw8n4BC7+c7uLmK0rE950/7jJbh+W4jlLCY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id 8EFFF33E82; Fri, 9 Feb 2024 18:07:47 -0500 (EST) Received: from [172.20.15.33] (37.46.124.80.rev.sfr.net [80.124.46.37]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id 12AD333E9B; Fri, 9 Feb 2024 18:07:46 -0500 (EST) Date: Sat, 10 Feb 2024 00:07:45 +0100 (CET) From: Gerald Pfeifer To: Florian Weimer cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Notes on the warnings-as-errors change in GCC 14 In-Reply-To: <87v876ssxg.fsf@oldenburg.str.redhat.com> Message-ID: <9fce9298-1aec-27ce-591e-a1d415d34dba@pfeifer.com> References: <87v876ssxg.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: mailmunge 3.11 on 209.68.5.143 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_NONE,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: On Fri, 2 Feb 2024, Florian Weimer wrote: > +

Certain warnings are now errors

That's quite a nice description, thank you, Florian! > +The initial ISO C standard and its 1999 revision removed support for May I suggest to wrap paragraphs in

...

? Not strictly necessary any more, now that we switched to HTML 5, though more consistent and explicit. > [For backwards] > +compatibility, GCC 13 and earlier compiler versions diagnosed use of > +these features as warnings only. Although these warnings have been > +enabled by default for many releases, experience shows that these > +warnings are easily ignored, resulting in difficult-to-diagnose bugs. Can we just say "GCC 13 and earlier" (or "GCC 13 and earlier versions")? And "...shows that they are easily ignored, resulting in difficult to diagnose bugs"? > +Several GNU/Linux distributions have shared patches from their porting > +efforts on relevant upstream mailing lists and bug trackers, but of > +course there is a strong overlap between programs that have these > +historic C compatibility issues and are dormant today. At first I thought something is missing here, then I realized it may be a difference between German (which also is my mother tongue) and English. One way to address it would be saying "and those that are dormant", though I believe something like ...but of course many programs that exhibit these historic C compatibility issues are dormant today. > +In most cases, simply adding the missing int keyword > +addresses the error. For example, a flag like > + > +
> +  static initialized;
> +
> + > +might turn into: > + > +
> +  static int initialized;
> +
How about "For example, a variable like ... becomes"? > +

If the return type of a function is omitted, the correct type to > +add could be int or void, depending on > +whether the function returns a value or not. "can be" > +

In some cases, the previously implied int type > +was not correct. I'd omit the comma here. > This mostly happens in function definitions > +that are not prototypes Naive questions: Can definitions really be prototypes (in C)? > +declared outside the parameter list. Using the correct > +type maybe required to avoid int-conversion errors (see below). Something feels odd with this sentence? > +

> +  void
> +  write_string (int fd, const char *s)

const char *s) as well?

> +Some programs are built with -std=c11 or
> +similar -std options that do not contain the
> +string gnu, but these programs still use POSIX or other

...but still use... (omit "these programs")

> +If undeclared functions from the same project are called and there is
> +yet no suitable shared header file, you should add a declaration to a

"no suitable shared header file yet, you can add..."

> +However, this is an obsolete C feature that will change meaning in C23
> +(declaration a function with a prototype and accepting no arguments,
> +similar to C++).

"declaration of a function", or some other change here?

> +Incorrectly spelled type names in function declarations are treated as
> +errors in more cases, under a
> +new -Wdeclaration-missing-parameter-type warning.  The
> +second line in the following example is now treated as an error
> +(previously this resulted in an unnamed warning):

What is an "unnamed" warning? Can we simply omit "unnamed" here?

> +GCC will type-check function arguments after that, potentially
> +requiring further changes.  (Previously, the function declaration was
> +treated as not having no prototype.)

That second sentence uses double negation, which logically is the same as 
just the original statement.

> +

> +By default, GCC still accepts returning an expression of > +type void from within a function that itself > +returns void, as a GNU extension that matches C++ rules > +in this area. Does the GNU extension match C++ (standard rules)? Wee, this is a patch. All the more kudos to you.. I'll be looking into the second half of the patch tomorrow; feel free to commit the aspects covered above (after considering my review). Cheers,