From patchwork Mon Aug 28 21:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC7EDC71153 for ; Mon, 28 Aug 2023 21:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233070AbjH1Vqo (ORCPT ); Mon, 28 Aug 2023 17:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232905AbjH1Vqd (ORCPT ); Mon, 28 Aug 2023 17:46:33 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EF76186 for ; Mon, 28 Aug 2023 14:46:30 -0700 (PDT) Received: (qmail 513 invoked by uid 109); 28 Aug 2023 21:46:30 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:46:30 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4513 invoked by uid 111); 28 Aug 2023 21:46:31 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:46:31 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:46:29 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 01/22] sequencer: use repository parameter in short_commit_name() Message-ID: <20230828214629.GA3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Instead of just using the_repository, we can take a repository parameter from the caller. Most of them already have one, and doing so clears up a few -Wunused-parameter warnings. There are still a few callers which use the_repository, but this pushes us one small step forward to eventually getting rid of those. Signed-off-by: Jeff King --- sequencer.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sequencer.c b/sequencer.c index 48475d1cc6..82dc3e160e 100644 --- a/sequencer.c +++ b/sequencer.c @@ -433,10 +433,9 @@ struct commit_message { const char *message; }; -static const char *short_commit_name(struct commit *commit) +static const char *short_commit_name(struct repository *r, struct commit *commit) { - return repo_find_unique_abbrev(the_repository, &commit->object.oid, - DEFAULT_ABBREV); + return repo_find_unique_abbrev(r, &commit->object.oid, DEFAULT_ABBREV); } static int get_message(struct commit *commit, struct commit_message *out) @@ -446,7 +445,7 @@ static int get_message(struct commit *commit, struct commit_message *out) out->message = repo_logmsg_reencode(the_repository, commit, NULL, get_commit_output_encoding()); - abbrev = short_commit_name(commit); + abbrev = short_commit_name(the_repository, commit); subject_len = find_commit_subject(out->message, &subject); @@ -2383,7 +2382,7 @@ static int do_pick_commit(struct repository *r, error(command == TODO_REVERT ? _("could not revert %s... %s") : _("could not apply %s... %s"), - short_commit_name(commit), msg.subject); + short_commit_name(r, commit), msg.subject); print_advice(r, res == 1, opts); repo_rerere(r, opts->allow_rerere_auto); goto leave; @@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list, item->offset_in_buf = todo_list->buf.len; subject_len = find_commit_subject(commit_buffer, &subject); strbuf_addf(&todo_list->buf, "%s %s %.*s\n", command_string, - short_commit_name(commit), subject_len, subject); + short_commit_name(opts->revs->repo, commit), + subject_len, subject); repo_unuse_commit_buffer(the_repository, commit, commit_buffer); } @@ -3593,7 +3593,7 @@ static int error_with_patch(struct repository *r, } else if (exit_code) { if (commit) fprintf_ln(stderr, _("Could not apply %s... %.*s"), - short_commit_name(commit), subject_len, subject); + short_commit_name(r, commit), subject_len, subject); else /* * We don't have the hash of the parent so @@ -4728,7 +4728,7 @@ static int pick_commits(struct repository *r, term_clear_line(); fprintf(stderr, _("Stopped at %s... %.*s\n"), - short_commit_name(commit), + short_commit_name(r, commit), item->arg_len, arg); } return error_with_patch(r, commit, @@ -5564,7 +5564,7 @@ static int make_script_with_merges(struct pretty_print_context *pp, if (!is_empty && (commit->object.flags & PATCHSAME)) { if (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS) warning(_("skipped previously applied commit %s"), - short_commit_name(commit)); + short_commit_name(revs->repo, commit)); skipped_commit = 1; continue; } @@ -5800,7 +5800,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc, if (!is_empty && (commit->object.flags & PATCHSAME)) { if (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS) warning(_("skipped previously applied commit %s"), - short_commit_name(commit)); + short_commit_name(r, commit)); skipped_commit = 1; continue; } @@ -5892,7 +5892,8 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list, todo_list->alloc = alloc; } -static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_list, +static void todo_list_to_strbuf(struct repository *r, + struct todo_list *todo_list, struct strbuf *buf, int num, unsigned flags) { struct todo_item *item; @@ -5921,7 +5922,7 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis /* add commit id */ if (item->commit) { const char *oid = flags & TODO_LIST_SHORTEN_IDS ? - short_commit_name(item->commit) : + short_commit_name(r, item->commit) : oid_to_hex(&item->commit->object.oid); if (item->command == TODO_FIXUP) { From patchwork Mon Aug 28 21:47:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B7EC83F12 for ; Mon, 28 Aug 2023 21:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbjH1Vrv (ORCPT ); Mon, 28 Aug 2023 17:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233026AbjH1VrV (ORCPT ); Mon, 28 Aug 2023 17:47:21 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8D2189 for ; Mon, 28 Aug 2023 14:47:18 -0700 (PDT) Received: (qmail 526 invoked by uid 109); 28 Aug 2023 21:47:18 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:18 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4520 invoked by uid 111); 28 Aug 2023 21:47:18 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:18 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:17 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 02/22] sequencer: mark repository argument as unused Message-ID: <20230828214717.GB3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In sequencer_get_last_command(), we don't ever look at the repository parameter. It _should_ be used when calling into git_path_* functions, but the one we use here is declared with the non-REPO variant of GIT_PATH_FUNC(), and so just uses the_repository internally. We could change the path helper to use REPO_GIT_PATH_FUNC(), but doing so piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in sequencer.c, and inconsistently switching one makes the code more confusing. Likewise, this one function is used in half a dozen other spots, all of which would need to start passing in a repository argument (with rippling effects up the call stack). So let's punt on that for now and just silence any -Wunused-parameter warning. Note that we could also drop this parameter entirely, as the function is always called directly, and not as a callback that has to conform to some external interface. But since we'd eventually want to use the repository parameter, let's leave it in place to avoid disrupting the callers twice. Signed-off-by: Jeff King --- sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index 82dc3e160e..41fd79d215 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2649,7 +2649,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item, return item->commit ? 0 : -1; } -int sequencer_get_last_command(struct repository *r, enum replay_action *action) +int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action) { const char *todo_file, *bol; struct strbuf buf = STRBUF_INIT; From patchwork Mon Aug 28 21:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCC0EC83F14 for ; Mon, 28 Aug 2023 21:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233070AbjH1Vrv (ORCPT ); Mon, 28 Aug 2023 17:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233745AbjH1Vr2 (ORCPT ); Mon, 28 Aug 2023 17:47:28 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09F09A8 for ; Mon, 28 Aug 2023 14:47:25 -0700 (PDT) Received: (qmail 529 invoked by uid 109); 28 Aug 2023 21:47:25 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:25 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4523 invoked by uid 111); 28 Aug 2023 21:47:26 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:26 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:24 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 03/22] ref-filter: mark unused parameters in parser callbacks Message-ID: <20230828214724.GC3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org These are similar to the cases annotated in 5fe9e1ce2f (ref-filter: mark unused callback parameters, 2023-02-24), but were added after that commit. Note that the ahead/behind callback ignores its "atom" parameter, which is a little unusual, since that struct usually stores the result. But in this case, the data is stored centrally in ref_array->counts, since we want to compute all ahead/behinds at once, not per ref. Signed-off-by: Jeff King --- ref-filter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 1bfaf20fbf..88b021dd1d 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -549,7 +549,8 @@ static int signature_atom_parser(struct ref_format *format UNUSED, return 0; } -static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom, +static int trailers_atom_parser(struct ref_format *format UNUSED, + struct used_atom *atom, const char *arg, struct strbuf *err) { atom->u.contents.trailer_opts.no_divider = 1; @@ -819,7 +820,7 @@ static int if_atom_parser(struct ref_format *format UNUSED, return 0; } -static int rest_atom_parser(struct ref_format *format, +static int rest_atom_parser(struct ref_format *format UNUSED, struct used_atom *atom UNUSED, const char *arg, struct strbuf *err) { @@ -828,7 +829,8 @@ static int rest_atom_parser(struct ref_format *format, return 0; } -static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom, +static int ahead_behind_atom_parser(struct ref_format *format, + struct used_atom *atom UNUSED, const char *arg, struct strbuf *err) { struct string_list_item *item; From patchwork Mon Aug 28 21:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C33A5C71153 for ; Mon, 28 Aug 2023 21:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233384AbjH1Vrw (ORCPT ); Mon, 28 Aug 2023 17:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbjH1Vrg (ORCPT ); Mon, 28 Aug 2023 17:47:36 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC18A186 for ; Mon, 28 Aug 2023 14:47:32 -0700 (PDT) Received: (qmail 534 invoked by uid 109); 28 Aug 2023 21:47:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4526 invoked by uid 111); 28 Aug 2023 21:47:33 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:33 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:31 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 04/22] pack-bitmap: mark unused parameters in show_object callback Message-ID: <20230828214731.GD3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This is similar to the cases in c50dca2a18 (list-objects: mark unused callback parameters, 2023-02-24), but was added after that commit. Signed-off-by: Jeff King --- pack-bitmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 6afc03d1e4..ca8319b87c 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1101,8 +1101,9 @@ static void show_boundary_commit(struct commit *commit, void *_data) } } -static void show_boundary_object(struct object *object, - const char *name, void *data) +static void show_boundary_object(struct object *object UNUSED, + const char *name UNUSED, + void *data UNUSED) { BUG("should not be called"); } From patchwork Mon Aug 28 21:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E6A9C83F15 for ; Mon, 28 Aug 2023 21:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbjH1Vrx (ORCPT ); Mon, 28 Aug 2023 17:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233224AbjH1Vrk (ORCPT ); Mon, 28 Aug 2023 17:47:40 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED4AF9 for ; Mon, 28 Aug 2023 14:47:37 -0700 (PDT) Received: (qmail 537 invoked by uid 109); 28 Aug 2023 21:47:37 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:37 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4529 invoked by uid 111); 28 Aug 2023 21:47:37 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:37 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:36 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 05/22] worktree: mark unused parameters in each_ref_fn callback Message-ID: <20230828214736.GE3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This is similar to the cases in 63e14ee2d6 (refs: mark unused each_ref_fn parameters, 2022-08-19), but it was added after that commit. Signed-off-by: Jeff King --- builtin/worktree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/worktree.c b/builtin/worktree.c index 10db70b7ec..62b7e26f4b 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -628,10 +628,10 @@ static void print_preparing_worktree_line(int detach, * * Returns 0 on failure and non-zero on success. */ -static int first_valid_ref(const char *refname, - const struct object_id *oid, - int flags, - void *cb_data) +static int first_valid_ref(const char *refname UNUSED, + const struct object_id *oid UNUSED, + int flags UNUSED, + void *cb_data UNUSED) { return 1; } From patchwork Mon Aug 28 21:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E810C83F17 for ; Mon, 28 Aug 2023 21:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233673AbjH1Vry (ORCPT ); Mon, 28 Aug 2023 17:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbjH1Vrn (ORCPT ); Mon, 28 Aug 2023 17:47:43 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03227F9 for ; Mon, 28 Aug 2023 14:47:40 -0700 (PDT) Received: (qmail 542 invoked by uid 109); 28 Aug 2023 21:47:40 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:40 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4532 invoked by uid 111); 28 Aug 2023 21:47:41 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:41 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:39 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 06/22] commit-graph: mark unused data parameters in generation callbacks Message-ID: <20230828214739.GF3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The compute_generation_info code uses function pointers to abstract the get/set generation operations. Some callers don't need the extra void data pointer, which should be annotated to appease -Wunused-parameter. Signed-off-by: Jeff King --- commit-graph.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index 0aa1640d15..73a539495b 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1568,12 +1568,14 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx) stop_progress(&ctx->progress); } -static timestamp_t get_generation_from_graph_data(struct commit *c, void *data) +static timestamp_t get_generation_from_graph_data(struct commit *c, + void *data UNUSED) { return commit_graph_data_at(c)->generation; } -static void set_generation_v2(struct commit *c, timestamp_t t, void *data) +static void set_generation_v2(struct commit *c, timestamp_t t, + void *data UNUSED) { struct commit_graph_data *g = commit_graph_data_at(c); g->generation = t; @@ -1616,7 +1618,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) } static void set_generation_in_graph_data(struct commit *c, timestamp_t t, - void *data) + void *data UNUSED) { commit_graph_data_at(c)->generation = t; } From patchwork Mon Aug 28 21:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49076C83F18 for ; Mon, 28 Aug 2023 21:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbjH1Vry (ORCPT ); Mon, 28 Aug 2023 17:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbjH1Vrq (ORCPT ); Mon, 28 Aug 2023 17:47:46 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078B3102 for ; Mon, 28 Aug 2023 14:47:43 -0700 (PDT) Received: (qmail 547 invoked by uid 109); 28 Aug 2023 21:47:43 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:43 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4535 invoked by uid 111); 28 Aug 2023 21:47:44 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:44 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:42 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 07/22] ls-tree: mark unused parameter in callback Message-ID: <20230828214742.GG3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The formatting functions are dispatched from a table of function pointers. The "path name only" function unsurprisingly does not need to look at its "oid" parameter, but we must mark it as unused to make -Wunused-parameter happy. Signed-off-by: Jeff King --- builtin/ls-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index f558db5f3b..209d2dc0d5 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -241,7 +241,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base, return recurse; } -static int show_tree_name_only(const struct object_id *oid, struct strbuf *base, +static int show_tree_name_only(const struct object_id *oid UNUSED, + struct strbuf *base, const char *pathname, unsigned mode, void *context) { From patchwork Mon Aug 28 21:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC05C83F19 for ; Mon, 28 Aug 2023 21:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233767AbjH1Vrz (ORCPT ); Mon, 28 Aug 2023 17:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233799AbjH1Vru (ORCPT ); Mon, 28 Aug 2023 17:47:50 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8D6F9 for ; Mon, 28 Aug 2023 14:47:47 -0700 (PDT) Received: (qmail 550 invoked by uid 109); 28 Aug 2023 21:47:47 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:47 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4538 invoked by uid 111); 28 Aug 2023 21:47:48 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:48 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:46 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 08/22] stash: mark unused parameter in diff callback Message-ID: <20230828214746.GH3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This is similar to the cases in 61bdc7c5d8 (diff: mark unused parameters in callbacks, 2022-12-13), but I missed it when making that commit. Signed-off-by: Jeff King --- builtin/stash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/stash.c b/builtin/stash.c index fe64cde9ce..c9365bea13 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -362,7 +362,7 @@ static int is_path_a_directory(const char *path) } static void add_diff_to_buf(struct diff_queue_struct *q, - struct diff_options *options, + struct diff_options *options UNUSED, void *data) { int i; From patchwork Mon Aug 28 21:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67FE6C71153 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbjH1VsY (ORCPT ); Mon, 28 Aug 2023 17:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233693AbjH1Vry (ORCPT ); Mon, 28 Aug 2023 17:47:54 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99A3186 for ; Mon, 28 Aug 2023 14:47:51 -0700 (PDT) Received: (qmail 553 invoked by uid 109); 28 Aug 2023 21:47:51 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:51 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4541 invoked by uid 111); 28 Aug 2023 21:47:52 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:52 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:50 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 09/22] trace2: mark unused us_elapsed_absolute parameters Message-ID: <20230828214750.GI3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Many trace2 targets ignore the absolute elapsed time parameters. However, the virtual interface needs to retain the parameter since it is used by others (e.g., the perf target). Signed-off-by: Jeff King --- trace2/tr2_tgt_event.c | 23 +++++++++++++---------- trace2/tr2_tgt_normal.c | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 53091781ec..59910a1a4f 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -335,7 +335,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias, } static void fn_child_start_fl(const char *file, int line, - uint64_t us_elapsed_absolute, + uint64_t us_elapsed_absolute UNUSED, const struct child_process *cmd) { const char *event_name = "child_start"; @@ -367,7 +367,8 @@ static void fn_child_start_fl(const char *file, int line, } static void fn_child_exit_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int cid, int pid, + uint64_t us_elapsed_absolute UNUSED, + int cid, int pid, int code, uint64_t us_elapsed_child) { const char *event_name = "child_exit"; @@ -388,7 +389,8 @@ static void fn_child_exit_fl(const char *file, int line, } static void fn_child_ready_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int cid, int pid, + uint64_t us_elapsed_absolute UNUSED, + int cid, int pid, const char *ready, uint64_t us_elapsed_child) { const char *event_name = "child_ready"; @@ -409,7 +411,7 @@ static void fn_child_ready_fl(const char *file, int line, } static void fn_thread_start_fl(const char *file, int line, - uint64_t us_elapsed_absolute) + uint64_t us_elapsed_absolute UNUSED) { const char *event_name = "thread_start"; struct json_writer jw = JSON_WRITER_INIT; @@ -423,7 +425,7 @@ static void fn_thread_start_fl(const char *file, int line, } static void fn_thread_exit_fl(const char *file, int line, - uint64_t us_elapsed_absolute, + uint64_t us_elapsed_absolute UNUSED, uint64_t us_elapsed_thread) { const char *event_name = "thread_exit"; @@ -439,7 +441,8 @@ static void fn_thread_exit_fl(const char *file, int line, jw_release(&jw); } -static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute, +static void fn_exec_fl(const char *file, int line, + uint64_t us_elapsed_absolute UNUSED, int exec_id, const char *exe, const char **argv) { const char *event_name = "exec"; @@ -460,8 +463,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute, } static void fn_exec_result_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int exec_id, - int code) + uint64_t us_elapsed_absolute UNUSED, + int exec_id, int code) { const char *event_name = "exec_result"; struct json_writer jw = JSON_WRITER_INIT; @@ -511,7 +514,7 @@ static void fn_repo_fl(const char *file, int line, } static void fn_region_enter_printf_va_fl(const char *file, int line, - uint64_t us_elapsed_absolute, + uint64_t us_elapsed_absolute UNUSED, const char *category, const char *label, const struct repository *repo, @@ -538,7 +541,7 @@ static void fn_region_enter_printf_va_fl(const char *file, int line, } static void fn_region_leave_printf_va_fl( - const char *file, int line, uint64_t us_elapsed_absolute, + const char *file, int line, uint64_t us_elapsed_absolute UNUSED, uint64_t us_elapsed_region, const char *category, const char *label, const struct repository *repo, const char *fmt, va_list ap) { diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c index d25ea13164..38d5ebddf6 100644 --- a/trace2/tr2_tgt_normal.c +++ b/trace2/tr2_tgt_normal.c @@ -86,7 +86,7 @@ static void fn_version_fl(const char *file, int line) } static void fn_start_fl(const char *file, int line, - uint64_t us_elapsed_absolute, const char **argv) + uint64_t us_elapsed_absolute UNUSED, const char **argv) { struct strbuf buf_payload = STRBUF_INIT; @@ -215,7 +215,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias, } static void fn_child_start_fl(const char *file, int line, - uint64_t us_elapsed_absolute, + uint64_t us_elapsed_absolute UNUSED, const struct child_process *cmd) { struct strbuf buf_payload = STRBUF_INIT; @@ -243,7 +243,8 @@ static void fn_child_start_fl(const char *file, int line, } static void fn_child_exit_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int cid, int pid, + uint64_t us_elapsed_absolute UNUSED, + int cid, int pid, int code, uint64_t us_elapsed_child) { struct strbuf buf_payload = STRBUF_INIT; @@ -256,7 +257,8 @@ static void fn_child_exit_fl(const char *file, int line, } static void fn_child_ready_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int cid, int pid, + uint64_t us_elapsed_absolute UNUSED, + int cid, int pid, const char *ready, uint64_t us_elapsed_child) { struct strbuf buf_payload = STRBUF_INIT; @@ -268,7 +270,8 @@ static void fn_child_ready_fl(const char *file, int line, strbuf_release(&buf_payload); } -static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute, +static void fn_exec_fl(const char *file, int line, + uint64_t us_elapsed_absolute UNUSED, int exec_id, const char *exe, const char **argv) { struct strbuf buf_payload = STRBUF_INIT; @@ -284,8 +287,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute, } static void fn_exec_result_fl(const char *file, int line, - uint64_t us_elapsed_absolute, int exec_id, - int code) + uint64_t us_elapsed_absolute UNUSED, + int exec_id, int code) { struct strbuf buf_payload = STRBUF_INIT; @@ -321,7 +324,8 @@ static void fn_repo_fl(const char *file, int line, } static void fn_printf_va_fl(const char *file, int line, - uint64_t us_elapsed_absolute, const char *fmt, + uint64_t us_elapsed_absolute UNUSED, + const char *fmt, va_list ap) { struct strbuf buf_payload = STRBUF_INIT; From patchwork Mon Aug 28 21:47:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98730C83F15 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbjH1VsY (ORCPT ); Mon, 28 Aug 2023 17:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbjH1Vr6 (ORCPT ); Mon, 28 Aug 2023 17:47:58 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BB2102 for ; Mon, 28 Aug 2023 14:47:55 -0700 (PDT) Received: (qmail 561 invoked by uid 109); 28 Aug 2023 21:47:55 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:55 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4544 invoked by uid 111); 28 Aug 2023 21:47:55 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:55 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:54 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 10/22] trace2: mark unused config callback parameter Message-ID: <20230828214754.GJ3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This should have been part of 783a86c142 (config: mark unused callback parameters, 2022-08-19), but was missed in that commit. Signed-off-by: Jeff King --- trace2/tr2_sysenv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c index f26ec95ab4..d3ecac2772 100644 --- a/trace2/tr2_sysenv.c +++ b/trace2/tr2_sysenv.c @@ -58,7 +58,8 @@ static struct tr2_sysenv_entry tr2_sysenv_settings[] = { /* clang-format on */ static int tr2_sysenv_cb(const char *key, const char *value, - const struct config_context *ctx UNUSED, void *d) + const struct config_context *ctx UNUSED, + void *d UNUSED) { int k; From patchwork Mon Aug 28 21:47:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF631C83F14 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233778AbjH1Vs0 (ORCPT ); Mon, 28 Aug 2023 17:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbjH1VsB (ORCPT ); Mon, 28 Aug 2023 17:48:01 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F680102 for ; Mon, 28 Aug 2023 14:47:58 -0700 (PDT) Received: (qmail 566 invoked by uid 109); 28 Aug 2023 21:47:58 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:47:58 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4547 invoked by uid 111); 28 Aug 2023 21:47:58 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:47:58 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:57 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 11/22] test-trace2: mark unused argv/argc parameters Message-ID: <20230828214757.GK3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The trace2 test helper uses function pointers to dispatch to individual tests. Not all tests bother looking at their argv/argc parameters. We could tighten this up (e.g., complaining when seeing unexpected parameters), but for internal test code it's not worth worrying about. This is similar in spirit to 126e3b3d2a (t/helper: mark unused argv/argc arguments, 2023-03-28). Signed-off-by: Jeff King --- t/helper/test-trace2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index 20c7495f38..d5ca0046c8 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -45,7 +45,7 @@ static int get_i(int *p_value, const char *data) * [] "def_param" events for all of the "interesting" pre-defined * config settings. */ -static int ut_001return(int argc, const char **argv) +static int ut_001return(int argc UNUSED, const char **argv) { int rc; @@ -65,7 +65,7 @@ static int ut_001return(int argc, const char **argv) * [] "def_param" events for all of the "interesting" pre-defined * config settings. */ -static int ut_002exit(int argc, const char **argv) +static int ut_002exit(int argc UNUSED, const char **argv) { int rc; @@ -201,7 +201,7 @@ static int ut_006data(int argc, const char **argv) return 0; } -static int ut_007BUG(int argc, const char **argv) +static int ut_007BUG(int argc UNUSED, const char **argv UNUSED) { /* * Exercise BUG() to ensure that the message is printed to trace2. From patchwork Mon Aug 28 21:47:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF672C83F17 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233818AbjH1Vs1 (ORCPT ); Mon, 28 Aug 2023 17:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233784AbjH1VsC (ORCPT ); Mon, 28 Aug 2023 17:48:02 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBDF6F9 for ; Mon, 28 Aug 2023 14:48:00 -0700 (PDT) Received: (qmail 569 invoked by uid 109); 28 Aug 2023 21:48:00 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:00 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4550 invoked by uid 111); 28 Aug 2023 21:48:01 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:01 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:47:59 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 12/22] grep: mark unused parameter in output function Message-ID: <20230828214759.GL3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This is a callback used with grep_options.output, but we don't look at the grep_opt parameter, as we're just writing the output to stdout. Signed-off-by: Jeff King --- grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grep.c b/grep.c index 0904d55b24..0124eb1960 100644 --- a/grep.c +++ b/grep.c @@ -17,7 +17,7 @@ static int grep_source_load(struct grep_source *gs); static int grep_source_is_binary(struct grep_source *gs, struct index_state *istate); -static void std_output(struct grep_opt *opt, const void *buf, size_t size) +static void std_output(struct grep_opt *opt UNUSED, const void *buf, size_t size) { fwrite(buf, size, 1, stdout); } From patchwork Mon Aug 28 21:48:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6558C83F19 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233823AbjH1Vs2 (ORCPT ); Mon, 28 Aug 2023 17:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233785AbjH1VsG (ORCPT ); Mon, 28 Aug 2023 17:48:06 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76DE3F9 for ; Mon, 28 Aug 2023 14:48:03 -0700 (PDT) Received: (qmail 572 invoked by uid 109); 28 Aug 2023 21:48:03 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:03 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4553 invoked by uid 111); 28 Aug 2023 21:48:03 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:03 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:02 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 13/22] add-interactive: mark unused callback parameters Message-ID: <20230828214802.GM3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The interactive commands are dispatched from a table of abstract pointers, but not every command uses every parameter it receives. Mark the unused ones to silence -Wunused-parameter. Signed-off-by: Jeff King --- add-interactive.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/add-interactive.c b/add-interactive.c index add9a1ad43..852e8e6b2f 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -1021,9 +1021,9 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps, return res; } -static int run_help(struct add_i_state *s, const struct pathspec *unused_ps, - struct prefix_item_list *unused_files, - struct list_and_choose_options *unused_opts) +static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED, + struct prefix_item_list *files UNUSED, + struct list_and_choose_options *opts UNUSED) { color_fprintf_ln(stdout, s->help_color, "status - %s", _("show paths with changes")); @@ -1074,7 +1074,7 @@ struct print_command_item_data { const char *color, *reset; }; -static void print_command_item(int i, int selected, +static void print_command_item(int i, int selected UNUSED, struct string_list_item *item, void *print_command_item_data) { From patchwork Mon Aug 28 21:48:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7804C83F18 for ; Mon, 28 Aug 2023 21:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233833AbjH1Vsa (ORCPT ); Mon, 28 Aug 2023 17:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233787AbjH1VsI (ORCPT ); Mon, 28 Aug 2023 17:48:08 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0942FF9 for ; Mon, 28 Aug 2023 14:48:05 -0700 (PDT) Received: (qmail 577 invoked by uid 109); 28 Aug 2023 21:48:05 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:05 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4556 invoked by uid 111); 28 Aug 2023 21:48:06 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:06 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:04 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 14/22] negotiator/noop: mark unused callback parameters Message-ID: <20230828214804.GN3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The noop negotiator unsurprisingly does not bother looking at any of its parameters. Mark them unused to silence -Wunused-parameter. Signed-off-by: Jeff King --- negotiator/noop.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/negotiator/noop.c b/negotiator/noop.c index 7b72937686..de39028ab7 100644 --- a/negotiator/noop.c +++ b/negotiator/noop.c @@ -3,22 +3,24 @@ #include "../commit.h" #include "../fetch-negotiator.h" -static void known_common(struct fetch_negotiator *n, struct commit *c) +static void known_common(struct fetch_negotiator *n UNUSED, + struct commit *c UNUSED) { /* do nothing */ } -static void add_tip(struct fetch_negotiator *n, struct commit *c) +static void add_tip(struct fetch_negotiator *n UNUSED, + struct commit *c UNUSED) { /* do nothing */ } -static const struct object_id *next(struct fetch_negotiator *n) +static const struct object_id *next(struct fetch_negotiator *n UNUSED) { return NULL; } -static int ack(struct fetch_negotiator *n, struct commit *c) +static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED) { /* * This negotiator does not emit any commits, so there is no commit to @@ -28,7 +30,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c) return 0; } -static void release(struct fetch_negotiator *n) +static void release(struct fetch_negotiator *n UNUSED) { /* nothing to release */ } From patchwork Mon Aug 28 21:48:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 033F6C83F1B for ; Mon, 28 Aug 2023 21:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233875AbjH1Vsb (ORCPT ); Mon, 28 Aug 2023 17:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbjH1VsL (ORCPT ); Mon, 28 Aug 2023 17:48:11 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1461F9 for ; Mon, 28 Aug 2023 14:48:08 -0700 (PDT) Received: (qmail 580 invoked by uid 109); 28 Aug 2023 21:48:08 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:08 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4559 invoked by uid 111); 28 Aug 2023 21:48:09 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:09 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:07 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 15/22] worktree: mark unused parameters in noop repair callback Message-ID: <20230828214807.GO3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The noop repair callback unsurprisingly does not look at any of its parameters. Mark them as unused to silence -Wunused-parameter. Signed-off-by: Jeff King --- worktree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worktree.c b/worktree.c index b8cf29e6a1..a56a6c2a3d 100644 --- a/worktree.c +++ b/worktree.c @@ -581,8 +581,10 @@ static void repair_gitfile(struct worktree *wt, strbuf_release(&dotgit); } -static void repair_noop(int iserr, const char *path, const char *msg, - void *cb_data) +static void repair_noop(int iserr UNUSED, + const char *path UNUSED, + const char *msg UNUSED, + void *cb_data UNUSED) { /* nothing */ } From patchwork Mon Aug 28 21:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18E71C83F1A for ; Mon, 28 Aug 2023 21:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233885AbjH1Vsd (ORCPT ); Mon, 28 Aug 2023 17:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbjH1VsN (ORCPT ); Mon, 28 Aug 2023 17:48:13 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EACF9 for ; Mon, 28 Aug 2023 14:48:11 -0700 (PDT) Received: (qmail 585 invoked by uid 109); 28 Aug 2023 21:48:11 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:11 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4562 invoked by uid 111); 28 Aug 2023 21:48:11 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:11 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:10 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 16/22] imap-send: mark unused parameters with NO_OPENSSL Message-ID: <20230828214810.GP3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Earlier patches annotating unused parameters in imap-send missed a few cases in code that is compiled only with NO_OPENSSL. These need to retain the extra parameters to match the interfaces used when we compile with openssl support. Note in the case of socket_perror() that the function declaration and parts of its code are shared between the two cases, and only the openssl code looks at "sock". So we can't simply mark the parameter as always unused. Instead, we can add a noop statement that references it. This is ugly, but should be portable. Signed-off-by: Jeff King --- imap-send.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/imap-send.c b/imap-send.c index 06386e0b3b..996651e4f8 100644 --- a/imap-send.c +++ b/imap-send.c @@ -206,10 +206,14 @@ static void socket_perror(const char *func, struct imap_socket *sock, int ret) else fprintf(stderr, "%s: unexpected EOF\n", func); } + /* mark as used to appease -Wunused-parameter with NO_OPENSSL */ + (void)sock; } #ifdef NO_OPENSSL -static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int verify) +static int ssl_socket_connect(struct imap_socket *sock UNUSED, + int use_tls_only UNUSED, + int verify UNUSED) { fprintf(stderr, "SSL requested but SSL support not compiled in\n"); return -1; @@ -904,7 +908,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) #else -static char *cram(const char *challenge_64, const char *user, const char *pass) +static char *cram(const char *challenge_64 UNUSED, + const char *user UNUSED, + const char *pass UNUSED) { die("If you want to use CRAM-MD5 authenticate method, " "you have to build git-imap-send with OpenSSL library."); From patchwork Mon Aug 28 21:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A34FC83F1D for ; Mon, 28 Aug 2023 21:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233889AbjH1Vse (ORCPT ); Mon, 28 Aug 2023 17:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233795AbjH1VsQ (ORCPT ); Mon, 28 Aug 2023 17:48:16 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BFEBF9 for ; Mon, 28 Aug 2023 14:48:13 -0700 (PDT) Received: (qmail 588 invoked by uid 109); 28 Aug 2023 21:48:13 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:13 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4565 invoked by uid 111); 28 Aug 2023 21:48:14 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:14 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:12 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 17/22] grep: mark unused parmaeters in pcre fallbacks Message-ID: <20230828214812.GQ3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When USE_LIBPCRE2 is not defined, we compile several noop fallbacks. These need to have their parameters annotated to avoid -Wunused-parameter warnings (and obviously we cannot remove the parameters, since the functions must match the non-fallback versions). Signed-off-by: Jeff King --- grep.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grep.c b/grep.c index 0124eb1960..fc2d0c837a 100644 --- a/grep.c +++ b/grep.c @@ -452,18 +452,20 @@ static void free_pcre2_pattern(struct grep_pat *p) pcre2_general_context_free(p->pcre2_general_context); } #else /* !USE_LIBPCRE2 */ -static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt) +static void compile_pcre2_pattern(struct grep_pat *p UNUSED, + const struct grep_opt *opt UNUSED) { die("cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE"); } -static int pcre2match(struct grep_pat *p, const char *line, const char *eol, - regmatch_t *match, int eflags) +static int pcre2match(struct grep_pat *p UNUSED, const char *line UNUSED, + const char *eol UNUSED, regmatch_t *match UNUSED, + int eflags UNUSED) { return 1; } -static void free_pcre2_pattern(struct grep_pat *p) +static void free_pcre2_pattern(struct grep_pat *p UNUSED) { } From patchwork Mon Aug 28 21:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49CB0C83F1C for ; Mon, 28 Aug 2023 21:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233962AbjH1Vsf (ORCPT ); Mon, 28 Aug 2023 17:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbjH1VsS (ORCPT ); Mon, 28 Aug 2023 17:48:18 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C72F9 for ; Mon, 28 Aug 2023 14:48:16 -0700 (PDT) Received: (qmail 591 invoked by uid 109); 28 Aug 2023 21:48:16 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:16 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4568 invoked by uid 111); 28 Aug 2023 21:48:17 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:17 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:15 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 18/22] credential: mark unused parameter in urlmatch callback Message-ID: <20230828214815.GR3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Our select_all() callback does not need to actually look at its parameters, since the point is to match everything. But we need to mark its parameters to satisfy -Wunused-parameter. Signed-off-by: Jeff King --- credential.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/credential.c b/credential.c index d664754163..18098bd35e 100644 --- a/credential.c +++ b/credential.c @@ -88,8 +88,8 @@ static int proto_is_http(const char *s) static void credential_describe(struct credential *c, struct strbuf *out); static void credential_format(struct credential *c, struct strbuf *out); -static int select_all(const struct urlmatch_item *a, - const struct urlmatch_item *b) +static int select_all(const struct urlmatch_item *a UNUSED, + const struct urlmatch_item *b UNUSED) { return 0; } From patchwork Mon Aug 28 21:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6B20C83F12 for ; Mon, 28 Aug 2023 21:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231609AbjH1Vs4 (ORCPT ); Mon, 28 Aug 2023 17:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233799AbjH1VsW (ORCPT ); Mon, 28 Aug 2023 17:48:22 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BB0F9 for ; Mon, 28 Aug 2023 14:48:19 -0700 (PDT) Received: (qmail 594 invoked by uid 109); 28 Aug 2023 21:48:19 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:19 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4571 invoked by uid 111); 28 Aug 2023 21:48:19 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:19 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:18 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 19/22] fetch: mark unused parameter in ref_transaction callback Message-ID: <20230828214818.GS3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since this callback is just trying to collect the set of queued tag updates, there is no need for it to look at old_oid at all. Mark it as unused to appease -Wunused-parameter. Signed-off-by: Jeff King --- builtin/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index eed4a7cdb6..8f93529505 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -308,7 +308,7 @@ static void clear_item(struct refname_hash_entry *item) static void add_already_queued_tags(const char *refname, - const struct object_id *old_oid, + const struct object_id *old_oid UNUSED, const struct object_id *new_oid, void *cb_data) { From patchwork Mon Aug 28 21:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2946C71153 for ; Mon, 28 Aug 2023 21:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbjH1Vs5 (ORCPT ); Mon, 28 Aug 2023 17:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjH1VsY (ORCPT ); Mon, 28 Aug 2023 17:48:24 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE817F9 for ; Mon, 28 Aug 2023 14:48:21 -0700 (PDT) Received: (qmail 597 invoked by uid 109); 28 Aug 2023 21:48:21 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:21 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4574 invoked by uid 111); 28 Aug 2023 21:48:22 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:22 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:20 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 20/22] bundle-uri: mark unused parameters in callbacks Message-ID: <20230828214820.GT3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The first hunk is similar to 02c3c59e62 (hashmap: mark unused callback parameters, 2022-08-19), but was added after that commit. The other two are used with for_all_bundles_in_list(), but don't use their void data pointer. Signed-off-by: Jeff King --- bundle-uri.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundle-uri.c b/bundle-uri.c index 4b5c49b93d..8492fffd2f 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -20,7 +20,7 @@ static struct { { BUNDLE_HEURISTIC_CREATIONTOKEN, "creationToken" }, }; -static int compare_bundles(const void *hashmap_cmp_fn_data, +static int compare_bundles(const void *hashmap_cmp_fn_data UNUSED, const struct hashmap_entry *he1, const struct hashmap_entry *he2, const void *id) @@ -45,7 +45,7 @@ void init_bundle_list(struct bundle_list *list) } static int clear_remote_bundle_info(struct remote_bundle_info *bundle, - void *data) + void *data UNUSED) { FREE_AND_NULL(bundle->id); FREE_AND_NULL(bundle->uri); @@ -779,7 +779,7 @@ static int unbundle_all_bundles(struct repository *r, return 0; } -static int unlink_bundle(struct remote_bundle_info *info, void *data) +static int unlink_bundle(struct remote_bundle_info *info, void *data UNUSED) { if (info->file) unlink_or_warn(info->file); From patchwork Mon Aug 28 21:48:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3181BC83F14 for ; Mon, 28 Aug 2023 21:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbjH1Vs7 (ORCPT ); Mon, 28 Aug 2023 17:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233859AbjH1Vsa (ORCPT ); Mon, 28 Aug 2023 17:48:30 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BED701A6 for ; Mon, 28 Aug 2023 14:48:24 -0700 (PDT) Received: (qmail 601 invoked by uid 109); 28 Aug 2023 21:48:24 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:24 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4577 invoked by uid 111); 28 Aug 2023 21:48:24 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:24 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:23 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 21/22] gc: mark unused descriptors in scheduler callbacks Message-ID: <20230828214823.GU3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Each of the scheduler update callbacks gets the descriptor of the lock file, but only the crontab updater needs it. We have to retain the unused descriptors because these are dispatched from a table of function pointers, but we should mark them to silence -Wunused-parameter. Signed-off-by: Jeff King --- builtin/gc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 1f53b66c7b..369bd43fb2 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1934,7 +1934,7 @@ static int launchctl_add_plists(void) launchctl_schedule_plist(exec_path, SCHEDULE_WEEKLY); } -static int launchctl_update_schedule(int run_maintenance, int fd) +static int launchctl_update_schedule(int run_maintenance, int fd UNUSED) { if (run_maintenance) return launchctl_add_plists(); @@ -2115,7 +2115,7 @@ static int schtasks_schedule_tasks(void) schtasks_schedule_task(exec_path, SCHEDULE_WEEKLY); } -static int schtasks_update_schedule(int run_maintenance, int fd) +static int schtasks_update_schedule(int run_maintenance, int fd UNUSED) { if (run_maintenance) return schtasks_schedule_tasks(); @@ -2556,7 +2556,7 @@ static int systemd_timer_setup_units(void) return ret; } -static int systemd_timer_update_schedule(int run_maintenance, int fd) +static int systemd_timer_update_schedule(int run_maintenance, int fd UNUSED) { if (run_maintenance) return systemd_timer_setup_units(); From patchwork Mon Aug 28 21:48:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13368364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42284C83F17 for ; Mon, 28 Aug 2023 21:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233814AbjH1VtB (ORCPT ); Mon, 28 Aug 2023 17:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233927AbjH1Vsf (ORCPT ); Mon, 28 Aug 2023 17:48:35 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7133ECC5 for ; Mon, 28 Aug 2023 14:48:27 -0700 (PDT) Received: (qmail 606 invoked by uid 109); 28 Aug 2023 21:48:27 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 28 Aug 2023 21:48:27 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 4580 invoked by uid 111); 28 Aug 2023 21:48:27 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 28 Aug 2023 17:48:27 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 28 Aug 2023 17:48:26 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 22/22] update-ref: mark unused parameter in parser callbacks Message-ID: <20230828214826.GV3831137@coredump.intra.peff.net> References: <20230828214604.GA3830831@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230828214604.GA3830831@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The parsing of stdin is driven by a table of function pointers; mark unused parameters in concrete functions to avoid -Wunused-parameter warnings. Signed-off-by: Jeff King --- builtin/update-ref.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 242102273e..c0c4e65e6f 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -311,8 +311,8 @@ static void report_ok(const char *command) fflush(stdout); } -static void parse_cmd_option(struct ref_transaction *transaction, - const char *next, const char *end) +static void parse_cmd_option(struct ref_transaction *transaction UNUSED, + const char *next, const char *end UNUSED) { const char *rest; if (skip_prefix(next, "no-deref", &rest) && *rest == line_termination) @@ -321,16 +321,16 @@ static void parse_cmd_option(struct ref_transaction *transaction, die("option unknown: %s", next); } -static void parse_cmd_start(struct ref_transaction *transaction, - const char *next, const char *end) +static void parse_cmd_start(struct ref_transaction *transaction UNUSED, + const char *next, const char *end UNUSED) { if (*next != line_termination) die("start: extra input: %s", next); report_ok("start"); } static void parse_cmd_prepare(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf error = STRBUF_INIT; if (*next != line_termination) @@ -341,7 +341,7 @@ static void parse_cmd_prepare(struct ref_transaction *transaction, } static void parse_cmd_abort(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf error = STRBUF_INIT; if (*next != line_termination) @@ -352,7 +352,7 @@ static void parse_cmd_abort(struct ref_transaction *transaction, } static void parse_cmd_commit(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf error = STRBUF_INIT; if (*next != line_termination)