From patchwork Sat Aug 17 08:21:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767047 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7636B13D2BB for ; Sat, 17 Aug 2024 08:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882892; cv=none; b=KyiWGpNx7y+qeQ9tz+er6BtAXfEu3cTH9uYTFFs5oYs0e3NY+ZH5JxYioq/YsnDH5p4H333F8rfzKWDFCmSmYnpeUETxvco/Cn3Ukrm0uRXeyumn/PsITfJs+ZPma/mjODiEV5ye3gar4lxl4oN2zg2wMsZcAJ8pUOCNj3UgraA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882892; c=relaxed/simple; bh=Q+Dgufsx3wduSWkFtV0HF6ozt9Zhy4eUHvfoyEzUGpo=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MnfTMkTV6bJHKcBNOmCGILPOOZ8moXGhJczKTuOjOATfXTGPzHUA2Wc/QY2WtzXaNYFOfTAueei5ur2SSpaoIlU2qeX1CjW4kLNcS4p2oB0jwN2T0x7vMnFqr5qQzRtqXxt/IIOHwZDXFKOHGXGuanQYc2G/rpm0IxjbVfskEGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24670 invoked by uid 109); 17 Aug 2024 08:21:28 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:21:28 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27929 invoked by uid 111); 17 Aug 2024 08:21:33 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:21:33 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:21:27 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 01/15] imap-send: mark unused parameter in ssl_socket_connect() fallback Message-ID: <20240817082127.GA10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> Commit cea1ff7f1f (imap-send: drop global `imap_server_conf` variable, 2024-06-07) added an imap_server_conf parameter to several functions. But when compiled with NO_OPENSSL, the ssl_socket_connect() fallback just returns immediately, so its parameters all need to be annotated to avoid triggering -Wunused-parameter. Signed-off-by: Jeff King --- imap-send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imap-send.c b/imap-send.c index 01404e5047..3551908de6 100644 --- a/imap-send.c +++ b/imap-send.c @@ -190,7 +190,7 @@ static void socket_perror(const char *func, struct imap_socket *sock, int ret) #ifdef NO_OPENSSL static int ssl_socket_connect(struct imap_socket *sock UNUSED, - const struct imap_server_conf *cfg, + const struct imap_server_conf *cfg UNUSED, int use_tls_only UNUSED) { fprintf(stderr, "SSL requested but SSL support not compiled in\n"); From patchwork Sat Aug 17 08:21:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767048 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A4BC12FB37 for ; Sat, 17 Aug 2024 08:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882922; cv=none; b=kTyfSveo4UuDst6LTRawuIKnuDbg6XOhAtUetX/Cgr+TEJGqfgUZdsA45fbqgN2QQYNuxY4yE17gSxBjGdl7WtdatSpWZLRjqOelVfwMSNdvGp9YsuuX8oHVHFXC3Ie+b0sesogaIVc9aXLbrGkrKNdEOTo4f3uEXXR6A17J/Gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882922; c=relaxed/simple; bh=0NqesQBTTLSv5taP0t+lulgewfFLps+O6yP/E/I/mf8=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WwJab9O3RuVKm+yb0CvdRnaW1aSyWdV3DkeWLUwXlBtwlvErf7BIsX4H8NUHXV2aarVi5yWUzWdcyIuhv2Qxv5/vu5j2U3wv71l1a+tT2TCxKhvhrlCiPT1Uo1BKkOJ/Z/i9LgmoXpK0cCGXc3cdY67lxV4pzkWpKUcJQYT7hCg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24679 invoked by uid 109); 17 Aug 2024 08:21:58 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:21:58 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27935 invoked by uid 111); 17 Aug 2024 08:22:02 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:22:02 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:21:57 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 02/15] update-ref: mark more unused parameters in parser callbacks Message-ID: <20240817082157.GB10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> This is a continuation of 44ad082968 (update-ref: mark unused parameter in parser callbacks, 2023-08-29), as we've grown a few more virtual functions since then. Signed-off-by: Jeff King --- builtin/update-ref.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 6a6a2ff55d..8f31da9a4b 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -274,7 +274,7 @@ static void parse_cmd_update(struct ref_transaction *transaction, } static void parse_cmd_symref_update(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { char *refname, *new_target, *old_arg; char *old_target = NULL; @@ -360,7 +360,7 @@ static void parse_cmd_create(struct ref_transaction *transaction, static void parse_cmd_symref_create(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf err = STRBUF_INIT; char *refname, *new_target; @@ -423,7 +423,7 @@ static void parse_cmd_delete(struct ref_transaction *transaction, static void parse_cmd_symref_delete(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf err = STRBUF_INIT; char *refname, *old_target; @@ -479,7 +479,7 @@ static void parse_cmd_verify(struct ref_transaction *transaction, } static void parse_cmd_symref_verify(struct ref_transaction *transaction, - const char *next, const char *end) + const char *next, const char *end UNUSED) { struct strbuf err = STRBUF_INIT; struct object_id old_oid; From patchwork Sat Aug 17 08:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767049 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60DD12FB37 for ; Sat, 17 Aug 2024 08:22:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882929; cv=none; b=uc94dBzoOn/hSn+3Uf9H58p6hvj9DjnyUBuQ5X+LDrfSTXdIsVjSuzMlf5srAq4nstNhcWOW034AJjmyobInJ9q0ruDnt9vd+4DzKqZwIXKU+kLegMQ571+lLMxA7+hHtY9UC+EzCi52UyaCDIix810kwuNirK/dCYOAh5bjOhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882929; c=relaxed/simple; bh=HDM8Gr27BOIroCbJaHqBmHiEQYBADP+vm00l62abY0s=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qVV2A17DND5+a8MlCem63DXCupH6Pbmu5BtDmbLm8iruOmX40YfLQAfElH5wzIKyRM7wX2GoWNdAgyM53LLrI+0Fxf232zKVIoyL40uXekAFBZ39BR3ZZOl8udi828F8UpXJ2+HRoVnTZrWMVvdXEPc/2dU6rZKjH/l4YX9RKrs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24682 invoked by uid 109); 17 Aug 2024 08:22:06 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:22:06 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27938 invoked by uid 111); 17 Aug 2024 08:22:10 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:22:10 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:22:05 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 03/15] refs: mark unused parameters in ref_store fsck callbacks Message-ID: <20240817082205.GC10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> Commit ab6f79d8df (refs: set up ref consistency check infrastructure, 2024-08-08) added virtual functions to the ref store for doing fsck checks. But the packed and reftable backends do not yet do anything. Let's annotate them to silence -Wunused-parameter. Signed-off-by: Jeff King --- refs/packed-backend.c | 4 ++-- refs/reftable-backend.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/packed-backend.c b/refs/packed-backend.c index f00106df14..afd292ec6a 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -1733,8 +1733,8 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s return empty_ref_iterator_begin(); } -static int packed_fsck(struct ref_store *ref_store, - struct fsck_options *o) +static int packed_fsck(struct ref_store *ref_store UNUSED, + struct fsck_options *o UNUSED) { return 0; } diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 8b7ffbf66f..7337d4422d 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -2309,8 +2309,8 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store, return ret; } -static int reftable_be_fsck(struct ref_store *ref_store, - struct fsck_options *o) +static int reftable_be_fsck(struct ref_store *ref_store UNUSED, + struct fsck_options *o UNUSED) { return 0; } From patchwork Sat Aug 17 08:22:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767050 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF18712FB37 for ; Sat, 17 Aug 2024 08:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882946; cv=none; b=KS9UxIOVsniOND23XlKHDzKuoEbQ0C9WspRrt0D0G+0AmVqK38LUvhT27tq04Zy1U0OKiq8+ULyyAfGFFocagOjDH7LKzWnHer1Vk/bhqyZR1Yhvie0uEibRqxgwI0j8Uez0iZt6YUNXgAyLbVbccDuO8W8YWt6WaEBa6WZVOpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882946; c=relaxed/simple; bh=bT1Q/yoNzwMVG4uBHGXHgjmUee4G59zWxiNumrk9P6I=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t/3H+W0IpU4RkX0XdYERUS3afg6GXts9EI2vc9XGuDCWLCo2u3WLY2MmxUoyAaDBD650vJ/xxY+STG7ojPJHMu3pyEuex7PpKlrwakwosogfjaGM5KgbZ8O2sPSXB6ks5iRMOFw/ntlVu4IwpD4nJ1ABVnRoszVK8FLvLdkewTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24685 invoked by uid 109); 17 Aug 2024 08:22:24 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:22:24 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27941 invoked by uid 111); 17 Aug 2024 08:22:28 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:22:28 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:22:22 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 04/15] refs: mark unused parameters in do_for_each_reflog_helper() Message-ID: <20240817082222.GD10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> This is an each_ref_fn callback, so it has to match that interface. We marked most of these in 63e14ee2d6 (refs: mark unused each_ref_fn parameters, 2022-08-19), but in this case: - this function was created in 31f898397b (refs: drop unused params from the reflog iterator callback, 2024-02-21), and most of the arguments were correctly mark as UNUSED, but "flags" was missed. - commit e8207717f1 (refs: add referent to each_ref_fn, 2024-08-09) added a new argument to the each_ref_fn callback. In most callbacks it added an UNUSED annotation, but it missed one case. Signed-off-by: Jeff King --- refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 74de3d3009..584674520e 100644 --- a/refs.c +++ b/refs.c @@ -2390,9 +2390,10 @@ struct do_for_each_reflog_help { void *cb_data; }; -static int do_for_each_reflog_helper(const char *refname, const char *referent, +static int do_for_each_reflog_helper(const char *refname, + const char *referent UNUSED, const struct object_id *oid UNUSED, - int flags, + int flags UNUSED, void *cb_data) { struct do_for_each_reflog_help *hp = cb_data; From patchwork Sat Aug 17 08:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767051 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C848112FB37 for ; Sat, 17 Aug 2024 08:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882962; cv=none; b=YARudx4fR8jztXOwDMMUxtFRJsH1LcFTsBRnCNIJR0Ao72qH6ae46sUfjHlI48Hqcf28YQ7dOBpx2abV4Ig1QszM1/78j10jBKUVl4DCAtZ9dFf3kd9wJCgbsBflKk7erFqQwX0FpE+VN7e3PlwLCZBhtUq7U+gcb0EUjk98HDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882962; c=relaxed/simple; bh=8tHk3w//YoBkGXXwneucMawJXlJYMMyHGODCmkaL6D4=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JmD0lZWHUyTCPePW2S0G/qanqGbvz2K4C3vGCPo2orCySTYui7htSzxh09pOAg14RY8IVLh/qb8AF4MnjfwjIBfEdVbDVwjc4CqwJcsM1sr4209jqu4uLAWOCdLoekF8B3TBjRz08UzZ4QqHnWQntFxDckeSuqN0SQ3z1zJ8fJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24690 invoked by uid 109); 17 Aug 2024 08:22:40 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:22:40 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27947 invoked by uid 111); 17 Aug 2024 08:22:44 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:22:44 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:22:38 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 05/15] oss-fuzz: mark unused argv/argc argument Message-ID: <20240817082238.GE10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> The dummy fuzz cmd_main() does not look at its argc/argv parameters (since it should never even be run), but has to match the usual cmd_main() declaration. Mark them to silence -Wunused-parameter. Signed-off-by: Jeff King --- oss-fuzz/dummy-cmd-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oss-fuzz/dummy-cmd-main.c b/oss-fuzz/dummy-cmd-main.c index 071cb231ba..8ef776d06f 100644 --- a/oss-fuzz/dummy-cmd-main.c +++ b/oss-fuzz/dummy-cmd-main.c @@ -8,7 +8,7 @@ * executed. */ -int cmd_main(int argc, const char **argv) { +int cmd_main(int argc UNUSED, const char **argv UNUSED) { BUG("We should not execute cmd_main() from a fuzz target"); return 1; } From patchwork Sat Aug 17 08:22:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767052 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CB6F1422B8 for ; Sat, 17 Aug 2024 08:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882975; cv=none; b=Nm3sK+EQB1cusVk2+xsYTTziAmhd/ADdWPP8p0C/g8HeToYhZ+At4KU8G9S832ZFqzdHWqB5Ukl0k56rKF8wYiUktS5w95EqI7KSToqCQcgAgwbUpz9m8hwUGcaOCWHrA7biME/jUgWZr4lGjk1IYrcroANPyR/4cWupDgWhPJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882975; c=relaxed/simple; bh=Dqj3VjE3svxQw7vTnndn95/G/Kr+OXOpN4+6EIFIbaE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kwwSra+5R1nCpa3jKBVO7CXbkTdmXz0sVIJmXAsJqgq+jT/2RHlk4bzxL1OOlA7Yv9xD7Lo4cb6YNDJm6s3kyHlZsJlcTvYJVchSME7ckl0uolKWl6xgPDQTy4gIvIYVcp9LRexpxcx0mBIBsDA0MMLC9TOGSRI2yQ1SsP6X6HA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24695 invoked by uid 109); 17 Aug 2024 08:22:53 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:22:53 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27950 invoked by uid 111); 17 Aug 2024 08:22:57 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:22:57 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:22:52 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 06/15] t/helper: mark more unused argv/argc arguments Message-ID: <20240817082252.GF10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> This is a continuation of 126e3b3d2a (t/helper: mark unused argv/argc arguments, 2023-03-28) to cover a few new cases: - test-example-tap was added since that commit - test-hashmap used to accept the "ignorecase" argument on the command line. But since most of its logic was moved to a unit-test in 3469a23659 (t: port helper/test-hashmap.c to unit-tests/t-hashmap.c, 2024-08-03), it now ignores its argv entirely. Signed-off-by: Jeff King --- t/helper/test-example-tap.c | 2 +- t/helper/test-hashmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/helper/test-example-tap.c b/t/helper/test-example-tap.c index d072ad559f..f35667bd29 100644 --- a/t/helper/test-example-tap.c +++ b/t/helper/test-example-tap.c @@ -70,7 +70,7 @@ static void t_empty(void) ; /* empty */ } -int cmd__example_tap(int argc, const char **argv) +int cmd__example_tap(int argc UNUSED, const char **argv UNUSED) { test_res = TEST(check_res = check_int(1, ==, 1), "passing test"); TEST(t_res(1), "passing test and assertion return 1"); diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c index 195e6278be..7782ae585e 100644 --- a/t/helper/test-hashmap.c +++ b/t/helper/test-hashmap.c @@ -138,7 +138,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) * * perfhashmap method rounds -> test hashmap.[ch] performance */ -int cmd__hashmap(int argc, const char **argv) +int cmd__hashmap(int argc UNUSED, const char **argv UNUSED) { struct string_list parts = STRING_LIST_INIT_NODUP; struct strbuf line = STRBUF_INIT; From patchwork Sat Aug 17 08:23:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767053 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D726512FB37 for ; Sat, 17 Aug 2024 08:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882993; cv=none; b=OYOGXxCwubCKVJJyyv0Af7nyHN9VB7De8mN1Wcf77njrKkGSvCxUwnMcQlKlhKBhrA9oN2xE5pa4wJVgHMkXf64vGKAiMnsere4K7FPnO9CzuFTrkORzvcf1pzgzzoxrDZVFrw0dMUIlqgd06hI8YX/mF9PqfZMPLPXeLsUntwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723882993; c=relaxed/simple; bh=ywOn7EbP0IVt1EsP/x6DX0G5TezlszCYiYkS7bJz84Y=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RUBPo1avPvmCboybYZEzrwx9zBod12INU80Zk3vDQJc1lj9suEdpZFs4bTl69OWffvolcpNHoYj5oUy6IlnGLM40HpEVbOHT16vDHbyHGWYb9l67Pqauoyuv+Z0NyHUWu9vY+36NJKHWM54OS49EMdpps8+YluEPnux+uQzr+2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24702 invoked by uid 109); 17 Aug 2024 08:23:10 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:23:10 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27953 invoked by uid 111); 17 Aug 2024 08:23:14 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:23:14 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:23:09 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 07/15] unit-tests: ignore unused argc/argv Message-ID: <20240817082309.GG10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> All of the unit test programs have their own cmd_main() function, but none of them actually look at the argc/argv that is passed in. In the long run we may want them to handle options for the test harness. But we'd probably do that with a shared harness cmd_main(), dispatching to the individual tests. In the meantime, let's annotate the unused parameters to avoid triggering -Wunused-parameter. Signed-off-by: Jeff King --- t/unit-tests/t-ctype.c | 2 +- t/unit-tests/t-hash.c | 2 +- t/unit-tests/t-mem-pool.c | 2 +- t/unit-tests/t-prio-queue.c | 2 +- t/unit-tests/t-reftable-basics.c | 2 +- t/unit-tests/t-reftable-merged.c | 2 +- t/unit-tests/t-reftable-pq.c | 2 +- t/unit-tests/t-reftable-record.c | 2 +- t/unit-tests/t-reftable-tree.c | 2 +- t/unit-tests/t-strbuf.c | 2 +- t/unit-tests/t-strcmp-offset.c | 2 +- t/unit-tests/t-strvec.c | 2 +- t/unit-tests/t-trailer.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/t/unit-tests/t-ctype.c b/t/unit-tests/t-ctype.c index d6ac1fe678..24cc566cfe 100644 --- a/t/unit-tests/t-ctype.c +++ b/t/unit-tests/t-ctype.c @@ -33,7 +33,7 @@ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \ "\x7f" -int cmd_main(int argc, const char **argv) { +int cmd_main(int argc UNUSED, const char **argv UNUSED) { TEST_CHAR_CLASS(isspace, " \n\r\t"); TEST_CHAR_CLASS(isdigit, DIGIT); TEST_CHAR_CLASS(isalpha, LOWER UPPER); diff --git a/t/unit-tests/t-hash.c b/t/unit-tests/t-hash.c index e9a78bf2c0..e62647019b 100644 --- a/t/unit-tests/t-hash.c +++ b/t/unit-tests/t-hash.c @@ -38,7 +38,7 @@ static void check_hash_data(const void *data, size_t data_length, "SHA1 and SHA256 (%s) works", #literal); \ } while (0) -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { struct strbuf aaaaaaaaaa_100000 = STRBUF_INIT; struct strbuf alphabet_100000 = STRBUF_INIT; diff --git a/t/unit-tests/t-mem-pool.c b/t/unit-tests/t-mem-pool.c index a0d57df761..fe500c704b 100644 --- a/t/unit-tests/t-mem-pool.c +++ b/t/unit-tests/t-mem-pool.c @@ -20,7 +20,7 @@ static void t_calloc_100(struct mem_pool *pool) check(pool->mp_block->end != NULL); } -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { TEST(setup_static(t_calloc_100, 1024 * 1024), "mem_pool_calloc returns 100 zeroed bytes with big block"); diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c index 7a4e5780e1..fe6ae37935 100644 --- a/t/unit-tests/t-prio-queue.c +++ b/t/unit-tests/t-prio-queue.c @@ -69,7 +69,7 @@ static void test_prio_queue(int *input, size_t input_size, #define TEST_INPUT(input, result) \ test_prio_queue(input, ARRAY_SIZE(input), result, ARRAY_SIZE(result)) -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { TEST(TEST_INPUT(((int []){ 2, 6, 3, 10, 9, 5, 7, 4, 5, 8, 1, DUMP }), ((int []){ 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10 })), diff --git a/t/unit-tests/t-reftable-basics.c b/t/unit-tests/t-reftable-basics.c index 4e80bdf16d..7ffee74dca 100644 --- a/t/unit-tests/t-reftable-basics.c +++ b/t/unit-tests/t-reftable-basics.c @@ -145,7 +145,7 @@ static void test_u16_roundtrip(void) check_int(in, ==, out); } -int cmd_main(int argc, const char *argv[]) +int cmd_main(int argc UNUSED, const char *argv[] UNUSED) { TEST(test_common_prefix(), "common_prefix_size works"); TEST(test_parse_names_normal(), "parse_names works for basic input"); diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c index b6263ee8b5..2d65d5c3cb 100644 --- a/t/unit-tests/t-reftable-merged.c +++ b/t/unit-tests/t-reftable-merged.c @@ -452,7 +452,7 @@ static void t_default_write_opts(void) } -int cmd_main(int argc, const char *argv[]) +int cmd_main(int argc UNUSED, const char *argv[] UNUSED) { TEST(t_default_write_opts(), "merged table with default write opts"); TEST(t_merged_logs(), "merged table with multiple log updates for same ref"); diff --git a/t/unit-tests/t-reftable-pq.c b/t/unit-tests/t-reftable-pq.c index 039bd0f1f9..ada4c19f18 100644 --- a/t/unit-tests/t-reftable-pq.c +++ b/t/unit-tests/t-reftable-pq.c @@ -142,7 +142,7 @@ static void t_merged_iter_pqueue_top(void) merged_iter_pqueue_release(&pq); } -int cmd_main(int argc, const char *argv[]) +int cmd_main(int argc UNUSED, const char *argv[] UNUSED) { TEST(t_pq_record(), "pq works with record-based comparison"); TEST(t_pq_index(), "pq works with index-based comparison"); diff --git a/t/unit-tests/t-reftable-record.c b/t/unit-tests/t-reftable-record.c index cb649ee419..a7f67d4d9f 100644 --- a/t/unit-tests/t-reftable-record.c +++ b/t/unit-tests/t-reftable-record.c @@ -532,7 +532,7 @@ static void t_reftable_index_record_roundtrip(void) strbuf_release(&in.u.idx.last_key); } -int cmd_main(int argc, const char *argv[]) +int cmd_main(int argc UNUSED, const char *argv[] UNUSED) { TEST(t_reftable_ref_record_comparison(), "comparison operations work on ref record"); TEST(t_reftable_log_record_comparison(), "comparison operations work on log record"); diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c index e7d774d774..700479d34b 100644 --- a/t/unit-tests/t-reftable-tree.c +++ b/t/unit-tests/t-reftable-tree.c @@ -75,7 +75,7 @@ static void t_infix_walk(void) tree_free(root); } -int cmd_main(int argc, const char *argv[]) +int cmd_main(int argc UNUSED, const char *argv[] UNUSED) { TEST(t_tree_search(), "tree_search works"); TEST(t_infix_walk(), "infix_walk works"); diff --git a/t/unit-tests/t-strbuf.c b/t/unit-tests/t-strbuf.c index 6027dafef7..3f4044d697 100644 --- a/t/unit-tests/t-strbuf.c +++ b/t/unit-tests/t-strbuf.c @@ -105,7 +105,7 @@ static void t_addstr(struct strbuf *buf, const void *data) check_str(buf->buf + orig_len, text); } -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { if (!TEST(t_static_init(), "static initialization works")) test_skip_all("STRBUF_INIT is broken"); diff --git a/t/unit-tests/t-strcmp-offset.c b/t/unit-tests/t-strcmp-offset.c index fe4c2706b1..6880f21161 100644 --- a/t/unit-tests/t-strcmp-offset.c +++ b/t/unit-tests/t-strcmp-offset.c @@ -24,7 +24,7 @@ static void check_strcmp_offset(const char *string1, const char *string2, expect_offset), \ "strcmp_offset(%s, %s) works", #string1, #string2) -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { TEST_STRCMP_OFFSET("abc", "abc", 0, 3); TEST_STRCMP_OFFSET("abc", "def", -1, 0); diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c index fa1a041469..c3b610dda7 100644 --- a/t/unit-tests/t-strvec.c +++ b/t/unit-tests/t-strvec.c @@ -227,7 +227,7 @@ static void t_detach(void) free(detached); } -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { TEST(t_static_init(), "static initialization"); TEST(t_dynamic_init(), "dynamic initialization"); diff --git a/t/unit-tests/t-trailer.c b/t/unit-tests/t-trailer.c index 2ecca359d9..e1c6ad7461 100644 --- a/t/unit-tests/t-trailer.c +++ b/t/unit-tests/t-trailer.c @@ -308,7 +308,7 @@ static void run_t_trailer_iterator(void) } } -int cmd_main(int argc, const char **argv) +int cmd_main(int argc UNUSED, const char **argv UNUSED) { run_t_trailer_iterator(); return test_done(); From patchwork Sat Aug 17 08:23:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767054 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAD7212FB37 for ; Sat, 17 Aug 2024 08:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883012; cv=none; b=PSHRyAtG43XiAgK1C7R+DrbAEhOtj2eOJogPyGlym1fhdI48EVjwZyuBesuSTt4QUlB8ztHqbkE8QQ7IyQwEtqdBf0Nmjzl6f2Ar3OAYAwcYVnef6YhXr/bsuA94C8yflVZ3dLGpjq3bw4Nzf0VvTDo07Nr92GXV+iOA+fTkUII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883012; c=relaxed/simple; bh=ufWibANIImAKdfpVfk/wGrGZEHwzNQUI2q/p1lF39LU=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WPlIP7U6UZ0RJMyddWVu2/7y4MMlADqmlaCryCIeksPuS5NrGFXpRZ6rccYZ7MbY3jlLMqccDWYTe04o+rY40Z/1cpJvjHzuu9XYSJAkiezFri7IIi9iou6wux8QmR1Wzh0uWlC+NaYALU9f3Ufqc5Vm6Kqbv331xb3PqoLJDkE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24709 invoked by uid 109); 17 Aug 2024 08:23:30 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:23:30 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27956 invoked by uid 111); 17 Aug 2024 08:23:34 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:23:34 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:23:29 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 08/15] reftable: ignore unused argc/argv in test functions Message-ID: <20240817082329.GH10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> There are several reftable test "main" functions that don't look at their argc/argv. They don't technically need to take these parameters, as they are called individually by cmd__reftable(). But it probably makes sense to keep them all consistent for now. In the long run these will probably all get converted to the unit-test framework anyway. Signed-off-by: Jeff King --- reftable/block_test.c | 2 +- reftable/readwrite_test.c | 2 +- reftable/stack_test.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reftable/block_test.c b/reftable/block_test.c index 90aecd5a7c..f8e31d2d3c 100644 --- a/reftable/block_test.c +++ b/reftable/block_test.c @@ -116,7 +116,7 @@ static void test_block_read_write(void) } } -int block_test_main(int argc, const char *argv[]) +int block_test_main(int argc UNUSED, const char *argv[] UNUSED) { RUN_TEST(test_block_read_write); return 0; diff --git a/reftable/readwrite_test.c b/reftable/readwrite_test.c index f411abfe9c..15a113b78a 100644 --- a/reftable/readwrite_test.c +++ b/reftable/readwrite_test.c @@ -951,7 +951,7 @@ static void test_corrupt_table(void) strbuf_release(&buf); } -int readwrite_test_main(int argc, const char *argv[]) +int readwrite_test_main(int argc UNUSED, const char *argv[] UNUSED) { RUN_TEST(test_log_zlib_corruption); RUN_TEST(test_corrupt_table); diff --git a/reftable/stack_test.c b/reftable/stack_test.c index 8c36590ff0..f84b92f312 100644 --- a/reftable/stack_test.c +++ b/reftable/stack_test.c @@ -1084,7 +1084,7 @@ static void test_reftable_stack_compaction_concurrent_clean(void) clear_dir(dir); } -int stack_test_main(int argc, const char *argv[]) +int stack_test_main(int argc UNUSED, const char *argv[] UNUSED) { RUN_TEST(test_empty_add); RUN_TEST(test_read_file); From patchwork Sat Aug 17 08:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767055 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C375B12FB37 for ; Sat, 17 Aug 2024 08:24:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883050; cv=none; b=lF7tBFctaf1OUKUyz4uGXoG5CBZWTxBOzkl8Fic2asa9A+t+39VFZlGMvNedqqaC3Anfk35VI3EIm61M6hVyb/60J1RH4fpk/s8twFDK7Qk+m2reexRiUdS2yg0LVkB5bKxjMeBRra1QyUZ9S9OO8MYZuuSY9YNteh7/sOAGEm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883050; c=relaxed/simple; bh=FL3YHUWGca7oFH6xxI8+ggBTBdB49Oyfv/JipP8T3h4=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E0jlTfLjZsuH+ngHx9TZ32Ktkaj6ipVVVSkjsNW12/u+F2/RQosSFfYEuDV/HsQukpIZwL2k2YjR0Gi5WkbAEottbmdrxKmc26Dd4YHhVCE271RR6bY6zuYM/hq6a+XVPKT2V5hoIDG4QgNc+Y4dLKKaGULK+YF4BR/PswhKTsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24720 invoked by uid 109); 17 Aug 2024 08:24:08 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:24:07 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27960 invoked by uid 111); 17 Aug 2024 08:24:11 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:24:11 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:24:06 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 09/15] reftable: drop obsolete test function declarations Message-ID: <20240817082406.GI10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> These functions were moved to the unit test framework in ba9661b457 (t: move reftable/record_test.c to the unit testing framework, 2024-07-02) and b34116a30c (t: move reftable/basics_test.c to the unit testing framework, 2024-05-29). The declarations in reftable-tests.h are leftover cruft. Signed-off-by: Jeff King --- OK, I lied in the cover letter, this one isn't just adding UNUSED. But hopefully it is also obviously correct. ;) reftable/reftable-tests.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h index 4b666810af..941e5dd011 100644 --- a/reftable/reftable-tests.h +++ b/reftable/reftable-tests.h @@ -9,9 +9,7 @@ license that can be found in the LICENSE file or at #ifndef REFTABLE_TESTS_H #define REFTABLE_TESTS_H -int basics_test_main(int argc, const char **argv); int block_test_main(int argc, const char **argv); -int record_test_main(int argc, const char **argv); int readwrite_test_main(int argc, const char **argv); int stack_test_main(int argc, const char **argv); int reftable_dump_main(int argc, char *const *argv); From patchwork Sat Aug 17 08:24:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767056 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2255713BC35 for ; Sat, 17 Aug 2024 08:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883079; cv=none; b=K6mRxw4qaao2Pj/MqmQzK7gCxnlP9RmCQdaaEB9KxP7gCJqNgwsrPwd5ry2VueWfLWqaR2CHI3ATbkGNUv7q615w8NvGBKwF7+h9x2e+3gVqnG+T6GEisuH2A6nWyzSQX/oBsNdRVW4rjJF+pfXqYaOgNRJssq/6y9U8HVmd/bo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883079; c=relaxed/simple; bh=bx6HS0MPCl2YlgxveJahqeTPele9DDP1TRb+Aj6sqFg=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QhPVfIiZDvdqcDKbGv88fxidhajcVAqEcrliOjKoMQU+WQEttwjmvVLUzBCT3lRH08jZIvPhcfTn22HUzo3R+eLK6TeQMqtAXuLKEJB53e8iH0k4DosfWb3aWZkmGiNZBe1CM+I2ipbYl1e84oqnQS6oW45t4xrxApMpViIT6gM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24731 invoked by uid 109); 17 Aug 2024 08:24:37 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:24:37 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27963 invoked by uid 111); 17 Aug 2024 08:24:41 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:24:41 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:24:36 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 10/15] reftable: mark unused parameters in virtual functions Message-ID: <20240817082436.GJ10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> The reftable code uses a lot of virtual function pointers, but many of the concrete implementations do not need all of the parameters. For the most part these are obviously fine to just mark as UNUSED (e.g., the empty_iterator functions unsurprisingly do not do anything). Here are a few cases where I dug a little deeper (but still ended up just marking them UNUSED): - the iterator exclude_patterns is best-effort and optional (though it would be nice to support in the long run as an optimization) - ignoring the ref_store in many transaction functions is unexpected, but works because the ref_transaction itself carries enough information to do what we need. - ignoring "err" for in some cases (e.g., transaction abort) is OK because we do not return any errors. It is a little odd for reftable_be_create_reflog(), though, since we do return errors there. We should perhaps be creating string error messages at this layer, but I've punted on that for now. Signed-off-by: Jeff King --- refs/reftable-backend.c | 14 +++++++------- reftable/blocksource.c | 8 ++++---- reftable/generic.c | 8 +++++--- reftable/iter.c | 3 ++- reftable/record.c | 31 ++++++++++++++++++------------- reftable/stack_test.c | 4 ++-- reftable/test_framework.c | 2 +- reftable/writer.c | 2 +- t/unit-tests/t-reftable-merged.c | 2 +- 9 files changed, 41 insertions(+), 33 deletions(-) diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 7337d4422d..a2de39f2ca 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -614,7 +614,7 @@ static struct reftable_ref_iterator *ref_iterator_for_stack(struct reftable_ref_ static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_store, const char *prefix, - const char **exclude_patterns, + const char **exclude_patterns UNUSED, unsigned int flags) { struct reftable_ref_iterator *main_iter, *worktree_iter; @@ -1123,9 +1123,9 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store, return ret; } -static int reftable_be_transaction_abort(struct ref_store *ref_store, +static int reftable_be_transaction_abort(struct ref_store *ref_store UNUSED, struct ref_transaction *transaction, - struct strbuf *err) + struct strbuf *err UNUSED) { struct reftable_transaction_data *tx_data = transaction->backend_data; free_transaction_data(tx_data); @@ -1315,7 +1315,7 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data return ret; } -static int reftable_be_transaction_finish(struct ref_store *ref_store, +static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED, struct ref_transaction *transaction, struct strbuf *err) { @@ -1726,8 +1726,8 @@ static int reftable_reflog_iterator_advance(struct ref_iterator *ref_iterator) return ITER_OK; } -static int reftable_reflog_iterator_peel(struct ref_iterator *ref_iterator, - struct object_id *peeled) +static int reftable_reflog_iterator_peel(struct ref_iterator *ref_iterator UNUSED, + struct object_id *peeled UNUSED) { BUG("reftable reflog iterator cannot be peeled"); return -1; @@ -1988,7 +1988,7 @@ static int write_reflog_existence_table(struct reftable_writer *writer, static int reftable_be_create_reflog(struct ref_store *ref_store, const char *refname, - struct strbuf *errmsg) + struct strbuf *errmsg UNUSED) { struct reftable_ref_store *refs = reftable_be_downcast(ref_store, REF_STORE_WRITE, "create_reflog"); diff --git a/reftable/blocksource.c b/reftable/blocksource.c index eeed254ba9..abce4bb2e1 100644 --- a/reftable/blocksource.c +++ b/reftable/blocksource.c @@ -13,14 +13,14 @@ license that can be found in the LICENSE file or at #include "reftable-blocksource.h" #include "reftable-error.h" -static void strbuf_return_block(void *b, struct reftable_block *dest) +static void strbuf_return_block(void *b UNUSED, struct reftable_block *dest) { if (dest->len) memset(dest->data, 0xff, dest->len); reftable_free(dest->data); } -static void strbuf_close(void *b) +static void strbuf_close(void *b UNUSED) { } @@ -55,7 +55,7 @@ void block_source_from_strbuf(struct reftable_block_source *bs, bs->arg = buf; } -static void malloc_return_block(void *b, struct reftable_block *dest) +static void malloc_return_block(void *b UNUSED, struct reftable_block *dest) { if (dest->len) memset(dest->data, 0xff, dest->len); @@ -85,7 +85,7 @@ static uint64_t file_size(void *b) return ((struct file_block_source *)b)->size; } -static void file_return_block(void *b, struct reftable_block *dest) +static void file_return_block(void *b UNUSED, struct reftable_block *dest UNUSED) { } diff --git a/reftable/generic.c b/reftable/generic.c index 28ae26145e..a00725d9c4 100644 --- a/reftable/generic.c +++ b/reftable/generic.c @@ -201,17 +201,19 @@ int iterator_next(struct reftable_iterator *it, struct reftable_record *rec) return it->ops->next(it->iter_arg, rec); } -static int empty_iterator_seek(void *arg, struct reftable_record *want) +static int empty_iterator_seek(void *arg UNUSED, + struct reftable_record *want UNUSED) { return 0; } -static int empty_iterator_next(void *arg, struct reftable_record *rec) +static int empty_iterator_next(void *arg UNUSED, + struct reftable_record *rec UNUSED) { return 1; } -static void empty_iterator_close(void *arg) +static void empty_iterator_close(void *arg UNUSED) { } diff --git a/reftable/iter.c b/reftable/iter.c index fddea31e51..9e8b2952fd 100644 --- a/reftable/iter.c +++ b/reftable/iter.c @@ -127,7 +127,8 @@ static int indexed_table_ref_iter_next_block(struct indexed_table_ref_iter *it) return 0; } -static int indexed_table_ref_iter_seek(void *p, struct reftable_record *want) +static int indexed_table_ref_iter_seek(void *p UNUSED, + struct reftable_record *want UNUSED) { BUG("seeking indexed table is not supported"); return -1; diff --git a/reftable/record.c b/reftable/record.c index a2cba5ef74..2ec0c6d346 100644 --- a/reftable/record.c +++ b/reftable/record.c @@ -516,7 +516,7 @@ static void reftable_obj_record_release(void *rec) memset(obj, 0, sizeof(struct reftable_obj_record)); } -static void reftable_obj_record_print(const void *rec, int hash_size) +static void reftable_obj_record_print(const void *rec, int hash_size UNUSED) { const struct reftable_obj_record *obj = rec; char hex[GIT_MAX_HEXSZ + 1] = { 0 }; @@ -532,7 +532,7 @@ static void reftable_obj_record_print(const void *rec, int hash_size) } static void reftable_obj_record_copy_from(void *rec, const void *src_rec, - int hash_size) + int hash_size UNUSED) { struct reftable_obj_record *obj = rec; const struct reftable_obj_record *src = @@ -559,7 +559,7 @@ static uint8_t reftable_obj_record_val_type(const void *rec) } static int reftable_obj_record_encode(const void *rec, struct string_view s, - int hash_size) + int hash_size UNUSED) { const struct reftable_obj_record *r = rec; struct string_view start = s; @@ -594,7 +594,8 @@ static int reftable_obj_record_encode(const void *rec, struct string_view s, static int reftable_obj_record_decode(void *rec, struct strbuf key, uint8_t val_type, struct string_view in, - int hash_size, struct strbuf *scratch UNUSED) + int hash_size UNUSED, + struct strbuf *scratch UNUSED) { struct string_view start = in; struct reftable_obj_record *r = rec; @@ -647,12 +648,13 @@ static int reftable_obj_record_decode(void *rec, struct strbuf key, return start.len - in.len; } -static int not_a_deletion(const void *p) +static int not_a_deletion(const void *p UNUSED) { return 0; } -static int reftable_obj_record_equal_void(const void *a, const void *b, int hash_size) +static int reftable_obj_record_equal_void(const void *a, const void *b, + int hash_size UNUSED) { struct reftable_obj_record *ra = (struct reftable_obj_record *) a; struct reftable_obj_record *rb = (struct reftable_obj_record *) b; @@ -1066,7 +1068,7 @@ static void reftable_index_record_key(const void *r, struct strbuf *dest) } static void reftable_index_record_copy_from(void *rec, const void *src_rec, - int hash_size) + int hash_size UNUSED) { struct reftable_index_record *dst = rec; const struct reftable_index_record *src = src_rec; @@ -1082,13 +1084,13 @@ static void reftable_index_record_release(void *rec) strbuf_release(&idx->last_key); } -static uint8_t reftable_index_record_val_type(const void *rec) +static uint8_t reftable_index_record_val_type(const void *rec UNUSED) { return 0; } static int reftable_index_record_encode(const void *rec, struct string_view out, - int hash_size) + int hash_size UNUSED) { const struct reftable_index_record *r = (const struct reftable_index_record *)rec; @@ -1104,8 +1106,10 @@ static int reftable_index_record_encode(const void *rec, struct string_view out, } static int reftable_index_record_decode(void *rec, struct strbuf key, - uint8_t val_type, struct string_view in, - int hash_size, struct strbuf *scratch UNUSED) + uint8_t val_type UNUSED, + struct string_view in, + int hash_size UNUSED, + struct strbuf *scratch UNUSED) { struct string_view start = in; struct reftable_index_record *r = rec; @@ -1122,7 +1126,8 @@ static int reftable_index_record_decode(void *rec, struct strbuf key, return start.len - in.len; } -static int reftable_index_record_equal(const void *a, const void *b, int hash_size) +static int reftable_index_record_equal(const void *a, const void *b, + int hash_size UNUSED) { struct reftable_index_record *ia = (struct reftable_index_record *) a; struct reftable_index_record *ib = (struct reftable_index_record *) b; @@ -1137,7 +1142,7 @@ static int reftable_index_record_cmp(const void *_a, const void *_b) return strbuf_cmp(&a->last_key, &b->last_key); } -static void reftable_index_record_print(const void *rec, int hash_size) +static void reftable_index_record_print(const void *rec, int hash_size UNUSED) { const struct reftable_index_record *idx = rec; /* TODO: escape null chars? */ diff --git a/reftable/stack_test.c b/reftable/stack_test.c index f84b92f312..1a638cd2e0 100644 --- a/reftable/stack_test.c +++ b/reftable/stack_test.c @@ -399,7 +399,7 @@ static void test_reftable_stack_auto_compaction_fails_gracefully(void) clear_dir(dir); } -static int write_error(struct reftable_writer *wr, void *arg) +static int write_error(struct reftable_writer *wr UNUSED, void *arg) { return *((int *)arg); } @@ -816,7 +816,7 @@ static void test_reflog_expire(void) reftable_log_record_release(&log); } -static int write_nothing(struct reftable_writer *wr, void *arg) +static int write_nothing(struct reftable_writer *wr, void *arg UNUSED) { reftable_writer_set_limits(wr, 1, 1); return 0; diff --git a/reftable/test_framework.c b/reftable/test_framework.c index 4066924eee..a07fec5d84 100644 --- a/reftable/test_framework.c +++ b/reftable/test_framework.c @@ -21,7 +21,7 @@ ssize_t strbuf_add_void(void *b, const void *data, size_t sz) return sz; } -int noop_flush(void *arg) +int noop_flush(void *arg UNUSED) { return 0; } diff --git a/reftable/writer.c b/reftable/writer.c index 45b3e9ce1f..9d5e6072bc 100644 --- a/reftable/writer.c +++ b/reftable/writer.c @@ -544,7 +544,7 @@ static void write_object_record(void *void_arg, void *key) done:; } -static void object_record_free(void *void_arg, void *key) +static void object_record_free(void *void_arg UNUSED, void *key) { struct obj_index_tree_node *entry = key; diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c index 2d65d5c3cb..99f8fcadfe 100644 --- a/t/unit-tests/t-reftable-merged.c +++ b/t/unit-tests/t-reftable-merged.c @@ -22,7 +22,7 @@ static ssize_t strbuf_add_void(void *b, const void *data, const size_t sz) return sz; } -static int noop_flush(void *arg) +static int noop_flush(void *arg UNUSED) { return 0; } From patchwork Sat Aug 17 08:24:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767057 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E84E12FB37 for ; Sat, 17 Aug 2024 08:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883090; cv=none; b=MtTsJR9Hq61VP3oIxHPAV2s3HazUNLC8+rboa3uK+SqJQP4mK6CgJVsT/megyJQ6eOHmKbwT3plja4BBZG69VnssX4aWlG7Dah/+HWCxeIvN8xfQ+jVV6tFa+7Gjy8fxuNMuXTzukPI2Qn0bRcRZTQuD2sMKuur+PMR2V6Zqtz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883090; c=relaxed/simple; bh=Gmt6cuJyp20lDjpvE3qI/WdWaKr8Ucc8fpkcsJn5eos=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VTL6xxnRv69v9Prqvo4Xd8zvuFQBkykUA8QDrw3NpXNCWdQS45FBrlq2iuIqfCtayy7xco8cR7101NuDKozOgzu/ITEHIfY97oWgtGK3UMcXxuqdOE/wfSsUFaTbPaCW5z2tl6W+KJk5rBObpSA4ErNPOIOCRXJIRIGX8/pd6cQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24736 invoked by uid 109); 17 Aug 2024 08:24:48 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:24:48 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27966 invoked by uid 111); 17 Aug 2024 08:24:52 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:24:52 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:24:47 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 11/15] t-hashmap: mark unused parameters in callback function Message-ID: <20240817082447.GK10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> The t_intern() setup function doesn't operate on a hashmap, so it ignores its parameters. But we can't drop them since it is passed as a pointer to setup(), so we have to match the other setup functions. Mark them to silence -Wunused-parameter. Signed-off-by: Jeff King --- t/unit-tests/t-hashmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/unit-tests/t-hashmap.c b/t/unit-tests/t-hashmap.c index 09a48c2c4e..da102eb541 100644 --- a/t/unit-tests/t-hashmap.c +++ b/t/unit-tests/t-hashmap.c @@ -322,7 +322,8 @@ static void t_alloc(struct hashmap *map, unsigned int ignore_case) free(removed); } -static void t_intern(struct hashmap *map, unsigned int ignore_case) +static void t_intern(struct hashmap *map UNUSED, + unsigned int ignore_case UNUSED) { const char *values[] = { "value1", "Value1", "value2", "value2" }; From patchwork Sat Aug 17 08:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767058 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B228B12FB37 for ; Sat, 17 Aug 2024 08:25:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883106; cv=none; b=j2UpTIni3vsPV9NiZHzhBZu9AODvihYstPJkMNRZF4YlHpkzftaC/CuDLUwNc1G3n5UCzB/ge1tLhfWsI/2rMqOnQqMokoq/W1dNrtCIeB8vnIR7ImZSjiKVKMnqSutN7Ix/DxLTg6Ex2YNEr0Npy8yqQG1nPqoGqq++YeoIJbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883106; c=relaxed/simple; bh=YM7wbM9JkawGRmwjn25yfHy5eQ94hxg0DzN+OWa/MPY=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EBvar6kqiYgCugNDiCJH3HL4/Nd7l9Tx7iG07b+ncjtLaPQlSXChXpDbH2NoOcO6W5Kd/8GWEmcLjLXRluVgRU0KSxHLND3fhnhnrBJX+DZvcr+imiK3Oae+UC4VEj1A9Tw6qOm7jnV3z4ue0QQvwaqW5/NkF5d8fRjc9xaKPuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24741 invoked by uid 109); 17 Aug 2024 08:25:04 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:25:04 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 28036 invoked by uid 111); 17 Aug 2024 08:25:08 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:25:08 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:25:03 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 12/15] test-mergesort: mark unused parameters in trivial callback Message-ID: <20240817082503.GL10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> The mode_copy() function does nothing, but since it's used as a function pointer within "struct mode", it has to conform to the interface. Mark it to quiet -Wunused-parameter. Signed-off-by: Jeff King --- t/helper/test-mergesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c index 42ccc87051..328bfe2977 100644 --- a/t/helper/test-mergesort.c +++ b/t/helper/test-mergesort.c @@ -122,7 +122,7 @@ static const struct dist *get_dist_by_name(const char *name) return NULL; } -static void mode_copy(int *arr, int n) +static void mode_copy(int *arr UNUSED, int n UNUSED) { /* nothing */ } From patchwork Sat Aug 17 08:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767059 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD2612FB37 for ; Sat, 17 Aug 2024 08:25:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883119; cv=none; b=etPFYGErhOJkg/nmISeKMmVK+/9AEofjHvnHvJlfqauUNU/xqWaGC+fwvYEKVF1SOVgcTP7ylPgpanFqZvn4KJDITull0QR5wdag1dvMDguGsw7rB8EMI/X+dWFX/rHn9lB0JZXNz6A/0JeCvUl9mDt4PytSLVdlPsukkahuGkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883119; c=relaxed/simple; bh=GmqyYhz8tCXU+YWeizDVYj+RttLj2Aw+HeNtvEhaPVY=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NCLY8ERvGWCNBAhIS2T7F700MB7JDzVel9u3NlnBCGtWqoe9DMnfWD84pm1bKCWqPERqIjGdDHe+EiypwvSH/13KvCGh0/oHSFU5NpoNVLBWHpPtSCVElM2Tqzuj+SAMga5Xt4Kqqy2ipPHWop6JPsFKLDlTz6bHWj/u7SSRrMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24748 invoked by uid 109); 17 Aug 2024 08:25:17 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:25:17 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 28039 invoked by uid 111); 17 Aug 2024 08:25:21 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:25:21 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:25:16 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 13/15] setup: mark unused parameter in config callback Message-ID: <20240817082516.GM10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> This is logically a continuation of 783a86c142 (config: mark unused callback parameters, 2022-08-19), but this case was introduced much later in 4412a04fe6 (init.templateDir: consider this config setting protected, 2024-03-29). Signed-off-by: Jeff King --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index 5f81d9fac0..bd44ca21cc 100644 --- a/setup.c +++ b/setup.c @@ -1907,7 +1907,7 @@ struct template_dir_cb_data { }; static int template_dir_cb(const char *key, const char *value, - const struct config_context *ctx, void *d) + const struct config_context *ctx UNUSED, void *d) { struct template_dir_cb_data *data = d; From patchwork Sat Aug 17 08:25:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767060 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E52DD12FB37 for ; Sat, 17 Aug 2024 08:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883136; cv=none; b=kz+ZsUwZVDMI5GpbIu/1Hy6NbZsfM9XgVkXXLMtZv+rZydpwplhx6P4RexBNO1JhqHy+OPvTewn/cyFq43a8gBYRohLkzimJMWyfk+GdwAIBSdNZWEiXTgtWFyoii2JJRdAmh5VSl9+mvNZTLYLiHyelOeWHDVoyQIOMYW9otuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883136; c=relaxed/simple; bh=qAAAHN0tP7tyR3CeeOpYZZENbGFJIjcMDi5B9Hy896o=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tCv6s4H7Hs6i4wd5f++wuzOfHALom8NUirN9FtTZ1D531bHnOjWJreSaeJoeQhioq7nBneWAmwe29Qvb5EacDNxjNLKmL1dRc5ywHw6842bipmcZvvMwinxR++WIURITdXIMwBPt1SURO6fLmEGmDdeF0Yxk/FiJ+gIJ8NF8boU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24755 invoked by uid 109); 17 Aug 2024 08:25:34 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:25:34 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 28043 invoked by uid 111); 17 Aug 2024 08:25:38 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:25:38 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:25:32 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 14/15] daemon: mark unused parameters in non-posix fallbacks Message-ID: <20240817082532.GN10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> If NO_POSIX_GOODIES is set, we compile fallback versions of a few functions. These don't do anything, so their parameters are unused, but we must keep them to match the ones on the other side of the #ifdef. Mark them to quiet -Wunused-parameter. Signed-off-by: Jeff King --- daemon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon.c b/daemon.c index 17d331b2f3..428a445559 100644 --- a/daemon.c +++ b/daemon.c @@ -1175,13 +1175,13 @@ static int service_loop(struct socketlist *socklist) struct credentials; -static void drop_privileges(struct credentials *cred) +static void drop_privileges(struct credentials *cred UNUSED) { /* nothing */ } -static struct credentials *prepare_credentials(const char *user_name, - const char *group_name) +static struct credentials *prepare_credentials(const char *user_name UNUSED, + const char *group_name UNUSED) { die("--user not supported on this platform"); } From patchwork Sat Aug 17 08:25:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767061 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4398913E043 for ; Sat, 17 Aug 2024 08:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883145; cv=none; b=Bj/gZZwJ4yOtb3QkCqqYUkRP4Xs8Q/8ZYhwV9kdmeDX2Zb+eem0FKuGW3/PF37DDrRY/QqwSyGpplh4W/BEn5qDEuQbtouhIqzhkKZgXbjQnzPjB0HflLEYtm8t8dWW2vm7U8BAGiYfmB5sJ16EHP17ZSasqWtv3naA4/mC3otk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723883145; c=relaxed/simple; bh=+js4deg2UiqFzqy9Hetv0vix/E4gs5F3yz5a4fE78zs=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nug1FwiMDe+FnE9FJnM9Dln5u7tAORxBNzhwRKloF/rcL8z4TnHOinfh3DBRMn4hxoNnykA/KdFRYxy9jfunlnrShpe1lVGDrPlOd8Eo41dtuqs9keMYUYawkkTDoJX6ylvqZl5GqdmQsYVLOwbZxn8ILlimrZaR676zYfHAQF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 24760 invoked by uid 109); 17 Aug 2024 08:25:43 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 08:25:43 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 28046 invoked by uid 111); 17 Aug 2024 08:25:47 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 04:25:47 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 04:25:42 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 15/15] scalar: mark unused parameters in dummy function Message-ID: <20240817082542.GO10287@coredump.intra.peff.net> References: <20240817082101.GA6761@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817082101.GA6761@coredump.intra.peff.net> We have a dummy load_builtin_commands() function to satisfy the linker, but which we never expect to be called. Mark its parameters to avoid complaints from -Wunused-parameter. Signed-off-by: Jeff King --- scalar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scalar.c b/scalar.c index 1fe8a93e65..6166a8dd4c 100644 --- a/scalar.c +++ b/scalar.c @@ -400,7 +400,8 @@ static int delete_enlistment(struct strbuf *enlistment) * Dummy implementation; Using `get_version_info()` would cause a link error * without this. */ -void load_builtin_commands(const char *prefix, struct cmdnames *cmds) +void load_builtin_commands(const char *prefix UNUSED, + struct cmdnames *cmds UNUSED) { die("not implemented"); }