From: Florian Weimer <fweimer@redhat.com>
To: Gerald Pfeifer <gerald@pfeifer.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Notes on the warnings-as-errors change in GCC 14
Date: Thu, 15 Feb 2024 17:44:59 +0100 [thread overview]
Message-ID: <875xypad84.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <2058c7ba-20af-7cb5-f15d-ec0653f76903@pfeifer.com> (Gerald Pfeifer's message of "Sat, 10 Feb 2024 12:00:34 +0100 (CET)")
* Gerald Pfeifer:
> On Fri, 2 Feb 2024, Florian Weimer wrote:
>> htdocs/gcc-14/porting_to.html | 465 ++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 465 insertions(+)
>> +
>> +<h4 id="int-conversion">Using pointers as integers and vice versa (<code>-Werror=int-conversion</code>)</h4>
>
>> +It makes sense to address missing <code>int</code> type, implicit
>
> Should this be plural here ("<code>int</code> types") or some adding a
> word such as "declaration"? Genuine question.
“missing <code>int</code> type[s]” seems to be okay.
>> +Some of them will be caused by missing types resulting
>> +in <code>int</code>, and the default <code>int</code> return type of
>> +implicitly declared functions.
>
> ...resulting in implicit <code>int</code>... or something like that?
> Not sure how to be phrase it.
I went with: “missing types [treated as] <code>int</code>”
>> +GCC no longer casts all pointer types to all other pointer types.
>
> Do you mean it no longer does so implicitly, or not at all? That is,
> there are now cases where even an explicit cast such as
>
> foo_p = (foo_type*) bar_p
>
> no longer works? Or just
>
> foo_p = bar_p
>
> no longer works for all combinations?
The latter, other reviewers noted it as well, and I've got this now:
“GCC no longer [allows implicitly casting] all pointer types to all”
>> +appropriate casts, and maybe consider using code <code>void *</code>
>> +in more places (particularly for old programs that predate the
>> +introduction of <code>void</code> into the C language).
>
> Here I got confused.
>
> At first I thought I was reading that <code>void *</void> should be used
> for cases where <code>void</void> did not exist yet. Now I think I
> understand: this is about programs where <code>void *</code> was not used
> since it was not part of the language yet - and the encouragement is to
> update such old code by using it.
>
> If so, how about making the second case <code>void *</code>, too?
Makes sense. Technically you can't have void * without void,
but I can see this may be confusing.
>> +#include <stddef.h>
>
> I *think* we may need to use > here instead of plain '>', though I may
> be wrong.
No, only < needs to be quoted. This is true even for XML, not just
HTML5. Do you want me to change these to >?
>> +<pre>
>> +int
>> +compare (<ins>const void *a1</ins>, <ins>const void *b1</ins>)
>> +{
>> + <ins>char *const *a = a1;</ins>
>> + <ins>char *const *b = b1;</ins>
>> + return strcmp (*a, *b);
>> +}
>> +</pre>
>
> Great that you include this example here, that really helps!
>
> Just why "const void *a1" versus "char *const *a", that is, the different
> placement of const?
It's the right type. 8-) The examples uses an array of char *,
not const char *.
>> +unrelated to the actual objective of the probe. These failed probes
>> +tend to consistently disable program features and their tests, which
>> +means that an unexpected probe failure may result in silently dropping
>> +features.
>
> Omit "consistently"? I'm not sure what it adds here. And simplify the
> second half, something like
>
> These failed probes tend to disable program features (and their tests),
> resulting in silently dropping features.
What about this?
These failed probes tend to disable program features [together with]
their tests[], resulting in silently dropping features.
This what I meant with “consistently”: implementations and tests are
gone, so the testsuite doesn't flag it.
>> +In cases where this is a concern, generated <code>config.log</code>,
>> +<code>config.h</code> and other source code files can be compared
>> +using <a href="https://www.gnu.org/software/diffutils/">diff</a>,
>> +to ensure there are no unexpected differences.
>
> I wouldn't link to GNU diffutils here; just refer to the <code>diff</code>
> command - or even omit that aspect and leave it at "can be compared".
diff is really useful for that, manual comparison isn't. 8-)
I can drop the hyperlink.
>> +Some build systems do not pass the <code>CFLAGS</code> environment
>> +or <code>make</code> variable to all parts of the builds
>
> Is "make" a common variable? What is the context here?
Hmm, I meant to allude $(CFLAGS) here.
“<code>CFLAGS</code> [] variable to all parts of the builds” should be
sufficient.
>> +<p>
>> +It is unclear at which point GCC can enable the C23 <code>bool</code>
>> +keyword by default (making the <code>bool</code> type available
>> +without including <code>#include <stdbool.h></code> explicitly).
>
> Does C every include some header files implicitly?
GCC does, for <stdc-predef.h>. Not relevant here, though.
> For the benefit of the doubt: Okay, and thank you, modulo feedback from
> Jonathan and my two responses.
Thank you for your review.
I need to add two more code examples to the Autoconf section, should I
post a v2 with that, or add that in a subsequent commit?
Florian
next prev parent reply other threads:[~2024-02-15 16:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 16:59 Florian Weimer
2024-02-02 18:08 ` Jonathan Wakely
2024-02-15 15:57 ` Florian Weimer
2024-02-02 19:06 ` Jonathan Wakely
2024-02-08 7:04 ` Sam James
2024-02-15 16:07 ` Florian Weimer
2024-02-15 16:20 ` Sam James
2024-02-09 23:07 ` Gerald Pfeifer
2024-02-15 16:22 ` Florian Weimer
2024-02-15 22:58 ` Gerald Pfeifer
2024-02-15 16:49 ` Florian Weimer
2024-02-10 11:00 ` Gerald Pfeifer
2024-02-15 16:44 ` Florian Weimer [this message]
2024-02-16 21:23 ` Gerald Pfeifer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875xypad84.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gerald@pfeifer.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).