{"thread":{"id":"56236","subject":"[PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode","startedAt":"2021-08-08T03:42:26Z","lastAt":"2021-08-09T18:13:20Z","messageCount":2,"participants":["Carlo Marcelo Arenas Belón","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"432265","messageId":"20210808033834.74470-1-carenas@gmail.com","threadId":"56236","inReplyTo":null,"subject":"[PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2021-08-08T03:38:34Z","receivedAt":"2021-08-08T03:42:26Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"d540b70c85 (merge: cleanup messages like commit, 2019-04-17) adds\na way to change part of the helper text using a single call to\nstrbuf_add_commented_addf but with two formats with varying number\nof parameters.\n\nthis trigger a warning in old versions of Xcode (ex 8.0), so use\ninstead two independent calls with a matching number of parameters\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n builtin/merge.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex eddb8ae70d..9f160f7eb9 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -861,9 +861,11 @@ static void prepare_to_commit(struct commit_list *remoteheads)\n \t\t\tstrbuf_commented_addf(&msg, \"\\n\");\n \t\t}\n \t\tstrbuf_commented_addf(&msg, _(merge_editor_comment));\n-\t\tstrbuf_commented_addf(&msg, _(cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS ?\n-\t\t\tscissors_editor_comment :\n-\t\t\tno_scissors_editor_comment), comment_line_char);\n+\t\tif (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)\n+\t\t\tstrbuf_commented_addf(&msg, _(scissors_editor_comment));\n+\t\telse\n+\t\t\tstrbuf_commented_addf(&msg,\n+\t\t\t\t_(no_scissors_editor_comment), comment_line_char);\n \t}\n \tif (signoff)\n \t\tappend_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);\n-- \n2.33.0.rc1.373.gc715f1a457\n\n"},{"id":"432322","messageId":"YRFwO6TTpGYVbdNz@coredump.intra.peff.net","threadId":"56236","inReplyTo":"20210808033834.74470-1-carenas@gmail.com","subject":"Re: [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-08-09T18:13:15Z","receivedAt":"2021-08-09T18:13:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Aug 07, 2021 at 08:38:34PM -0700, Carlo Marcelo Arenas Belón wrote:\n\n> d540b70c85 (merge: cleanup messages like commit, 2019-04-17) adds\n> a way to change part of the helper text using a single call to\n> strbuf_add_commented_addf but with two formats with varying number\n> of parameters.\n> \n> this trigger a warning in old versions of Xcode (ex 8.0), so use\n> instead two independent calls with a matching number of parameters\n\nIn general, if only an old version of a compiler complains, I'd prefer\nto either silence it (by loosening the -W options in config.mak.dev for\nsystems without clang4), or just ignore it.\n\nThat said, in this case...\n\n> -\t\tstrbuf_commented_addf(&msg, _(cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS ?\n> -\t\t\tscissors_editor_comment :\n> -\t\t\tno_scissors_editor_comment), comment_line_char);\n> +\t\tif (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)\n> +\t\t\tstrbuf_commented_addf(&msg, _(scissors_editor_comment));\n> +\t\telse\n> +\t\t\tstrbuf_commented_addf(&msg,\n> +\t\t\t\t_(no_scissors_editor_comment), comment_line_char);\n\nI think the result is actually easier to follow, as we can see that in\nthe CLEANUP_SCISSORS code we do not care about comment_line_char.\n\nThanks for the cleanup.\n\n-Peff\n"}]}