Re: [PATCH] compat/regex: fix argument order to calloc(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
bit:

    -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,
well.

> Fix them all.
> 
> A sample breakage can be seen at
> 
>   https://github.com/git/git/actions/runs/9046793153/job/24857988702#step:4:272
> 
> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
> ---
> 
>  * 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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux