From patchwork Fri Dec 6 10:27:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896901 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 B2E791FBEB9 for ; Fri, 6 Dec 2024 10:27:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480860; cv=none; b=dn5JZX37Va3Ujcy0xBiWzV8E0Wc/oT+uELZpwEk9Y+UYY484br6cZQ1pF+geroUnXIS1BjUGmBC7p7DkmXExCWwRvpZc9J/EVlU6Uq5Z2V1FKf9KSbmqi0ooStdc6oZyhD4duycx7u20Q0aetHvin9dneZqECKN0rLENDuADcrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480860; c=relaxed/simple; bh=jvSyuzL8Cgti+WSwNArd0F9PGqU9gWVkkcTW4NXC6fU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rH05LfDWWIUlsFRLBQvFPSbkDDl2TtycpPv2WqCBvjuFpAtmNfX1ewRnOnXPGPdkYK4tPM9oaPYQPddJ8AGeVUqhOmuYHuYEV/SlZoU/Dyedl4EPkdWE0iOA73+41xAbwmD14moloCaXXRagpu3qi8WdqTwLq2uQLx4o6faPimw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=sLPR3Ej5; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WdFmv3Cj; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="sLPR3Ej5"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WdFmv3Cj" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id AB0A42540199; Fri, 6 Dec 2024 05:27:37 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Fri, 06 Dec 2024 05:27:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480857; x=1733567257; bh=xfoL0jmuLSLwJtumy9GRlADBdpY8qiI7GazRXl4V34s=; b= sLPR3Ej5JJs30bZfoJVOZ837JTqFk8Q8aiNgmuCDd2gUDWEVC78uEsQzP2b5mf12 pIaYOxfHyo7FYKwbxtGQsfsiP8oLeva/ZdPB7QS9qHS0RzyvkSwun1ESUvE+RTc+ 3+Tu1y1UOXcEwUHzNPjlALOXHdGXBtyAfvzSuqZxNqmtjZqIIlVpW4cJslBs3ndv lP348DRTk97hWzDMLOP83wu4bg7vr/jdkBqNyU3vhwIuwEjXXCCgQ2vcbvUurkP/ gNfIendnAGF4AVfBcDVBE2GzBOysMwSlsU+OW55YrWrou5Zj/ID01OHms8Mspvtj 5ETvQ9HqAawYo4AhK0bBDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480857; x= 1733567257; bh=xfoL0jmuLSLwJtumy9GRlADBdpY8qiI7GazRXl4V34s=; b=W dFmv3CjW0i4Igjjtq2UdOSJ8S7bHWgHRfrojBVh/SRN7abpPS0b8ocjhzuftk3Is U8BoMNwnBhHV3S+7BkIFIX6ZABVW209fIWyi1v5g5E5rs4X2sEU7mMuAmN+rVoZZ SCZNFmleupox7G1IessAkMzimjr0kRayvxPJYm8hAElcMk/vj0uunuDKbf/k47ze P1qJ//XmVhRcQvOYTkAtNU2BVRaUUw7AMq8LU4IHAL/q7nhzKgCzerDu6TgeILP5 420Zge2c1bml57ttCxdugGaL4kD08TiUMkjwV6ZeGrXCh722xyCalnW5na2CF0lb gZn8GpscK9El0w6O89NeA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghffhes phgvfhhfrdhnvghtpdhrtghpthhtohepshhhvghjihgrlhhuohesghhmrghilhdrtghomh dprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohep ghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:36 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 83943075 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:11 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:16 +0100 Subject: [PATCH v4 01/16] git-compat-util: introduce macros to disable "-Wsign-compare" warnings Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-1-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 When compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up. Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context. Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, introduce a new set of macros that allow us to mark a file as being free of warnings with "-Wsign-compare". The mechanism is similar to what we do with `USE_THE_REPOSITORY_VARIABLE`: every file that is not marked with `DISABLE_SIGN_COMPARE_WARNINGS` will be compiled with those warnings enabled. These new markings will be wired up in the subsequent commits. Signed-off-by: Patrick Steinhardt --- git-compat-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index a06d4f3809e5664863d4d0f312c88b3e1364ee74..e283c46c6fa06e4079851296a55c9bd5472a65b4 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -44,6 +44,16 @@ struct strbuf; #define GIT_GNUC_PREREQ(maj, min) 0 #endif +#if defined(__GNUC__) || defined(__clang__) +# define PRAGMA(pragma) _Pragma(#pragma) +# define DISABLE_WARNING(warning) PRAGMA(GCC diagnostic ignored #warning) +#else +# define DISABLE_WARNING(warning) +#endif + +#ifdef DISABLE_SIGN_COMPARE_WARNINGS +DISABLE_WARNING(-Wsign-compare) +#endif #ifndef FLEX_ARRAY /* From patchwork Fri Dec 6 10:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896902 Received: from flow-b3-smtp.messagingengine.com (flow-b3-smtp.messagingengine.com [202.12.124.138]) (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 5BDFE1FC110 for ; Fri, 6 Dec 2024 10:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480861; cv=none; b=gUDYxwYQQ9QfiH/6K8SdzdeW1fsRV40IypkjBDVMZ+Jf13gA63fXYTLFMdWDjySIRLZc6M+qaPuaEJrs+hKvDoyEXCDzl4ar70Lir05LgyannkQkF2yHS9lCF0PIOr9Bviffy2nF5ImmwTuErJ49YGpxm7xr7SeHUCJ0NYF58t8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480861; c=relaxed/simple; bh=+GAZHQwsNXOz5X6RBqCMGSS0jJ6zg/37nifc597U8/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gXxTwa5hDCu+ysd40sejNGC5PjfT5cQBK6iIXIgy/uaF57/x1Zc0zGtn4g5rXeG7v/ysn8WOAuUAuIFEyYzlaoZhZI6BckMZ2Fn0awdbOml1JeePsmF9yRV1irrmLKYc6AiT8hQm327w1ohV651IJxEhLXCXULFyv9YAC8D+f7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=e4LXxtsR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Mk0Z81oR; arc=none smtp.client-ip=202.12.124.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="e4LXxtsR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Mk0Z81oR" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailflow.stl.internal (Postfix) with ESMTP id 3C60A1D40636; Fri, 6 Dec 2024 05:27:38 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 06 Dec 2024 05:27:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480858; x=1733488058; bh=b6ho0wcLsh01aSmlNVS0ZfrjkuOVmB9vVz4X/lCsbbs=; b= e4LXxtsRV65h4aGmVyeS836e40ABbkIIsN7V+qTNjKxuLliKu2o+Bt19bGZWPEyB +DZhyH8m8sCi7QhIYylZytZT7G4tWCscEgYsqrlTsUQ9PXCnzN5ngqf66jOX7MQA VxCgIPD7Z2sed5eOOHDBFl5OOho30rmvSPFsRu6mAqoc93c/00oXYJ3nbaXOzMqy 5y39P94SbV8Qp1JMapoUwDdxfh743QhVEI+6ARD+FReNNqigEYkkKnDEF2AsXMDa pIZESdJ2BtZm9CPHXLVAkmJpEHIFm2Yq6YsyunWJxHZDnpEZRZyfq81VIKIv6O94 Jv6wr4FwkMNn+KJnsuWkIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480858; x= 1733488058; bh=b6ho0wcLsh01aSmlNVS0ZfrjkuOVmB9vVz4X/lCsbbs=; b=M k0Z81oRTsWP/853cSfGfp6JRHAU6I7dIDcNnYgdxMMdOcjKLaMQ6VNN3OnHdSVxP jZC16ELag3Za33M/bfKH7IyfzR6IjmsdKIkaw4HdGVK7vnTQaMKGmEJCXyh9IWNu /M3r4siv/nPBOtWwIoutheHze2a6zgrQ9mzsORJkLu4CG43N82/FLkOAoNNec5bW YT36WJpsEwAYs3yE1wZksQnCbUkCog55FKg/rzbXKIvPXYPvl6XIhwovNnmWVUFR zff9aZ7yN8SRdAgCGdGzWsTM52iVbZK+VLiTD56yK3VEo1mGN/yfmPIFDT05n0IX 9Q127bZoq1GJRAGRr7lJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecuogfuphgrmhgfrhhlucdlfe dttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhm pefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtf frrghtthgvrhhnpeegleejtdelfeffleetvdeivdeuuefgheetjeehudetjeehhefhheej teeugfffvdenucffohhmrghinhepghhnuhdrohhrghenucfuphgrmhgfrhhlpehhthhtph emsddsfiiffidrghhnuhdrohhrghdslhhitggvnhhsvghsnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtg hpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvfhhfsehpvghf fhdrnhgvthdprhgtphhtthhopehshhgvjhhirghluhhosehgmhgrihhlrdgtohhmpdhrtg hpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehgihhtsehv ghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:36 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id b5defb24 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:12 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:17 +0100 Subject: [PATCH v4 02/16] compat/regex: explicitly ignore "-Wsign-compare" warnings Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-2-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 Explicitly ignore "-Wsign-compare" warnings in our bundled copy of the regcomp implementation. We don't use the macro introduced in the preceding commit because this code does not include "git-compat-util.h" in the first place. Note that we already directly use "#pragma GCC diagnostic ignored" in "regcomp.c", so it shouldn't be an issue to use it directly in the new spot, either. Signed-off-by: Patrick Steinhardt --- compat/regex/regex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/regex/regex.c b/compat/regex/regex.c index e6f4a5d177bb7d44345fcc25fabca1e62b0eebc4..4b09cc4e1457dc362b2c974e82a6f9739b499a83 100644 --- a/compat/regex/regex.c +++ b/compat/regex/regex.c @@ -17,6 +17,8 @@ License along with the GNU C Library; if not, see . */ +#pragma GCC diagnostic ignored "-Wsign-compare" + #ifdef HAVE_CONFIG_H #include "config.h" #endif From patchwork Fri Dec 6 10:27:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896903 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 2E4701FC7CB for ; Fri, 6 Dec 2024 10:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480861; cv=none; b=UfLWK6OkcvDHoF0Agl/BKB4eJmgKaVcFYrdSE/TKUsx8PXxoNZj2Eh8o7A7ohyyPvI9B6S6KzkF0CmqH9jQTxq9xBW2fyK0DRQ0FaquqxkL3gLmvwttwZOALEt++Et8YNPGGL87MOVvOt73UCsckWUKjxIF6LBgb8ALRpDMe3K4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480861; c=relaxed/simple; bh=D6Hhpn7vxHV7XfFB4j51n7BZsMwQz9dQhOFEKLgOFAM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QSqIk7lRF+Y8jlyl7rRwxoo9PBWXiO4TOKofnHncTXVFQzg03t2HOOv/qA1lWD8x2uyP1CZTGCwTokpDeWk66esXD/AJyINIjbPW21rtUtQNgKeECO0r6sEzrHyXS/B9QXUGJZzD/ThSVSHoR6jhi92C0BqE/NeeQAyCF4rp1zI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=T8P1Pmgx; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=yvNCknma; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="T8P1Pmgx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="yvNCknma" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 3F8F2114017B; Fri, 6 Dec 2024 05:27:39 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Fri, 06 Dec 2024 05:27:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480859; x=1733567259; bh=lHuP+MI7HPf2IiuivPg3fmZ1QpVXDTwAnm9MlbxjQls=; b= T8P1PmgxyHFv+bTWI396kTSGjXtS6hWBkzLsuZ+XnoNSIVZ/0OTaXCTESPTXIhk8 xnDtsAFfxTgf0ibcp00y1oyRuD74vGCwLvGmfV6A7kbJ/XD0glJfJEEdHtxHXtzd ZjrVb5FA+nKPkJTJEPAGHKWfabVOKFGIi0jJSYfgMAGev2kjZf2f3Om1ItffNVg8 U9pDxQszfoZmiSLpkeKwUD7KsegU+W9UJqg4/P0UAXXZnO54P8SEJUUTd2KwD9UT rpAK8c2u/HLe8a6xNmYcc8+9ThuZ7BRpH1M8wCzwSaH08rUN5U9Z0GbsjNptb9m7 9G0g2K0yZNl9OGxjcdf0Ig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480859; x= 1733567259; bh=lHuP+MI7HPf2IiuivPg3fmZ1QpVXDTwAnm9MlbxjQls=; b=y vNCknma4+8s/PQG6q9cqqVHgTvaeUDjFps7x8U4W7q264EkmlHOzetzNL9KnRrlT iDwvzKXRzz7dLz4WDg2v04LlxCkz3AZtd3i0a4D25FOJUlRECnieyetWx/XC3VWu SzbaSYyTahz3diT2i57vhOaykAiNSh9UJzl+tBNR6I/y0rI8fpH9Dw4zMYxIYNyw 4UyqzSf0SL9eL3X9q8hh2014KAKjHLm2weBj+eNZidqcFkaOCi6QpGjqH6d0cYH5 WFuTwtOdY0jDdgTMz0dfZpgNoBzywp6JxFL0QHEQnNr2loHteyLtgMN3W6OuAEoe ZVV0yUgCykBtzieEgTn1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtshht vghrsehpohgsohigrdgtohhmpdhrtghpthhtohepshhhvghjihgrlhhuohesghhmrghilh drtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghp thhtohepphgvfhhfsehpvghffhdrnhgvth X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:37 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 441f1ec0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:13 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:18 +0100 Subject: [PATCH v4 03/16] compat/win32: fix -Wsign-compare warning in "wWinMain()" Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-3-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 GCC generates a warning in "headless.c" because we compare `slash` with `size`, where the former is an `int` and the latter is a `size_t`. Fix the warning by storing `slash` as a `size_t`, as well. This commit is being singled out because the file does not include the "git-compat-util.h" header, and consequently, we cannot easily mark it with the `DISABLE_SIGN_COMPARE_WARNING` macro. Signed-off-by: Patrick Steinhardt --- compat/win32/headless.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/compat/win32/headless.c b/compat/win32/headless.c index 11392a0b9a6dac5522bc5042064f492bd73cc871..a6eb116ddc7b586fea80f46ac36d50a4b3ddb656 100644 --- a/compat/win32/headless.c +++ b/compat/win32/headless.c @@ -53,7 +53,8 @@ int WINAPI wWinMain(_In_ HINSTANCE instance, wchar_t git_command_line[32768]; size_t size = sizeof(git_command_line) / sizeof(wchar_t); const wchar_t *needs_quotes = L""; - int slash = 0, i; + size_t slash = 0; + int len; STARTUPINFO startup_info = { .cb = sizeof(STARTUPINFO), @@ -66,7 +67,7 @@ int WINAPI wWinMain(_In_ HINSTANCE instance, DWORD exit_code; /* First, determine the full path of argv[0] */ - for (i = 0; _wpgmptr[i]; i++) + for (size_t i = 0; _wpgmptr[i]; i++) if (_wpgmptr[i] == L' ') needs_quotes = L"\""; else if (_wpgmptr[i] == L'\\') @@ -79,16 +80,16 @@ int WINAPI wWinMain(_In_ HINSTANCE instance, extend_path(_wpgmptr, slash); /* Then, add the full path of `git.exe` as argv[0] */ - i = swprintf_s(git_command_line, size, L"%ls%.*ls\\git.exe%ls", - needs_quotes, slash, _wpgmptr, needs_quotes); - if (i < 0) + len = swprintf_s(git_command_line, size, L"%ls%.*ls\\git.exe%ls", + needs_quotes, (int) slash, _wpgmptr, needs_quotes); + if (len < 0) return 127; /* Too long path */ if (*command_line) { /* Now, append the command-line arguments */ - i = swprintf_s(git_command_line + i, size - i, - L" %ls", command_line); - if (i < 0) + len = swprintf_s(git_command_line + len, size - len, + L" %ls", command_line); + if (len < 0) return 127; } From patchwork Fri Dec 6 10:27:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896908 Received: from flow-b3-smtp.messagingengine.com (flow-b3-smtp.messagingengine.com [202.12.124.138]) (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 C5CF4201113 for ; Fri, 6 Dec 2024 10:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480867; cv=none; b=BSns8RtB62hNZL7PVsxP5Q5/eBEWgoTEuycvsRSEPsfrhSkG/DAYjFdL/97H8X2r507LWYxs6g88dUdc0YAhEiBz2Y7rDnzIDMLHfZzxOqQYlEpxASeTwkyN/dtNekQboVbg1JOlGRoKkyvKVDKWknlTuHW9F0M+0ZhaN1NIeEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480867; c=relaxed/simple; bh=5dJtIw9kQcNeyjtx3NEvJNWTfXVkTIzhnjr9vbX78KM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V/wvmLzFT1gdne7pKESjrnXjmVEPGc0KRiAPDDDZBCE0jTM7EEnEumiWmV1VZ/O3dDqWMCjaNfg9oE/3bGghVbpFsuKv0ZanG72cirTWu55X9hYoQ4Jonctz/WXcGUwq2B9evnn9usMZl3LeLjrTO3bRtk5s/G5C8a14Qy85edQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=gy3eNMhU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=E46Y14uP; arc=none smtp.client-ip=202.12.124.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="gy3eNMhU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="E46Y14uP" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailflow.stl.internal (Postfix) with ESMTP id 1F8BE1D40648; Fri, 6 Dec 2024 05:27:40 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Fri, 06 Dec 2024 05:27:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480859; x=1733488059; bh=hSbkc9WLgsAqxPJ2bfzyL7VOftRkchyFT2jJAfOrx5c=; b= gy3eNMhUpBQD+V+4ubtfVH3W49aNldRrYV2T0gBNRiSh4IHzFlhoJK9kVp9K00Eq 5g+h2mHhl5uX7vIzwJdliiUMDmefbxcCHOfDdQoGMwoWo8O/qJCe9nRtCET3Se+T VF3fTaw5aXnH6YeboEKdwFRdzCAWp0ZWE+s3thopK8kmhGEZ8V0ecLCUuaT5TNWV ovvs+bZZCix4UW7SP62s9Foye6Ig2MNVbVYkvvzJRbi7dgRh5yvK6D7ULRdgSB5X FCfN40LqXL7HttfjwlMgFBS9FngmE9h0lGUNzXmn5DlUNYqt7lGlrXIUcbPtwMoV Z+MpHqLXD2UrJ/NlygT5ZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480859; x= 1733488059; bh=hSbkc9WLgsAqxPJ2bfzyL7VOftRkchyFT2jJAfOrx5c=; b=E 46Y14uPF44Qd6QLqWsm+4w01E7yj+0zw6/ZIVh2Dwse1LgenrfQT5F/H2g/QxCkm jJbp2HFYIX3HfdoLyf7U4r1+AeMi58wgsG6LXmPB9YQb1SG8TutFA6I22+6HIX49 vmE3vTzwvwVV5InKUyU01OzmF6fssWHDuclHlM5Cs1ko5SJr7kPI2vz1pz4q8LPx iAeET6AtS+zat6EdfxFVHRNb2TlHjhNJ1CVXOD7zevoAPPmHC/kCCJWMNJYt8PQX u06i7UbTzdHQEwMdavsmvlEzR0/c7uA7mWJdVi/tyf8eFJMmCgnaMqca67g+94Qz vfLt4Aq0LOKNpc5bPxGlg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecuogfuphgrmhgfrhhlucdlfe dttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhm pefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtf frrghtthgvrhhnpeefveetvddvjeeivdduueejudehgeehleeggfeiheevkeduveekhffg tdfhgffhheenucffohhmrghinhepghhnuhdrohhrghdpghhoohhglhgvrdgtohhmnecuuf hprghmfghrlhephhhtthhpmedssdiffiifrdhgnhhurdhorhhgsdhlihgtvghnshgvshen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhmpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphht thhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepghhithesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehshhgvjhhirghluhhosehgmhgrihhlrdgtohhm pdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f2f6a31b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:14 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:19 +0100 Subject: [PATCH v4 04/16] global: mark code units that generate warnings with `-Wsign-compare` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-4-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 Mark code units that generate warnings with `-Wsign-compare`. This allows for a structured approach to get rid of all such warnings over time in a way that can be easily measured. Signed-off-by: Patrick Steinhardt --- add-interactive.c | 1 + add-patch.c | 1 + advice.c | 2 ++ apply.c | 1 + archive.c | 1 + attr.c | 1 + base85.c | 2 ++ bisect.c | 1 + blame.c | 1 + bloom.c | 2 ++ builtin/add.c | 3 +++ builtin/am.c | 2 ++ builtin/bisect.c | 2 ++ builtin/blame.c | 3 +++ builtin/branch.c | 3 +++ builtin/cat-file.c | 3 +++ builtin/checkout--worker.c | 2 ++ builtin/checkout-index.c | 3 +++ builtin/checkout.c | 2 ++ builtin/clean.c | 3 +++ builtin/clone.c | 3 +++ builtin/commit.c | 3 +++ builtin/describe.c | 2 ++ builtin/diff-files.c | 3 +++ builtin/diff-index.c | 2 ++ builtin/diff-tree.c | 2 ++ builtin/diff.c | 3 +++ builtin/difftool.c | 3 +++ builtin/fast-export.c | 3 +++ builtin/fast-import.c | 2 ++ builtin/fetch-pack.c | 2 ++ builtin/fetch.c | 3 +++ builtin/for-each-repo.c | 2 ++ builtin/fsmonitor--daemon.c | 2 ++ builtin/gc.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 4 +++- builtin/index-pack.c | 2 ++ builtin/log.c | 3 +++ builtin/ls-files.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/merge-file.c | 2 ++ builtin/merge-index.c | 2 ++ builtin/merge-ours.c | 3 +++ builtin/merge-tree.c | 2 ++ builtin/merge.c | 3 +++ builtin/mv.c | 2 ++ builtin/name-rev.c | 2 ++ builtin/pack-objects.c | 2 ++ builtin/pack-redundant.c | 2 ++ builtin/pack-refs.c | 2 ++ builtin/patch-id.c | 2 ++ builtin/prune.c | 2 ++ builtin/pull.c | 2 ++ builtin/push.c | 3 +++ builtin/range-diff.c | 2 ++ builtin/rebase.c | 3 +++ builtin/receive-pack.c | 2 ++ builtin/reflog.c | 2 ++ builtin/remote.c | 2 ++ builtin/repack.c | 2 ++ builtin/replay.c | 4 +++- builtin/rerere.c | 2 ++ builtin/reset.c | 3 +++ builtin/rev-list.c | 2 ++ builtin/rev-parse.c | 3 +++ builtin/revert.c | 2 ++ builtin/rm.c | 3 +++ builtin/shortlog.c | 2 ++ builtin/show-branch.c | 2 ++ builtin/show-index.c | 2 ++ builtin/sparse-checkout.c | 2 ++ builtin/stash.c | 2 ++ builtin/submodule--helper.c | 2 ++ builtin/tag.c | 3 +++ builtin/unpack-objects.c | 2 ++ builtin/update-index.c | 3 +++ builtin/update-ref.c | 2 ++ builtin/var.c | 3 +++ builtin/worktree.c | 2 ++ bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + cache-tree.c | 1 + chunk-format.c | 1 + color.c | 2 ++ column.c | 2 ++ combine-diff.c | 1 + commit-graph.c | 1 + commit-reach.c | 1 + commit.c | 1 + compat/fsmonitor/fsm-listen-darwin.c | 2 ++ compat/mingw.c | 1 + compat/poll/poll.c | 2 ++ compat/terminal.c | 2 ++ compat/win32mmap.c | 2 ++ compat/winansi.c | 2 ++ config.c | 1 + connect.c | 1 + convert.c | 1 + credential.c | 1 + csum-file.c | 1 + daemon.c | 1 + date.c | 2 ++ decorate.c | 3 +++ delta-islands.c | 1 + diagnose.c | 1 + diff-delta.c | 2 ++ diff-lib.c | 1 + diff-merges.c | 2 ++ diff-no-index.c | 2 ++ diff.c | 1 + diffcore-order.c | 3 +++ diffcore-pickaxe.c | 3 +++ diffcore-rename.c | 1 + diffcore-rotate.c | 3 +++ dir.c | 1 + entry.c | 1 + ewah/ewah_bitmap.c | 3 +++ ewah/ewah_io.c | 3 +++ ewah/ewah_rlw.c | 3 +++ fetch-pack.c | 1 + fmt-merge-msg.c | 1 + fsmonitor.c | 1 + gettext.c | 2 ++ git.c | 1 + gpg-interface.c | 1 + graph.c | 1 + grep.c | 2 ++ help.c | 1 + hex.c | 1 + http-backend.c | 1 + http-push.c | 1 + http-walker.c | 1 + http.c | 1 + imap-send.c | 1 + json-writer.c | 2 ++ kwset.c | 2 ++ line-log.c | 2 ++ list-objects-filter-options.c | 1 + list-objects-filter.c | 1 + list-objects.c | 1 + log-tree.c | 1 + ls-refs.c | 1 + mailinfo.c | 1 + mailmap.c | 1 + match-trees.c | 1 + mem-pool.c | 2 ++ merge-ll.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 1 + midx-write.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-file-convert.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + patch-ids.c | 2 ++ path.c | 1 + pathspec.c | 1 + pkt-line.c | 2 ++ preload-index.c | 1 + pretty.c | 1 + progress.c | 1 + pseudo-merge.c | 1 + quote.c | 2 ++ range-diff.c | 1 + reachable.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog-walk.c | 1 + reflog.c | 1 + refs.c | 1 + refs/debug.c | 2 ++ refs/files-backend.c | 1 + refs/iterator.c | 2 ++ refs/packed-backend.c | 1 + refspec.c | 1 + reftable/system.h | 2 ++ remote-curl.c | 1 + remote.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + run-command.c | 1 + scalar.c | 1 + send-pack.c | 1 + sequencer.c | 1 + serve.c | 1 + server-info.c | 1 + setup.c | 1 + shallow.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 2 ++ string-list.c | 2 ++ strvec.c | 2 ++ submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 2 ++ t/helper/test-bloom.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-config.c | 1 + t/helper/test-csprng.c | 2 ++ t/helper/test-drop-caches.c | 2 ++ t/helper/test-dump-fsmonitor.c | 1 + t/helper/test-dump-split-index.c | 1 + t/helper/test-dump-untracked-cache.c | 1 + t/helper/test-genrandom.c | 2 ++ t/helper/test-genzeros.c | 2 ++ t/helper/test-hash-speed.c | 2 ++ t/helper/test-mergesort.c | 2 ++ t/helper/test-parse-options.c | 2 ++ t/helper/test-path-utils.c | 1 + t/helper/test-reach.c | 1 + t/helper/test-ref-store.c | 1 + t/helper/test-revision-walking.c | 1 + t/helper/test-run-command.c | 2 ++ t/helper/test-string-list.c | 2 ++ t/helper/test-tool.c | 2 ++ t/helper/test-trace2.c | 1 + t/unit-tests/lib-reftable.c | 2 ++ t/unit-tests/t-example-decorate.c | 1 + t/unit-tests/t-prio-queue.c | 2 ++ t/unit-tests/t-reftable-readwrite.c | 2 ++ t/unit-tests/t-reftable-stack.c | 2 ++ t/unit-tests/t-trailer.c | 2 ++ t/unit-tests/test-lib.c | 2 ++ tag.c | 1 + tmp-objdir.c | 1 + trace.c | 1 + trace2.c | 2 ++ trace2/tr2_sysenv.c | 2 ++ trace2/tr2_tgt_event.c | 2 ++ trace2/tr2_tgt_perf.c | 2 ++ trailer.c | 1 + transport-helper.c | 1 + transport.c | 1 + tree-diff.c | 1 + unix-socket.c | 2 ++ unpack-trees.c | 1 + upload-pack.c | 1 + urlmatch.c | 2 ++ usage.c | 3 +++ userdiff.c | 1 + utf8.c | 2 ++ version.c | 1 + versioncmp.c | 1 + worktree.c | 1 + wrapper.c | 3 +++ ws.c | 3 +++ wt-status.c | 1 + xdiff-interface.c | 1 + xdiff/xdiffi.c | 1 + xdiff/xinclude.h | 2 ++ 265 files changed, 439 insertions(+), 2 deletions(-) diff --git a/add-interactive.c b/add-interactive.c index 49042b30261cc507d1094a007617764c1266eaed..d0f8c10e6fd460c67c564a1040d12780dfafbc69 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h" diff --git a/add-patch.c b/add-patch.c index 557903310deb23b2b8362bb4688b3d0cd2a1577b..7b598e14df016402ca41e1998466b5ba45623f90 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h" diff --git a/advice.c b/advice.c index 6b879d805c03049a2db67aaebfe3a1cd3aa2297c..c2da976543c946a02d532e6dc3fe53bec86ee2a2 100644 --- a/advice.c +++ b/advice.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "advice.h" #include "config.h" diff --git a/apply.c b/apply.c index a3fc2d5330f91c02af853039281d48fc17cf8e57..4a7b6120ac866e5bdae532da1d6946e94c7ec207 100644 --- a/apply.c +++ b/apply.c @@ -8,6 +8,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/archive.c b/archive.c index a7a92ff83937f86b3ec5c2c3f2d68f9b8cdbf6f1..b9c200cba618ebc642859f2b3c58731157ed0eba 100644 --- a/archive.c +++ b/archive.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/attr.c b/attr.c index c605d2c1703808668830947331fd4bc9c2a8fb54..67f11c96a524df4fc33817b0668b408c231767c4 100644 --- a/attr.c +++ b/attr.c @@ -7,6 +7,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/base85.c b/base85.c index bbacdca31b3bc3c1020d49e8e0c4c539a1232cbc..a6b827203965714bddbf673fecb0198b3ceef237 100644 --- a/base85.c +++ b/base85.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "base85.h" diff --git a/bisect.c b/bisect.c index d71c4e4b44b40706b8182bc8821bf711b5794376..1a9069c9ad8a19d6e0ee45415407c70f36885514 100644 --- a/bisect.c +++ b/bisect.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/blame.c b/blame.c index bf69768a7de6d2b989b85339a06af0a4763db4ad..a15ddf933352b0a7f997ce1beefdf473ffba0e17 100644 --- a/blame.c +++ b/blame.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "refs.h" diff --git a/bloom.c b/bloom.c index c4286341059991c00ae0f2728c4dc30a1ffa6b07..0c8d2cebf9c4ed92b7f38a749c0a089c6116a644 100644 --- a/bloom.c +++ b/bloom.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "bloom.h" #include "diff.h" diff --git a/builtin/add.c b/builtin/add.c index 7d353077921ad8850088f237ce96fc481039cd0d..ff6a7d7fd0868cafb98327ec4ffa81dcac66e4bb 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -3,6 +3,9 @@ * * Copyright (C) 2006 Linus Torvalds */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/am.c b/builtin/am.c index bfa95147cf403f9ce6b61afdd08077837fda2c48..f3b6546b3049a90fe32801087151e992623e7f17 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -5,6 +5,8 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "advice.h" diff --git a/builtin/bisect.c b/builtin/bisect.c index 8166d4abf532fbc95aaac71198e9722684ccf7f5..8b8d870cd1ef0845ae28aa9295a1d6c4db81d984 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "copy.h" #include "environment.h" diff --git a/builtin/blame.c b/builtin/blame.c index 6a7bb3b07248fbdfeb5ac3a05fed20fff4989a48..b33b44c89a431d45e05d9863f69c049ba5eec08c 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -4,7 +4,10 @@ * Copyright (c) 2006, 2014 by its authors * See COPYING for licensing conditions */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "color.h" diff --git a/builtin/branch.c b/builtin/branch.c index 05ba4cd7a6454d8753d983082807a06dd989cb48..349a6be6d686175bc75a7770ac59474a7224e448 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -4,7 +4,10 @@ * Copyright (c) 2006 Kristian Høgsberg * Based on git-branch.sh by Junio C Hamano. */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "color.h" diff --git a/builtin/cat-file.c b/builtin/cat-file.c index bfdfb51c7cb7b3cba47ae77b9041814fe9307407..825d7d83b24da068316618e3aceaf57c6461a13e 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -3,7 +3,10 @@ * * Copyright (C) Linus Torvalds, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "convert.h" diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c index ff6cdccc21dfd246f9bc37fab993e042cffd3960..b81002a1dfb4bbb05d2386ae9f03140bced1c82a 100644 --- a/builtin/checkout--worker.c +++ b/builtin/checkout--worker.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "entry.h" diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 6dd38eb05d49d6de451a063756b950122c626d21..a81501098d9fdbfd117ec9dcb76e9108b86b0ea3 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -4,7 +4,10 @@ * Copyright (C) 2005 Linus Torvalds * */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/checkout.c b/builtin/checkout.c index c449558e663a34b5aadfd9d18f3ca36d18432301..1f92e8297bba3bdbeb75a71de20607a9ac531e96 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "branch.h" diff --git a/builtin/clean.c b/builtin/clean.c index 9c48dd02711c6e60628ab6ac5402d4271ea1a378..053c94fc6bd12ac535a779b496f52b9547f95765 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -5,7 +5,10 @@ * * Based on git-clean.sh by Pavel Roskin */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/clone.c b/builtin/clone.c index 21721db28a12864621d27d2c70ee5c2598cccc0f..fd001d800c635e46bbc7027a8fdda2a8c9fbf069 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -7,7 +7,10 @@ * * Clone a repository into a different directory that does not yet exist. */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/commit.c b/builtin/commit.c index 71d674138c9a2b4e0967a95989f02363aa37beba..ef5e622c07746f86bb6d2fb2b909361bef1d1b10 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -4,7 +4,10 @@ * Copyright (c) 2007 Kristian Høgsberg * Based on git-commit.sh by Junio C Hamano and Linus Torvalds */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/describe.c b/builtin/describe.c index 7330a77b38ea7e4f8cf3c9ba14d247eaecd150f2..9045e583b7877276a1d62d6a972d2ab40a8ccdc0 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "environment.h" diff --git a/builtin/diff-files.c b/builtin/diff-files.c index e0e0ccec2343a285d85d6bf319395d1b98c042d2..604b04bb2c8694716fb3f6ba630d955959f6ceb9 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -3,7 +3,10 @@ * * Copyright (C) Linus Torvalds, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff-index.c b/builtin/diff-index.c index ad503624c027df90b9ea0ea8919e2aefd0df0b84..ebc824602e02e67cadfffa8022afef314d367bfa 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 4b6656bb9f79a6365c23668e075ad3a073f9e648..a4df2d0c130392f74b4da38dc5d0cd493d88f0e4 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff.c b/builtin/diff.c index 2fe92f373e9991489fcaeeba381bbfe017a5316a..a4fffee42c6c8c92bd8ba48246c25dae1f980b8d 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -3,7 +3,10 @@ * * Copyright (c) 2006 Junio C Hamano */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "ewah/ewok.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index 40e971e2259db4935e4cb253d69acbbbaf1616af..1914708a764d3f0637b327768a7f5cf8a6f96c13 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -11,7 +11,10 @@ * * Copyright (C) 2016 Johannes Schindelin */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/fast-export.c b/builtin/fast-export.c index e17f262e8e4d1c26f6235f1758febaef6fa2e1a0..a5c82eef1ded4dae5b4128781868e2c656eedfbd 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -3,7 +3,10 @@ * * Copyright (C) 2007 Johannes E. Schindelin */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 457cdb40cc820d33d968b76d61626d11758cf334..1cc5911bb0983ffe5c12d637fe72529de5917451 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "environment.h" diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 62e8c3aa6b8e8b2adc93edd5a3cbd9ecfb0bca75..bed2816c2d4a2167ecae6cb0c472493aa032aa94 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index 335083eb10728f384d677cde7a691440b8f4581f..b7457a7274bf9ede304c0a1c3c12deba3049bb56 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1,7 +1,10 @@ /* * "git fetch" */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index fae7f91cf15f7e5b5964d59bbc0f19b4f08146fc..7e36be9d8a55e9454668b935e8d13f52cdc0f62a 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index f3f6bd330b9ec9fa0c900c8e1f4b3963dfe8c8d6..029dc64d6c70fdc52b420053004729b794f4b322 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/gc.c b/builtin/gc.c index 364cb0eacf67764aca2f7f443b632ba6c2b8e722..a5879d6b6bdaaef86a06c62778c6ca8e79a7eae2 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -9,7 +9,10 @@ * * Copyright (c) 2006 Shawn O. Pearce */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "date.h" diff --git a/builtin/grep.c b/builtin/grep.c index 98b85c7fcaccc4b22dc2eacce074cdca99999f3d..d00ee76f24cfdea8ac15e08f812aa5868906940c 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -3,7 +3,10 @@ * * Copyright (c) 2006 Junio C Hamano */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "gettext.h" diff --git a/builtin/help.c b/builtin/help.c index 6a72d991a84d9f14ecb8a711a012ed544450ca1c..aa6bd6e412fe2341b234e6dad903787f8eb3b670 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -1,8 +1,10 @@ - /* * Builtin help command */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "exec-cmd.h" diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 95babdc5ea7e724ea6785e4c269869116b21c11f..54c7faf6ee3af8add04533c68196c6475d05d8c0 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "delta.h" diff --git a/builtin/log.c b/builtin/log.c index 368f6580a6eb8843592d3fc10d87bf85df03fb9e..cb41a035c6ead57e4d466ae0042a40435ebcde2f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -4,7 +4,10 @@ * (C) Copyright 2006 Linus Torvalds * 2006 Junio Hamano */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/ls-files.c b/builtin/ls-files.c index e016b0415d167e910f5b5b56ac8b06e6f49c130d..15499cd12b6bd5f97e24e3ca63f313fcc7f14e23 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -5,7 +5,10 @@ * * Copyright (C) Linus Torvalds, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "convert.h" diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index b8f7150ce9a5b47bbb15a13f392bdd8698efe2a9..52481f7f2ee75f0cc6a384fdc78ddd1ccad584df 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -4,6 +4,9 @@ * It just splits a mbox into a list of files: "0001" "0002" .. * so you can process them further from there. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "gettext.h" #include "string-list.h" diff --git a/builtin/merge-file.c b/builtin/merge-file.c index cb42865eb524bc9cd66f64fbe016c56df4869c87..7e315f374b2425d0c9c4069597c158670d13caab 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "diff.h" diff --git a/builtin/merge-index.c b/builtin/merge-index.c index a5b87ee3c5e3dec5aefd195848f566b7cb4fc8f3..342699edb77c97cd36eb2ac00d2495b3d64c6481 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "hex.h" #include "read-cache-ll.h" diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 1fcf53f0054e94e413aedd062189e3bc57079dcf..3672c6353f3219c48a2f10f9011cdd48d702265f 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -7,7 +7,10 @@ * * Pretend we resolved the heads, but declare our tree trumps everybody else. */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "builtin.h" #include "diff.h" diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index c5ed472967a692754b93af5eb1a96de698b8e704..3328144029a50894ef7fa3afe0f44133db406cda 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "tree-walk.h" #include "xdiff-interface.h" diff --git a/builtin/merge.c b/builtin/merge.c index 51038eaca849fa44cf7225d91c1aa828e8fc4d83..a2712a0babfafc94efbbba0040de332f2c6d25d8 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -5,7 +5,10 @@ * * Based on git-merge.sh by Junio C Hamano. */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/mv.c b/builtin/mv.c index 472a27873767b80cb63d84f05903292d6dd661e1..55a7d471dca0126c86add94f4577f0c9795fb0d6 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -3,7 +3,9 @@ * * Copyright (C) 2006 Johannes Schindelin */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h" diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 765eb20a9312e42eb5bdcec41526b3a9d6ea2393..beac166b5cb4149e2c29e8e4ccde7cfa2ceb2d61 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "environment.h" #include "gettext.h" diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 676a5867090cfd954e4e4c7f334b081ee4999cb0..a5d6f8db603c092b95a33674eb47d205aac0c8ce 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "environment.h" #include "gettext.h" diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index d2c1c4e5ec14711a54b8483106e9ed05fbe960bf..978c42aae7b86f0ce049eea0ac0b9bcfcf598348 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -5,7 +5,9 @@ * This file is licensed under the GPL v2. * */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h" diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 2d83c1ed2ac8c7fcf5568e46f56ae308447cfadf..71175a713a07a1e89050a869c92bd472bea15f87 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 93b398e391e00ca77c0cccc78c55044e4a194c15..56585757477911c96bbb9ef2cf3710691b8e744e 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/prune.c b/builtin/prune.c index 2b1de01339fc0446f4927bf58544e085b1669c3c..aeff9ca1b35c3f09c6bd334cbf52864df437fe05 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "commit.h" #include "diff.h" diff --git a/builtin/pull.c b/builtin/pull.c index edc56907aa252a092a63a5c963b62c9f1fb64aaa..6f8a32620c378f22f36cee4480d975d273bb04ff 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -7,6 +7,8 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/push.c b/builtin/push.c index 51c609f2089e64a54d824fdb243e5b49524f854e..7174efed6dce226a0dfbd117f996ce67b45a2625 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -1,7 +1,10 @@ /* * "git push" */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "branch.h" diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 1b33ab66a7b2013224f1c8f29854433d76776a0e..aa88a46d9ee3fcc61817834c770b3de352d78e7a 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "gettext.h" #include "object-name.h" diff --git a/builtin/rebase.c b/builtin/rebase.c index bbaca3c5d578359148cb469c0312717ef8774326..0498fff3c96d5756fe01bdc0547e470fd6bfb2bd 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -3,7 +3,10 @@ * * Copyright (c) 2018 Pratik Karki */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 9d2c07f68dafb6fce87cb59abc1cbf27db9aae09..c2e9103f112c1e37e9f030308633daf49eec1ecf 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/reflog.c b/builtin/reflog.c index 5a0c22f2f7e58733ce636619f3f19265b394bde5..08e99a22b04db7251c285ff56d70d5292ddd2723 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/remote.c b/builtin/remote.c index 1ad3e70a6b438a3c4446b16c02dc5c23c7fa14be..b2b13a7dd2acd466081e7bb49186d45f167dce9f 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/repack.c b/builtin/repack.c index d6bb37e84ae2e3715c48791b97f6798177629684..fd2ef166de085c117e1921874906cb5b9a481f99 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/replay.c b/builtin/replay.c index 2d12a4e403fa7d4499de0911191b545e31a1e95f..1afc6d1ee0cb738fa7fa3f2b5c8ce0dd7802e7da 100644 --- a/builtin/replay.c +++ b/builtin/replay.c @@ -2,9 +2,11 @@ * "git replay" builtin command */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" -#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "hex.h" diff --git a/builtin/rerere.c b/builtin/rerere.c index f7143c3f5d5670c83ff9995e756cd12ea7626863..706a9472133862a0dd513a4cee454403f5de748b 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/reset.c b/builtin/reset.c index 7154f88826d4c48680eb08466968fb05d4bd9f77..f34d22190f489fb522fb70584ae2d777a895afbf 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -7,7 +7,10 @@ * * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 3078787115f9f11b46799bc52e5f1a4cd5278cd1..9b41d0b62a4936b1ead43ccad1ba4b932e5db9ea 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "commit.h" diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 8401b4d7ab64f06b55fb055899d2eb36dc3810a2..949747a6b6c7f8ee854dd6027fd4bc7cee7f82be 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -3,7 +3,10 @@ * * Copyright (C) Linus Torvalds, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" diff --git a/builtin/revert.c b/builtin/revert.c index b7917dddd3e15e1d845c002bd31affdfd61d3cae..4b57c2c38378e02342e678cb8936b80637b98c5e 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "builtin.h" #include "parse-options.h" diff --git a/builtin/rm.c b/builtin/rm.c index eaff027258db4d7e7d1ca73f914d4bf756aa691d..12ae086a556ce3cfb522835cfa93e1d4c33b6e6c 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -3,7 +3,10 @@ * * Copyright (C) Linus Torvalds 2006 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/shortlog.c b/builtin/shortlog.c index c86b75d9813ad9207a773e95ce897b65929e86b9..1c46f13a16346c9a3ba41a92e0aec0428179b939 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "commit.h" diff --git a/builtin/show-branch.c b/builtin/show-branch.c index cd6bdf63bc103de7a4bffe61416e720f80cf3482..fce6b404e9265baafb4f173d2adad414b24984de 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "environment.h" diff --git a/builtin/show-index.c b/builtin/show-index.c index f164c01bbea4003ee97cdc4b3f7131b5b7def9ad..3152d3c74bf2ad43efb85ba08ec726cab3bc1d07 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "gettext.h" #include "hash.h" diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 34af5b259078e93ff4ae3381da4289d49ffa3b93..14dcace5f8ff7c80b32eb6aed7c0d3500a111457 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/stash.c b/builtin/stash.c index c212b1c0b2c7c55de2fdd5d7d7a247ce6f530960..a79d23f1a3d33c76fc6516330fe2fdad56413a01 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 19e587838132f26e2e10dc4a9f93f7b1c78cd49d..cfcaffee0d8ee5f97dc3e2d559caa82a5640b3e6 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "environment.h" diff --git a/builtin/tag.c b/builtin/tag.c index 5e1f904d352b752508a38cbb3a4382d9a049f175..9d4dfe8ab0cd94615f9d83fc2e78229497db96ac 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -5,7 +5,10 @@ * Carlos Rica * Based on git-tag.sh and mktag.c by Linus Torvalds. */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 02b8d02f63f0a216b52de38cb47e010c7bfccb07..2197d6d9332117636f31abadb5aff70424ba305d 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "bulk-checkin.h" #include "config.h" diff --git a/builtin/update-index.c b/builtin/update-index.c index 45b4a8b5556e08688c615577f4931a173eb7435d..74bbad9f87d86da0ae5520c39718bbe91098d5e0 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -3,7 +3,10 @@ * * Copyright (C) Linus Torvalds, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "bulk-checkin.h" #include "config.h" diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 670e7812d60ea88a20cd1c5cd113643095cb3be1..4d35bdc4b4b57937112e6c4c9740420b1f1771e5 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/var.c b/builtin/var.c index 2ecaed51b441963ddbfb6983403bd364d4fd72fd..74aa39dd6bfb261170152d7dd3dc3d724bec61bc 100644 --- a/builtin/var.c +++ b/builtin/var.c @@ -3,7 +3,10 @@ * * Copyright (C) Eric Biederman, 2005 */ + #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "attr.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 824dd71d643f112f384cde4de1373698c67de254..7dd46e7fc9000ff9ad4f104e5a63721c0a51a0fa 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -1,4 +1,6 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "builtin.h" #include "abspath.h" #include "advice.h" diff --git a/bulk-checkin.c b/bulk-checkin.c index 2753d5bbe4af3d1cae43df41426a3ee4a6974f41..4a70a70a951cfd1a488339a33bf3a76b5152a344 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h" diff --git a/bundle-uri.c b/bundle-uri.c index 0df66e28729e5cd8649850d641bd385500a94b45..38e1d66d79036bb9a5d4891d33459e2c1d397ca8 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bundle-uri.h" diff --git a/bundle.c b/bundle.c index 4773b51eb1df8057466c87f48445c49bc1f594ee..0501b74252e63e8278bc857517a5f168df7ce10e 100644 --- a/bundle.c +++ b/bundle.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "lockfile.h" diff --git a/cache-tree.c b/cache-tree.c index c595e8612044c7c909e87dbaf193416f3d6b1ca6..bcbcad3d61a09cb9d5a53a36f7dd12c36f3ec67b 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/chunk-format.c b/chunk-format.c index 2dde24e6a317ce82ac23f8ba8d1c9da6315bfca0..51b5a2c959a1cf2c7ff0939f1d13ef94029fca37 100644 --- a/chunk-format.c +++ b/chunk-format.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "chunk-format.h" diff --git a/color.c b/color.c index 227a5ab2f42ef99e578c837f59b2b40986a3c9e3..7df8862c710794044cdd1e44c50e7dbf64576af2 100644 --- a/color.c +++ b/color.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "color.h" diff --git a/column.c b/column.c index 50bbccc92ee86cf754a6b3250e52338a1870c990..93fae316b454ad3fe325f3e6227bb120d68c824d 100644 --- a/column.c +++ b/column.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "column.h" diff --git a/combine-diff.c b/combine-diff.c index 33d0ed7097569c57247f68c1f995a0bb23be0afa..641bc92dbdbc136b61d69527f4ad5386a2d2c6de 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h" diff --git a/commit-graph.c b/commit-graph.c index 5bd89c0acdd03df1328d75707136cfd2937582a5..7623a158c8e76c122466c54e8d68cd3519c5e381 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/commit-reach.c b/commit-reach.c index c3518aa3606f36d872ae096e6c3231d7dc6062a6..e3edd1199529792fafbaa03999c5b7b202f7cf1b 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/commit.c b/commit.c index cc03a9303623ad39a770c397d442cc4a7fad84c0..9c1f9fa2367e8c0930c8446e88b9368472dc6ade 100644 --- a/commit.c +++ b/commit.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h" diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c index dfa551459d2d1be3f3076c28ff77d497e95a4eda..58f3878a22666ea8a0bd5bfc215eadf06de747c0 100644 --- a/compat/fsmonitor/fsm-listen-darwin.c +++ b/compat/fsmonitor/fsm-listen-darwin.c @@ -23,6 +23,8 @@ #endif #endif +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "fsmonitor-ll.h" #include "fsm-listen.h" diff --git a/compat/mingw.c b/compat/mingw.c index 63f36c893bfe96f223daa6c4c18d20fa3a347c2e..408b1a310238a0077e1d239b832ace4719385975 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "win32.h" diff --git a/compat/poll/poll.c b/compat/poll/poll.c index afa6d245846a41f2232c1e6e633e2f015d419fd7..a2becd16cd0bd019aae9a4dba9ff5bf10cd5b1c6 100644 --- a/compat/poll/poll.c +++ b/compat/poll/poll.c @@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#define DISABLE_SIGN_COMPARE_WARNINGS + /* To bump the minimum Windows version to Windows Vista */ #include "git-compat-util.h" diff --git a/compat/terminal.c b/compat/terminal.c index d54efa1c5d6ebf63274b4878bc69be9db09a7124..7fe515b9c88e266f075043c0d48a6cbce5dacea2 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "compat/terminal.h" #include "gettext.h" diff --git a/compat/win32mmap.c b/compat/win32mmap.c index a4ab4cb939399ba1d7becc45fcda72902741f22d..e9519343167be1f98b127d27c8e05a1389345435 100644 --- a/compat/win32mmap.c +++ b/compat/win32mmap.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "../git-compat-util.h" void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) diff --git a/compat/winansi.c b/compat/winansi.c index 1b3f916b9fc409008e2c99da6ab73a0435892acf..ac2ffb78691a7d6bcae3b29e75019c8fb9339a67 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -4,6 +4,8 @@ #undef NOGDI +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "../git-compat-util.h" #include #include diff --git a/config.c b/config.c index a11bb85da303a7267e86a7a0b420fe22881e4d4f..969bd8630f86172912e4085a8103d9199642e701 100644 --- a/config.c +++ b/config.c @@ -7,6 +7,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/connect.c b/connect.c index 58f53d8dcbb87d4ec4e90a926ad3fadfec337d5d..10fad43e98652f8c441866c982103fc2a5a01321 100644 --- a/connect.c +++ b/connect.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/convert.c b/convert.c index c9a31eb4f03d6caa7bedba4b5237c42344f304c5..9cc0ca20ca07768282df966e45b3605bfc4f5d7b 100644 --- a/convert.c +++ b/convert.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/credential.c b/credential.c index 6dea3859ece3389c97dc773a2466eb291a1617e8..a995031c5f5d842f8e82d5e44e4f7a3e51a9e815 100644 --- a/credential.c +++ b/credential.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/csum-file.c b/csum-file.c index c203ebf11b344404311603246e76ad035b92e1a9..c14bacc7f9e5f56fcdb06a3abc7ac9babc45041a 100644 --- a/csum-file.c +++ b/csum-file.c @@ -9,6 +9,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h" diff --git a/daemon.c b/daemon.c index a40e435c6370cf1cfd2cef082184445f31748643..68789ceb222eeb389d58998fd00388f289868fc3 100644 --- a/daemon.c +++ b/daemon.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/date.c b/date.c index bee9fe8f102596cd2f5cae946a907dd63862ee13..a1b26a8dce697cbaea58b34e91d08ea446fba352 100644 --- a/date.c +++ b/date.c @@ -4,6 +4,8 @@ * Copyright (C) Linus Torvalds, 2005 */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "date.h" #include "gettext.h" diff --git a/decorate.c b/decorate.c index 69aeb142b45e9fee08d61dace73f6dc2bce1c2d0..e161e13772891f6566b1063f7b7410e6adaad7bc 100644 --- a/decorate.c +++ b/decorate.c @@ -2,6 +2,9 @@ * decorate.c - decorate a git object with some arbitrary * data. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "object.h" #include "decorate.h" diff --git a/delta-islands.c b/delta-islands.c index 844355125935ad64614f1cabbfd15a8e58ce185b..1c465a6041914538bcb8be51c500653d8fa1a626 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object.h" diff --git a/diagnose.c b/diagnose.c index cc2d535b60d7c886640f458f062cf5720f9cf36b..f340996e27b994c1ab58654bf248305a45833adc 100644 --- a/diagnose.c +++ b/diagnose.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diagnose.h" diff --git a/diff-delta.c b/diff-delta.c index 77fea08dfb04d3a6ec12e11dbd321084d9028722..a4faf73829be00c1e5d3d12d56a87085cc1abcfd 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -11,6 +11,8 @@ * published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "delta.h" diff --git a/diff-lib.c b/diff-lib.c index 3cf353946f51ca4ef96ab4a2add7cd97eacf258e..c6d3bc4d37d557dd9312c0ac7d56e80ffab15dbd 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/diff-merges.c b/diff-merges.c index 45507588a2797b8d3618e3a19a2854d12051157b..0adfe7f5c06b586500361f47ed0d05124c8c9f70 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "diff-merges.h" diff --git a/diff-no-index.c b/diff-no-index.c index c5fb06e6d1a90d60de54ed5a31573fd4998c4623..6f277892d3aef64910809f39c6faaf43d9778d60 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -4,6 +4,8 @@ * Copyright (c) 2008 by Junio C Hamano */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "abspath.h" #include "color.h" diff --git a/diff.c b/diff.c index dceac20d18f03dfb72632f4466ed5a8a8e51bc14..97417cc2a185b520a6af0b11425132ab5c4c54af 100644 --- a/diff.c +++ b/diff.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/diffcore-order.c b/diffcore-order.c index 912513d3e67a9b277dd24a93992c456a061b196f..ec59d3d9bcc85753352f5faba7982da1c4455b95 100644 --- a/diffcore-order.c +++ b/diffcore-order.c @@ -1,6 +1,9 @@ /* * Copyright (C) 2005 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "diff.h" diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 43fef8e8ba4e8273bcd664ce60d418e092b7931c..a52d569911c48e1527cf7f3dc6e546d8449bd32f 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -2,6 +2,9 @@ * Copyright (C) 2005 Junio C Hamano * Copyright (C) 2010 Google Inc. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "diff.h" #include "diffcore.h" diff --git a/diffcore-rename.c b/diffcore-rename.c index 1b1c1a6a1fabb6c4a45ccf763c4155108373b7f4..08ebb1fc3d087ffe666f747ebf5301a8f6f8b2d8 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -4,6 +4,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h" diff --git a/diffcore-rotate.c b/diffcore-rotate.c index 73ca20b331253c5282506747b8aca2fd145bfa3d..941a022d5e6e79592967166f1ffc7fcd62086010 100644 --- a/diffcore-rotate.c +++ b/diffcore-rotate.c @@ -2,6 +2,9 @@ * Copyright (C) 2021, Google LLC. * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "diff.h" diff --git a/dir.c b/dir.c index 7f35a3e3175355bad4f64bf4e65cf05d9bd6356f..5b2181e5899ce951791aa5e46ccdbb2d71ce6144 100644 --- a/dir.c +++ b/dir.c @@ -7,6 +7,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/entry.c b/entry.c index 3143b9996bf491f7ceddf2d39de741ed5c35ef11..93bd6a78ffac4ba3b5b6ac64ec0fd23c9793e56f 100644 --- a/entry.c +++ b/entry.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h" diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c index 8785cbc54a821cd2cb89ba0226a29a233d8c19ff..9be9bb3758cf0bc267d09d59b3b23a127b3e4721 100644 --- a/ewah/ewah_bitmap.c +++ b/ewah/ewah_bitmap.c @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h" diff --git a/ewah/ewah_io.c b/ewah/ewah_io.c index 9035ee65ea8db67c373492fcb1755f8b1499679e..da005523b0531c355bd99fb3d4d794af1b098d55 100644 --- a/ewah/ewah_io.c +++ b/ewah/ewah_io.c @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "ewok.h" #include "strbuf.h" diff --git a/ewah/ewah_rlw.c b/ewah/ewah_rlw.c index 5093d43e2f00e2bec4290c1fe918d8a0593e2e8c..76b4c6c19eda358a99ce398e5085b6132bc30371 100644 --- a/ewah/ewah_rlw.c +++ b/ewah/ewah_rlw.c @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h" diff --git a/fetch-pack.c b/fetch-pack.c index fe1fb3c1b7c8c39e99270cecff5309995806bf05..961cbe2fe338f459553aeb260f0a8b4362a32e6c 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h" diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c index 6acb37b48020c1f0ce2d5034c478cbb783409502..5b63c3b088a17a1563494cc2811f10649d196d30 100644 --- a/fmt-merge-msg.c +++ b/fmt-merge-msg.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/fsmonitor.c b/fsmonitor.c index 309a2541cbeebe142096176c213056872a0aae6f..98b2b476f086842e67509a9bc0044bfec5fd12fd 100644 --- a/fsmonitor.c +++ b/fsmonitor.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/gettext.c b/gettext.c index 57facbc21ec2545e5bdeb1e738445ad403f419b4..8d08a61f8487dc30559e5e5d6d31cf06a92789e1 100644 --- a/gettext.c +++ b/gettext.c @@ -2,6 +2,8 @@ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "abspath.h" #include "environment.h" diff --git a/git.c b/git.c index 46b3c740c5d665388917c6eee3052cc3ef8368f2..cd33b1f405c64cf1d08c40e3251630abae4b005b 100644 --- a/git.c +++ b/git.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/gpg-interface.c b/gpg-interface.c index 07335987a6b9ceaf6edc2da71c2e636b0513372f..a67d80475bf9d8452de0c3ae9bb08ceeb4c11c4b 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/graph.c b/graph.c index bf000fdbe11f09a771a0b8a8254004d8348d7895..52205f75c37cf3467ac5e9de1574425d6c203359 100644 --- a/graph.c +++ b/graph.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/grep.c b/grep.c index e95cded4149d33d33a9d2027939df4eefba535d1..4e155ee9e66367e00e72c4541aefb2d755d59f25 100644 --- a/grep.c +++ b/grep.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "gettext.h" diff --git a/help.c b/help.c index 8a830ba35c6fd1377213e2ed40846f3d46dba363..5483ea8fd293fc9c072f4be33ec0e5778a3020d4 100644 --- a/help.c +++ b/help.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/hex.c b/hex.c index 5ca78a7744113b15ecb154f08ac0ecb524c86d66..e62406c182ae54ad9475424f0be00e2d9a6bcaab 100644 --- a/hex.c +++ b/hex.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h" diff --git a/http-backend.c b/http-backend.c index 73eec4ea3d844345ab607488490227d3dbacc02a..33cf3782826f6cca696ecb8c85cea7f4a0829b46 100644 --- a/http-backend.c +++ b/http-backend.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/http-push.c b/http-push.c index 4d24e6b8d4e092591d5687be2bdb3840fa74893c..a5e8c3e9003074c125f562769b26ffe11985c0c3 100644 --- a/http-push.c +++ b/http-push.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/http-walker.c b/http-walker.c index 43cde0ebe51c3fa311e9b42fb0608763e777b2f5..7918ddc0968dd3bef50da6d76e5b1a9e61279112 100644 --- a/http-walker.c +++ b/http-walker.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h" diff --git a/http.c b/http.c index bc64e577998a77342a7a7b9d19295ceb953041f4..88bf3ba0a36d5fbde54e1ee9444e8997c4856189 100644 --- a/http.c +++ b/http.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h" diff --git a/imap-send.c b/imap-send.c index 25c68fd90d72453a720bde86f480107ea0cf827b..68ab1aea837c3549a56675407edae19e12c6bfdf 100644 --- a/imap-send.c +++ b/imap-send.c @@ -22,6 +22,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/json-writer.c b/json-writer.c index 25b9201f9c0bce3c7f268301250cbe42f630fdd1..8c5187e9fdda81455531c6ad42f7f2d4d8b81a9b 100644 --- a/json-writer.c +++ b/json-writer.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "json-writer.h" diff --git a/kwset.c b/kwset.c index 695e47b7ccfaf1aaa0e866933dffa8b7fcc51868..1714eada608b86b14acf82ec4832c3c4d7e9205c 100644 --- a/kwset.c +++ b/kwset.c @@ -32,6 +32,8 @@ String Matching: An Aid to Bibliographic Search," CACM June 1975, Vol. 18, No. 6, which describes the failure function used below. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "kwset.h" diff --git a/line-log.c b/line-log.c index bc67b75d10d34edc726c00c887d57016e40f3a00..628e3fe3ae18dcbc93adf233057e5ac9faf7e902 100644 --- a/line-log.c +++ b/line-log.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "diffcore.h" #include "line-range.h" diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index fa72e81e4ad130590546a0003de67648bc1736c6..d1f7c56e6f973062ce69312718dbda79f4b944cd 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/list-objects-filter.c b/list-objects-filter.c index dc598a081bb25283a1f0d287baf3805da2955106..4afa3029dca926baff81fba4a553b31dfed551a1 100644 --- a/list-objects-filter.c +++ b/list-objects-filter.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h" diff --git a/list-objects.c b/list-objects.c index 985d008799d0bb20a56ccaf6f821c699125373f6..2075c69496cde719e3f8deeb05dd5e14f589f036 100644 --- a/list-objects.c +++ b/list-objects.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h" diff --git a/log-tree.c b/log-tree.c index 83cc4b1cfb798c923a8147364e63ceaebf1dacf8..d08eb672a933900558b305b31860f6753a470bf0 100644 --- a/log-tree.c +++ b/log-tree.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit-reach.h" diff --git a/ls-refs.c b/ls-refs.c index c824aea7146a3e825c54b62bc7a77da82365940f..89a796a3561502893e160917bf04fb66af54397b 100644 --- a/ls-refs.c +++ b/ls-refs.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/mailinfo.c b/mailinfo.c index d1f42bd7e3e692aceb6806cedd71af1546c8aa4e..aa263bf490881daa915a03a681c00979f138d09b 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/mailmap.c b/mailmap.c index 9f9fa3199a85f82fd57381086943059ed0a9ff3f..f35d20ed7fd1ef251e65419805fec49a3c30bcbb 100644 --- a/mailmap.c +++ b/mailmap.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/match-trees.c b/match-trees.c index 147b03abf18f65a7c0a0f262960e4a4b740d27b7..a1c8b91eaef8fa7c1714e6c2b4ec78ac365ae99d 100644 --- a/match-trees.c +++ b/match-trees.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h" diff --git a/mem-pool.c b/mem-pool.c index a3ba38831d94d6fcde4de9c19972c3df7a369ee2..62441dcc71968f3aaaccdac4dea3cb4ff2f18708 100644 --- a/mem-pool.c +++ b/mem-pool.c @@ -2,6 +2,8 @@ * Memory Pool implementation logic. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "mem-pool.h" #include "gettext.h" diff --git a/merge-ll.c b/merge-ll.c index 62fc625552dcd3a598bd2de80ae93c96ea5c98cf..b2dc26da4fe92d2c922435fa5dad381f996ef26b 100644 --- a/merge-ll.c +++ b/merge-ll.c @@ -5,6 +5,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/merge-ort.c b/merge-ort.c index 11029c10be3d2bed33b7d7cf49e83a183fe56a18..46e78c3ffa68e62dec08e8619800fcae28a9dd9d 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -15,6 +15,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-ort.h" diff --git a/merge-recursive.c b/merge-recursive.c index ed64a4c537ca8925c0336164a5ae30a4fd7cd6fe..5dfaf32b2c18809209da4a0fa306b23b7e08c98e 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -5,6 +5,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-recursive.h" diff --git a/merge.c b/merge.c index fe3efa4b24b7d10514cda3c3dfa6a06093dfc1f4..da04fff3baa6b64e2581ac86186b99db914a6858 100644 --- a/merge.c +++ b/merge.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/midx-write.c b/midx-write.c index b3a5f6c51669349dc26edf94b5c25b8fea033322..f1a6f83baee834ab9b40ee2e566b515d06cbb4c5 100644 --- a/midx-write.c +++ b/midx-write.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/midx.c b/midx.c index e82d4f2e65496b3e26c6e21c42e274406111aa3b..504e03327ab0dd135e4772ec8b9de4bdd77da3f5 100644 --- a/midx.c +++ b/midx.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/name-hash.c b/name-hash.c index 95528e3bcd2a3e36cf72faa7ed629c3175492bbb..d66de1cdfd563336f468817306664dea9a4a9e7a 100644 --- a/name-hash.c +++ b/name-hash.c @@ -7,6 +7,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/notes-merge.c b/notes-merge.c index dadbbabf86da6a3acf82c1a292700b483b5dfb5d..8d701ed428aa621cc21871c49a0776bccf4be916 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/notes.c b/notes.c index f4f18daf07ec5257130c515d0b80166de9c4bde5..f5344230505afbdbbac1519e7605d541e6f94f11 100644 --- a/notes.c +++ b/notes.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/object-file-convert.c b/object-file-convert.c index 3887d6d57b7965074702829403b36518ab7022e6..eba71955cf7b8821b9e6d0129c7542cf10c652a8 100644 --- a/object-file-convert.c +++ b/object-file-convert.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/object-file.c b/object-file.c index 891eaa2b4bee2e6b5da1211c950fafa9aa40a807..5b792b3dd42cecde43a1b18abc164fd368cbcd69 100644 --- a/object-file.c +++ b/object-file.c @@ -8,6 +8,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/object-name.c b/object-name.c index c892fbe80aa7173dfcc1995de5a75bc322c6adb7..d396778efc02b4b3818c3ba8d34e209c537c4129 100644 --- a/object-name.c +++ b/object-name.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-name.h" diff --git a/object.c b/object.c index 94ea8fb8d2c4f9877e0b89759e890c44d6392698..100bf9b8d12beb1bdaa0c222e51e920471d891c7 100644 --- a/object.c +++ b/object.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 49758e2525f01afc4c31a97a8128e5d92f7f7939..4f8be53c2bd75f83a0555e2a5510c2bbca07b36d 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/pack-bitmap.c b/pack-bitmap.c index 683f4670519ff3a96f0c6c5a1ac36ba64ad6e2b0..bbcf7e9401e43bbd7df1e764c96c62b9aa47ec2f 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/pack-check.c b/pack-check.c index e883dae3f24bb4c04c2f0ddf520e0e91bd209f07..8d9f6da7ce45f8a1bd83e0768d47d7e5ebe88493 100644 --- a/pack-check.c +++ b/pack-check.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/packfile.c b/packfile.c index 9560f0a33c6f26d0d14dfe81320f5a760cc585df..f38c207fb6b15ea52440c850d9dee103f5dbd940 100644 --- a/packfile.c +++ b/packfile.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/parallel-checkout.c b/parallel-checkout.c index 01736f1352a5dc58886dfd3cb05a46d2a32e829d..7cc6b3052819ac640968a6dd01c0c7db1c7accb0 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/patch-ids.c b/patch-ids.c index a5683b462c6e7692ceff3218213b9747a9b6cc02..8b891980732fd33f89bb8b1ef1bf9ad6717120ec 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "diff.h" #include "commit.h" diff --git a/path.c b/path.c index 93491bab141c5633691f5172e450052800da63ed..1f210048047b72370d87a6161c4af0142c17cf6a 100644 --- a/path.c +++ b/path.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/pathspec.c b/pathspec.c index 0fc6f84a6e629858ca6d1e65a3c1af352d043e95..89663645e13dd49499b7f6cf8b1fdf663145981d 100644 --- a/pathspec.c +++ b/pathspec.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/pkt-line.c b/pkt-line.c index 24479eae4dbe2a44b15a10f86b15bfc6f865bb34..90ea2b6974b1d0957cfdc5e2f9a2c30720723f12 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "copy.h" #include "pkt-line.h" diff --git a/preload-index.c b/preload-index.c index 7926eb09a695f7c5ea0e0de1e48690caf6c6fa6f..ab94d6f39967ea4358f51ff8384aa60927bfe259 100644 --- a/preload-index.c +++ b/preload-index.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pathspec.h" diff --git a/pretty.c b/pretty.c index 098378720a44c71cdec69f1b3cb4485806357e2a..0bc8ad8a9a8bc1b0002e3634dbf9588569dc61bd 100644 --- a/pretty.c +++ b/pretty.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/progress.c b/progress.c index 0d44c18edc0c522c3d8fb4769c26009439cc61ce..a8fdfceb5cd12879ebac80589bb5b5e8661c2627 100644 --- a/progress.c +++ b/progress.c @@ -10,6 +10,7 @@ #define GIT_TEST_PROGRESS_ONLY #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pager.h" diff --git a/pseudo-merge.c b/pseudo-merge.c index bb59965ed26d5bbddb17149f8460bfe175722898..971f54cfe1a895aed00f6d0a65c62aafc83a0cc8 100644 --- a/pseudo-merge.c +++ b/pseudo-merge.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pseudo-merge.h" diff --git a/quote.c b/quote.c index 3c05194496f65f879f437abd29823986ef118f47..b9f6bdc775c4686c192b8b339adac7e664af8e0f 100644 --- a/quote.c +++ b/quote.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "path.h" #include "quote.h" diff --git a/range-diff.c b/range-diff.c index 10885ba301389754869b7cdc73f7596e6cb069ea..eea172bcc993a634bbec1d73ac296374b38d232f 100644 --- a/range-diff.c +++ b/range-diff.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/reachable.c b/reachable.c index 3e9b3dd0a46cb410b8f032784115c78084c5dbd9..34079e1ae9b20313c86c7962f518aa266b7153ea 100644 --- a/reachable.c +++ b/reachable.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/read-cache.c b/read-cache.c index 01d0b3ad22565da67fbba9c1aa0fd3cb4e97589d..15d79839c205176f9161f537aa706dac44b3023c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -5,6 +5,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h" diff --git a/ref-filter.c b/ref-filter.c index 84c603610723eacf15349e0c5809a771de418bfd..23054694c2c96014ef411a225c6c941eb8d2d56c 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/reflog-walk.c b/reflog-walk.c index c7070b13b004b7c207a3f99740999f582c15c1b0..b53628ed5372235d840ce481d22a90cf10ad5c8a 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/reflog.c b/reflog.c index aeab78c9b71573c0e043f2de833a7e97580d20f6..1b5f031f6d787f3e454471252c7a600dcb765a15 100644 --- a/reflog.c +++ b/reflog.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/refs.c b/refs.c index 762f3e324d59c60cd4f05c2f257e54de8deb00e5..02fb4b7cb2cd1ce9b2cfbe61b420eb0fe5b80e0d 100644 --- a/refs.c +++ b/refs.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/refs/debug.c b/refs/debug.c index a893ae0c90bbbd3b567f75b86fd51059efcd5cf4..89fbd593204cb2e0cc6c74bad11956f105089f82 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "hex.h" #include "refs-internal.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index 64f51f0da905a9a8a1ac4109c6b0a9a85a355db7..14aaf8cffc3cb8c37bc2debe5996de126bcdcb76 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../abspath.h" diff --git a/refs/iterator.c b/refs/iterator.c index 8e999d81fc638fc52b470819a79ece7ee08842cb..d25e568bf0b7684611ea74b1bb658ad4b816cc2d 100644 --- a/refs/iterator.c +++ b/refs/iterator.c @@ -3,6 +3,8 @@ * documentation about the design and use of reference iterators. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "refs.h" #include "refs/refs-internal.h" diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 3406f1e71dd81174469f6f390129ca5ddd1c8878..a7b6f74b6e35f897f619c540cbc600bbd888bc67 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../config.h" diff --git a/refspec.c b/refspec.c index 994901f55b8e3723dcc21e3c33d3e401960fe7fd..6d86e04442ca2132c318616fd6ebd4b94a28e4eb 100644 --- a/refspec.c +++ b/refspec.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/reftable/system.h b/reftable/system.h index 5ec85833434727c720abb4ba00dc7a22c8ac5d26..d3b8a55f4be3c5ca6e0278cf4334e45172a6be03 100644 --- a/reftable/system.h +++ b/reftable/system.h @@ -11,6 +11,8 @@ license that can be found in the LICENSE file or at /* This header glues the reftable library to the rest of Git */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "lockfile.h" #include "tempfile.h" diff --git a/remote-curl.c b/remote-curl.c index 9a71e0430188475d44f8118b361416d9d02ecb83..a24e3a8b9abcc9f01d862a18dbd237fdad8d3d3a 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h" diff --git a/remote.c b/remote.c index 10104d11e3cba1908cd35f22b54e167755770404..a6d8c15189d03d3b3ac1c749bebdce3fd4ed558c 100644 --- a/remote.c +++ b/remote.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/rerere.c b/rerere.c index d01e98bf653b043ce949f291bec9ad790f057eff..e7fa6426b399e0337435003e2816ea9d021a379b 100644 --- a/rerere.c +++ b/rerere.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/resolve-undo.c b/resolve-undo.c index 8c9911affbe409cdc635f7fd1270225c30a51236..b5a9dfb4acc51173b1d9b7b1b044a1fc611d3f74 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h" diff --git a/revision.c b/revision.c index 347dabf7f9a1a87765150ec998deae9b6709b5f6..a152916861bbe1f479d2bb0cf0878a2fda171273 100644 --- a/revision.c +++ b/revision.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/run-command.c b/run-command.c index 94f2f3079ff754a0445e1c443c4991691879d04e..402138b8b53ae8e74897cbafeaaf226850135f65 100644 --- a/run-command.c +++ b/run-command.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "run-command.h" diff --git a/scalar.c b/scalar.c index ac0cb579d3f00551fc0afe75f724208c367d8dc3..87bb30991bf768534a988608d9b194dc8b5ba78a 100644 --- a/scalar.c +++ b/scalar.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/send-pack.c b/send-pack.c index 6677c44e8acd19f16706ad2d78f72fee889daa55..6e68074e50dbc48622b0e63e56cfbe3560dcd605 100644 --- a/send-pack.c +++ b/send-pack.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/sequencer.c b/sequencer.c index 459066e43baa73838a4929d8dcd359e8d25cd883..407ee4e90fea685a53504265ce528cb3b8443330 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/serve.c b/serve.c index d674764a25d4cdb68a89cfcf991cbee94fa8cfe3..1e08fa92510c5f78e675aa0e91c8505018d5dcfa 100644 --- a/serve.c +++ b/serve.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h" diff --git a/server-info.c b/server-info.c index c5af4cd98a6696a15cda42a4a41a76bb729db93a..ef2f3f4b5c7b04c46520b2fd9d4352b806658f40 100644 --- a/server-info.c +++ b/server-info.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h" diff --git a/setup.c b/setup.c index 7b648de0279116b381eea46800ad130606926103..8084465197cb7fe3f91389458b44f619612c8930 100644 --- a/setup.c +++ b/setup.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/shallow.c b/shallow.c index 4bb1518dbc80747d2641a5a80291ab159270804c..82a8da3d730b2f4f6bda462c8ac347f0b10da993 100644 --- a/shallow.c +++ b/shallow.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h" diff --git a/sideband.c b/sideband.c index 02805573fab85d602a83e5bc54dfb5ba404ab44b..251e9615ed0239d77556d4ff92fe5570f083d6fe 100644 --- a/sideband.c +++ b/sideband.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "color.h" diff --git a/sparse-index.c b/sparse-index.c index 2107840bfc56714ec4cbe31253035b063e363ed7..5634abafaa07ed77ad24d10457b7f1f3ec6108ec 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/split-index.c b/split-index.c index cfbc773e6cd3b11ea5f47ab92310a56c30f6971c..4c74c4adda45d611bfad0a4d9aa5cb2f0eeb2212 100644 --- a/split-index.c +++ b/split-index.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/strbuf.c b/strbuf.c index 3d2189a7f648dcba44e85aa1b2047b00b3f871df..8ddd4b06c595ac3f8b38a65d3e1ca4b340fddf9f 100644 --- a/strbuf.c +++ b/strbuf.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h" diff --git a/string-list.c b/string-list.c index 954569f381d8d7ea2e1c6f1333b1e8379ffe2fe8..bf061fec563d742b79c4ab2ffc1734da4f6c4d9e 100644 --- a/string-list.c +++ b/string-list.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "string-list.h" diff --git a/strvec.c b/strvec.c index d1cf4e2496a564c878f4b81207efe275abed72cf..e8f87ab3a60e5912f910b3107bfde70a1f809c3e 100644 --- a/strvec.c +++ b/strvec.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "strvec.h" #include "strbuf.h" diff --git a/submodule-config.c b/submodule-config.c index 9c8c37b25986aabc7098b53953ac1ecf85375ed0..a25059ed7f8d8fbacf97d2a3a6ea5cf18da2ecfe 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h" diff --git a/submodule.c b/submodule.c index 7ec564854d03398ff8acf4e280d48125c47f2876..ed1441923d9e3f4f98e476c5899f54c6ed445ae2 100644 --- a/submodule.c +++ b/submodule.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/symlinks.c b/symlinks.c index b29e340c2da43e9ac35adcda05322b1e068017ca..9cc090d42c089f82178de90514d592cf70a5822f 100644 --- a/symlinks.c +++ b/symlinks.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "setup.h" diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index 97541daf7157b1a8adda5fb97f839208a5e99fd0..8d4ef441312e2059058c6465b0c084e6f31921cc 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "bloom.h" diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c index 5cdef3ebefc6281499f80a01456b8cf6c6944d5c..3ae45cec3be6390c8220dab95a403c573ce719a2 100644 --- a/t/helper/test-cache-tree.c +++ b/t/helper/test-cache-tree.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "gettext.h" diff --git a/t/helper/test-config.c b/t/helper/test-config.c index 33247f0e92e01ddf24e219894fea6b3aa66de26e..75e028ab2a04497d3438bf46e936e0c4eb44ae8d 100644 --- a/t/helper/test-config.c +++ b/t/helper/test-config.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "config.h" diff --git a/t/helper/test-csprng.c b/t/helper/test-csprng.c index 65d14973c520ea739543080d6d6fe8c1641d9f34..ea9b9b656307d32bdc1f2e15a91793b1dda9c463 100644 --- a/t/helper/test-csprng.c +++ b/t/helper/test-csprng.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "git-compat-util.h" diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c index 73e551cfc222695c31bfc6897d12dc025c87b439..7055d94354fbfa1dda8c7bafbcdd8f426786ec05 100644 --- a/t/helper/test-drop-caches.c +++ b/t/helper/test-drop-caches.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "git-compat-util.h" diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c index 1b7f37a84fb2ac1bfc110376e18d4ed4e2fd3d3c..7b78f9d182d89dae4878e0ecf3e0bd99f79bfd39 100644 --- a/t/helper/test-dump-fsmonitor.c +++ b/t/helper/test-dump-fsmonitor.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "read-cache-ll.h" diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c index a6720faf9ca99d4e523cb2ce056b74867bd4a024..f31b44a7677a96ed2f2eec870ded3af8d1b2a79e 100644 --- a/t/helper/test-dump-split-index.c +++ b/t/helper/test-dump-split-index.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h" diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c index b2e70837a90a94d628a3d027fe28092a8ba348d9..ae057958000e41959ec452c6577287fbd8475173 100644 --- a/t/helper/test-dump-untracked-cache.c +++ b/t/helper/test-dump-untracked-cache.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "dir.h" diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c index 99b8dc1e2d9cdc3a0e0f464fdeee0f94733d00d1..5b51e6648d8e698b09f400efcf67a0708c226e9d 100644 --- a/t/helper/test-genrandom.c +++ b/t/helper/test-genrandom.c @@ -4,6 +4,8 @@ * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "git-compat-util.h" diff --git a/t/helper/test-genzeros.c b/t/helper/test-genzeros.c index 47af843b6816005f2370fb130bc9f2bde873c029..b895436a32de602c3cdf2a2d491c7a4b1e76df9d 100644 --- a/t/helper/test-genzeros.c +++ b/t/helper/test-genzeros.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "git-compat-util.h" diff --git a/t/helper/test-hash-speed.c b/t/helper/test-hash-speed.c index 7de822af5168d12cfd1146f7ab8eacc02273f570..81a446dd64e4134585f90a01c28e95edf0b059de 100644 --- a/t/helper/test-hash-speed.c +++ b/t/helper/test-hash-speed.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "hash.h" diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c index 328bfe29778c46094579327c995a0d56d7435f10..791e12879388de328b2448d4b3f55cfe4ab87a97 100644 --- a/t/helper/test-mergesort.c +++ b/t/helper/test-mergesort.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "mem-pool.h" #include "mergesort.h" diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 5da359486cdcb353b277653111bc201c5f82851e..25ba08a7c37ea1915534d5c52f41c6e15473453c 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "parse-options.h" #include "strbuf.h" diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c index 3129aa28fd2859125c78da3fd286ea609db706e2..72ac8d1b1b011de48ddc62dfae4b21f4132559a0 100644 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "abspath.h" diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c index 84deee604adb4ba28150de8356ad0fe318ecbb35..25c232464df1639766c2db013d6e5b4b7021cbb2 100644 --- a/t/helper/test-reach.c +++ b/t/helper/test-reach.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h" diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index 240f6fc29d7f1bb20658deee467bcb46ac3407b2..c5c4cb142dde77667e9cc108def294e4712683f0 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h" diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c index 071f5bd1e21974ba2104a76305a5156ee2c2961f..3b931a34a2a2198287fb7f0175ac11e6f2ba0059 100644 --- a/t/helper/test-revision-walking.c +++ b/t/helper/test-revision-walking.c @@ -9,6 +9,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h" diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c index 61eb1175fe53f482b92bd4cda75ea34ce3d62cba..3719f23cc2d02f0a6c1760a3263bbc6a0f335fcb 100644 --- a/t/helper/test-run-command.c +++ b/t/helper/test-run-command.c @@ -8,6 +8,8 @@ * published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "run-command.h" #include "strvec.h" diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c index e2aad611d1c8bbc110c877c7d7555c046b82e7db..6f10c5a43540b8001cf878a6cb0a0bb11bdee882 100644 --- a/t/helper/test-string-list.c +++ b/t/helper/test-string-list.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-tool.h" #include "strbuf.h" #include "string-list.h" diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 1ebb69a5dc4c1716fe21e1640eecf5f5f05c130d..b626f64eca47cce16abdd9915462af46c66b0044 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "test-tool.h" #include "test-tool-utils.h" diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index c588c273ce73f18ab487d6125d7387601a86bb21..415df078c1638a3a1fdf5b555efbef63e68be43b 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "strvec.h" diff --git a/t/unit-tests/lib-reftable.c b/t/unit-tests/lib-reftable.c index 2ddf480588d36ae0bd2e45870dc9739acedd93ae..7bc742e4f7a420eb35c0b15e03a5136751a1948f 100644 --- a/t/unit-tests/lib-reftable.c +++ b/t/unit-tests/lib-reftable.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "lib-reftable.h" #include "test-lib.h" #include "reftable/constants.h" diff --git a/t/unit-tests/t-example-decorate.c b/t/unit-tests/t-example-decorate.c index 8bf0709c41f6814ba6b12184c9e316cf972a5415..61da8e1c8bedb6313369bc5eefd63b5aa54f78d6 100644 --- a/t/unit-tests/t-example-decorate.c +++ b/t/unit-tests/t-example-decorate.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-lib.h" #include "object.h" diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c index fe6ae37935b8a8de9f4446dda7598b0c2b8bfc76..a3d1aabab5ce08aedbce2ff815d0676d8784bad6 100644 --- a/t/unit-tests/t-prio-queue.c +++ b/t/unit-tests/t-prio-queue.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-lib.h" #include "prio-queue.h" diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c index d279b86df0aeda11b3fb4d2c15803760ae394941..d38092ff8317c93fe8f9d61ed5d31e25895dd69e 100644 --- a/t/unit-tests/t-reftable-readwrite.c +++ b/t/unit-tests/t-reftable-readwrite.c @@ -6,6 +6,8 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-lib.h" #include "lib-reftable.h" #include "reftable/basics.h" diff --git a/t/unit-tests/t-reftable-stack.c b/t/unit-tests/t-reftable-stack.c index 72f6747064f62106e87c9a90e5fe315139d46e60..4377c0af1b8fbd174bd6d25c693954244c31f802 100644 --- a/t/unit-tests/t-reftable-stack.c +++ b/t/unit-tests/t-reftable-stack.c @@ -6,6 +6,8 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-lib.h" #include "lib-reftable.h" #include "reftable/merged.h" diff --git a/t/unit-tests/t-trailer.c b/t/unit-tests/t-trailer.c index e1c6ad7461ed2ebe1e0671f27342d415b96ec19b..184593e73d6e238e188ec85de744d22fe9ea9b66 100644 --- a/t/unit-tests/t-trailer.c +++ b/t/unit-tests/t-trailer.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-lib.h" #include "trailer.h" diff --git a/t/unit-tests/test-lib.c b/t/unit-tests/test-lib.c index fa1f95965c709aeefb98aa787ad1b7023d557e36..87e1f5c201f253a3b35dda823cdc0dadbf7e723b 100644 --- a/t/unit-tests/test-lib.c +++ b/t/unit-tests/test-lib.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "test-lib.h" enum result { diff --git a/tag.c b/tag.c index d24170e34062f05f06f3f791f3e2a3a296dc5022..332fc338e9a3a60d593c12edb599e565bdc66422 100644 --- a/tag.c +++ b/tag.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" diff --git a/tmp-objdir.c b/tmp-objdir.c index 9da0071cba837586241994367d0d3392dbb1bfab..b9084d0ac3cf8b4de879951a6f2480f26635172b 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tmp-objdir.h" diff --git a/trace.c b/trace.c index d8c43773ae8b96bff61db1835cd1f19694be56b3..2cfd25942ee725b022e8dea26096f01f2164a407 100644 --- a/trace.c +++ b/trace.c @@ -22,6 +22,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/trace2.c b/trace2.c index f894532d05331c48607fc3434b8d31937f951a4b..82d16e2783d98690a72934f873f145fc890d5f1a 100644 --- a/trace2.c +++ b/trace2.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "repository.h" diff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c index 048cdd543830418bfe53957b278ab654ecfdcb66..01379c5cad8438c8d5ef38c3cfe9e27c6ff0d478 100644 --- a/trace2/tr2_sysenv.c +++ b/trace2/tr2_sysenv.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "dir.h" diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 45b0850a5ec5c8d1e35df940da003fa9bbddd2ba..69ee40449fa4a79b70495627c856a8b5a422f09b 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "json-writer.h" diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c index a6f9a8a193e058fc164a8e9bd8dc823b7a317a85..298ae27f9d7f24bdca70e064d215de7f57aad625 100644 --- a/trace2/tr2_tgt_perf.c +++ b/trace2/tr2_tgt_perf.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "config.h" #include "repository.h" diff --git a/trailer.c b/trailer.c index 46f0e4610bf5b949dedbe0132a8f3a3f0fffc644..b7e406328534e8904c7fe7980e22d7777e6c4002 100644 --- a/trailer.c +++ b/trailer.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/transport-helper.c b/transport-helper.c index bc27653cdee211bd68cfc624b0fefd66fa1917fc..387c67d5bd198e01250addbcfc12b59868d2007e 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "transport.h" diff --git a/transport.c b/transport.c index 47fda6a7732f4b8cdcb6e750f36b896a988ffd0b..abf0ff57066edb0f88d5ab06306e4d58c98017dd 100644 --- a/transport.c +++ b/transport.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/tree-diff.c b/tree-diff.c index 5eab8af631b78955589d1bb73031ecc854303c51..d9237ffd9bf6fe2579277ed97f1628f3b863ccad 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -3,6 +3,7 @@ */ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h" diff --git a/unix-socket.c b/unix-socket.c index 79800d80636fc57fa8cc2696e33013c1c29e86b3..483c9c448c3964ca3dc46da7060671fc778211c4 100644 --- a/unix-socket.c +++ b/unix-socket.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "strbuf.h" #include "unix-socket.h" diff --git a/unpack-trees.c b/unpack-trees.c index e10a9d12091ea286757881be19fea9dff21f0e32..b3be5d542f5fc5a02b8838101f7334ff44b2c626 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/upload-pack.c b/upload-pack.c index 43006c0614cabab1d47e29540d88d7b89b8f7d14..728b2477fcc71fbf9b6f6aaa53ef3581a6bf7eaf 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/urlmatch.c b/urlmatch.c index 1d0254abacbc3f393062351bc55ccd9bef32051a..eea8300489d79bdb18170d447027020d158fc108 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h" diff --git a/usage.c b/usage.c index 29a9725784a42ed11363b4c41c7a105c0b13f64a..8c672a57f672d9251cadf59e33e7c96943a2024f 100644 --- a/usage.c +++ b/usage.c @@ -3,6 +3,9 @@ * * Copyright (C) Linus Torvalds, 2005 */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "gettext.h" #include "trace2.h" diff --git a/userdiff.c b/userdiff.c index d43d8360d17227852f33e41fa41efdc1cfc4c74a..340c4eb4f77ab17798d25383fa4b6135c661b67a 100644 --- a/userdiff.c +++ b/userdiff.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/utf8.c b/utf8.c index 6bfaefa28ebbbfd145b30b58fe0e937ea921ec91..35a02519392e650a065c72646aa2340b989448cf 100644 --- a/utf8.c +++ b/utf8.c @@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "strbuf.h" #include "utf8.h" diff --git a/version.c b/version.c index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..d5aadab709e06dcd55765f36ba8e949cfa1541f1 100644 --- a/version.c +++ b/version.c @@ -1,3 +1,4 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h" diff --git a/versioncmp.c b/versioncmp.c index e3b2a6e330a3e830d4ef1a953a209716313646f5..71cef7e85862270b537df3dface350a6462e94ed 100644 --- a/versioncmp.c +++ b/versioncmp.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" diff --git a/worktree.c b/worktree.c index 77ff484d3ec48c547ee4e3d958dfa28a52c1eaa7..86b36f5190253d1fb373208061ce109e69d86a10 100644 --- a/worktree.c +++ b/worktree.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" diff --git a/wrapper.c b/wrapper.c index f87d90bf5794a55418d657160f3c86735c1e4bd7..fa79fd6ec9e144509f34e007bb2ffa458d69e695 100644 --- a/wrapper.c +++ b/wrapper.c @@ -1,6 +1,9 @@ /* * Various trivial helper wrappers around standard functions */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "abspath.h" #include "parse.h" diff --git a/ws.c b/ws.c index 9456e2fdbe3766b89497cf740b6280770daf5fd8..70acee3337f2418ccf3f5d124815e4d24d56e073 100644 --- a/ws.c +++ b/ws.c @@ -3,6 +3,9 @@ * * Copyright (c) 2007 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "attr.h" #include "strbuf.h" diff --git a/wt-status.c b/wt-status.c index 6a8c05d1cff165dda8f42b843bf78490ac624d4e..3ee918176422c7c8c045fadae67c39a7d57e987e 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" diff --git a/xdiff-interface.c b/xdiff-interface.c index d5dc88661e72078df3ce9e39a3ea7e15fd46092e..3bd61f26e9043e1dd7b2eea98dbe0ac6c5280ab4 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -1,4 +1,5 @@ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c index 344c2dfc3eb443a721cc45b6ba3be56e9f186c97..4685ba613778149dba84d080869d1b6d7fc2654c 100644 --- a/xdiff/xdiffi.c +++ b/xdiff/xdiffi.c @@ -19,6 +19,7 @@ * Davide Libenzi * */ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "xinclude.h" diff --git a/xdiff/xinclude.h b/xdiff/xinclude.h index a4285ac0eb2840fb3d128b81ab4e19ca3fa673ae..7e56542526a9fe9669a435929b877382b2b4e835 100644 --- a/xdiff/xinclude.h +++ b/xdiff/xinclude.h @@ -23,6 +23,8 @@ #if !defined(XINCLUDE_H) #define XINCLUDE_H +#define DISABLE_SIGN_COMPARE_WARNINGS + #include "git-compat-util.h" #include "xmacros.h" #include "xdiff.h" From patchwork Fri Dec 6 10:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896904 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 C3BEE201010 for ; Fri, 6 Dec 2024 10:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480863; cv=none; b=SlxxuF6Ha6V37ncyL26b//8ZfYNtiOOopYuNOA5FONagaEfxHbvgvRs/8zdvWv0Y5IO3tTB8MuSd6xNQRG/zvSd6RhEva/FoPvAjCuerRUBasj4ptdJ3Nh2ieThoQLfIxJQR7V1ub4hXfo+A1Hkh1yFY7c7Hq+84+rax09/83aU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480863; c=relaxed/simple; bh=KB1iPDo37816jUbxvuR2sy93KKs96H5bcCpgcFLXcXY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lHFf9w2hhkDSF5lOw/0zSsLslBrL4FWwqNBfFd26124A53mNtNisoayMUDnslYWLPKGA8lAZIofZ5+yRRUUCOAY7LTAX7xHLl+3N3E3MM3grKNsCEin/1zZl6VNq4gO+krOd+RACBoEcTt00p6ReYkYLzlEGD+BKa/2aGrIv4yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=aBJNLkLu; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AWiyPwFh; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="aBJNLkLu"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AWiyPwFh" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id C2637114017A; Fri, 6 Dec 2024 05:27:40 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Fri, 06 Dec 2024 05:27:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480860; x=1733567260; bh=a6Rz2IryRT8K18I8oNDuG+1cT2TDOOc6NtZ42HoqJMk=; b= aBJNLkLu9wNV125U3ss/z2t4KW2j0eaMMFhE/02hcUI2hZren1W+TzMdPSY1zILc j5RefulBqPgoxPFMkM5pjY9V05TyY2YFa5A2dLwOoA69FGjUQHuEOFWNMgtgYdau 3XGs//ggbfo+dGrouLQnXoGiaMBf6IaYEpFIhn2yNu4EleWQASIGmF4VLh9eD0/4 IlcLj2HxAlf91MqmK2rtLi9DggyGjVlz00FS2RyWKC9oG5FvjsIKEwq8HKEGWRvP Zr2cxGQv1BMook75sApdg/NbPdcZ7lm+cUwjMJjr5PBjspboz3N67LpjWOkioCay sJBprMhlhz1XYzkG3JPu/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480860; x= 1733567260; bh=a6Rz2IryRT8K18I8oNDuG+1cT2TDOOc6NtZ42HoqJMk=; b=A WiyPwFh0tJIalCbSXFc0nYhzqzeoD9K85PVLje1lA/lzpXv992Cjnf5MXkhbyyyY zbPOaaFMdnjJVwcM2jggNWzcpEQ58aQR3SZzgDwPOi1v4Xv368QSn8JwUCxO0AuR 71zB9jMzG74zp19VGUHNCGmr01Ev/yyhA36G0AhU7m3NqE2vbjX49SKBU2YtI11+ aZAXGyZcbowMOTCzDHbIHMSF5SrAksm1oEM7JGeFN388nUEX6jMxIGCuOu+/mv8M G1y1xxjn1nnLTb/D8bxvPQTK+SRoiAzZht1PtvOv0wNGEWkWNcDJ2rKOQQHtGzJ3 OQopf7kE3sMJWmOppFO/g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpedtueekgfehtd egleeukedvkefgtdfhfedvudeiueelheelgeeujeetvdfgteevteenucffohhmrghinhep mhgrkhdruggvvhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpth htohepphgvfhhfsehpvghffhdrnhgvthdprhgtphhtthhopehshhgvjhhirghluhhosehg mhgrihhlrdgtohhmpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:39 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 1d05b8f0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:15 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:20 +0100 Subject: [PATCH v4 05/16] config.mak.dev: drop `-Wno-sign-compare` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-5-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 There is no need anymore to disable `-Wsign-compare` now that all files that cause warnings have been marked accordingly. Drop the option. Signed-off-by: Patrick Steinhardt --- config.mak.dev | 1 - 1 file changed, 1 deletion(-) diff --git a/config.mak.dev b/config.mak.dev index 8eca7fa22823b46ebdf02b73d53031784fd5ba2a..0fd8cc4d355ebb7428e1d8258154926dedf8827b 100644 --- a/config.mak.dev +++ b/config.mak.dev @@ -53,7 +53,6 @@ ifeq ($(filter extra-all,$(DEVOPTS)),) # These are disabled because we have these all over the place. DEVELOPER_CFLAGS += -Wno-empty-body DEVELOPER_CFLAGS += -Wno-missing-field-initializers -DEVELOPER_CFLAGS += -Wno-sign-compare endif endif From patchwork Fri Dec 6 10:27:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896906 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 C5EC5201278 for ; Fri, 6 Dec 2024 10:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; cv=none; b=NliNEgzL/PBsB2q7mBnbva0/xGXQETah7HFibA6OrnUDmKdZJqincwSczUh7iOa2bYm95zwFds0cyuCyYCskZJgz97dR8OEEmPRuY9SunotzmaeC8r883kcRq8OHM5EmImSmkWoCNlBVBRzb9IZu1fHX/QGi8PqXGvfV8oL7Opw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; c=relaxed/simple; bh=3sANn2AVJM5Xs+V7whFEWrXfntOz+y/8yQVv+8Ekskk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oruIOfo3D/XoqdWBnu8qgAhIIUe4393NEB3RkfVU7gfpIAtJZKX9wLC+sO6E/grOIXhVb2jGtWEDb3V6AIwU7UkwpLquYmMuNzdRRmfachtpd8dxiuZ5erOQEssdwxJSZL62fHiyqmujzjv5fqfwdXl37CErWXrEfBmRWUG2/Zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=zRfvJEFj; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=yNFlfejO; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="zRfvJEFj"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="yNFlfejO" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id C77C12540197; Fri, 6 Dec 2024 05:27:41 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 06 Dec 2024 05:27:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480861; x=1733567261; bh=6An8TOU1+GqDHXA2K+p0c3agKhpCmPZrK3YIscio5jo=; b= zRfvJEFjq8ewe4mOXPvOe+HIi7S4CIo39Z9bMoWjAsn04MltXXV2FAqRvOv+2RQQ rM3QNiuWTts5IS6Dl9uHHkQWofdWow3cpv2WBuPzgb64racTOOmMERuUzUWOuptb /hszLiWCMuaJae6lPeAQciMU5C7p1yrqT74S5/zANjZHpY76awP06uoLrT8cLnNg V68P8o32rGuultx7BwRvhio6wU2pSb7iV+YDA94bHgTPG41uXJPg5FTkUWMiOPwg VwAUuN58eV0isEFLZkHP8xG6gV66kEsi4vxQIRyzRDcXKByCGbLSeOxAyeGgXqg5 jg9b6oqgXYsgq0+K/xbSHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480861; x= 1733567261; bh=6An8TOU1+GqDHXA2K+p0c3agKhpCmPZrK3YIscio5jo=; b=y NFlfejOTUwp6LcxOjsWuoushauDkeUqZHMEZpjrFyLBcY9YCB+zRHG1qywZIUeo8 2PmBUTuNGc/JaZAyHXWM3AEkRqy5pmukUqmuRnoV9UQnR7yyLX2tN933877UJDMa PtjNfPGTmu/bmv9hvCA0HOeqcC3rK0xFVdNP2n9TGt4kCa3arcKFxUk6/g9z8wtt x4PCyyKXDV0FyU8amhEJ8VyA+q7M3vHvI25z6vxoq8NPvHASdUAMoCN89aUj/kQc 7wrbZpnYb2Sv8Aetc9+gYmG+MmHTumsi6Q4O5LO1Z7I5bnZYy/fgRem7V1WemI2T gmEgaYhspDSyhVntmfQlw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtshht vghrsehpohgsohigrdgtohhmpdhrtghpthhtohepphgvfhhfsehpvghffhdrnhgvthdprh gtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhh vghjihgrlhhuohesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:40 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 879276f0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:16 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:21 +0100 Subject: [PATCH v4 06/16] diff.h: fix index used to loop through unsigned integer Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-6-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 The `struct diff_flags` structure is essentially an array of flags, all of which have the same type. We can thus use `sizeof()` to iterate through all of the flags, which we do in `diff_flags_or()`. But while the statement returns an unsigned integer, we used a signed integer to iterate through the flags, which generates a warning. Fix this by using `size_t` for the index instead. Signed-off-by: Patrick Steinhardt --- builtin/am.c | 1 - builtin/diff-tree.c | 1 - builtin/merge-ours.c | 1 - builtin/pack-refs.c | 1 - builtin/range-diff.c | 1 - builtin/reflog.c | 1 - builtin/reset.c | 1 - builtin/revert.c | 1 - builtin/shortlog.c | 1 - diff-merges.c | 2 -- diff.h | 3 +-- diffcore-order.c | 2 -- diffcore-rotate.c | 2 -- list-objects-filter.c | 1 - patch-ids.c | 2 -- reachable.c | 1 - reflog-walk.c | 1 - t/helper/test-revision-walking.c | 1 - 18 files changed, 1 insertion(+), 23 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index f3b6546b3049a90fe32801087151e992623e7f17..1338b606febdde6700c573b45f89aa70785f54e8 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -5,7 +5,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h" diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index a4df2d0c130392f74b4da38dc5d0cd493d88f0e4..40804e7b48e319f6618cd22ac3695ce510b5f51a 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 3672c6353f3219c48a2f10f9011cdd48d702265f..3ecd9172f18466823ad867ca28958c12a3266b85 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -9,7 +9,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h" diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 71175a713a07a1e89050a869c92bd472bea15f87..4fdd68880e0c6d30ca77df1e5f0f2e3f5117097e 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/builtin/range-diff.c b/builtin/range-diff.c index aa88a46d9ee3fcc61817834c770b3de352d78e7a..433c305fc5fc3a5f9ba3515430311338f3bf13c3 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h" diff --git a/builtin/reflog.c b/builtin/reflog.c index 08e99a22b04db7251c285ff56d70d5292ddd2723..95f264989bbf1a955b3be528b84ce1fe525e8459 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/builtin/reset.c b/builtin/reset.c index f34d22190f489fb522fb70584ae2d777a895afbf..73b4537a9a567d1a7661fed89ed362d0f0c81c0d 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -9,7 +9,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h" diff --git a/builtin/revert.c b/builtin/revert.c index 4b57c2c38378e02342e678cb8936b80637b98c5e..aca6c293cdfb2f1ca119f6336b56e36eb3f9dfbf 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h" diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 1c46f13a16346c9a3ba41a92e0aec0428179b939..30075b67be8dac2db7aba793a818f357c7c11cc1 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/diff-merges.c b/diff-merges.c index 0adfe7f5c06b586500361f47ed0d05124c8c9f70..45507588a2797b8d3618e3a19a2854d12051157b 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "diff-merges.h" diff --git a/diff.h b/diff.h index 5c8de795353f0a7201e1a5aa7b6c241dd2bb17ad..6e6007c17b01ada6eab3cb54e94b34b781335348 100644 --- a/diff.h +++ b/diff.h @@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a, { char *tmp_a = (char *)a; const char *tmp_b = (const char *)b; - int i; - for (i = 0; i < sizeof(struct diff_flags); i++) + for (size_t i = 0; i < sizeof(struct diff_flags); i++) tmp_a[i] |= tmp_b[i]; } diff --git a/diffcore-order.c b/diffcore-order.c index ec59d3d9bcc85753352f5faba7982da1c4455b95..f91ef2247145a6157196fb6ebb063bc98d2c3e87 100644 --- a/diffcore-order.c +++ b/diffcore-order.c @@ -2,8 +2,6 @@ * Copyright (C) 2005 Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "gettext.h" #include "diff.h" diff --git a/diffcore-rotate.c b/diffcore-rotate.c index 941a022d5e6e79592967166f1ffc7fcd62086010..67b591261adcc66ef8ab51df9677851564597d17 100644 --- a/diffcore-rotate.c +++ b/diffcore-rotate.c @@ -3,8 +3,6 @@ * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "gettext.h" #include "diff.h" diff --git a/list-objects-filter.c b/list-objects-filter.c index 4afa3029dca926baff81fba4a553b31dfed551a1..dc598a081bb25283a1f0d287baf3805da2955106 100644 --- a/list-objects-filter.c +++ b/list-objects-filter.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h" diff --git a/patch-ids.c b/patch-ids.c index 8b891980732fd33f89bb8b1ef1bf9ad6717120ec..a5683b462c6e7692ceff3218213b9747a9b6cc02 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "diff.h" #include "commit.h" diff --git a/reachable.c b/reachable.c index 34079e1ae9b20313c86c7962f518aa266b7153ea..3e9b3dd0a46cb410b8f032784115c78084c5dbd9 100644 --- a/reachable.c +++ b/reachable.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" diff --git a/reflog-walk.c b/reflog-walk.c index b53628ed5372235d840ce481d22a90cf10ad5c8a..c7070b13b004b7c207a3f99740999f582c15c1b0 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c index 3b931a34a2a2198287fb7f0175ac11e6f2ba0059..071f5bd1e21974ba2104a76305a5156ee2c2961f 100644 --- a/t/helper/test-revision-walking.c +++ b/t/helper/test-revision-walking.c @@ -9,7 +9,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h" From patchwork Fri Dec 6 10:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896905 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 53CB820127B for ; Fri, 6 Dec 2024 10:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; cv=none; b=oTkAqO2aHo2qVNhDHYO2AtU52lxASWvrjV19/cr7vRGivms1MS9DMcgGpiG9Xp7ccwQxct/atjoTvrOMfZfosUg1bhJiH/aEInzd5YvqKzxHoatxSg6FZN/K8+sknLcDuhkurEQLyg3UFMkdV+nufaFq5SGV+835oCXPTiyExZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; c=relaxed/simple; bh=3bAiEC3dupnf/7lgMKCnNShW/DVInUpbO3Zl9XrZQ0w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IyMC9CCnSWrxe9+Y2EPLCcnZSrJBnecGRlz/i8+wIM633+LA/9Bf2WgnZyCmNvS3ux5GQJwTegKP58vNptKKechthHRvQSJurhSk55rVjkxrfbVGKxsVXfabIZfUCob+JOw/ICMgeGDA+5RGmcNJ/K1RLfTwTF7QLi8CeBUpv+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Rlfxlnpc; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=g2jUcu2P; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Rlfxlnpc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="g2jUcu2P" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 525AB114017B; Fri, 6 Dec 2024 05:27:42 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Fri, 06 Dec 2024 05:27:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480862; x=1733567262; bh=cYzUS1HzqYti2IA7mNf2QlhblaIXXfyAVh1w59Hu4o0=; b= RlfxlnpcJ31g4b4NHx9XD5eymPxyHs2ID2CoUA56BAvgeyRhUiExBfx/FkHU5H1z AkMQhvL2dqrzubx5Plgzq8YcPxv3ngwAXF3V5bTv3Nxd1Y49cpBgIBkoXtabK4LM 8+5x5aWGaHyGcLQU2icMv9t5nnISzyD1iXhlf5g8IYQEXmnm7hXaZNHCscWwo8X/ oIR7f8AEQTwovY2vH8il962iC416q92bF82SV1GE5XQxoiTLnk8vBSdIY3HYYmDi 25aXVllI9mYPhePCy2GESyX1hICVS0VrMnmj8QpM8WS/VKNoluxyl5uqiwLp6Suf OGMdbYTU3KeYFOhNxPc6rg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480862; x= 1733567262; bh=cYzUS1HzqYti2IA7mNf2QlhblaIXXfyAVh1w59Hu4o0=; b=g 2jUcu2PoCzLtO/EKh12cENBaqXogeB83KBTqIPfi4GvCdYJBy83nx4QIX0a3sW8x WJG9m2Uk1s+44NttX8RUw59gnIVvN3gvYB/3EUAxJCdf4ywWNkjMf19eEJL1O82c qKHyRfKz9VIdFQUr1FxjoONzwSfxWrPPs26VZcKoh6M/AvHvg007JDLmTOskjdeT 9ydvoqV9SLw0pSBrSmgf1Xw6+PZtAqd3loXYdT4EQGrmwwQFPboU5J4ktofWoTbq l9HaMFZNIpRukSTmDSVnL04xn1W70L5r5kamkYMgdizro/QmtMFPcxFkg+bEsYXN pfTpYJZUAGCOh7cRVrImw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtshht vghrsehpohgsohigrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlh drohhrghdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepshhh vghjihgrlhhuohesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:41 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 35d2c3c8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:17 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:22 +0100 Subject: [PATCH v4 07/16] csum-file: fix -Wsign-compare warning on 32-bit platform Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-7-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 From: Junio C Hamano On 32-bit platforms, ssize_t may be "int" while size_t may be "unsigned int". At times we compare the number of bytes we read stored in a ssize_t variable with "unsigned int", but that is done after we check that we did not get an error return (which is negative---and that is the whole reason why we used ssize_t and not size_t), so these comparisons are safe. But compilers may not realize that. Cast these to size_t to work around the false positives. On platforms with size_t/ssize_t wider than a normal int, this won't be an issue. Signed-off-by: Junio C Hamano Signed-off-by: Patrick Steinhardt --- csum-file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/csum-file.c b/csum-file.c index c14bacc7f9e5f56fcdb06a3abc7ac9babc45041a..5716016e12eec8c35f6495141fb2fcc250732803 100644 --- a/csum-file.c +++ b/csum-file.c @@ -9,7 +9,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h" @@ -24,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f, if (ret < 0) die_errno("%s: sha1 file read error", f->name); - if (ret != count) + if ((size_t)ret != count) die("%s: sha1 file truncated", f->name); if (memcmp(buf, f->check_buffer, count)) die("sha1 file '%s' validation error", f->name); From patchwork Fri Dec 6 10:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896907 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 52501202C35 for ; Fri, 6 Dec 2024 10:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; cv=none; b=HgYF8k4UNg3NeNnH+zLWmFR/uuHi/NgdlpBGYouyEW+0ZAPPpbdNLkX8Gz0ZJ8cax5PI69fgKS79XBdPTi31B0yb9UC6YUWyOPLqqegE863KgrNxZyu15JyFU2jxJeSDyqOvczirNh/D3PNNsrYo/0ZZEOP7ns5RzOtvS2OxDuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480865; c=relaxed/simple; bh=9idDw9a3ghceEKfwMFfZou7ibAVDLPZ/fx5UQGxSwjQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YCnDDwkkyaT6EIkiITsp5ou5NRWx9Zy/ev7k6dY2IZrfPvJTyEUqmmtQBcUmu82sBbqv/NVjyetyLyxzj/uwiWVIBEU+zZ76HyYNkeQ0CeQbjhJJuAHpNxgs6t+4tkK50/5rg63ldeS3eXbUt2v1J7UyguyCBpupVjN/M0zwYu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Usen9/9+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=aaStIWxI; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Usen9/9+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aaStIWxI" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 67B7E114019D; Fri, 6 Dec 2024 05:27:43 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 06 Dec 2024 05:27:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480863; x=1733567263; bh=QbdMSJMfkp0/ImGVEVlA9hsHcvgfxuuU6m1G1ySNEuI=; b= Usen9/9+tJJUfrPLapZRmt0RDwNaNsE9ueLWJ6Ovl9C3WNDESwvDJ7YWDQrKS+x6 y8pCV9uEb6kV72FkRZaODp60hs7UteF/pVX1k7acFxD572W75ZNCdeNfIFhk2jJT m0S+9LjRD6LNniD5GzV8bVYY2BfbfvtUsMBOuBn/ABoYwml+cTT4U/2glVVpr1Jv XzQjfChqqRmxBc93PxiIOKWIQ7EsXziPOXJefti6k4TxxFRApHrkMaJehMBkMfoT xgsimPrvhhKwPmGNYNJ60Ddti84PxpP396vQ+4q9yR2zfn00suRZsdCFbS4D2IIY xNbHN6SSp7fpX5p6SS757g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480863; x= 1733567263; bh=QbdMSJMfkp0/ImGVEVlA9hsHcvgfxuuU6m1G1ySNEuI=; b=a aStIWxIqO2C9AmuxyFtkg1N6kgN6WtCbjUw6wXCjSsuItWiWS4vAdQP6LCatxO5D GZ2bVWEVHO/xUsEv72ZF1iLSgFqmwTZpVk1tNy3pCVQMdwVEkuGpQ+PoWyZJU6+h nMEcLxLTL9q8EE51j9mZFTqRCX7S2PdvnzBC5C8Vb8lKpuP7ZNYSwaTJ3pJH4X60 Axp+bMum+ciQGHFMH45zRmeufxiCgCFGJ9hmq/sxSc73/ganIHQJ3zUnDD7JuVjq DG6S/7U5tnl4utvQ6exXhzL2X6Bf2apiQvo7KDvRrdsGP00sVTK+Y1qjb0ULzjGN 2AGY3o8FlZEVDmBJSO4cg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhgvjhhi rghluhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnh gvlhdrohhrghdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohep ghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:42 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 17c68933 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:18 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:23 +0100 Subject: [PATCH v4 08/16] pkt-line: fix -Wsign-compare warning on 32 bit platform Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-8-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 Similar to the preceding commit, we get a warning in `get_packet_data()` on 32 bit platforms due to our lenient use of `ssize_t`. This function is kind of curious though: we accept an `unsigned size` of bytes to read, then store the actual number of bytes read in an `ssize_t` and return it as an `int`. This is a whole lot of integer conversions, and in theory these can cause us to overflow when the passed-in size is larger than `ssize_t`, which on 32 bit platforms is implemented as an `int`. None of the callers of that function even care about the number of bytes we have read, so returning that number is moot anyway. Refactor the function such that it only returns an error code, which plugs the potential overflow. While at it, convert the passed-in size parameter to be of type `size_t`. Signed-off-by: Patrick Steinhardt --- pkt-line.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkt-line.c b/pkt-line.c index 90ea2b6974b1d0957cfdc5e2f9a2c30720723f12..2dc29d5b68e45740a7f4e473b7c7ffa57bc09528 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -340,30 +340,32 @@ int write_packetized_from_buf_no_flush_count(const char *src_in, size_t len, } static int get_packet_data(int fd, char **src_buf, size_t *src_size, - void *dst, unsigned size, int options) + void *dst, size_t size, int options) { - ssize_t ret; + size_t bytes_read; if (fd >= 0 && src_buf && *src_buf) BUG("multiple sources given to packet_read"); /* Read up to "size" bytes from our source, whatever it is. */ if (src_buf && *src_buf) { - ret = size < *src_size ? size : *src_size; - memcpy(dst, *src_buf, ret); - *src_buf += ret; - *src_size -= ret; + bytes_read = size < *src_size ? size : *src_size; + memcpy(dst, *src_buf, bytes_read); + *src_buf += bytes_read; + *src_size -= bytes_read; } else { - ret = read_in_full(fd, dst, size); + ssize_t ret = read_in_full(fd, dst, size); if (ret < 0) { if (options & PACKET_READ_GENTLE_ON_READ_ERROR) return error_errno(_("read error")); die_errno(_("read error")); } + + bytes_read = (size_t) ret; } /* And complain if we didn't get enough bytes to satisfy the read. */ - if (ret != size) { + if (bytes_read != size) { if (options & PACKET_READ_GENTLE_ON_EOF) return -1; @@ -372,7 +374,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, die(_("the remote end hung up unexpectedly")); } - return ret; + return 0; } int packet_length(const char lenbuf_hex[4], size_t size) From patchwork Fri Dec 6 10:27:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896911 Received: from flow-b3-smtp.messagingengine.com (flow-b3-smtp.messagingengine.com [202.12.124.138]) (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 09D27202C55 for ; Fri, 6 Dec 2024 10:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480868; cv=none; b=t5+nR6B/AFZVyNBMOyZ0bQPzlrPRyCviPFIaRzSot0HzOHovnfSJRzqYO73cLR7u0o3l5SCvxpKgjclFNfgr6hVyOjwwJbsEEppsAodQq4DF0Coe/cBqFiX6aXOeXhOnhDFnNh2ecDRsrWxZMESAxyAAYWF+LeTfB8fsdUSQbBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480868; c=relaxed/simple; bh=sISejI6P2l6t+ilyPdtsug6kPn+hZPaxrHPJKYF37Ag=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JErNYtU7WvF//7nISQKqsi6Y2+J7vNi4wUPn+H81MeGvfZHeqAGHvdNOwOr0B10cMgh8d8BAMrs4wTdIy5HEM/M27386Uv/CYTH2pu2vjxsnp2QQqCjnGxhQEST/neGdaMSs4lxycCAnteO/uyBzDw8SoA3nWsXH9GEHRikQUL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=d7dT1mkl; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=wgD12esB; arc=none smtp.client-ip=202.12.124.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="d7dT1mkl"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="wgD12esB" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailflow.stl.internal (Postfix) with ESMTP id EFB041D40636; Fri, 6 Dec 2024 05:27:43 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Fri, 06 Dec 2024 05:27:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480863; x=1733488063; bh=hE8cm2o1cOteC6vY6OVRftU2jH4YF7Po9+fYMp13TDs=; b= d7dT1mklPgjpJP7LLRefl2NYgULa5vQ8WvxNW03f6Wz0/IXc2BuTYvCErNQjT5Pe aMrPgXEvetY0i6uQBqGpim89GjncyT+J5OkDUwY2nkrrbOlblfVt+5w3wS4rsGTz QMzOu54xV9qOW8Ox8ZNuLe9zdB+toGc0Z5mhTaJQO7gNI/wy+TeAI+U+jbRk15bX dbckcizSnR6sY4cTKg7E4EwC40WnJqQCkAS6ZHhbsDHjTMZBsy+WyJwr6N9h8oMl SxzNDx74gZ7y5tnLK9rkq8Lia8VrrfoOxV0ZyfPHcncUySNdEI2Xi03nX3pX085T K22ksU3T5nNVzKawxw8Feg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480863; x= 1733488063; bh=hE8cm2o1cOteC6vY6OVRftU2jH4YF7Po9+fYMp13TDs=; b=w gD12esBf12XK/d+YYdFJ9nL/tfrUuKILW6k3JjXsILW3iN9tCgaGPqI18HKvFIqB ujnqh2hsVy1WYMSR7+uDUcXazuXAc1mJl0dZubfcDy3xE38iBGuDSxs4cBxpvXYl QCeSG8vMBBX6APNd9SrLrNSxCPk9E7uFev0dT53D9sxCfHyYWIpx+jJw+kDxZdoE FgbO02WV2At+5RrW8mqKv4MKg9aSJifPcZWrXFx9BHiAI6o/MjNAciidVLowxYSh XJofLWatmXPj3F6msNC4Z9AmOQtGfyU8ET7pjozBKAmmJKdILvQway4IxPvQFmpW 6f/+gqbqifOdF8QtkKRuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecuogfuphgrmhgfrhhlucdlfe dttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhm pefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtf frrghtthgvrhhnpeefjeffhefgudegleeijeduuddugfegledttdffhfffueduleetfffg kefgkedujeenucffohhmrghinhepghhnuhdrohhrghdprhgvfhgvrhgvnhgtvghsrdhnrh enucfuphgrmhgfrhhlpehhthhtphemsddsfiiffidrghhnuhdrohhrghdslhhitggvnhhs vghsnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepph hssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhr tghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehgih htshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepshhhvghjihgrlhhuohesghhm rghilhdrtghomhdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvght X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:42 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 3b61c01d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:19 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:24 +0100 Subject: [PATCH v4 09/16] global: trivial conversions to fix `-Wsign-compare` warnings Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-9-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 We have a bunch of loops which iterate up to an unsigned boundary using a signed index, which generates warnigs because we compare a signed and unsigned value in the loop condition. Address these sites for trivial cases and enable `-Wsign-compare` warnings for these code units. This patch only adapts those code units where we can drop the `DISABLE_SIGN_COMPARE_WARNINGS` macro in the same step. Signed-off-by: Patrick Steinhardt --- advice.c | 9 ++------- base85.c | 5 +---- builtin/add.c | 10 ++++------ builtin/branch.c | 1 - builtin/difftool.c | 4 ++-- builtin/for-each-repo.c | 5 ++--- builtin/help.c | 4 +--- builtin/mailsplit.c | 3 +-- builtin/merge-tree.c | 6 ++---- builtin/pack-redundant.c | 4 +--- builtin/pull.c | 4 +--- builtin/push.c | 5 ++--- builtin/rerere.c | 9 ++++----- builtin/stash.c | 7 ++----- builtin/submodule--helper.c | 8 +++----- builtin/var.c | 4 +--- commit.c | 4 +--- compat/fsmonitor/fsm-listen-darwin.c | 5 +---- compat/terminal.c | 5 +---- diagnose.c | 8 +++----- diffcore-rename.c | 4 +--- entry.c | 5 ++--- ewah/ewah_bitmap.c | 6 +----- git.c | 33 +++++++++++++-------------------- help.h | 8 +++----- hex.c | 7 ++----- http-push.c | 4 +--- list-objects-filter-options.c | 5 +---- list-objects.c | 8 ++------ ls-refs.c | 5 +---- merge.c | 5 ++--- path.c | 5 ++--- pkt-line.c | 5 +---- refs/debug.c | 5 +---- send-pack.c | 6 ++---- serve.c | 8 ++------ strvec.c | 5 +---- t/helper/test-bloom.c | 10 ++-------- t/helper/test-dump-fsmonitor.c | 4 +--- t/helper/test-dump-split-index.c | 4 +--- t/helper/test-dump-untracked-cache.c | 7 +++---- t/helper/test-hash-speed.c | 7 ++----- t/helper/test-parse-options.c | 7 ++----- t/helper/test-reach.c | 4 +--- t/helper/test-ref-store.c | 4 +--- t/helper/test-tool.c | 5 +---- t/unit-tests/t-example-decorate.c | 5 ++--- t/unit-tests/t-prio-queue.c | 4 +--- tmp-objdir.c | 4 +--- trailer.c | 4 +--- transport-helper.c | 14 ++++++-------- transport.c | 14 ++++---------- usage.c | 4 +--- version.c | 4 +--- versioncmp.c | 4 +--- 55 files changed, 105 insertions(+), 238 deletions(-) diff --git a/advice.c b/advice.c index c2da976543c946a02d532e6dc3fe53bec86ee2a2..147b596d33974e45d74747d6ca43c05eedeee0fe 100644 --- a/advice.c +++ b/advice.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "advice.h" #include "config.h" @@ -162,7 +160,6 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...) int git_default_advice_config(const char *var, const char *value) { const char *k, *slot_name; - int i; if (!strcmp(var, "color.advice")) { advice_use_color = git_config_colorbool(var, value); @@ -181,7 +178,7 @@ int git_default_advice_config(const char *var, const char *value) if (!skip_prefix(var, "advice.", &k)) return 0; - for (i = 0; i < ARRAY_SIZE(advice_setting); i++) { + for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) { if (strcasecmp(k, advice_setting[i].key)) continue; advice_setting[i].level = git_config_bool(var, value) @@ -195,9 +192,7 @@ int git_default_advice_config(const char *var, const char *value) void list_config_advices(struct string_list *list, const char *prefix) { - int i; - - for (i = 0; i < ARRAY_SIZE(advice_setting); i++) + for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) list_config_item(list, prefix, advice_setting[i].key); } diff --git a/base85.c b/base85.c index a6b827203965714bddbf673fecb0198b3ceef237..80e899a2b1a20d840117609993811d8ab9a31733 100644 --- a/base85.c +++ b/base85.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "base85.h" @@ -31,10 +29,9 @@ static const char en85[] = { static char de85[256]; static void prep_base85(void) { - int i; if (de85['Z']) return; - for (i = 0; i < ARRAY_SIZE(en85); i++) { + for (size_t i = 0; i < ARRAY_SIZE(en85); i++) { int ch = en85[i]; de85[ch] = i + 1; } diff --git a/builtin/add.c b/builtin/add.c index ff6a7d7fd0868cafb98327ec4ffa81dcac66e4bb..78dfb265776724109f4a8b93a419c32667979954 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -4,8 +4,6 @@ * Copyright (C) 2006 Linus Torvalds */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "builtin.h" #include "advice.h" #include "config.h" @@ -42,9 +40,9 @@ static int chmod_pathspec(struct repository *repo, char flip, int show_only) { - int i, ret = 0; + int ret = 0; - for (i = 0; i < repo->index->cache_nr; i++) { + for (size_t i = 0; i < repo->index->cache_nr; i++) { struct cache_entry *ce = repo->index->cache[i]; int err; @@ -72,9 +70,9 @@ static int renormalize_tracked_files(struct repository *repo, const struct pathspec *pathspec, int flags) { - int i, retval = 0; + int retval = 0; - for (i = 0; i < repo->index->cache_nr; i++) { + for (size_t i = 0; i < repo->index->cache_nr; i++) { struct cache_entry *ce = repo->index->cache[i]; if (!include_sparse && diff --git a/builtin/branch.c b/builtin/branch.c index 349a6be6d686175bc75a7770ac59474a7224e448..3737a11cbf9ad0acbc23bf4eaaf9cff45226a97b 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -6,7 +6,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index 1914708a764d3f0637b327768a7f5cf8a6f96c13..03a8bb92a95896f4b4d2f0bef3d8256359c08c06 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -13,7 +13,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" @@ -367,7 +366,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix, char *lbase_dir = NULL, *rbase_dir = NULL; size_t ldir_len, rdir_len, wtdir_len; const char *workdir, *tmp; - int ret = 0, i; + int ret = 0; + size_t i; FILE *fp = NULL; struct hashmap working_tree_dups = HASHMAP_INIT(working_tree_entry_cmp, NULL); diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index 7e36be9d8a55e9454668b935e8d13f52cdc0f62a..325a7925f1fdb577f4802466065ae4f05f48f449 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -38,7 +37,7 @@ int cmd_for_each_repo(int argc, { static const char *config_key = NULL; int keep_going = 0; - int i, result = 0; + int result = 0; const struct string_list *values; int err; @@ -63,7 +62,7 @@ int cmd_for_each_repo(int argc, else if (err) return 0; - for (i = 0; i < values->nr; i++) { + for (size_t i = 0; i < values->nr; i++) { int ret = run_command_on_repo(values->items[i].string, argc, argv); if (ret) { if (!keep_going) diff --git a/builtin/help.c b/builtin/help.c index aa6bd6e412fe2341b234e6dad903787f8eb3b670..05136279cf7b1007ab754f5630c34536a5f9461f 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -3,7 +3,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -131,7 +130,6 @@ static void list_config_help(enum show_config_type type) struct string_list keys = STRING_LIST_INIT_DUP; struct string_list keys_uniq = STRING_LIST_INIT_DUP; struct string_list_item *item; - int i; for (p = config_name_list; *p; p++) { const char *var = *p; @@ -158,7 +156,7 @@ static void list_config_help(enum show_config_type type) e->prefix, e->placeholder); string_list_sort(&keys); - for (i = 0; i < keys.nr; i++) { + for (size_t i = 0; i < keys.nr; i++) { const char *var = keys.items[i].string; const char *wildcard, *tag, *cut; const char *dot = NULL; diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 52481f7f2ee75f0cc6a384fdc78ddd1ccad584df..41dd3047313e6cab6dcf7fe65d2f5529e70e4aa2 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -175,7 +175,6 @@ static int split_maildir(const char *maildir, const char *dir, char *file = NULL; FILE *f = NULL; int ret = -1; - int i; struct string_list list = STRING_LIST_INIT_DUP; list.cmp = maildir_filename_cmp; @@ -183,7 +182,7 @@ static int split_maildir(const char *maildir, const char *dir, if (populate_maildir_list(&list, maildir) < 0) goto out; - for (i = 0; i < list.nr; i++) { + for (size_t i = 0; i < list.nr; i++) { char *name; free(file); diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 3328144029a50894ef7fa3afe0f44133db406cda..9a6c8b4e4cf21219da5866111f5ae5eda0e1b83a 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "tree-walk.h" @@ -499,10 +498,9 @@ static int real_merge(struct merge_tree_options *o, if (!result.clean) { struct string_list conflicted_files = STRING_LIST_INIT_NODUP; const char *last = NULL; - int i; merge_get_conflicted_files(&result, &conflicted_files); - for (i = 0; i < conflicted_files.nr; i++) { + for (size_t i = 0; i < conflicted_files.nr; i++) { const char *name = conflicted_files.items[i].string; struct stage_info *c = conflicted_files.items[i].util; if (!o->name_only) @@ -586,7 +584,7 @@ int cmd_merge_tree(int argc, if (xopts.nr && o.mode == MODE_TRIVIAL) die(_("--trivial-merge is incompatible with all other options")); - for (int x = 0; x < xopts.nr; x++) + for (size_t x = 0; x < xopts.nr; x++) if (parse_merge_opt(&o.merge_options, xopts.v[x])) die(_("unknown strategy option: -X%s"), xopts.v[x]); diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index 978c42aae7b86f0ce049eea0ac0b9bcfcf598348..275333f543476c94bf1d73f74158613c2d050101 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -7,7 +7,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h" @@ -391,7 +390,6 @@ static int cmp_remaining_objects(const void *a, const void *b) static void sort_pack_list(struct pack_list **pl) { struct pack_list **ary, *p; - int i; size_t n = pack_list_size(*pl); if (n < 2) @@ -405,7 +403,7 @@ static void sort_pack_list(struct pack_list **pl) QSORT(ary, n, cmp_remaining_objects); /* link them back again */ - for (i = 0; i < n - 1; i++) + for (size_t i = 0; i < n - 1; i++) ary[i]->next = ary[i + 1]; ary[n - 1]->next = NULL; *pl = ary[0]; diff --git a/builtin/pull.c b/builtin/pull.c index 6f8a32620c378f22f36cee4480d975d273bb04ff..9c4a00620a053b375294b9895a2b402a3deed6e8 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -7,7 +7,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h" @@ -943,11 +942,10 @@ static int get_can_ff(struct object_id *orig_head, static int already_up_to_date(struct object_id *orig_head, struct oid_array *merge_heads) { - int i; struct commit *ours; ours = lookup_commit_reference(the_repository, orig_head); - for (i = 0; i < merge_heads->nr; i++) { + for (size_t i = 0; i < merge_heads->nr; i++) { struct commit_list *list = NULL; struct commit *theirs; int ok; diff --git a/builtin/push.c b/builtin/push.c index 7174efed6dce226a0dfbd117f996ce67b45a2625..90de3746b5229f87655c4111112980945cd49832 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -3,7 +3,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h" @@ -420,7 +419,7 @@ static int do_push(int flags, const struct string_list *push_options, struct remote *remote) { - int i, errs; + int errs; struct strvec *url; struct refspec *push_refspec = &rs; @@ -435,7 +434,7 @@ static int do_push(int flags, } errs = 0; url = push_url_of_remote(remote); - for (i = 0; i < url->nr; i++) { + for (size_t i = 0; i < url->nr; i++) { struct transport *transport = transport_get(remote, url->v[i]); if (flags & TRANSPORT_PUSH_OPTIONS) diff --git a/builtin/rerere.c b/builtin/rerere.c index 706a9472133862a0dd513a4cee454403f5de748b..41127e24e5309815dbb8d36cf9bbf905d1703c79 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -57,7 +56,7 @@ int cmd_rerere(int argc, struct repository *repo UNUSED) { struct string_list merge_rr = STRING_LIST_INIT_DUP; - int i, autoupdate = -1, flags = 0; + int autoupdate = -1, flags = 0; struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate, @@ -100,11 +99,11 @@ int cmd_rerere(int argc, if (setup_rerere(the_repository, &merge_rr, flags | RERERE_READONLY) < 0) return 0; - for (i = 0; i < merge_rr.nr; i++) + for (size_t i = 0; i < merge_rr.nr; i++) printf("%s\n", merge_rr.items[i].string); } else if (!strcmp(argv[0], "remaining")) { rerere_remaining(the_repository, &merge_rr); - for (i = 0; i < merge_rr.nr; i++) { + for (size_t i = 0; i < merge_rr.nr; i++) { if (merge_rr.items[i].util != RERERE_RESOLVED) printf("%s\n", merge_rr.items[i].string); else @@ -116,7 +115,7 @@ int cmd_rerere(int argc, if (setup_rerere(the_repository, &merge_rr, flags | RERERE_READONLY) < 0) return 0; - for (i = 0; i < merge_rr.nr; i++) { + for (size_t i = 0; i < merge_rr.nr; i++) { const char *path = merge_rr.items[i].string; const struct rerere_id *id = merge_rr.items[i].util; if (diff_two(rerere_path(id, "preimage"), path, path, path)) diff --git a/builtin/stash.c b/builtin/stash.c index a79d23f1a3d33c76fc6516330fe2fdad56413a01..dbaa999cf171a7606f8629912777538925d6ae34 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h" @@ -875,9 +874,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op struct tree *tree[ARRAY_SIZE(oid)]; struct tree_desc tree_desc[ARRAY_SIZE(oid)]; struct unpack_trees_options unpack_tree_opt = { 0 }; - int i; - for (i = 0; i < ARRAY_SIZE(oid); i++) { + for (size_t i = 0; i < ARRAY_SIZE(oid); i++) { tree[i] = parse_tree_indirect(oid[i]); if (parse_tree(tree[i]) < 0) die(_("failed to parse tree")); @@ -1559,12 +1557,11 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q repo_read_index_preload(the_repository, NULL, 0); if (!include_untracked && ps->nr) { - int i; char *ps_matched = xcalloc(ps->nr, 1); /* TODO: audit for interaction with sparse-index. */ ensure_full_index(the_repository->index); - for (i = 0; i < the_repository->index->cache_nr; i++) + for (size_t i = 0; i < the_repository->index->cache_nr; i++) ce_path_match(the_repository->index, the_repository->index->cache[i], ps, ps_matched); diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index cfcaffee0d8ee5f97dc3e2d559caa82a5640b3e6..f9b970f8a64a54f198c56ef272b8f20b9999c59f 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h" @@ -196,7 +195,7 @@ static int module_list_compute(const char **argv, struct pathspec *pathspec, struct module_list *list) { - int i, result = 0; + int result = 0; char *ps_matched = NULL; parse_pathspec(pathspec, 0, @@ -209,7 +208,7 @@ static int module_list_compute(const char **argv, if (repo_read_index(the_repository) < 0) die(_("index file corrupt")); - for (i = 0; i < the_repository->index->cache_nr; i++) { + for (size_t i = 0; i < the_repository->index->cache_nr; i++) { const struct cache_entry *ce = the_repository->index->cache[i]; if (!match_pathspec(the_repository->index, pathspec, ce->name, ce_namelen(ce), @@ -3398,7 +3397,6 @@ static void die_on_index_match(const char *path, int force) die(_("index file corrupt")); if (ps.nr) { - int i; char *ps_matched = xcalloc(ps.nr, 1); /* TODO: audit for interaction with sparse-index. */ @@ -3408,7 +3406,7 @@ static void die_on_index_match(const char *path, int force) * Since there is only one pathspec, we just need to * check ps_matched[0] to know if a cache entry matched. */ - for (i = 0; i < the_repository->index->cache_nr; i++) { + for (size_t i = 0; i < the_repository->index->cache_nr; i++) { ce_path_match(the_repository->index, the_repository->index->cache[i], &ps, ps_matched); diff --git a/builtin/var.c b/builtin/var.c index 74aa39dd6bfb261170152d7dd3dc3d724bec61bc..1449656cc924f849ee9c881c18b734a3ec55e9f3 100644 --- a/builtin/var.c +++ b/builtin/var.c @@ -5,7 +5,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" @@ -181,10 +180,9 @@ static void list_vars(void) if ((val = ptr->read(0))) { if (ptr->multivalued && *val) { struct string_list list = STRING_LIST_INIT_DUP; - int i; string_list_split(&list, val, '\n', -1); - for (i = 0; i < list.nr; i++) + for (size_t i = 0; i < list.nr; i++) printf("%s=%s\n", ptr->name, list.items[i].string); string_list_clear(&list, 0); } else { diff --git a/commit.c b/commit.c index 9c1f9fa2367e8c0930c8446e88b9368472dc6ade..8f6045a6c3400e09e0ec174f7eab5fdae8a6cd3f 100644 --- a/commit.c +++ b/commit.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h" @@ -1766,7 +1765,6 @@ int commit_tree_extended(const char *msg, size_t msg_len, { &compat_sig, r->compat_hash_algo }, { &sig, r->hash_algo }, }; - int i; /* * We write algorithms in the order they were implemented in @@ -1780,7 +1778,7 @@ int commit_tree_extended(const char *msg, size_t msg_len, * We traverse each algorithm in order, and apply the signature * to each buffer. */ - for (i = 0; i < ARRAY_SIZE(bufs); i++) { + for (size_t i = 0; i < ARRAY_SIZE(bufs); i++) { if (!bufs[i].algo) continue; add_header_signature(&buffer, bufs[i].sig, bufs[i].algo); diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c index 58f3878a22666ea8a0bd5bfc215eadf06de747c0..43c3a915a0edfc8d625ed9218f85ecdc2ba8985b 100644 --- a/compat/fsmonitor/fsm-listen-darwin.c +++ b/compat/fsmonitor/fsm-listen-darwin.c @@ -23,8 +23,6 @@ #endif #endif -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "fsmonitor-ll.h" #include "fsm-listen.h" @@ -210,13 +208,12 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED, const char *slash; char *resolved = NULL; struct strbuf tmp = STRBUF_INIT; - int k; /* * Build a list of all filesystem changes into a private/local * list and without holding any locks. */ - for (k = 0; k < num_of_events; k++) { + for (size_t k = 0; k < num_of_events; k++) { /* * On Mac, we receive an array of absolute paths. */ diff --git a/compat/terminal.c b/compat/terminal.c index 7fe515b9c88e266f075043c0d48a6cbce5dacea2..584f27bf7e1078338d5b7a0aedf12aecdc95fbd1 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "compat/terminal.h" #include "gettext.h" @@ -261,14 +259,13 @@ static DWORD cmode_in, cmode_out; void restore_term(void) { if (use_stty) { - int i; struct child_process cp = CHILD_PROCESS_INIT; if (stty_restore.nr == 0) return; strvec_push(&cp.args, "stty"); - for (i = 0; i < stty_restore.nr; i++) + for (size_t i = 0; i < stty_restore.nr; i++) strvec_push(&cp.args, stty_restore.items[i].string); run_command(&cp); string_list_clear(&stty_restore, 0); diff --git a/diagnose.c b/diagnose.c index f340996e27b994c1ab58654bf248305a45833adc..b11931df86c4ba84f7aec77cb7965083f5aa31fa 100644 --- a/diagnose.c +++ b/diagnose.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diagnose.h" @@ -32,7 +31,6 @@ static struct diagnose_option diagnose_options[] = { int option_parse_diagnose(const struct option *opt, const char *arg, int unset) { - int i; enum diagnose_mode *diagnose = opt->value; if (!arg) { @@ -40,7 +38,7 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset) return 0; } - for (i = 0; i < ARRAY_SIZE(diagnose_options); i++) { + for (size_t i = 0; i < ARRAY_SIZE(diagnose_options); i++) { if (!strcmp(arg, diagnose_options[i].option_name)) { *diagnose = diagnose_options[i].mode; return 0; @@ -187,7 +185,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode) char **argv_copy = NULL; int stdout_fd = -1, archiver_fd = -1; struct strbuf buf = STRBUF_INIT; - int res, i; + int res; struct archive_dir archive_dirs[] = { { ".git", 0 }, { ".git/hooks", 0 }, @@ -240,7 +238,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode) /* Only include this if explicitly requested */ if (mode == DIAGNOSE_ALL) { - for (i = 0; i < ARRAY_SIZE(archive_dirs); i++) { + for (size_t i = 0; i < ARRAY_SIZE(archive_dirs); i++) { if (add_directory_to_archiver(&archiver_args, archive_dirs[i].path, archive_dirs[i].recursive)) { diff --git a/diffcore-rename.c b/diffcore-rename.c index 08ebb1fc3d087ffe666f747ebf5301a8f6f8b2d8..10bb0321b10d5896aaa6a26a624d2066598bf51f 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -4,7 +4,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h" @@ -689,7 +688,6 @@ static void cleanup_dir_rename_info(struct dir_rename_info *info, struct hashmap_iter iter; struct strmap_entry *entry; struct string_list to_remove = STRING_LIST_INIT_NODUP; - int i; if (!info->setup) return; @@ -735,7 +733,7 @@ static void cleanup_dir_rename_info(struct dir_rename_info *info, if (strintmap_contains(counts, UNKNOWN_DIR)) strintmap_remove(counts, UNKNOWN_DIR); } - for (i = 0; i < to_remove.nr; ++i) + for (size_t i = 0; i < to_remove.nr; ++i) strmap_remove(info->dir_rename_count, to_remove.items[i].string, 1); string_list_clear(&to_remove, 0); diff --git a/entry.c b/entry.c index 93bd6a78ffac4ba3b5b6ac64ec0fd23c9793e56f..53a1c393582b2e6be4398985ca3c5f4fadece3cb 100644 --- a/entry.c +++ b/entry.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h" @@ -442,7 +441,7 @@ static int check_path(const char *path, int len, struct stat *st, int skiplen) static void mark_colliding_entries(const struct checkout *state, struct cache_entry *ce, struct stat *st) { - int i, trust_ino = check_stat; + int trust_ino = check_stat; #if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__) trust_ino = 0; @@ -452,7 +451,7 @@ static void mark_colliding_entries(const struct checkout *state, /* TODO: audit for interaction with sparse-index. */ ensure_full_index(state->istate); - for (i = 0; i < state->istate->cache_nr; i++) { + for (size_t i = 0; i < state->istate->cache_nr; i++) { struct cache_entry *dup = state->istate->cache[i]; if (dup == ce) { diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c index 9be9bb3758cf0bc267d09d59b3b23a127b3e4721..67f8f588e056248dbc2707f68abdd832203e5d97 100644 --- a/ewah/ewah_bitmap.c +++ b/ewah/ewah_bitmap.c @@ -17,8 +17,6 @@ * along with this program; if not, see . */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h" @@ -258,10 +256,8 @@ void ewah_each_bit(struct ewah_bitmap *self, void (*callback)(size_t, void*), vo ++pointer; for (k = 0; k < rlw_get_literal_words(word); ++k) { - int c; - /* todo: zero count optimization */ - for (c = 0; c < BITS_IN_EWORD; ++c, ++pos) { + for (size_t c = 0; c < BITS_IN_EWORD; ++c, ++pos) { if ((self->buffer[pointer] & ((eword_t)1 << c)) != 0) callback(pos, payload); } diff --git a/git.c b/git.c index cd33b1f405c64cf1d08c40e3251630abae4b005b..71d644dc1c59902b2f14c14914c78285ffa92638 100644 --- a/git.c +++ b/git.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -56,7 +55,7 @@ static void list_builtins(struct string_list *list, unsigned int exclude_option) static void exclude_helpers_from_list(struct string_list *list) { - int i = 0; + size_t i = 0; while (i < list->nr) { if (strstr(list->items[i].string, "--")) @@ -76,7 +75,6 @@ static int match_token(const char *spec, int len, const char *token) static int list_cmds(const char *spec) { struct string_list list = STRING_LIST_INIT_DUP; - int i; int nongit; /* @@ -114,7 +112,7 @@ static int list_cmds(const char *spec) if (*spec == ',') spec++; } - for (i = 0; i < list.nr; i++) + for (size_t i = 0; i < list.nr; i++) puts(list.items[i].string); string_list_clear(&list, 0); return 0; @@ -323,10 +321,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) trace2_cmd_name("_query_"); if (!strcmp(cmd, "parseopt")) { struct string_list list = STRING_LIST_INIT_DUP; - int i; list_builtins(&list, NO_PARSEOPT); - for (i = 0; i < list.nr; i++) + for (size_t i = 0; i < list.nr; i++) printf("%s ", list.items[i].string); string_list_clear(&list, 0); exit(0); @@ -652,8 +649,7 @@ static struct cmd_struct commands[] = { static struct cmd_struct *get_builtin(const char *s) { - int i; - for (i = 0; i < ARRAY_SIZE(commands); i++) { + for (size_t i = 0; i < ARRAY_SIZE(commands); i++) { struct cmd_struct *p = commands + i; if (!strcmp(s, p->cmd)) return p; @@ -668,8 +664,7 @@ int is_builtin(const char *s) static void list_builtins(struct string_list *out, unsigned int exclude_option) { - int i; - for (i = 0; i < ARRAY_SIZE(commands); i++) { + for (size_t i = 0; i < ARRAY_SIZE(commands); i++) { if (exclude_option && (commands[i].option & exclude_option)) continue; @@ -680,7 +675,6 @@ static void list_builtins(struct string_list *out, unsigned int exclude_option) void load_builtin_commands(const char *prefix, struct cmdnames *cmds) { const char *name; - int i; /* * Callers can ask for a subset of the commands based on a certain @@ -691,7 +685,7 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds) if (!skip_prefix(prefix, "git-", &prefix)) BUG("prefix '%s' must start with 'git-'", prefix); - for (i = 0; i < ARRAY_SIZE(commands); i++) + for (size_t i = 0; i < ARRAY_SIZE(commands); i++) if (skip_prefix(commands[i].cmd, prefix, &name)) add_cmdname(cmds, name, strlen(name)); } @@ -813,7 +807,7 @@ static int run_argv(struct strvec *args) handle_builtin(args); else if (get_builtin(args->v[0])) { struct child_process cmd = CHILD_PROCESS_INIT; - int i; + int err; /* * The current process is committed to launching a @@ -827,7 +821,7 @@ static int run_argv(struct strvec *args) commit_pager_choice(); strvec_push(&cmd.args, "git"); - for (i = 0; i < args->nr; i++) + for (size_t i = 0; i < args->nr; i++) strvec_push(&cmd.args, args->v[i]); trace_argv_printf(cmd.args.v, "trace: exec:"); @@ -840,9 +834,9 @@ static int run_argv(struct strvec *args) cmd.clean_on_exit = 1; cmd.wait_after_clean = 1; cmd.trace2_child_class = "git_alias"; - i = run_command(&cmd); - if (i >= 0 || errno != ENOENT) - exit(i); + err = run_command(&cmd); + if (err >= 0 || errno != ENOENT) + exit(err); die("could not execute builtin %s", args->v[0]); } @@ -851,9 +845,8 @@ static int run_argv(struct strvec *args) seen = unsorted_string_list_lookup(&cmd_list, args->v[0]); if (seen) { - int i; struct strbuf sb = STRBUF_INIT; - for (i = 0; i < cmd_list.nr; i++) { + for (size_t i = 0; i < cmd_list.nr; i++) { struct string_list_item *item = &cmd_list.items[i]; strbuf_addf(&sb, "\n %s", item->string); @@ -947,7 +940,7 @@ int cmd_main(int argc, const char **argv) */ setup_path(); - for (size_t i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) strvec_push(&args, argv[i]); while (1) { diff --git a/help.h b/help.h index 67207b3073ce48fa25f67f9a4922abc4e2ce7926..c54bf0977dac4d3fffde9a434eb0e9dd87415305 100644 --- a/help.h +++ b/help.h @@ -60,8 +60,7 @@ static inline void list_config_item(struct string_list *list, #define define_list_config_array(array) \ void list_config_##array(struct string_list *list, const char *prefix) \ { \ - int i; \ - for (i = 0; i < ARRAY_SIZE(array); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(array); i++) \ if (array[i]) \ list_config_item(list, prefix, array[i]); \ } \ @@ -70,11 +69,10 @@ struct string_list #define define_list_config_array_extra(array, values) \ void list_config_##array(struct string_list *list, const char *prefix) \ { \ - int i; \ static const char *extra[] = values; \ - for (i = 0; i < ARRAY_SIZE(extra); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(extra); i++) \ list_config_item(list, prefix, extra[i]); \ - for (i = 0; i < ARRAY_SIZE(array); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(array); i++) \ if (array[i]) \ list_config_item(list, prefix, array[i]); \ } \ diff --git a/hex.c b/hex.c index e62406c182ae54ad9475424f0be00e2d9a6bcaab..865a232167553d6376c51d51604544cc71813fb1 100644 --- a/hex.c +++ b/hex.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h" @@ -8,8 +7,7 @@ static int get_hash_hex_algop(const char *hex, unsigned char *hash, const struct git_hash_algo *algop) { - int i; - for (i = 0; i < algop->rawsz; i++) { + for (size_t i = 0; i < algop->rawsz; i++) { int val = hex2chr(hex); if (val < 0) return -1; @@ -84,7 +82,6 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, { static const char hex[] = "0123456789abcdef"; char *buf = buffer; - int i; /* * Our struct object_id has been memset to 0, so default to printing @@ -93,7 +90,7 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, if (algop == &hash_algos[0]) algop = the_hash_algo; - for (i = 0; i < algop->rawsz; i++) { + for (size_t i = 0; i < algop->rawsz; i++) { unsigned int val = *hash++; *buf++ = hex[val >> 4]; *buf++ = hex[val & 0xf]; diff --git a/http-push.c b/http-push.c index a5e8c3e9003074c125f562769b26ffe11985c0c3..43da1c7cd33b402ea77e3ce79e496f670ffdcc3b 100644 --- a/http-push.c +++ b/http-push.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" @@ -1339,7 +1338,6 @@ static struct object_list **process_tree(struct tree *tree, static int get_delta(struct rev_info *revs, struct remote_lock *lock) { - int i; struct commit *commit; struct object_list **p = &objects; int count = 0; @@ -1352,7 +1350,7 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock) count += add_send_request(&commit->object, lock); } - for (i = 0; i < revs->pending.nr; i++) { + for (size_t i = 0; i < revs->pending.nr; i++) { struct object_array_entry *entry = revs->pending.objects + i; struct object *obj = entry->item; const char *name = entry->name; diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index d1f7c56e6f973062ce69312718dbda79f4b944cd..948376d42d06afa5e6a05ffb50dd88054c881597 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" @@ -395,8 +394,6 @@ void list_objects_filter_copy( struct list_objects_filter_options *dest, const struct list_objects_filter_options *src) { - int i; - /* Copy everything. We will overwrite the pointers shortly. */ memcpy(dest, src, sizeof(struct list_objects_filter_options)); @@ -405,7 +402,7 @@ void list_objects_filter_copy( dest->sparse_oid_name = xstrdup_or_null(src->sparse_oid_name); ALLOC_ARRAY(dest->sub, dest->sub_alloc); - for (i = 0; i < src->sub_nr; i++) + for (size_t i = 0; i < src->sub_nr; i++) list_objects_filter_copy(&dest->sub[i], &src->sub[i]); } diff --git a/list-objects.c b/list-objects.c index 2075c69496cde719e3f8deeb05dd5e14f589f036..deacef98aafdaa951a986a9a96a4a25d82717136 100644 --- a/list-objects.c +++ b/list-objects.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h" @@ -284,7 +283,6 @@ void mark_edges_uninteresting(struct rev_info *revs, int sparse) { struct commit_list *list; - int i; if (sparse) { struct oidset set; @@ -321,7 +319,7 @@ void mark_edges_uninteresting(struct rev_info *revs, } if (revs->edge_hint_aggressive) { - for (i = 0; i < revs->cmdline.nr; i++) { + for (size_t i = 0; i < revs->cmdline.nr; i++) { struct object *obj = revs->cmdline.rev[i].item; struct commit *commit = (struct commit *)obj; if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING)) @@ -344,11 +342,9 @@ static void add_pending_tree(struct rev_info *revs, struct tree *tree) static void traverse_non_commits(struct traversal_context *ctx, struct strbuf *base) { - int i; - assert(base->len == 0); - for (i = 0; i < ctx->revs->pending.nr; i++) { + for (size_t i = 0; i < ctx->revs->pending.nr; i++) { struct object_array_entry *pending = ctx->revs->pending.objects + i; struct object *obj = pending->item; const char *name = pending->name; diff --git a/ls-refs.c b/ls-refs.c index 89a796a3561502893e160917bf04fb66af54397b..e28c841375861d3b735755de1dea780283bb7d28 100644 --- a/ls-refs.c +++ b/ls-refs.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h" @@ -54,12 +53,10 @@ static enum { */ static int ref_match(const struct strvec *prefixes, const char *refname) { - int i; - if (!prefixes->nr) return 1; /* no restriction */ - for (i = 0; i < prefixes->nr; i++) { + for (size_t i = 0; i < prefixes->nr; i++) { const char *prefix = prefixes->v[i]; if (starts_with(refname, prefix)) diff --git a/merge.c b/merge.c index da04fff3baa6b64e2581ac86186b99db914a6858..5ecaf508e4cb98d6093fff0f2da0a27f777dd016 100644 --- a/merge.c +++ b/merge.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h" @@ -26,11 +25,11 @@ int try_merge_command(struct repository *r, const char *head_arg, struct commit_list *remotes) { struct child_process cmd = CHILD_PROCESS_INIT; - int i, ret; + int ret; struct commit_list *j; strvec_pushf(&cmd.args, "merge-%s", strategy); - for (i = 0; i < xopts_nr; i++) + for (size_t i = 0; i < xopts_nr; i++) strvec_pushf(&cmd.args, "--%s", xopts[i]); for (j = common; j; j = j->next) strvec_push(&cmd.args, merge_argument(j->item)); diff --git a/path.c b/path.c index 1f210048047b72370d87a6161c4af0142c17cf6a..b4be7581aa6c94380223045648778a18f74596bf 100644 --- a/path.c +++ b/path.c @@ -3,7 +3,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" @@ -1141,12 +1140,12 @@ int strbuf_normalize_path(struct strbuf *src) */ int longest_ancestor_length(const char *path, struct string_list *prefixes) { - int i, max_len = -1; + int max_len = -1; if (!strcmp(path, "/")) return -1; - for (i = 0; i < prefixes->nr; i++) { + for (size_t i = 0; i < prefixes->nr; i++) { const char *ceil = prefixes->items[i].string; int len = strlen(ceil); diff --git a/pkt-line.c b/pkt-line.c index 2dc29d5b68e45740a7f4e473b7c7ffa57bc09528..a5bcbc96fb340f50ce6083aa2b7e9611d80de179 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "copy.h" #include "pkt-line.h" @@ -41,7 +39,6 @@ static int packet_trace_pack(const char *buf, unsigned int len, int sideband) static void packet_trace(const char *buf, unsigned int len, int write) { - int i; struct strbuf out; static int in_pack, sideband; @@ -74,7 +71,7 @@ static void packet_trace(const char *buf, unsigned int len, int write) get_trace_prefix(), write ? '>' : '<'); /* XXX we should really handle printable utf8 */ - for (i = 0; i < len; i++) { + for (unsigned int i = 0; i < len; i++) { /* suppress newlines */ if (buf[i] == '\n') continue; diff --git a/refs/debug.c b/refs/debug.c index 89fbd593204cb2e0cc6c74bad11956f105089f82..fbc4df08b43ca73a866a0494079f26c1ad161293 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "hex.h" #include "refs-internal.h" @@ -85,9 +83,8 @@ static void print_update(int i, const char *refname, static void print_transaction(struct ref_transaction *transaction) { - int i; trace_printf_key(&trace_refs, "transaction {\n"); - for (i = 0; i < transaction->nr; i++) { + for (size_t i = 0; i < transaction->nr; i++) { struct ref_update *u = transaction->updates[i]; print_update(i, u->refname, &u->old_oid, &u->new_oid, u->flags, u->type, u->msg); diff --git a/send-pack.c b/send-pack.c index 6e68074e50dbc48622b0e63e56cfbe3560dcd605..7e8321368379efe2600a1f573e2e4cd5140a008d 100644 --- a/send-pack.c +++ b/send-pack.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" @@ -73,7 +72,6 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised, */ struct child_process po = CHILD_PROCESS_INIT; FILE *po_in; - int i; int rc; trace2_region_enter("send_pack", "pack_objects", the_repository); @@ -105,9 +103,9 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised, * parameters by writing to the pipe. */ po_in = xfdopen(po.in, "w"); - for (i = 0; i < advertised->nr; i++) + for (size_t i = 0; i < advertised->nr; i++) feed_object(&advertised->oid[i], po_in, 1); - for (i = 0; i < negotiated->nr; i++) + for (size_t i = 0; i < negotiated->nr; i++) feed_object(&negotiated->oid[i], po_in, 1); while (refs) { diff --git a/serve.c b/serve.c index 1e08fa92510c5f78e675aa0e91c8505018d5dcfa..c8694e375159ca0044cb045500954770e1e5cb93 100644 --- a/serve.c +++ b/serve.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h" @@ -164,12 +163,11 @@ void protocol_v2_advertise_capabilities(void) { struct strbuf capability = STRBUF_INIT; struct strbuf value = STRBUF_INIT; - int i; /* serve by default supports v2 */ packet_write_fmt(1, "version 2\n"); - for (i = 0; i < ARRAY_SIZE(capabilities); i++) { + for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) { struct protocol_capability *c = &capabilities[i]; if (c->advertise(the_repository, &value)) { @@ -195,12 +193,10 @@ void protocol_v2_advertise_capabilities(void) static struct protocol_capability *get_capability(const char *key, const char **value) { - int i; - if (!key) return NULL; - for (i = 0; i < ARRAY_SIZE(capabilities); i++) { + for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) { struct protocol_capability *c = &capabilities[i]; const char *out; if (!skip_prefix(key, c->name, &out)) diff --git a/strvec.c b/strvec.c index e8f87ab3a60e5912f910b3107bfde70a1f809c3e..5cead29ba12c1545b2922567c69d4b74dad46ca6 100644 --- a/strvec.c +++ b/strvec.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "strvec.h" #include "strbuf.h" @@ -129,8 +127,7 @@ void strvec_split(struct strvec *array, const char *to_split) void strvec_clear(struct strvec *array) { if (array->v != empty_strvec) { - int i; - for (i = 0; i < array->nr; i++) + for (size_t i = 0; i < array->nr; i++) free((char *)array->v[i]); free(array->v); } diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index 8d4ef441312e2059058c6465b0c084e6f31921cc..14e075c1a11a4e06f111df4d410f0a11354ea4b8 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "bloom.h" @@ -12,30 +11,25 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS; static void add_string_to_filter(const char *data, struct bloom_filter *filter) { struct bloom_key key; - int i; fill_bloom_key(data, strlen(data), &key, &settings); printf("Hashes:"); - for (i = 0; i < settings.num_hashes; i++){ + for (size_t i = 0; i < settings.num_hashes; i++) printf("0x%08x|", key.hashes[i]); - } printf("\n"); add_key_to_filter(&key, filter, &settings); clear_bloom_key(&key); } static void print_bloom_filter(struct bloom_filter *filter) { - int i; - if (!filter) { printf("No filter.\n"); return; } printf("Filter_Length:%d\n", (int)filter->len); printf("Filter_Data:"); - for (i = 0; i < filter->len; i++) { + for (size_t i = 0; i < filter->len; i++) printf("%02x|", filter->data[i]); - } printf("\n"); } diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c index 7b78f9d182d89dae4878e0ecf3e0bd99f79bfd39..efd017ca357e0b27b5bd5d07a62f1fd5d1d7d843 100644 --- a/t/helper/test-dump-fsmonitor.c +++ b/t/helper/test-dump-fsmonitor.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "read-cache-ll.h" @@ -9,7 +8,6 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED) { struct index_state *istate = the_repository->index; - int i; setup_git_directory(); if (do_read_index(istate, the_repository->index_file, 0) < 0) @@ -20,7 +18,7 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED) } printf("fsmonitor last update %s\n", istate->fsmonitor_last_update); - for (i = 0; i < istate->cache_nr; i++) + for (size_t i = 0; i < istate->cache_nr; i++) printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-"); return 0; diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c index f31b44a7677a96ed2f2eec870ded3af8d1b2a79e..f855a3862c97bb3af7a2a3a83c6a5a033b4a3dea 100644 --- a/t/helper/test-dump-split-index.c +++ b/t/helper/test-dump-split-index.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h" @@ -17,7 +16,6 @@ static void show_bit(size_t pos, void *data UNUSED) int cmd__dump_split_index(int ac UNUSED, const char **av) { struct split_index *si; - int i; setup_git_directory(); @@ -29,7 +27,7 @@ int cmd__dump_split_index(int ac UNUSED, const char **av) return 0; } printf("base %s\n", oid_to_hex(&si->base_oid)); - for (i = 0; i < the_repository->index->cache_nr; i++) { + for (size_t i = 0; i < the_repository->index->cache_nr; i++) { struct cache_entry *ce = the_repository->index->cache[i]; printf("%06o %s %d\t%s\n", ce->ce_mode, oid_to_hex(&ce->oid), ce_stage(ce), ce->name); diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c index ae057958000e41959ec452c6577287fbd8475173..01a109496bee7872d098ba3ac64c9e7e07404da7 100644 --- a/t/helper/test-dump-untracked-cache.c +++ b/t/helper/test-dump-untracked-cache.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "dir.h" @@ -24,7 +23,7 @@ static int compare_dir(const void *a_, const void *b_) static void dump(struct untracked_cache_dir *ucd, struct strbuf *base) { - int i, len; + int len; QSORT(ucd->untracked, ucd->untracked_nr, compare_untracked); QSORT(ucd->dirs, ucd->dirs_nr, compare_dir); len = base->len; @@ -38,9 +37,9 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base) if (ucd->valid) fputs(" valid", stdout); printf("\n"); - for (i = 0; i < ucd->untracked_nr; i++) + for (size_t i = 0; i < ucd->untracked_nr; i++) printf("%s\n", ucd->untracked[i]); - for (i = 0; i < ucd->dirs_nr; i++) + for (size_t i = 0; i < ucd->dirs_nr; i++) dump(ucd->dirs[i], base); strbuf_setlen(base, len); } diff --git a/t/helper/test-hash-speed.c b/t/helper/test-hash-speed.c index 81a446dd64e4134585f90a01c28e95edf0b059de..80df1aae66b6242e91725bd7ad8d3e72742034b3 100644 --- a/t/helper/test-hash-speed.c +++ b/t/helper/test-hash-speed.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-tool.h" #include "hash.h" @@ -18,12 +16,11 @@ int cmd__hash_speed(int ac, const char **av) unsigned char hash[GIT_MAX_RAWSZ]; clock_t initial, start, end; unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 }; - int i; void *p; const struct git_hash_algo *algo = NULL; if (ac == 2) { - for (i = 1; i < GIT_HASH_NALGOS; i++) { + for (size_t i = 1; i < GIT_HASH_NALGOS; i++) { if (!strcmp(av[1], hash_algos[i].name)) { algo = &hash_algos[i]; break; @@ -38,7 +35,7 @@ int cmd__hash_speed(int ac, const char **av) printf("algo: %s\n", algo->name); - for (i = 0; i < ARRAY_SIZE(bufsizes); i++) { + for (size_t i = 0; i < ARRAY_SIZE(bufsizes); i++) { unsigned long j, kb; double kb_per_sec; p = xcalloc(1, bufsizes[i]); diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 25ba08a7c37ea1915534d5c52f41c6e15473453c..bfe45ec68b01f1a8824c6d3e06559887899487b0 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-tool.h" #include "parse-options.h" #include "strbuf.h" @@ -176,7 +174,6 @@ int cmd__parse_options(int argc, const char **argv) OPT_ALIAS('Z', "alias-target", "alias-source"), OPT_END(), }; - int i; int ret = 0; trace2_cmd_name("_parse_"); @@ -200,10 +197,10 @@ int cmd__parse_options(int argc, const char **argv) show(&expect, &ret, "dry run: %s", dry_run ? "yes" : "no"); show(&expect, &ret, "file: %s", file ? file : "(not set)"); - for (i = 0; i < list.nr; i++) + for (size_t i = 0; i < list.nr; i++) show(&expect, &ret, "list: %s", list.items[i].string); - for (i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) show(&expect, &ret, "arg %02d: %s", i, argv[i]); expect.strdup_strings = 1; diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c index 25c232464df1639766c2db013d6e5b4b7021cbb2..01cf77ae65b9a7db2f31a9a1558b8bb84b2e81d3 100644 --- a/t/helper/test-reach.c +++ b/t/helper/test-reach.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h" @@ -14,7 +13,6 @@ static void print_sorted_commit_ids(struct commit_list *list) { - int i; struct string_list s = STRING_LIST_INIT_DUP; while (list) { @@ -24,7 +22,7 @@ static void print_sorted_commit_ids(struct commit_list *list) string_list_sort(&s); - for (i = 0; i < s.nr; i++) + for (size_t i = 0; i < s.nr; i++) printf("%s\n", s.items[i].string); string_list_clear(&s, 0); diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index c5c4cb142dde77667e9cc108def294e4712683f0..1cc05f043ac204fcea0d3304e93e8e2bde5b6b70 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h" @@ -25,14 +24,13 @@ struct flag_definition { static unsigned int parse_flags(const char *str, struct flag_definition *defs) { struct string_list masks = STRING_LIST_INIT_DUP; - int i = 0; unsigned int result = 0; if (!strcmp(str, "0")) return 0; string_list_split(&masks, str, ',', 64); - for (; i < masks.nr; i++) { + for (size_t i = 0; i < masks.nr; i++) { const char *name = masks.items[i].string; struct flag_definition *def = defs; int found = 0; diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index b626f64eca47cce16abdd9915462af46c66b0044..4a7aa993ba99e2791718e0d7206158aad207dc56 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "test-tool.h" #include "test-tool-utils.h" @@ -103,7 +101,6 @@ static NORETURN void die_usage(void) int cmd_main(int argc, const char **argv) { - int i; const char *working_directory = NULL; struct option options[] = { OPT_STRING('C', NULL, &working_directory, "directory", @@ -122,7 +119,7 @@ int cmd_main(int argc, const char **argv) if (working_directory && chdir(working_directory) < 0) die("Could not cd to '%s'", working_directory); - for (i = 0; i < ARRAY_SIZE(cmds); i++) { + for (size_t i = 0; i < ARRAY_SIZE(cmds); i++) { if (!strcmp(cmds[i].name, argv[1])) { argv++; argc--; diff --git a/t/unit-tests/t-example-decorate.c b/t/unit-tests/t-example-decorate.c index 61da8e1c8bedb6313369bc5eefd63b5aa54f78d6..bfc776e223868735f36276f454b4932298800749 100644 --- a/t/unit-tests/t-example-decorate.c +++ b/t/unit-tests/t-example-decorate.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-lib.h" #include "object.h" @@ -43,9 +42,9 @@ static void t_lookup(struct test_vars *vars) static void t_loop(struct test_vars *vars) { - int i, objects_noticed = 0; + int objects_noticed = 0; - for (i = 0; i < vars->n.size; i++) { + for (size_t i = 0; i < vars->n.size; i++) { if (vars->n.entries[i].base) objects_noticed++; } diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c index a3d1aabab5ce08aedbce2ff815d0676d8784bad6..a0536350003b81a9f8afbc10627afa503a891e10 100644 --- a/t/unit-tests/t-prio-queue.c +++ b/t/unit-tests/t-prio-queue.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-lib.h" #include "prio-queue.h" @@ -27,7 +25,7 @@ static void test_prio_queue(int *input, size_t input_size, struct prio_queue pq = { intcmp }; int j = 0; - for (int i = 0; i < input_size; i++) { + for (size_t i = 0; i < input_size; i++) { void *peek, *get; switch(input[i]) { case GET: diff --git a/tmp-objdir.c b/tmp-objdir.c index b9084d0ac3cf8b4de879951a6f2480f26635172b..659fcdcc2954ed392f9e241667ea6a7d2c79b828 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tmp-objdir.h" @@ -238,7 +237,6 @@ static int migrate_paths(struct strbuf *src, struct strbuf *dst, { size_t src_len = src->len, dst_len = dst->len; struct string_list paths = STRING_LIST_INIT_DUP; - int i; int ret = 0; if (read_dir_paths(&paths, src->buf) < 0) @@ -246,7 +244,7 @@ static int migrate_paths(struct strbuf *src, struct strbuf *dst, paths.cmp = pack_copy_cmp; string_list_sort(&paths); - for (i = 0; i < paths.nr; i++) { + for (size_t i = 0; i < paths.nr; i++) { const char *name = paths.items[i].string; enum finalize_object_file_flags flags_copy = flags; diff --git a/trailer.c b/trailer.c index b7e406328534e8904c7fe7980e22d7777e6c4002..310cf582dc370374953b0c7ecef90d6e616c9942 100644 --- a/trailer.c +++ b/trailer.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" @@ -523,7 +522,6 @@ static int git_trailer_config(const char *conf_key, const char *value, struct conf_info *conf; char *name = NULL; enum trailer_info_type type; - int i; if (!skip_prefix(conf_key, "trailer.", &trailer_item)) return 0; @@ -533,7 +531,7 @@ static int git_trailer_config(const char *conf_key, const char *value, return 0; variable_name++; - for (i = 0; i < ARRAY_SIZE(trailer_config_items); i++) { + for (size_t i = 0; i < ARRAY_SIZE(trailer_config_items); i++) { if (strcmp(trailer_config_items[i].name, variable_name)) continue; name = xstrndup(trailer_item, variable_name - trailer_item - 1); diff --git a/transport-helper.c b/transport-helper.c index 387c67d5bd198e01250addbcfc12b59868d2007e..d457b425501a74d8837cdbb41855a205fc151b01 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "transport.h" @@ -314,9 +313,9 @@ static int string_list_set_helper_option(struct helper_data *data, struct string_list *list) { struct strbuf buf = STRBUF_INIT; - int i, ret = 0; + int ret = 0; - for (i = 0; i < list->nr; i++) { + for (size_t i = 0; i < list->nr; i++) { strbuf_addf(&buf, "option %s ", name); quote_c_style(list->items[i].string, &buf, NULL, 0); strbuf_addch(&buf, '\n'); @@ -334,7 +333,7 @@ static int set_helper_option(struct transport *transport, { struct helper_data *data = transport->data; struct strbuf buf = STRBUF_INIT; - int i, ret, is_bool = 0; + int ret, is_bool = 0; get_helper(transport); @@ -345,12 +344,12 @@ static int set_helper_option(struct transport *transport, return string_list_set_helper_option(data, name, (struct string_list *)value); - for (i = 0; i < ARRAY_SIZE(unsupported_options); i++) { + for (size_t i = 0; i < ARRAY_SIZE(unsupported_options); i++) { if (!strcmp(name, unsupported_options[i])) return 1; } - for (i = 0; i < ARRAY_SIZE(boolean_options); i++) { + for (size_t i = 0; i < ARRAY_SIZE(boolean_options); i++) { if (!strcmp(name, boolean_options[i])) { is_bool = 1; break; @@ -482,7 +481,6 @@ static int get_exporter(struct transport *transport, { struct helper_data *data = transport->data; struct child_process *helper = get_helper(transport); - int i; child_process_init(fastexport); @@ -498,7 +496,7 @@ static int get_exporter(struct transport *transport, if (data->import_marks) strvec_pushf(&fastexport->args, "--import-marks=%s", data->import_marks); - for (i = 0; i < revlist_args->nr; i++) + for (size_t i = 0; i < revlist_args->nr; i++) strvec_push(&fastexport->args, revlist_args->items[i].string); fastexport->git_cmd = 1; diff --git a/transport.c b/transport.c index abf0ff57066edb0f88d5ab06306e4d58c98017dd..d94ed4f98f338eb4eeec56ff05a022a1a64bc3a9 100644 --- a/transport.c +++ b/transport.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h" @@ -48,7 +47,6 @@ static int transport_color_config(void) "color.transport.rejected" }, *key = "color.transport"; char *value; - int i; static int initialized; if (initialized) @@ -61,7 +59,7 @@ static int transport_color_config(void) if (!want_color_stderr(transport_use_color)) return 0; - for (i = 0; i < ARRAY_SIZE(keys); i++) + for (size_t i = 0; i < ARRAY_SIZE(keys); i++) if (!git_config_get_string(keys[i], &value)) { if (!value) return config_error_nonbool(keys[i]); @@ -154,14 +152,13 @@ static struct ref *get_refs_from_bundle(struct transport *transport, { struct bundle_transport_data *data = transport->data; struct ref *result = NULL; - int i; if (for_push) return NULL; get_refs_from_bundle_inner(transport); - for (i = 0; i < data->header.references.nr; i++) { + for (size_t i = 0; i < data->header.references.nr; i++) { struct string_list_item *e = data->header.references.items + i; const char *name = e->string; struct ref *ref = alloc_ref(name); @@ -1282,11 +1279,9 @@ void transport_set_verbosity(struct transport *transport, int verbosity, static void die_with_unpushed_submodules(struct string_list *needs_pushing) { - int i; - fprintf(stderr, _("The following submodule paths contain changes that can\n" "not be found on any remote:\n")); - for (i = 0; i < needs_pushing->nr; i++) + for (size_t i = 0; i < needs_pushing->nr; i++) fprintf(stderr, " %s\n", needs_pushing->items[i].string); fprintf(stderr, _("\nPlease try\n\n" " git push --recurse-submodules=on-demand\n\n" @@ -1602,9 +1597,8 @@ int transport_get_remote_bundle_uri(struct transport *transport) void transport_unlock_pack(struct transport *transport, unsigned int flags) { int in_signal_handler = !!(flags & TRANSPORT_UNLOCK_PACK_IN_SIGNAL_HANDLER); - int i; - for (i = 0; i < transport->pack_lockfiles.nr; i++) + for (size_t i = 0; i < transport->pack_lockfiles.nr; i++) if (in_signal_handler) unlink(transport->pack_lockfiles.items[i].string); else diff --git a/usage.c b/usage.c index 8c672a57f672d9251cadf59e33e7c96943a2024f..47709006c15f675490f87e1f555161d33fca72e9 100644 --- a/usage.c +++ b/usage.c @@ -4,8 +4,6 @@ * Copyright (C) Linus Torvalds, 2005 */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "gettext.h" #include "trace2.h" @@ -192,7 +190,7 @@ void NORETURN die(const char *err, ...) static const char *fmt_with_err(char *buf, int n, const char *fmt) { char str_error[256], *err; - int i, j; + size_t i, j; err = strerror(errno); for (i = j = 0; err[i] && j < sizeof(str_error) - 1; ) { diff --git a/version.c b/version.c index d5aadab709e06dcd55765f36ba8e949cfa1541f1..44cd39ae26baa38e1ceaf3ee7a44dfece8719db0 100644 --- a/version.c +++ b/version.c @@ -1,4 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h" @@ -25,11 +24,10 @@ const char *git_user_agent_sanitized(void) if (!agent) { struct strbuf buf = STRBUF_INIT; - int i; strbuf_addstr(&buf, git_user_agent()); strbuf_trim(&buf); - for (i = 0; i < buf.len; i++) { + for (size_t i = 0; i < buf.len; i++) { if (buf.buf[i] <= 32 || buf.buf[i] >= 127) buf.buf[i] = '.'; } diff --git a/versioncmp.c b/versioncmp.c index 71cef7e85862270b537df3dface350a6462e94ed..b6eebdb989c04264124fa501f19b6c346f56f7e1 100644 --- a/versioncmp.c +++ b/versioncmp.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h" @@ -78,11 +77,10 @@ static int swap_prereleases(const char *s1, int off, int *diff) { - int i; struct suffix_match match1 = { -1, off, -1 }; struct suffix_match match2 = { -1, off, -1 }; - for (i = 0; i < prereleases->nr; i++) { + for (size_t i = 0; i < prereleases->nr; i++) { const char *suffix = prereleases->items[i].string; int start, suffix_len = strlen(suffix); if (suffix_len < off) From patchwork Fri Dec 6 10:27:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896909 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 B8ADB202F71 for ; Fri, 6 Dec 2024 10:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480867; cv=none; b=JdvtmwkSresWvnCkQ3gAGR3+N3aaCSZ9QstS1KZoLgoVm8C0D4MdDYZIii47kkMtbapaCqIWqb+QsKJJnspPfzkXSUvB/s9d2xCpiSMGS1nP/hJYKuJcNc3aoWCsLympRM9gJQl+rafKoDmVAw9mqU5x+2wFU5uzU/Hg10qEXRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480867; c=relaxed/simple; bh=QFrusp397+dOKKcr4SKzF+LoFWbtbFJiGTftPiq2ZZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=htHNAIu9vxvmGvE/GLJC4z+jZItxgm/LulVbVDrXtWgqvn9GNvP9gPOPr3h++K/j+hlBjLL1QdvpZy1QQRhWNK3gvvFMMATuBNTbIf0I6/SDurbx/BApTNfeOaxRAVKgwOa01hSmdFEfH4HXhBf9iLYC5adXqToAI5jEv3NCxE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=e5zXIBMd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=2bNoyd6x; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="e5zXIBMd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="2bNoyd6x" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id EBA22254019F; Fri, 6 Dec 2024 05:27:44 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 06 Dec 2024 05:27:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480864; x=1733567264; bh=h80l7HwccbjgUZiQGYrPx7hNd2Zha/Q0iHlJ/tqYFt8=; b= e5zXIBMddN01qCV4ywiyK6UH7A3F/gJlK27BTQ5ZxrbhUAFmXUJDTdmUG+nsIUlU vzOT3aUqNID1Nl8LarYsSAXUbO5Dzf1ZWJcvgMUOEDCYp1lvoEKXb0vf/ep6nl+N y5zrRp7Rh/dB2XCfQNa6xjtv7ylGaxf3SVHW9qANqBXVsjOlq7j4BSyKUf7WH4yD nDBR+/r3Mr6JrG5Xo/SHVgiaXVN5DLzPJabtv721r90xSfTsVQpvDQb9Mi5fX3JK t68SLclLHGpaMfikotQa5iIyg/PiWKqDdCktfmnOJiYm8nxkVBxpdTHRDWE2wlEW 9jBId96FlS2xVm5jgNz1bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480864; x= 1733567264; bh=h80l7HwccbjgUZiQGYrPx7hNd2Zha/Q0iHlJ/tqYFt8=; b=2 bNoyd6xXOGTVx2t/9wEFvS7qqougXF9y87SZeWuS6VAEPJq0BDewK/vTfEf0Y4OU yKc/+/DU0fecKtKjHPwU15UhFn4+wyLGyBpeTn4gxGxFZdgm961h3lkmod7OfMqA 62muiJnPUTWPWEW1wVrVNGG/tw1/qtxp7qCAsezTAVywzvhOvyf2d0h4siw6Q7HD GlNkpukE5QX1UmAGRze/b0qdA9Isud7LUimHFpEox098aa4/1OqhHWZ74K/Up0KM RvVs3v6rtg7ohdxDlurpSlzePmm9dzqR7s+z4OjPHq7QpBCXWjWtDn2zdJB1cabB kqGPywQuiekwp5/20Yj2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhgvjhhi rghluhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithhsthgvrhesphhosghogi drtghomhdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepghhi thesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:43 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 2404da87 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:20 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:25 +0100 Subject: [PATCH v4 10/16] daemon: fix loops that have mismatching integer types Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-10-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 We have several loops in "daemon.c" that use a signed integer to loop through a `size_t`. Adapt them to instead use a `size_t` as counter value. Signed-off-by: Patrick Steinhardt --- daemon.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/daemon.c b/daemon.c index 68789ceb222eeb389d58998fd00388f289868fc3..bf313bc21a0b82a12064c534af78c9ad51be78e6 100644 --- a/daemon.c +++ b/daemon.c @@ -503,8 +503,7 @@ static struct daemon_service daemon_service[] = { static void enable_service(const char *name, int ena) { - int i; - for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { + for (size_t i = 0; i < ARRAY_SIZE(daemon_service); i++) { if (!strcmp(daemon_service[i].name, name)) { daemon_service[i].enabled = ena; return; @@ -515,8 +514,7 @@ static void enable_service(const char *name, int ena) static void make_service_overridable(const char *name, int ena) { - int i; - for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { + for (size_t i = 0; i < ARRAY_SIZE(daemon_service); i++) { if (!strcmp(daemon_service[i].name, name)) { daemon_service[i].overridable = ena; return; @@ -737,7 +735,7 @@ static void set_keep_alive(int sockfd) static int execute(void) { char *line = packet_buffer; - int pktlen, len, i; + int pktlen, len; char *addr = getenv("REMOTE_ADDR"), *port = getenv("REMOTE_PORT"); struct hostinfo hi = HOSTINFO_INIT; struct strvec env = STRVEC_INIT; @@ -758,7 +756,7 @@ static int execute(void) if (len != pktlen) parse_extra_args(&hi, &env, line + len + 1, pktlen - len - 1); - for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { + for (size_t i = 0; i < ARRAY_SIZE(daemon_service); i++) { struct daemon_service *s = &(daemon_service[i]); const char *arg; @@ -1108,8 +1106,8 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct s if (!listen_addr->nr) setup_named_sock(NULL, listen_port, socklist); else { - int i, socknum; - for (i = 0; i < listen_addr->nr; i++) { + int socknum; + for (size_t i = 0; i < listen_addr->nr; i++) { socknum = setup_named_sock(listen_addr->items[i].string, listen_port, socklist); @@ -1123,11 +1121,10 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct s static int service_loop(struct socketlist *socklist) { struct pollfd *pfd; - int i; CALLOC_ARRAY(pfd, socklist->nr); - for (i = 0; i < socklist->nr; i++) { + for (size_t i = 0; i < socklist->nr; i++) { pfd[i].fd = socklist->list[i]; pfd[i].events = POLLIN; } @@ -1135,8 +1132,6 @@ static int service_loop(struct socketlist *socklist) signal(SIGCHLD, child_handler); for (;;) { - int i; - check_dead_children(); if (poll(pfd, socklist->nr, -1) < 0) { @@ -1148,7 +1143,7 @@ static int service_loop(struct socketlist *socklist) continue; } - for (i = 0; i < socklist->nr; i++) { + for (size_t i = 0; i < socklist->nr; i++) { if (pfd[i].revents & POLLIN) { union { struct sockaddr sa; From patchwork Fri Dec 6 10:27:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896910 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 62E61202F86 for ; Fri, 6 Dec 2024 10:27:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480868; cv=none; b=aYHyKlVvu6mcQaeNrDmblcGTdEFKAL4ZxuQfDeOAVT4A0tlvzgf7rjtbQLciQVlK4bWPFcqX6htSLPZyljkT+pIsBcWYUQGgAQqUDJdeuj6uW8Gxay7+6YCpKDam1UCw66Nft0gZ15sYE2y2gxVQJH3Czwj/UzALGmIWyFDWE90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480868; c=relaxed/simple; bh=OrIjeXuF9w1rHOW5ZBOKjcpZv9boHrkcBksyNW6vs6M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=knOATgbQIMAe98nVTwRxvWmt5GXWzPa/JdZ5FwkKnIDv6DmXxxQB7Q2BAKqEqv1Hgp6+nirpkiOEYyQgv5dBr6Gaw/AtKALTPcPVh7OYOWPkcXv3HpgxaC0sJqYqlBnDR/tdP209V6Hjc1gsMV5lwwibfZnz2j7wRc1+bmGbl60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=ojx/Shnd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qr04ZBBl; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="ojx/Shnd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qr04ZBBl" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 8CAF5114017B; Fri, 6 Dec 2024 05:27:45 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Fri, 06 Dec 2024 05:27:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480865; x=1733567265; bh=1RpNUTixPgdVutE0Y8H/jYG71yZfDcWpSTddOqURV3Q=; b= ojx/ShndBenWVSAPkCsL194nTjyfZxIsgX8amepjcjBZzMgnYv2bIIuwOTMkfxex X0lsFyWYxFylqbZ/j9f2nilsTy5s4nAY5+o0RPgBovD9gWRFVYoxQVO8cMBXtB9T K1ijQ8KLFu0z4qUIWdmlkXryDwBbkcQOTcRxgVKF5ctu0Tqa9OtzeoKXflvNPRyh 1XQkEwhGSvqq1Vn/xpRRQtgbLg0Mn+EWTHS/4LRQcXQlgcj6wSFXOyJWTVxNxoLS qn5L/lq6DxpoYPy16zGaEyLMjNBtiL8Y41S8bYB10U544c//KwEmylJoIp0Rg+r5 UsST+Xn+977IzOnnS/o3Aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480865; x= 1733567265; bh=1RpNUTixPgdVutE0Y8H/jYG71yZfDcWpSTddOqURV3Q=; b=q r04ZBBlKqC2nQWC2bGv6Wp1/5Moo2Vgpji8l2N1rXg5EMDYC8fRET90oYzRb0Jjb QMPqu8JwdTgPff4xHNpLZon6Bln4iuE1RLdQ7H5UBoB48dZfHwaoU1rZptA88ngI iDlcNOGRiliaAyF+5EHTvlGzwXDsR2D7T1sQV3nthvyuii7rebXLFEcCukFd1GMa Ewsc/WQn9Ve+8hGgq7vRQJ2xztLakZvWsSCnQ7MeWnAH5oulBCSAs6ZqvVoYLGug 8WIQNV27v/3qKPphAWOsIWXNerd7WHgTvjsh682tDBzLLnh6LfYC5kHDzvPrjb1E 313wXkvhoVNPmBQtqcVZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghffhes phgvfhhfrdhnvghtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepshhh vghjihgrlhhuohesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:44 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f365c310 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:21 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:26 +0100 Subject: [PATCH v4 11/16] daemon: fix type of `max_connections` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-11-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 The `max_connections` type tracks how many children git-daemon(1) would spawn at the same time. This value can be controlled via a command line switch: if given a positive value we'll set that up as the limit. But when given either zero or a negative value we don't enforce any limit at all. But even when being passed a negative value we won't actually store it, but normalize it to 0. Still, the variable used to store the config is using a signed integer, which causes warnings when comparing the number of accepted connections (`max_connections`) with the number of current connections being handled (`live_children`). Adapt the type of `max_connections` such that the types of both variables match. Signed-off-by: Patrick Steinhardt --- daemon.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/daemon.c b/daemon.c index bf313bc21a0b82a12064c534af78c9ad51be78e6..5ca70335fc4b94b6f3cadeac309316b70dd9377f 100644 --- a/daemon.c +++ b/daemon.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" @@ -801,8 +800,7 @@ static int addrcmp(const struct sockaddr_storage *s1, return 0; } -static int max_connections = 32; - +static unsigned int max_connections = 32; static unsigned int live_children; static struct child { @@ -1315,10 +1313,11 @@ int cmd_main(int argc, const char **argv) continue; } if (skip_prefix(arg, "--max-connections=", &v)) { - if (strtol_i(v, 10, &max_connections)) + int parsed_value; + if (strtol_i(v, 10, &parsed_value)) die(_("invalid max-connections '%s', expecting an integer"), v); - if (max_connections < 0) - max_connections = 0; /* unlimited */ + /* A negative value indicates unlimited children. */ + max_connections = parsed_value < 0 ? 0 : parsed_value; continue; } if (!strcmp(arg, "--strict-paths")) { From patchwork Fri Dec 6 10:27:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896912 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 921662036F2 for ; Fri, 6 Dec 2024 10:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480869; cv=none; b=qbeggMfxr+LFvYxVnzgkXnLNXAI4K2eKVhZuVOzClwmK5lufZaeREP55L/BHnHoQmZylEY5vYH1VzkianfLn2myVaIYjfskRyYKJ8AgON3jShj+mwivA1j5ncBxK7ejeJtblYCJok5faUFvyeJUMCeVPO8prsrxO2R11S2gmGVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480869; c=relaxed/simple; bh=N/kGI35uw2wReGQtRhDTg/oIyFx9rb9hd63XvAwvqEo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jJwmOwT2XPZs/vB0Gld20cZUyk/+w9dQmwBLbNv4bYnWiC6EGPmnSK1gnAzOnCX0oEJQPTVoo72RBOmpoM2MH95j2mVoRFV7Kt7hurrBoC7Qt2Fcl6j17k0bSa9k4bSVFTlu6RVb1sa1OL+p8fh4M3hdaoXzvkNNOL55zoswsMw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=uqJHuHoy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=BRqd5fh2; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="uqJHuHoy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="BRqd5fh2" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 8BB7525401A4; Fri, 6 Dec 2024 05:27:46 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 06 Dec 2024 05:27:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480866; x=1733567266; bh=Ossup2nZ6UWY2WKN4PsWIuN24Ki+kOfYdJwR1luyMmo=; b= uqJHuHoyluktx4AyJDhl8Z4b82YxBaSOdeZq+DEbzgOyLwkcLNyztHEO2TqwZoVs HFeDC3EHAK9vHEDgfKCbgzWIGWW57XqRjPyG+7domIF530vN3J7PCYA0195ADW33 CEdlU6oJKINRrknbRB9GL2Uiksg57IzI7XRBU4dK92ug1HJfWrhMnzO6EU9j7rOH eMV/UTJwrlsoJUlODUba/mGZA995b8zJZd9l9UMS3i4g+farFZoYSdJHR+8oZtlZ hUUp8lIdOF1xZybphsgnLs9exEm8KvNY4nS6b8CpSsjDLYjbk7j/Ede8V/LP7VeT Dq+cJXukxCWMtFIHGIvroQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480866; x= 1733567266; bh=Ossup2nZ6UWY2WKN4PsWIuN24Ki+kOfYdJwR1luyMmo=; b=B Rqd5fh2mBr+2GfkXkgr1nUMM7bPFgmsHmrXvnv4O0zloJfyvVZMDAqygLAWdReAg Jdmd07xgij/Ma3avQAlbBJ9idhwyVa1eNTjGhnT/mJjkTjEQNmaRHkNZ1kI49HbW GdRltRRVaxZOZUdtjQTF0eOZSA0tfWthfSY/G/WR9uYi1OgTRG571ldshfTcXE+5 od19H8YLbKhlO36QSlE62FheFsHfx4omxj9TlRxrq7TAnp2JNADuS9NefdOXWY+w eO9uKDwGGtT7Cx2wm+lL8TtFNJq+7f77uOMhyViik6anjqodGn1kXob3+dm+U7o6 aRRfz31QlEnVlqcuHbFHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghffhes phgvfhhfrdhnvghtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopehshhgvjhhirghluhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohep ghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:45 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id bd7e8cdc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:22 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:27 +0100 Subject: [PATCH v4 12/16] gpg-interface: address -Wsign-comparison warnings Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-12-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 There are a couple of -Wsign-comparison warnings in "gpg-interface.c". Most of them are trivial and simply using signed integers to loop towards an upper unsigned bound. But in `parse_signed_buffer()` we have one case where the different signedness of the two values of a ternary expression results in a warning. Given that: - `size` will always be bigger than `len` due to the loop condition. - `eol` will always be after `buf + len` because it is found via memchr(3p) starting from `buf + len`. We know that both values will always be natural integers. Squelch the warning by casting the left-hand side to `size_t`. Signed-off-by: Patrick Steinhardt --- gpg-interface.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gpg-interface.c b/gpg-interface.c index a67d80475bf9d8452de0c3ae9bb08ceeb4c11c4b..0896458de5a9889bf5951d9703c37a67e20d3e1a 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h" @@ -128,9 +127,7 @@ static struct gpg_format *use_format = &gpg_format[0]; static struct gpg_format *get_format_by_name(const char *str) { - int i; - - for (i = 0; i < ARRAY_SIZE(gpg_format); i++) + for (size_t i = 0; i < ARRAY_SIZE(gpg_format); i++) if (!strcmp(gpg_format[i].name, str)) return gpg_format + i; return NULL; @@ -138,9 +135,9 @@ static struct gpg_format *get_format_by_name(const char *str) static struct gpg_format *get_format_by_sig(const char *sig) { - int i, j; + int j; - for (i = 0; i < ARRAY_SIZE(gpg_format); i++) + for (size_t i = 0; i < ARRAY_SIZE(gpg_format); i++) for (j = 0; gpg_format[i].sigs[j]; j++) if (starts_with(sig, gpg_format[i].sigs[j])) return gpg_format + i; @@ -228,7 +225,7 @@ static void parse_gpg_output(struct signature_check *sigc) { const char *buf = sigc->gpg_status; const char *line, *next; - int i, j; + int j; int seen_exclusive_status = 0; /* Iterate over all lines */ @@ -243,7 +240,7 @@ static void parse_gpg_output(struct signature_check *sigc) continue; /* Iterate over all search strings */ - for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) { + for (size_t i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) { if (skip_prefix(line, sigcheck_gpg_status[i].check, &line)) { /* * GOODSIG, BADSIG etc. can occur only once for @@ -700,7 +697,7 @@ size_t parse_signed_buffer(const char *buf, size_t size) match = len; eol = memchr(buf + len, '\n', size - len); - len += eol ? eol - (buf + len) + 1 : size - len; + len += eol ? (size_t) (eol - (buf + len) + 1) : size - len; } return match; } From patchwork Fri Dec 6 10:27:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896914 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 224DC204F93 for ; Fri, 6 Dec 2024 10:27:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480871; cv=none; b=PgKZOWCIbDq/ttw/I+Uw1GaRbREI3K9oQIU5FNGXGHYezuDBvQLVVdgqWi2o5v3oAvjV8TaM/M70Lw4m2GL7kuhlYv9BmIDaIR/I1S9lvGe8xIr2f3QoczGamhuL0f2SDD9kTB/5XZ6xBtlk+UBu0MfxNvxpiEDuRlbQnzhz54s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480871; c=relaxed/simple; bh=4A5hJcnl89eJSiYK+D/tsPW0zSdbZrIuo/Hk/pk2ogU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kze2itlvg0WL5Q0/hAP3QrW+zDC4SZTxk1PmZHFeK0VHZ6iYnuUeTCFK5kRYPM/DOAicFyndZwPjxHpqtYs85UAk6Bf9WZ7BuKTA6Tm7opOdu9Wfj+Zvt/lzQKtZaQ91et8LfHHrwo5y1UUogXT9mi4bhD7RkbE4U1McX/kKUBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=L9ajW0TQ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=CmyOyNUO; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="L9ajW0TQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CmyOyNUO" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2882725401A5; Fri, 6 Dec 2024 05:27:48 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 06 Dec 2024 05:27:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480868; x=1733567268; bh=L9fwyeePiKCC2J7KAJdx1nMDCEg27PWm1Zxjr2q5wzk=; b= L9ajW0TQ+hg1Lq6JgJWz8EyTtwsvQiSV1vcFpe74uqhw2IJKjdBhY9l5wj6Yghkc f9cQbzOU/EqvDgLRs1zVcSSPb1N4oiDp5igiP1mYfKX4y5g/3yNrKQWsHvdCiDq4 RGCPTI+yUMR3BEtNfDBezM7eUsuz+GopjIwZ5cLX+LTLhmSh2GO0Q/xZSQGgcYM2 OPXoAM0pGZjWFAAcsiIxo6XVZ8DwIXmpWSanKG/2mO4FQ2C7E/lewm0Nk1Z1pV4h 0kiHREkVv5vyASP1He9BlTxH4ae5iGViXIlOEAB6wtppy0FAZVt2ChwgiXLWRg5y tjVo8wk+VA3crRmSvraxZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480868; x= 1733567268; bh=L9fwyeePiKCC2J7KAJdx1nMDCEg27PWm1Zxjr2q5wzk=; b=C myOyNUODf5fMisblg3ojmXT2c4qEZ9nBQUBp/aGLlQ+yghFfhK2V82v2wdEqBD66 wPhBmUl5HZwXclxc6tRQPgucRj+JaCv7mCsWIyA7KZN1tZ6kRKX9T+vkotJmON35 oqoVgzFYGSCthXAPBnxXm0qRJXUukvAUFsG9335It4ZnNDSWifhr6b3dikPADqIl HuKH16Bl8ErAFWB37I4FrXsoXPECovPhyFbYJa0x2sHsIBdHfJcNjC9h1sdiPjuc AHjd9Vm8+S+uGUEKDfIAzHSte1EB9InGU6ToHadGrmIKkbqH+mvR8Xk+JkS0Jek0 OeJgxl8Oo5LeTf/CzH/xg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhgvjhhi rghluhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepphgvfhhfsehpvghffhdrnhgvth dprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohep ghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:46 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 8507b04c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:23 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:28 +0100 Subject: [PATCH v4 13/16] builtin/blame: fix type of `length` variable when emitting object ID Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-13-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 The `length` variable is used to store how many bytes we wish to emit from an object ID. This value will either be the full hash algorithm's length, or the abbreviated hash that can be set via `--abbrev` or the "core.abbrev" option. The former is of type `size_t`, whereas the latter is of type `int`, which causes a warning with "-Wsign-compare". The reason why `abbrev` is using a signed type is mostly that it is initialized with `-1` to indicate that we have to compute the minimum abbreviation length. This length is computed via `find_alignment()`, which always gets called before `emit_other()`, and thus we can assume that the value would never be negative in `emit_other()`. In fact, we can even assume that the value will always be at least `MINIMUM_ABBREV`, which is enforced by both `git_default_core_config()` and `parse_opt_abbrev_cb()`. We implicitly rely on this by subtracting up to 3 without checking for whether the value becomes negative. We then pass the value to printf(3p) to print the prefix of our object's ID, so if that assumption was violated we may end up with undefined behaviour. Squelch the warning by asserting this invariant and casting the value of `abbrev` to `size_t`. This allows us to store the whole length as an unsigned integer, which we can then pass to `fwrite()`. Signed-off-by: Patrick Steinhardt --- builtin/blame.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index b33b44c89a431d45e05d9863f69c049ba5eec08c..867032e4c16878ffd56df8a73162b89ca4bd2694 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -6,7 +6,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -468,9 +467,14 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int reset = GIT_COLOR_RESET; } + if (abbrev < MINIMUM_ABBREV) + BUG("abbreviation is smaller than minimum length: %d < %d", + abbrev, MINIMUM_ABBREV); + for (cnt = 0; cnt < ent->num_lines; cnt++) { char ch; - int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? the_hash_algo->hexsz : abbrev; + size_t length = (opt & OUTPUT_LONG_OBJECT_NAME) ? + the_hash_algo->hexsz : (size_t) abbrev; if (opt & OUTPUT_COLOR_LINE) { if (cnt > 0) { @@ -501,7 +505,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int length--; putchar('?'); } - printf("%.*s", length, hex); + fwrite(hex, 1, length, stdout); if (opt & OUTPUT_ANNOTATE_COMPAT) { const char *name; if (opt & OUTPUT_SHOW_EMAIL) From patchwork Fri Dec 6 10:27:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896913 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 AAA722066DF for ; Fri, 6 Dec 2024 10:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480872; cv=none; b=pVxqDaFM0z3vcJZD1/mxyGgGqYNbciY5BMpzcpdeClKV9gLR4KCeJKHtFUM203qtcQnPSWX7TSS5oUzitdujgR1uM7yp/BS4kszFy0/Q6AawIXqugrRFOfjGgSc1IeNBVG3HHLiVcIcSlP+/FtlOdbV2C6u+9aAv/L5qCDM7+a4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480872; c=relaxed/simple; bh=w83Z7qVtT1pAzIDieN9NholhiQ7RayQeaLFBlaFFRws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ldo0LkIiLAsaOY3jIc0Jg5FuS/dEramAe6QBlCJALQYSQTopb2Y/aGo/bxDYx9nnTElPxwxYMXy+HEOvmdcQly7yIRz3HzJQd15EH81mWVsU//64IBRnxE2F6drcnTZXBH/QWLqEQgSgzBBw6282JBL06BhOTC0j99OW+YPrJRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=VweMkaYE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=izj8y+wU; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="VweMkaYE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="izj8y+wU" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id B995F254019D; Fri, 6 Dec 2024 05:27:49 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 06 Dec 2024 05:27:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480869; x=1733567269; bh=lzXQzs4rHh1xMhm6Dtqos7K6TNTL60M0CMeaylKhEzM=; b= VweMkaYELnB1ZtJ3UVWvxeSOXAGct0Dth0Wv9r8+clFV/wuTCAZwy2XnB68h7AOg u0AOw4b1oIfNtE+JUywImjFx+8Yap6pdQklYM5Q01ogrq8p/l8ha4femNtlc+dn3 xvnGfhyh8+m3LipPHspgIXdDazxodJutchUu7m0dze0/Qhem/ok4nI7NsrPembbu +dXjlFyM4Yv7Cjldr3fJ1aYtsubrgnS/r6krAD++j8QTSwmKPYDJErZXrVqfw1G/ iTg5gOlSZnqXOwvtoev9iyWLknNjx+pWYJ9NMu7Bf0epa6JWLEQzz4njJJLUitL8 zvdHn4oFwHX/N9O7xQgr9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480869; x= 1733567269; bh=lzXQzs4rHh1xMhm6Dtqos7K6TNTL60M0CMeaylKhEzM=; b=i zj8y+wUMRYDcspGBGHkxCSsMfuAN5YdL/mi2YtCT4E35qIDuBSbq/pQTbd9nQV8d 7HjOqK37RdwN3l/651XjU88alYBUPFZ1aOuUDFLhKR/0ltTrtinz71GsHG9D9cxG aGpRxSQn21hCGJzLBvDyGQIQ5pyAbEfZjZgXjMXY42Bpeuoh6Rtyxo6glT4JKeUp 1icoBKUG/svQl/ga1XP7kYm5BAd0/7/2bIltVzRTY34zmEYwQ1lNCVn3JWm2cZw1 Kyyl4YYL033+uqJGzk625MKtSEYyFtocWzVVUmeqqq3yKJEHS/4CNBXvRlAdcLWH uwaA1KGF2pXR05llncX7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhgvjhhi rghluhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepphgvfhhfsehpvghffhdrnhgvth dprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohep ghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:48 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 355963f7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:24 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:29 +0100 Subject: [PATCH v4 14/16] builtin/patch-id: fix type of `get_one_patchid()` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-14-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 In `get_one_patchid()` we assign either the result of `strlen()` or `remove_space()` to `len`. But while the former correctly returns a `size_t`, the latter returns an `int` to indicate the length of the stripped string even though it cannot ever return a negative value. This causes a warning with "-Wsign-conversion". In fact, even `get_one_patchid()` itself is also using an integer as return value even though it always returns the length of the patch, and this bubbles up to other callers. Adapt the function and its helpers to use `size_t` for string lengths consistently. Signed-off-by: Patrick Steinhardt --- builtin/patch-id.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 56585757477911c96bbb9ef2cf3710691b8e744e..f540d8daa736b027649c8c64ffe5100cf4044037 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -10,13 +9,13 @@ #include "parse-options.h" #include "setup.h" -static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result) +static void flush_current_id(size_t patchlen, struct object_id *id, struct object_id *result) { if (patchlen) printf("%s %s\n", oid_to_hex(result), oid_to_hex(id)); } -static int remove_space(char *line) +static size_t remove_space(char *line) { char *src = line; char *dst = line; @@ -63,10 +62,11 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after) return 1; } -static int get_one_patchid(struct object_id *next_oid, struct object_id *result, - struct strbuf *line_buf, int stable, int verbatim) +static size_t get_one_patchid(struct object_id *next_oid, struct object_id *result, + struct strbuf *line_buf, int stable, int verbatim) { - int patchlen = 0, found_next = 0; + size_t patchlen = 0; + int found_next = 0; int before = -1, after = -1; int diff_is_binary = 0; char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1]; @@ -78,7 +78,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result, while (strbuf_getwholeline(line_buf, stdin, '\n') != EOF) { char *line = line_buf->buf; const char *p = line; - int len; + size_t len; /* Possibly skip over the prefix added by "log" or "format-patch" */ if (!skip_prefix(line, "commit ", &p) && @@ -179,7 +179,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result, static void generate_id_list(int stable, int verbatim) { struct object_id oid, n, result; - int patchlen; + size_t patchlen; struct strbuf line_buf = STRBUF_INIT; oidclr(&oid, the_repository->hash_algo); From patchwork Fri Dec 6 10:27:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896915 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 423BB2066CE for ; Fri, 6 Dec 2024 10:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480873; cv=none; b=SDRbUeZqQXVKOv3Fje4+HKc0chY+DjPR1Nin/GazgnSXTOaVcsEqDWzmcVSoCksvCfk3lt3O4McL5FkkYtkI64rxqbXb9IXRuAaiurMVNfQtJ/MBQdE0pGuLJR0ZsVcYBFKQnSrlrX5sXRe7On+/j7dOPVxoV777Q8zbcuIO9sE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480873; c=relaxed/simple; bh=yt9s0BtuoNwslmGrVUJspMnZLrL8LjlqmoebGr92Pjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CeqprsZc9ZsbxZVfAfsjPbhufjDfkkzqgnDlfRrhKtFeNQy6TTM3fQpRkz4CenG1AXR8hXVCfEf00WHMhUcQCD9MP+UxxsUqgKMg1lnejPiFNrbUfGsEF/FfesbU9yiyoqpRIxA2r2Nz/FHKlMObgepG4LFDlOeXvOu9NCNQ/Xo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=gLwOaic6; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=c8RDZhsu; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="gLwOaic6"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="c8RDZhsu" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 5DEA41140199; Fri, 6 Dec 2024 05:27:51 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Fri, 06 Dec 2024 05:27:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480871; x=1733567271; bh=WVe4Ftejp5H0HkEx+Che1Q/7xLKln4ZVzJqDk+25+2M=; b= gLwOaic6dhl7axoaVjQ5LN8kjuRebEpiPWdLP1TPYZFss8dWUGeTuLpY/NLCeWG9 6+WKVno9m+v0gUxxkWcf+SFUz/ahyO5R5LAHFPMgZTPi03U/uScw4UfScBADNImU POsxk4VaiZoL8XSDiHvLpyvHcZXjQRacnenFDIUb6zRR60w0EdVxIxwe5QB6jxbt vKdrpT2YzNnjXjQxhy2m/tSZlTGlLdVfzZOfFmZx2acX/fEr/V3BtwBe5nY2n2d2 avncqe2ns8tOQp7LmYMaR8izJJbCGtXKmiQF775waETw/I0z+aRxMNpdh8k/vGP1 Ze6C50ONc8NI97L8f3Rxyg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480871; x= 1733567271; bh=WVe4Ftejp5H0HkEx+Che1Q/7xLKln4ZVzJqDk+25+2M=; b=c 8RDZhsuSoPOwUfioU8Qnznhk7XsTafe1QZuf0EJ9LqfkqzulwPXPPiNDOK0E1cd0 O4RwHERXd8kI5uMHLn8H0jgKZrUpKvNeKMyvbLVQQB8Ifft3APAsJxXjiBTYYFc4 voGs6vZGVY/XRtf04J2m1waaMymxxH/WXvrGBltEjHHRAs76kKwiGJPelHhqGbYL A09Mx4vvSnByPeAQTf6bI6sRa/dGjiFB3dIKY9+SlWTetqAAHmTEYCWvGOiQhZTP mvOch/KAkH9HJd1eVi2mT3v7NUnLUQGEw/NKlJ07dTaFmzZpzVoga4FhrAwMvrKG e/0iuYGDM3qD/fXAeQaFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtshht vghrsehpohgsohigrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlh drohhrghdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepshhh vghjihgrlhhuohesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:50 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id c17c5066 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:25 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:30 +0100 Subject: [PATCH v4 15/16] scalar: address -Wsign-compare warnings Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-15-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 There are two -Wsign-compare warnings in "scalar.c", both of which are trivial: - We mistakenly use a signed integer to loop towards an upper unsigned bound in `cmd_reconfigure()`. - We subtract `path_sep - enlistment->buf`, which results in a signed integer, and use the value in a ternary expression where second value is unsigned. But as `path_sep` is being assigned the result of `find_last_dir_sep(enlistment->buf + offset)` we know that it must always be bigger than or equal to `enlistment->buf`, and thus the result will be positive. Address both of these warnings. Signed-off-by: Patrick Steinhardt --- scalar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scalar.c b/scalar.c index 87bb30991bf768534a988608d9b194dc8b5ba78a..f24bcd0169cee4f5055304a42954f7bf5df67e48 100644 --- a/scalar.c +++ b/scalar.c @@ -3,7 +3,6 @@ */ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h" @@ -380,7 +379,7 @@ static int delete_enlistment(struct strbuf *enlistment) offset = offset_1st_component(enlistment->buf); path_sep = find_last_dir_sep(enlistment->buf + offset); strbuf_add(&parent, enlistment->buf, - path_sep ? path_sep - enlistment->buf : offset); + path_sep ? (size_t) (path_sep - enlistment->buf) : offset); if (chdir(parent.buf) < 0) { int res = error_errno(_("could not switch to '%s'"), parent.buf); strbuf_release(&parent); @@ -655,7 +654,7 @@ static int cmd_reconfigure(int argc, const char **argv) NULL }; struct string_list scalar_repos = STRING_LIST_INIT_DUP; - int i, res = 0; + int res = 0; struct strbuf commondir = STRBUF_INIT, gitdir = STRBUF_INIT; argc = parse_options(argc, argv, NULL, options, @@ -673,7 +672,7 @@ static int cmd_reconfigure(int argc, const char **argv) git_config(get_scalar_repos, &scalar_repos); - for (i = 0; i < scalar_repos.nr; i++) { + for (size_t i = 0; i < scalar_repos.nr; i++) { int succeeded = 0; struct repository *old_repo, r = { NULL }; const char *dir = scalar_repos.items[i].string; From patchwork Fri Dec 6 10:27:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13896916 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 C8842206F02 for ; Fri, 6 Dec 2024 10:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480875; cv=none; b=VjBl9pzuwo94IUJ7ZG3+ivm63/iXhvF3bX3BkDcByPIhrOr3cyA40iNcSKopHhfhrlWcYDVXJAYsupBIrGNivRPj6/ggxdDDHjycvYN9TtvmGfzkX0ydf95mIJkgxnGi77Eza/QvTYE/+9JbsVtb8f3bi40WvV5R29FyspGQ6Ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733480875; c=relaxed/simple; bh=JkYboJKZHZM+ac9wiyc90QKzF5VInOMnSQN9tRtdM3s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EnjDD+IX0SG/ciIHkFcyEU2/p4V/iyhSqmTxes53iYKHsBCoug6sY3AOwanXHY67/Ph+BSxz1SRPOvBYEfA6UBDbZzwBHqQgDff/akynfshMVX3pNS6rkJgI4896msdmOwsUpeGNBxrhjHmAg+m53RjtXftNQUhKrTNVyzxGR8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Pi9CsvK4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=EgrdIXJ4; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Pi9CsvK4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EgrdIXJ4" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id F3BD1114017B; Fri, 6 Dec 2024 05:27:52 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 06 Dec 2024 05:27:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733480872; x=1733567272; bh=6lo4x03kqPtlSZAbT88AtH6OR/rU64pzA4QOdeYe26A=; b= Pi9CsvK4Ckz34VDpL2OI832Eg72/Ux6xZoXnLP1IXGqksBOmB1oKPSW2yZVo5Ice NpoRb6FJe8W18oFS0Af22wCFwLXTT1chxBO7cGAJ72e0bbGXOuxV72X5/7Fhopko sOg6CcqZ/sMVvvUT7ryePPN7LnRLJF6toF43tYUOqFjX/qvNOVA92jl9tQCNteA8 cVZ8QmPeRzhEhj8sIcQJjnJ3usvpjAjntIOEPjfdDAxyhY11e5sIsQufwmktSmr5 GdK+hDwjQMywCHVa7clx+WXPiMUHh7vfTCKlbIDaVolAPTvUMCvQnqRL1UpxFkUD aZC5RvZhIHEoeWLIw1jTQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733480872; x= 1733567272; bh=6lo4x03kqPtlSZAbT88AtH6OR/rU64pzA4QOdeYe26A=; b=E grdIXJ4ZzmAmWtwRWjIj3jT0T72u/FdY632GOfrebrSGU80f/QKynHctPVfRVqG+ vkV11/VWkm76dVmoTCHXrBRowCSfI9SPaSRXv+rVYxLxnGH/mUONVd4ctT4gPixb /K+vVNo1tcPpkhcNneYgfn8OUXYZn23QPRom004EstI1TzHI17bV77evLSkNtXZS 0cCX5p67UEaVWcRvi1rbOX9Qy7fDmoPAYiXyHczXvn4xOaaAeEOOftpEOYRZZ0aw 9eDBXEDdO9bvELUmvoaHKWuK2aWiZVBrRijjBcauhfrFnUUtvl6xWZURf3xIIdmr UIp08trX/da00XMwklVPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieelgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephfffufggtg fgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhn hhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvd ekheeuvdekfeffiedvueelteekudehjeetkeegvddugfdtgfeileenucevlhhushhtvghr ufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtshht vghrsehpohgsohigrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlh drohhrghdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepshhh vghjihgrlhhuohesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Dec 2024 05:27:51 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f4d64569 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 6 Dec 2024 10:26:25 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 06 Dec 2024 11:27:31 +0100 Subject: [PATCH v4 16/16] t/helper: don't depend on implicit wraparound Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-pks-sign-compare-v4-16-0344c6dfb219@pks.im> References: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> In-Reply-To: <20241206-pks-sign-compare-v4-0-0344c6dfb219@pks.im> To: git@vger.kernel.org Cc: shejialuo , Jeff King , Junio C Hamano X-Mailer: b4 0.14.2 In our test helpers we have two cases where we assign -1 to an `unsigned long`. The intent is to essentially mean "unbounded output", which is achieved via implicit wraparound of the value. This pattern causes warnings with -Wsign-compare though. Adapt it and instead use `ULONG_MAX` explicitly. Signed-off-by: Patrick Steinhardt --- t/helper/test-csprng.c | 5 +---- t/helper/test-genrandom.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/t/helper/test-csprng.c b/t/helper/test-csprng.c index ea9b9b656307d32bdc1f2e15a91793b1dda9c463..a4a0aca61773b0b30de618955e5a5b61bba2d0cc 100644 --- a/t/helper/test-csprng.c +++ b/t/helper/test-csprng.c @@ -1,9 +1,6 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-tool.h" #include "git-compat-util.h" - int cmd__csprng(int argc, const char **argv) { unsigned long count; @@ -14,7 +11,7 @@ int cmd__csprng(int argc, const char **argv) return 2; } - count = (argc == 2) ? strtoul(argv[1], NULL, 0) : -1L; + count = (argc == 2) ? strtoul(argv[1], NULL, 0) : ULONG_MAX; while (count) { unsigned long chunk = count < sizeof(buf) ? count : sizeof(buf); diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c index 5b51e6648d8e698b09f400efcf67a0708c226e9d..51b67f2f87469471a40288e369d9c784eb2ccba0 100644 --- a/t/helper/test-genrandom.c +++ b/t/helper/test-genrandom.c @@ -4,8 +4,6 @@ * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-tool.h" #include "git-compat-util.h" @@ -24,7 +22,7 @@ int cmd__genrandom(int argc, const char **argv) next = next * 11 + *c; } while (*c++); - count = (argc == 3) ? strtoul(argv[2], NULL, 0) : -1L; + count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX; while (count--) { next = next * 1103515245 + 12345;