From patchwork Mon Jul 3 06:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299620 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 AA516EB64DC for ; Mon, 3 Jul 2023 06:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjGCGoB (ORCPT ); Mon, 3 Jul 2023 02:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjGCGoA (ORCPT ); Mon, 3 Jul 2023 02:44:00 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D10B3CE for ; Sun, 2 Jul 2023 23:43:59 -0700 (PDT) Received: (qmail 14008 invoked by uid 109); 3 Jul 2023 06:44:00 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:00 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2607 invoked by uid 111); 3 Jul 2023 06:44:02 -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, 03 Jul 2023 02:44:02 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:43:58 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 01/14] test-ref-store: drop unimplemented reflog-expire command Message-ID: <20230703064358.GA3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The reflog-expire command has been unimplemented since it was added in 80f2a6097c (t/helper: add test-ref-store to test ref-store functions, 2017-03-26). This causes -Wunused-parameter to complain, since the function just calls die() without looking at its arguments. We could mark these as UNUSED to silence the warning. But let's just drop the function. It has no callers in the test suite and is not doing anything useful, beyond perhaps reminding us that it's something we _could_ be testing. But since the bulk of the work in adding such tests would be the shell bits that actually examine the reflog state before and after expiration, this is not even a useful step in that direction. Somebody who wants to do that work later can easily add this function back. Signed-off-by: Jeff King --- t/helper/test-ref-store.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index fb18831ec2..aa900cbfab 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -268,11 +268,6 @@ static int cmd_delete_reflog(struct ref_store *refs, const char **argv) return refs_delete_reflog(refs, refname); } -static int cmd_reflog_expire(struct ref_store *refs, const char **argv) -{ - die("not supported yet"); -} - static int cmd_delete_ref(struct ref_store *refs, const char **argv) { const char *msg = notnull(*argv++, "msg"); @@ -326,7 +321,6 @@ static struct command commands[] = { { "reflog-exists", cmd_reflog_exists }, { "create-reflog", cmd_create_reflog }, { "delete-reflog", cmd_delete_reflog }, - { "reflog-expire", cmd_reflog_expire }, /* * backend transaction functions can't be tested separately */ From patchwork Mon Jul 3 06:44: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: 13299621 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 1AD4AEB64DC for ; Mon, 3 Jul 2023 06:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjGCGoG (ORCPT ); Mon, 3 Jul 2023 02:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjGCGoE (ORCPT ); Mon, 3 Jul 2023 02:44:04 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B3CCD for ; Sun, 2 Jul 2023 23:44:03 -0700 (PDT) Received: (qmail 14019 invoked by uid 109); 3 Jul 2023 06:44:04 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:04 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2613 invoked by uid 111); 3 Jul 2023 06:44: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, 03 Jul 2023 02:44:06 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:02 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 02/14] do_for_each_ref_helper(): mark unused repository parameter Message-ID: <20230703064402.GB3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This function gets a repository parameter because it's a callback for do_for_each_repo_ref_iterator(). But it's just a wrapper that passes along each call to a regular each_ref_fn callback, and the latter doesn't accept a repository argument. Probably in the long run all of the each_ref_fn callbacks should get a repository parameter, too. But changing that now would require updates all over the code base. Until that happens, let's annotate this wrapper callback to quiet the compiler's -Wunused-parameter warning. Signed-off-by: Jeff King --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index c029f64982..edeae90ebb 100644 --- a/refs.c +++ b/refs.c @@ -1588,7 +1588,7 @@ struct do_for_each_ref_help { void *cb_data; }; -static int do_for_each_ref_helper(struct repository *r, +static int do_for_each_ref_helper(struct repository *r UNUSED, const char *refname, const struct object_id *oid, int flags, From patchwork Mon Jul 3 06:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299622 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 766D9EB64DC for ; Mon, 3 Jul 2023 06:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbjGCGoK (ORCPT ); Mon, 3 Jul 2023 02:44:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjGCGoJ (ORCPT ); Mon, 3 Jul 2023 02:44:09 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33468CE for ; Sun, 2 Jul 2023 23:44:07 -0700 (PDT) Received: (qmail 14029 invoked by uid 109); 3 Jul 2023 06:44:07 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:07 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2616 invoked by uid 111); 3 Jul 2023 06:44:10 -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, 03 Jul 2023 02:44:10 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:05 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 03/14] http: mark unused parameters in curl callbacks Message-ID: <20230703064405.GC3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org These functions are all used as callbacks for curl, so they have to conform to a particular interface. But they don't need all of their parameters: - fwrite_null() throws away the input, so it doesn't look at most parameters - fwrite_wwwauth() in theory could take the auth struct in its void pointer, but instead we just access it as the global http_auth (matching the rest of the code in this file) - curl_trace() always writes via the trace mechanism, so it doesn't need its void pointer to know where to send things. Likewise, it ignores the CURL parameter, since nothing we trace requires querying the handle. Signed-off-by: Jeff King --- http.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http.c b/http.c index 5772c8ced3..5b8e9c8c48 100644 --- a/http.c +++ b/http.c @@ -196,7 +196,7 @@ static inline int is_hdr_continuation(const char *ptr, const size_t size) return size && (*ptr == ' ' || *ptr == '\t'); } -static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p) +static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p UNUSED) { size_t size = eltsize * nmemb; struct strvec *values = &http_auth.wwwauth_headers; @@ -295,7 +295,8 @@ static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p) return size; } -size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf) +size_t fwrite_null(char *ptr UNUSED, size_t eltsize UNUSED, size_t nmemb, + void *data UNUSED) { return nmemb; } @@ -820,7 +821,9 @@ static void curl_dump_info(char *data, size_t size) strbuf_release(&buf); } -static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) +static int curl_trace(CURL *handle UNUSED, curl_infotype type, + char *data, size_t size, + void *userp UNUSED) { const char *text; enum { NO_FILTER = 0, DO_FILTER = 1 }; From patchwork Mon Jul 3 06:44:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299623 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 C9FC0C0015E for ; Mon, 3 Jul 2023 06:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjGCGoM (ORCPT ); Mon, 3 Jul 2023 02:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjGCGoK (ORCPT ); Mon, 3 Jul 2023 02:44:10 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4154E8 for ; Sun, 2 Jul 2023 23:44:09 -0700 (PDT) Received: (qmail 14039 invoked by uid 109); 3 Jul 2023 06:44:10 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:10 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2619 invoked by uid 111); 3 Jul 2023 06:44:12 -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, 03 Jul 2023 02:44:12 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:08 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 04/14] http-push: mark unused parameter in xml callback Message-ID: <20230703064408.GD3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The xml_start_tag() function is passed the expat library's XML_SetElementHandler() function, so it has to conform to the expected interface. But we don't actually care about the attributes list. Mark it so that -Wunused-parameter does not complain. Signed-off-by: Jeff King --- http-push.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-push.c b/http-push.c index 9ab2383d2b..a704f490fd 100644 --- a/http-push.c +++ b/http-push.c @@ -783,7 +783,7 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) static void one_remote_ref(const char *refname); static void -xml_start_tag(void *userData, const char *name, const char **atts) +xml_start_tag(void *userData, const char *name, const char **atts UNUSED) { struct xml_ctx *ctx = (struct xml_ctx *)userData; const char *c = strchr(name, ':'); From patchwork Mon Jul 3 06:44:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299624 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 26021EB64DC for ; Mon, 3 Jul 2023 06:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbjGCGoS (ORCPT ); Mon, 3 Jul 2023 02:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjGCGoN (ORCPT ); Mon, 3 Jul 2023 02:44:13 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B08A6D2 for ; Sun, 2 Jul 2023 23:44:12 -0700 (PDT) Received: (qmail 14046 invoked by uid 109); 3 Jul 2023 06:44:13 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:13 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2622 invoked by uid 111); 3 Jul 2023 06:44:15 -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, 03 Jul 2023 02:44:15 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:11 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 05/14] am: mark unused keep_cr parameters Message-ID: <20230703064411.GE3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When parsing the input, we have a "keep_cr" parameter to tell us how to handle line endings. But this doesn't apply to stgit or hg patches (which are not mailbox formats where we have to worry about that), so we ignore the parameter entirely in those functions. Let's mark these as unused so that -Wunused-parameter does not complain about them. Note that we could just drop these parameters entirely. They are necessary to conform to the mail_conv_fn interface used by split_mail_conv(), but these two callbacks are the only ones used with that function. The other formats (which _do_ care about keep_cr) use split_mail_mbox(). But it's conceivable that we'd eventually add another format that does care about this option, so let's leave it as part of the generic interface. Signed-off-by: Jeff King --- builtin/am.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index a78daa6971..8451f5e423 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -787,7 +787,7 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state, * A split_mail_conv() callback that converts an StGit patch to an RFC2822 * message suitable for parsing with git-mailinfo. */ -static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr) +static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED) { struct strbuf sb = STRBUF_INIT; int subject_printed = 0; @@ -870,7 +870,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths, * A split_patches_conv() callback that converts a mercurial patch to a RFC2822 * message suitable for parsing with git-mailinfo. */ -static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr) +static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED) { struct strbuf sb = STRBUF_INIT; int rc = 0; From patchwork Mon Jul 3 06:44: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: 13299625 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 4E946C0015E for ; Mon, 3 Jul 2023 06:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230263AbjGCGoU (ORCPT ); Mon, 3 Jul 2023 02:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjGCGoR (ORCPT ); Mon, 3 Jul 2023 02:44:17 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820D9134 for ; Sun, 2 Jul 2023 23:44:15 -0700 (PDT) Received: (qmail 14052 invoked by uid 109); 3 Jul 2023 06:44:15 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:15 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2625 invoked by uid 111); 3 Jul 2023 06:44: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, 03 Jul 2023 02:44:17 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:13 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 06/14] count-objects: mark unused parameter in alternates callback Message-ID: <20230703064413.GF3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Callbacks to for_each_altodb() get a void data pointer, but we don't need it here. Mark it as unused to silence -Wunused-parameter. Signed-off-by: Jeff King --- builtin/count-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/count-objects.c b/builtin/count-objects.c index 97cdfb0ac5..2d4bb5e8d0 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -82,7 +82,7 @@ static int count_cruft(const char *basename UNUSED, const char *path, return 0; } -static int print_alternate(struct object_directory *odb, void *data) +static int print_alternate(struct object_directory *odb, void *data UNUSED) { printf("alternate: "); quote_c_style(odb->path, NULL, stdout, 0); From patchwork Mon Jul 3 06:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299626 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 2518DEB64DD for ; Mon, 3 Jul 2023 06:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbjGCGoZ (ORCPT ); Mon, 3 Jul 2023 02:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjGCGoS (ORCPT ); Mon, 3 Jul 2023 02:44:18 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF320D2 for ; Sun, 2 Jul 2023 23:44:17 -0700 (PDT) Received: (qmail 14058 invoked by uid 109); 3 Jul 2023 06:44:17 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:17 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2628 invoked by uid 111); 3 Jul 2023 06:44: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; Mon, 03 Jul 2023 02:44:20 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:16 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 07/14] revisions: drop unused "opt" parameter in "tweak" callbacks Message-ID: <20230703064416.GG3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The setup_revision_opt struct has a "tweak" function pointer, which can be used to adjust parameters after setup_revisions() parses arguments, but before it finalizes setup. In addition to the rev_info struct, the callback receives a pointer to the setup_revision_opt, as well. But none of the existing callbacks looks at the extra "opt" parameter, leading to -Wunused-parameter warnings. We could mark it as UNUSED, but instead let's remove it entirely. It's conceivable that it could be useful for a callback to have access to the "opt" struct. But in the 13 years that this mechanism has existed, nobody has used it. So let's just drop it in the name of simplifying. Signed-off-by: Jeff King --- builtin/diff-tree.c | 2 +- builtin/log.c | 6 ++---- revision.c | 2 +- revision.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index d62caa6c8b..c9ba35f143 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -99,7 +99,7 @@ static const char diff_tree_usage[] = " --root include the initial commit as diff against /dev/null\n" COMMON_DIFF_OPTIONS_HELP; -static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt) +static void diff_tree_tweak_rev(struct rev_info *rev) { if (!rev->diffopt.output_format) { if (rev->dense_combined_merges) diff --git a/builtin/log.c b/builtin/log.c index 89442dceda..91bc7d967e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -718,8 +718,7 @@ static int show_tree_object(const struct object_id *oid UNUSED, return 0; } -static void show_setup_revisions_tweak(struct rev_info *rev, - struct setup_revision_opt *opt) +static void show_setup_revisions_tweak(struct rev_info *rev) { if (rev->first_parent_only) diff_merges_default_to_first_parent(rev); @@ -862,8 +861,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix) return cmd_log_deinit(cmd_log_walk(&rev), &rev); } -static void log_setup_revisions_tweak(struct rev_info *rev, - struct setup_revision_opt *opt) +static void log_setup_revisions_tweak(struct rev_info *rev) { if (rev->diffopt.flags.default_follow_renames && diff_check_follow_pathspec(&rev->prune_data, 0)) diff --git a/revision.c b/revision.c index 84768565ce..73f8c7e2e0 100644 --- a/revision.c +++ b/revision.c @@ -2955,7 +2955,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s if (!revs->def) revs->def = opt ? opt->def : NULL; if (opt && opt->tweak) - opt->tweak(revs, opt); + opt->tweak(revs); if (revs->show_merge) prepare_show_merge(revs); if (revs->def && !revs->pending.nr && !revs->rev_input_given) { diff --git a/revision.h b/revision.h index 25776af381..18f49565c2 100644 --- a/revision.h +++ b/revision.h @@ -428,7 +428,7 @@ void repo_init_revisions(struct repository *r, */ struct setup_revision_opt { const char *def; - void (*tweak)(struct rev_info *, struct setup_revision_opt *); + void (*tweak)(struct rev_info *); unsigned int assume_dashdash:1, allow_exclude_promisor_objects:1, free_removed_argv_elements:1; From patchwork Mon Jul 3 06:44: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: 13299627 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 4887DEB64DD for ; Mon, 3 Jul 2023 06:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbjGCGo3 (ORCPT ); Mon, 3 Jul 2023 02:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbjGCGoV (ORCPT ); Mon, 3 Jul 2023 02:44:21 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0383A109 for ; Sun, 2 Jul 2023 23:44:19 -0700 (PDT) Received: (qmail 14067 invoked by uid 109); 3 Jul 2023 06:44:20 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:20 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2631 invoked by uid 111); 3 Jul 2023 06:44: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, 03 Jul 2023 02:44:22 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:18 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 08/14] fsck: mark unused parameters in various fsck callbacks Message-ID: <20230703064418.GH3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There are a few callback functions which are used with the fsck code, but it's natural that not all callbacks need all parameters. For reporting, even something as obvious as "the oid of the object which had a problem" is not always used, as some callers are only checking a single object in the first place. And for both reporting and walking, things like void data pointers and the fsck_options aren't always necessary. But since each such parameter is used by _some_ callback, we have to keep them in the interface. Mark the unused ones in specific callbacks to avoid triggering -Wunused-parameter. Signed-off-by: Jeff King --- builtin/fsck.c | 10 +++++----- builtin/index-pack.c | 3 ++- builtin/mktag.c | 8 ++++---- builtin/unpack-objects.c | 3 ++- fsck.c | 4 ++-- object-file.c | 10 +++++----- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index fa26462337..9af71a4e03 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -92,11 +92,11 @@ static int objerror(struct object *obj, const char *err) return -1; } -static int fsck_error_func(struct fsck_options *o, +static int fsck_error_func(struct fsck_options *o UNUSED, const struct object_id *oid, enum object_type object_type, enum fsck_msg_type msg_type, - enum fsck_msg_id msg_id, + enum fsck_msg_id msg_id UNUSED, const char *message) { switch (msg_type) { @@ -121,7 +121,7 @@ static int fsck_error_func(struct fsck_options *o, static struct object_array pending; static int mark_object(struct object *obj, enum object_type type, - void *data, struct fsck_options *options) + void *data, struct fsck_options *options UNUSED) { struct object *parent = data; @@ -206,8 +206,8 @@ static int traverse_reachable(void) return !!result; } -static int mark_used(struct object *obj, enum object_type object_type, - void *data, struct fsck_options *options) +static int mark_used(struct object *obj, int type UNUSED, + void *data UNUSED, struct fsck_options *options UNUSED) { if (!obj) return 1; diff --git a/builtin/index-pack.c b/builtin/index-pack.c index c1250b070f..f6c2f0909d 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -223,7 +223,8 @@ static void cleanup_thread(void) } static int mark_link(struct object *obj, enum object_type type, - void *data, struct fsck_options *options) + void *data UNUSED, + struct fsck_options *options UNUSED) { if (!obj) return -1; diff --git a/builtin/mktag.c b/builtin/mktag.c index 43e2766db4..d8e0b5afc0 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -18,11 +18,11 @@ static int option_strict = 1; static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT; -static int mktag_fsck_error_func(struct fsck_options *o, - const struct object_id *oid, - enum object_type object_type, +static int mktag_fsck_error_func(struct fsck_options *o UNUSED, + const struct object_id *oid UNUSED, + enum object_type object_type UNUSED, enum fsck_msg_type msg_type, - enum fsck_msg_id msg_id, + enum fsck_msg_id msg_id UNUSED, const char *message) { switch (msg_type) { diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 1979532a9d..558b8485ba 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -214,7 +214,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf) * Verify its reachability and validity recursively and write it out. */ static int check_object(struct object *obj, enum object_type type, - void *data, struct fsck_options *options) + void *data UNUSED, + struct fsck_options *options UNUSED) { struct obj_buffer *obj_buf; diff --git a/fsck.c b/fsck.c index a219d6f2c0..feba5239a4 100644 --- a/fsck.c +++ b/fsck.c @@ -1307,9 +1307,9 @@ int fsck_buffer(const struct object_id *oid, enum object_type type, int fsck_error_function(struct fsck_options *o, const struct object_id *oid, - enum object_type object_type, + enum object_type object_type UNUSED, enum fsck_msg_type msg_type, - enum fsck_msg_id msg_id, + enum fsck_msg_id msg_id UNUSED, const char *message) { if (msg_type == FSCK_WARN) { diff --git a/object-file.c b/object-file.c index 8d87720dd5..68a2397e33 100644 --- a/object-file.c +++ b/object-file.c @@ -2308,11 +2308,11 @@ int repo_has_object_file(struct repository *r, * report the minimal fsck error here, and rely on the caller to * give more context. */ -static int hash_format_check_report(struct fsck_options *opts, - const struct object_id *oid, - enum object_type object_type, - enum fsck_msg_type msg_type, - enum fsck_msg_id msg_id, +static int hash_format_check_report(struct fsck_options *opts UNUSED, + const struct object_id *oid UNUSED, + enum object_type object_type UNUSED, + enum fsck_msg_type msg_type UNUSED, + enum fsck_msg_id msg_id UNUSED, const char *message) { error(_("object fails fsck: %s"), message); From patchwork Mon Jul 3 06:44:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13299628 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 62D15EB64DD for ; Mon, 3 Jul 2023 06:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbjGCGob (ORCPT ); Mon, 3 Jul 2023 02:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbjGCGoY (ORCPT ); Mon, 3 Jul 2023 02:44:24 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DA51B4 for ; Sun, 2 Jul 2023 23:44:22 -0700 (PDT) Received: (qmail 14075 invoked by uid 109); 3 Jul 2023 06:44:23 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:23 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2634 invoked by uid 111); 3 Jul 2023 06: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; Mon, 03 Jul 2023 02:44:25 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:21 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 09/14] merge-tree: mark unused parameter in traverse callback Message-ID: <20230703064421.GI3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Our threeway_callback() does not bother to look at its "n" parameter. It is static in this file and used only by trivial_merge_trees(), which always passes 3 trees (hence the name "threeway"). It also does not look at "dirmask". This is OK, as it handles directories specifically by looking at the mode bits. Other traverse_info callbacks need these, so we can't get drop them from the interface. But let's annotate these ones to avoid complaints from -Wunused-parameter. Signed-off-by: Jeff King --- builtin/merge-tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 6f7db436d2..0de42aecf4 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -324,7 +324,9 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3]) * The successful merge rules are the same as for the three-way merge * in git-read-tree. */ -static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info) +static int threeway_callback(int n UNUSED, unsigned long mask, + unsigned long dirmask UNUSED, + struct name_entry *entry, struct traverse_info *info) { /* Same in both? */ if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) { From patchwork Mon Jul 3 06:44: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: 13299629 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 0556DEB64DC for ; Mon, 3 Jul 2023 06:44:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230274AbjGCGol (ORCPT ); Mon, 3 Jul 2023 02:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjGCGo2 (ORCPT ); Mon, 3 Jul 2023 02:44:28 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569E9E8 for ; Sun, 2 Jul 2023 23:44:27 -0700 (PDT) Received: (qmail 14091 invoked by uid 109); 3 Jul 2023 06:44:27 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:27 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2637 invoked by uid 111); 3 Jul 2023 06:44: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; Mon, 03 Jul 2023 02:44:30 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:25 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 10/14] replace: mark unused parameter in ref callback Message-ID: <20230703064425.GJ3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We don't look at the "flags" parameter, which is natural for something that is just printing the contents of the replace refs. But let's mark it to appease -Wunused-parameter. This probably should have been part of 63e14ee2d6 (refs: mark unused each_ref_fn parameters, 2022-08-19), but I missed it as this one is a repo_each_ref_fn, which takes an extra repository argument. Signed-off-by: Jeff King --- builtin/replace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/replace.c b/builtin/replace.c index 9ceaa25233..17b75229d2 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -49,7 +49,7 @@ struct show_data { static int show_reference(struct repository *r, const char *refname, const struct object_id *oid, - int flag, void *cb_data) + int flag UNUSED, void *cb_data) { struct show_data *data = cb_data; From patchwork Mon Jul 3 06:44: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: 13299630 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 1FC16C0015E for ; Mon, 3 Jul 2023 06:44:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbjGCGom (ORCPT ); Mon, 3 Jul 2023 02:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbjGCGob (ORCPT ); Mon, 3 Jul 2023 02:44:31 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 446741B4 for ; Sun, 2 Jul 2023 23:44:30 -0700 (PDT) Received: (qmail 14099 invoked by uid 109); 3 Jul 2023 06:44:30 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:30 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2640 invoked by uid 111); 3 Jul 2023 06:44:32 -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, 03 Jul 2023 02:44:32 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:28 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 11/14] replace: mark unused parameter in each_mergetag_fn callback Message-ID: <20230703064428.GK3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We don't look at the "commit" parameter to our callback, as our "mergetag_data" pointer contains the original name "ref", which we use instead. But we can't get rid of it, since other for_each_mergetag callbacks do use it. Let's mark the parameter to avoid -Wunused-parameter warnings. Signed-off-by: Jeff King --- builtin/replace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/replace.c b/builtin/replace.c index 17b75229d2..da59600ad2 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -409,7 +409,7 @@ struct check_mergetag_data { const char **argv; }; -static int check_one_mergetag(struct commit *commit, +static int check_one_mergetag(struct commit *commit UNUSED, struct commit_extra_header *extra, void *data) { From patchwork Mon Jul 3 06:44: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: 13299631 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 B7884EB64DD for ; Mon, 3 Jul 2023 06:44:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjGCGon (ORCPT ); Mon, 3 Jul 2023 02:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbjGCGog (ORCPT ); Mon, 3 Jul 2023 02:44:36 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E911E41 for ; Sun, 2 Jul 2023 23:44:32 -0700 (PDT) Received: (qmail 14105 invoked by uid 109); 3 Jul 2023 06:44:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2643 invoked by uid 111); 3 Jul 2023 06:44:35 -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, 03 Jul 2023 02:44:35 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:31 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 12/14] rev-parse: mark unused parameter in for_each_abbrev callback Message-ID: <20230703064431.GL3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We don't need to use the "data" parameter in this instance. Let's mark it to avoid -Wunused-parameter warnings. Signed-off-by: Jeff King --- builtin/rev-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 3e2ee44177..075e2c5aa4 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -226,7 +226,7 @@ static int anti_reference(const char *refname, const struct object_id *oid, return 0; } -static int show_abbrev(const struct object_id *oid, void *cb_data) +static int show_abbrev(const struct object_id *oid, void *cb_data UNUSED) { show_rev(NORMAL, oid, NULL); return 0; From patchwork Mon Jul 3 06:44: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: 13299632 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 433A8EB64DC for ; Mon, 3 Jul 2023 06:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjGCGon (ORCPT ); Mon, 3 Jul 2023 02:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjGCGoh (ORCPT ); Mon, 3 Jul 2023 02:44:37 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C36E55 for ; Sun, 2 Jul 2023 23:44:34 -0700 (PDT) Received: (qmail 14111 invoked by uid 109); 3 Jul 2023 06:44:35 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:35 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2646 invoked by uid 111); 3 Jul 2023 06:44: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, 03 Jul 2023 02:44:37 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:33 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 13/14] tag: mark unused parameters in each_tag_name_fn callbacks Message-ID: <20230703064433.GM3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We iterate over the set of input tag names using callbacks. But not all operations need the same inputs, so some parameters go unused (but of course not the same ones for each operation). Mark the unused ones to avoid -Wunused-parameter warnings. Signed-off-by: Jeff King --- builtin/tag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index e63bee8eab..81ca3fa19a 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -121,7 +121,7 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn, return had_error; } -static int collect_tags(const char *name, const char *ref, +static int collect_tags(const char *name UNUSED, const char *ref, const struct object_id *oid, void *cb_data) { struct string_list *ref_list = cb_data; @@ -155,7 +155,7 @@ static int delete_tags(const char **argv) return result; } -static int verify_tag(const char *name, const char *ref, +static int verify_tag(const char *name, const char *ref UNUSED, const struct object_id *oid, void *cb_data) { int flags; From patchwork Mon Jul 3 06:44: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: 13299633 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 728DDEB64DC for ; Mon, 3 Jul 2023 06:44:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbjGCGot (ORCPT ); Mon, 3 Jul 2023 02:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjGCGoi (ORCPT ); Mon, 3 Jul 2023 02:44:38 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBBC5D3 for ; Sun, 2 Jul 2023 23:44:37 -0700 (PDT) Received: (qmail 14121 invoked by uid 109); 3 Jul 2023 06:44:38 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 03 Jul 2023 06:44:38 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2649 invoked by uid 111); 3 Jul 2023 06:44: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; Mon, 03 Jul 2023 02:44:40 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 3 Jul 2023 02:44:36 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 14/14] t/helper: mark unused callback void data parameters Message-ID: <20230703064436.GN3537614@coredump.intra.peff.net> References: <20230703064347.GA3524892@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Many callback interfaces have an extra void data parameter, but we don't always need it (especially for dumping functions like the ones in test helpers). Mark them as unused to avoid -Wunused-parameter warnings. Signed-off-by: Jeff King --- t/helper/test-dump-split-index.c | 2 +- t/helper/test-oid-array.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c index 5cf0b26dca..f29d18ef94 100644 --- a/t/helper/test-dump-split-index.c +++ b/t/helper/test-dump-split-index.c @@ -7,7 +7,7 @@ #include "split-index.h" #include "ewah/ewok.h" -static void show_bit(size_t pos, void *data) +static void show_bit(size_t pos, void *data UNUSED) { printf(" %d", (int)pos); } diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c index eef68833b7..aafe398ef0 100644 --- a/t/helper/test-oid-array.c +++ b/t/helper/test-oid-array.c @@ -4,7 +4,7 @@ #include "setup.h" #include "strbuf.h" -static int print_oid(const struct object_id *oid, void *data) +static int print_oid(const struct object_id *oid, void *data UNUSED) { puts(oid_to_hex(oid)); return 0;