From patchwork Tue Aug 29 23:43: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: 13369837 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 D1989C6FA8F for ; Tue, 29 Aug 2023 23:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241191AbjH2Xnu (ORCPT ); Tue, 29 Aug 2023 19:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241187AbjH2Xno (ORCPT ); Tue, 29 Aug 2023 19:43:44 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1DF1B3 for ; Tue, 29 Aug 2023 16:43:41 -0700 (PDT) Received: (qmail 14756 invoked by uid 109); 29 Aug 2023 23:43:40 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:43:40 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19732 invoked by uid 111); 29 Aug 2023 23:43: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; Tue, 29 Aug 2023 19:43:41 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:43:39 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 01/22] sequencer: use repository parameter in short_commit_name() Message-ID: <20230829234339.GA227087@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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. Note that a few of these functions have a "rev_info" whose "repo" parameter could probably be used instead of the_repository. I'm leaving that for further cleanups, as it's not immediately obvious that revs->repo is always valid, and there's quite a bit of other possible refactoring here (even getting rid of some "struct repository" arguments in favor of revs->repo). 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..cd5264171a 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(the_repository, 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(the_repository, 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 Tue Aug 29 23:44: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: 13369838 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 43A07C83F1D for ; Tue, 29 Aug 2023 23:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241192AbjH2Xov (ORCPT ); Tue, 29 Aug 2023 19:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241197AbjH2Xo1 (ORCPT ); Tue, 29 Aug 2023 19:44:27 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CDE1BE for ; Tue, 29 Aug 2023 16:44:24 -0700 (PDT) Received: (qmail 14771 invoked by uid 109); 29 Aug 2023 23:44:24 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:44:24 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19742 invoked by uid 111); 29 Aug 2023 23:44:25 -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; Tue, 29 Aug 2023 19:44:25 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:44:23 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 02/22] sequencer: mark repository argument as unused Message-ID: <20230829234423.GB227087@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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. This is due to ed5b1ca10b (status: do not report errors in sequencer/todo, 2019-06-27), which dropped the call to parse_insn_line(). However, 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 cd5264171a..70696d4a65 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 Tue Aug 29 23:45:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369839 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 5226CC6FA8F for ; Tue, 29 Aug 2023 23:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241269AbjH2XpY (ORCPT ); Tue, 29 Aug 2023 19:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241272AbjH2XpK (ORCPT ); Tue, 29 Aug 2023 19:45:10 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33A11B3 for ; Tue, 29 Aug 2023 16:45:07 -0700 (PDT) Received: (qmail 14781 invoked by uid 109); 29 Aug 2023 23:45:07 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:07 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19829 invoked by uid 111); 29 Aug 2023 23:45:08 -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; Tue, 29 Aug 2023 19:45:08 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:06 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 03/22] ref-filter: mark unused parameters in parser callbacks Message-ID: <20230829234506.GA227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369840 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 7365CC83F17 for ; Tue, 29 Aug 2023 23:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241271AbjH2XpZ (ORCPT ); Tue, 29 Aug 2023 19:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241274AbjH2XpQ (ORCPT ); Tue, 29 Aug 2023 19:45:16 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662421B1 for ; Tue, 29 Aug 2023 16:45:14 -0700 (PDT) Received: (qmail 14793 invoked by uid 109); 29 Aug 2023 23:45:14 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:14 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19838 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:14 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:13 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 04/22] pack-bitmap: mark unused parameters in show_object callback Message-ID: <20230829234513.GB227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369843 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 839B7C83F18 for ; Tue, 29 Aug 2023 23:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241281AbjH2Xp2 (ORCPT ); Tue, 29 Aug 2023 19:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241275AbjH2XpT (ORCPT ); Tue, 29 Aug 2023 19:45:19 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B3521B1 for ; Tue, 29 Aug 2023 16:45:17 -0700 (PDT) Received: (qmail 14808 invoked by uid 109); 29 Aug 2023 23:45:16 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:16 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19844 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:17 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:15 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 05/22] worktree: mark unused parameters in each_ref_fn callback Message-ID: <20230829234515.GC227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369841 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 A1B6DC83F1A for ; Tue, 29 Aug 2023 23:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241288AbjH2Xpb (ORCPT ); Tue, 29 Aug 2023 19:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241276AbjH2XpV (ORCPT ); Tue, 29 Aug 2023 19:45:21 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE0691B1 for ; Tue, 29 Aug 2023 16:45:18 -0700 (PDT) Received: (qmail 14817 invoked by uid 109); 29 Aug 2023 23:45:18 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:18 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19850 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:19 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:17 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 06/22] commit-graph: mark unused data parameters in generation callbacks Message-ID: <20230829234517.GD227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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. Note that we can drop the assignment of the "data" parameter in compute_generation_numbers(), as we've just shown that neither of the callbacks it uses will access it. This matches the caller in ensure_generations_valid(), which already does not bother to set "data". Signed-off-by: Jeff King --- commit-graph.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index 0aa1640d15..e11f326097 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; @@ -1587,7 +1589,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) .commits = &ctx->commits, .get_generation = get_generation_from_graph_data, .set_generation = set_generation_v2, - .data = ctx, }; if (ctx->report_progress) @@ -1616,7 +1617,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 Tue Aug 29 23:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369842 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 927E5C71153 for ; Tue, 29 Aug 2023 23:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241286AbjH2Xp3 (ORCPT ); Tue, 29 Aug 2023 19:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241277AbjH2XpW (ORCPT ); Tue, 29 Aug 2023 19:45:22 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70DBE1B1 for ; Tue, 29 Aug 2023 16:45:20 -0700 (PDT) Received: (qmail 14830 invoked by uid 109); 29 Aug 2023 23:45:20 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:20 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19856 invoked by uid 111); 29 Aug 2023 23:45:20 -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; Tue, 29 Aug 2023 19:45:20 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:19 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 07/22] ls-tree: mark unused parameter in callback Message-ID: <20230829234519.GE227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369844 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 74C99C83F17 for ; Tue, 29 Aug 2023 23:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239761AbjH2Xp7 (ORCPT ); Tue, 29 Aug 2023 19:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236539AbjH2XpY (ORCPT ); Tue, 29 Aug 2023 19:45:24 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D59C1B1 for ; Tue, 29 Aug 2023 16:45:21 -0700 (PDT) Received: (qmail 14841 invoked by uid 109); 29 Aug 2023 23:45:21 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:21 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19862 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:22 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:20 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 08/22] stash: mark unused parameter in diff callback Message-ID: <20230829234520.GF227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369846 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 BB506C71153 for ; Tue, 29 Aug 2023 23:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241283AbjH2XqB (ORCPT ); Tue, 29 Aug 2023 19:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241280AbjH2Xp0 (ORCPT ); Tue, 29 Aug 2023 19:45:26 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71FE1B3 for ; Tue, 29 Aug 2023 16:45:23 -0700 (PDT) Received: (qmail 14855 invoked by uid 109); 29 Aug 2023 23:45:23 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:23 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19868 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:24 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:22 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 09/22] trace2: mark unused us_elapsed_absolute parameters Message-ID: <20230829234522.GG227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369845 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 EB199C83F1A for ; Tue, 29 Aug 2023 23:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241289AbjH2XqD (ORCPT ); Tue, 29 Aug 2023 19:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241282AbjH2Xp2 (ORCPT ); Tue, 29 Aug 2023 19:45:28 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 350651BC for ; Tue, 29 Aug 2023 16:45:25 -0700 (PDT) Received: (qmail 14865 invoked by uid 109); 29 Aug 2023 23:45:25 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:25 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19874 invoked by uid 111); 29 Aug 2023 23:45:25 -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; Tue, 29 Aug 2023 19:45:25 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:23 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 10/22] trace2: mark unused config callback parameter Message-ID: <20230829234523.GH227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369847 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 CB846C83F18 for ; Tue, 29 Aug 2023 23:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241293AbjH2XqE (ORCPT ); Tue, 29 Aug 2023 19:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241291AbjH2Xpc (ORCPT ); Tue, 29 Aug 2023 19:45:32 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C36BCC5 for ; Tue, 29 Aug 2023 16:45:26 -0700 (PDT) Received: (qmail 14878 invoked by uid 109); 29 Aug 2023 23:45:26 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:26 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19880 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:27 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:25 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 11/22] test-trace2: mark unused argv/argc parameters Message-ID: <20230829234525.GI227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369848 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 06ACCC83F1B for ; Tue, 29 Aug 2023 23:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241298AbjH2XqF (ORCPT ); Tue, 29 Aug 2023 19:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241295AbjH2Xpj (ORCPT ); Tue, 29 Aug 2023 19:45:39 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82477CD9 for ; Tue, 29 Aug 2023 16:45:28 -0700 (PDT) Received: (qmail 14892 invoked by uid 109); 29 Aug 2023 23:45:28 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:28 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19886 invoked by uid 111); 29 Aug 2023 23:45:28 -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; Tue, 29 Aug 2023 19:45:28 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:27 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 12/22] grep: mark unused parameter in output function Message-ID: <20230829234527.GJ227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369849 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 770B4C6FA8F for ; Tue, 29 Aug 2023 23:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbjH2Xq1 (ORCPT ); Tue, 29 Aug 2023 19:46:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241304AbjH2Xpl (ORCPT ); Tue, 29 Aug 2023 19:45:41 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304701B3 for ; Tue, 29 Aug 2023 16:45:30 -0700 (PDT) Received: (qmail 14903 invoked by uid 109); 29 Aug 2023 23:45:29 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:29 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19892 invoked by uid 111); 29 Aug 2023 23:45:30 -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; Tue, 29 Aug 2023 19:45:30 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:28 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 13/22] add-interactive: mark unused callback parameters Message-ID: <20230829234528.GK227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369850 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 AFF29C71153 for ; Tue, 29 Aug 2023 23:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241296AbjH2Xq2 (ORCPT ); Tue, 29 Aug 2023 19:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241327AbjH2Xpw (ORCPT ); Tue, 29 Aug 2023 19:45:52 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C356CF4 for ; Tue, 29 Aug 2023 16:45:31 -0700 (PDT) Received: (qmail 14914 invoked by uid 109); 29 Aug 2023 23:45:31 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:31 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19899 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:31 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:30 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 14/22] negotiator/noop: mark unused callback parameters Message-ID: <20230829234530.GL227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369851 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 EF8AAC83F18 for ; Tue, 29 Aug 2023 23:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241304AbjH2Xqb (ORCPT ); Tue, 29 Aug 2023 19:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241328AbjH2Xpw (ORCPT ); Tue, 29 Aug 2023 19:45:52 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 070FDE48 for ; Tue, 29 Aug 2023 16:45:32 -0700 (PDT) Received: (qmail 14926 invoked by uid 109); 29 Aug 2023 23:45:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19905 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:33 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:31 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 15/22] worktree: mark unused parameters in noop repair callback Message-ID: <20230829234531.GM227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369855 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 D0BCAC83F17 for ; Tue, 29 Aug 2023 23:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241301AbjH2Xq3 (ORCPT ); Tue, 29 Aug 2023 19:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241332AbjH2Xpz (ORCPT ); Tue, 29 Aug 2023 19:45:55 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC76E55 for ; Tue, 29 Aug 2023 16:45:34 -0700 (PDT) Received: (qmail 14938 invoked by uid 109); 29 Aug 2023 23:45:34 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:34 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19911 invoked by uid 111); 29 Aug 2023 23:45:34 -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; Tue, 29 Aug 2023 19:45:34 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:33 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 16/22] imap-send: mark unused parameters with NO_OPENSSL Message-ID: <20230829234533.GN227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369852 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 0CCBBC83F1A for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241310AbjH2Xqf (ORCPT ); Tue, 29 Aug 2023 19:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241303AbjH2XqF (ORCPT ); Tue, 29 Aug 2023 19:46:05 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E2CE60 for ; Tue, 29 Aug 2023 16:45:35 -0700 (PDT) Received: (qmail 14950 invoked by uid 109); 29 Aug 2023 23:45:35 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:35 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19917 invoked by uid 111); 29 Aug 2023 23:45:36 -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; Tue, 29 Aug 2023 19:45:36 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:34 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 17/22] grep: mark unused parmaeters in pcre fallbacks Message-ID: <20230829234534.GO227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369854 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 2B944C83F1C for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241318AbjH2Xqh (ORCPT ); Tue, 29 Aug 2023 19:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241353AbjH2XqJ (ORCPT ); Tue, 29 Aug 2023 19:46:09 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACFC3E70 for ; Tue, 29 Aug 2023 16:45:37 -0700 (PDT) Received: (qmail 14961 invoked by uid 109); 29 Aug 2023 23:45:37 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:37 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19923 invoked by uid 111); 29 Aug 2023 23:45: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; Tue, 29 Aug 2023 19:45:37 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:36 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 18/22] credential: mark unused parameter in urlmatch callback Message-ID: <20230829234536.GP227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369853 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 1C6ECC83F19 for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241330AbjH2Xqi (ORCPT ); Tue, 29 Aug 2023 19:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241364AbjH2XqJ (ORCPT ); Tue, 29 Aug 2023 19:46:09 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ABC510C8 for ; Tue, 29 Aug 2023 16:45:38 -0700 (PDT) Received: (qmail 14973 invoked by uid 109); 29 Aug 2023 23:45:38 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:38 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19930 invoked by uid 111); 29 Aug 2023 23:45:39 -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; Tue, 29 Aug 2023 19:45:39 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:37 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 19/22] fetch: mark unused parameter in ref_transaction callback Message-ID: <20230829234537.GQ227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369857 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 58D7AC83F1E for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241334AbjH2Xqi (ORCPT ); Tue, 29 Aug 2023 19:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241380AbjH2XqK (ORCPT ); Tue, 29 Aug 2023 19:46:10 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 704E210D3 for ; Tue, 29 Aug 2023 16:45:40 -0700 (PDT) Received: (qmail 14986 invoked by uid 109); 29 Aug 2023 23:45:40 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:40 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19936 invoked by uid 111); 29 Aug 2023 23:45:40 -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; Tue, 29 Aug 2023 19:45:40 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:39 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 20/22] bundle-uri: mark unused parameters in callbacks Message-ID: <20230829234539.GR227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13369856 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 3A492C83F1B for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241337AbjH2Xqj (ORCPT ); Tue, 29 Aug 2023 19:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241395AbjH2XqL (ORCPT ); Tue, 29 Aug 2023 19:46:11 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF19210E7 for ; Tue, 29 Aug 2023 16:45:41 -0700 (PDT) Received: (qmail 14999 invoked by uid 109); 29 Aug 2023 23:45:41 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:41 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19943 invoked by uid 111); 29 Aug 2023 23:45:42 -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; Tue, 29 Aug 2023 19:45:42 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:40 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 21/22] gc: mark unused descriptors in scheduler callbacks Message-ID: <20230829234540.GS227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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 Tue Aug 29 23:45: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: 13369858 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 6935FC83F1D for ; Tue, 29 Aug 2023 23:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241344AbjH2Xqj (ORCPT ); Tue, 29 Aug 2023 19:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241406AbjH2XqM (ORCPT ); Tue, 29 Aug 2023 19:46:12 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F580CD1 for ; Tue, 29 Aug 2023 16:45:43 -0700 (PDT) Received: (qmail 15009 invoked by uid 109); 29 Aug 2023 23:45:43 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 29 Aug 2023 23:45:43 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19949 invoked by uid 111); 29 Aug 2023 23:45:43 -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; Tue, 29 Aug 2023 19:45:43 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 29 Aug 2023 19:45:42 -0400 From: Jeff King To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood Subject: [PATCH v2 22/22] update-ref: mark unused parameter in parser callbacks Message-ID: <20230829234542.GT227214@coredump.intra.peff.net> References: <20230829234305.GA226944@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829234305.GA226944@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)