Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <>
To: Junio C Hamano <>
Subject: Re: [PATCH] compat/regex: fix argument order to calloc(3)
Date: Mon, 13 May 2024 12:00:10 +0200	[thread overview]
Message-ID: <ZkHkiBa2hSbjcmZd@tanuki> (raw)
In-Reply-To: <xmqqbk5bim2n.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

On Sat, May 11, 2024 at 11:25:04PM -0700, Junio C Hamano wrote:
> Windows compiler suddenly started complaining that calloc(3) takes
> its arguments in <nmemb, size> order.  Indeed, there are many calls
> that has their arguments in a _wrong_ order.

I think this is actually new to GCC 14. The release notes include this

    -Walloc-size and -Wcalloc-transposed-args warnings are enabled for C++ as well

It's a bit puzzling that this seemingly only changed for C++, but oh,

> Fix them all.
> A sample breakage can be seen at
> Signed-off-by: Junio C Hamano <>
> ---
>  * I wonder if there is an easier way to deal with toolchain and/or
>    platform changes (I am assuming that is what caused this
>    breakage) than just seeing and then reacting to a breakage after
>    it happens.

I think the best thing we can do is to be proactive and be faster than
our toolchain to enable (sensible) warnings. Over time all the compilers
tend to become stricter, and if we are already as strict as possible
then chances are less likely that we'll have to do anything about
upstream changes.

But other than that I don't really have much of an idea.

The patch itself looks obviously good to me, thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-05-13 10:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12  6:25 [PATCH] compat/regex: fix argument order to calloc(3) Junio C Hamano
2024-05-13 10:00 ` Patrick Steinhardt [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZkHkiBa2hSbjcmZd@tanuki \ \ \ \

* 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).