Re: [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode

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

 



On Sat, Aug 07, 2021 at 08:38:34PM -0700, Carlo Marcelo Arenas Belón wrote:

> d540b70c85 (merge: cleanup messages like commit, 2019-04-17) adds
> a way to change part of the helper text using a single call to
> strbuf_add_commented_addf but with two formats with varying number
> of parameters.
> 
> this trigger a warning in old versions of Xcode (ex 8.0), so use
> instead two independent calls with a matching number of parameters

In general, if only an old version of a compiler complains, I'd prefer
to either silence it (by loosening the -W options in config.mak.dev for
systems without clang4), or just ignore it.

That said, in this case...

> -		strbuf_commented_addf(&msg, _(cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS ?
> -			scissors_editor_comment :
> -			no_scissors_editor_comment), comment_line_char);
> +		if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)
> +			strbuf_commented_addf(&msg, _(scissors_editor_comment));
> +		else
> +			strbuf_commented_addf(&msg,
> +				_(no_scissors_editor_comment), comment_line_char);

I think the result is actually easier to follow, as we can see that in
the CLEANUP_SCISSORS code we do not care about comment_line_char.

Thanks for the cleanup.

-Peff



[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