summaryrefslogtreecommitdiff
path: root/t/helper/test-parse-options.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 11:27:24 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-06 20:20:04 +0900
commit80c9e70ebe871f0826bc101142c66ff783405100 (patch)
treec95f04cef2dc0abb2d1fe8e4470e9e385e637b12 /t/helper/test-parse-options.c
parent25435e4ad87aa484ce0d9d2adf3aa407f0241704 (diff)
global: trivial conversions to fix `-Wsign-compare` warnings
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-parse-options.c')
-rw-r--r--t/helper/test-parse-options.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 25ba08a7c3..bfe45ec68b 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;