Bug#1106786: git ftbfs on s390x (test failures) (4/4)
From
Sebastian Andrzej Siewior@21:1/5 to
All on Fri Jun 6 18:30:01 2025
[continued from previous message]
+ OPT_CALLBACK('C', "context", &opt, N_("n"),
+ N_("show <n> context lines before and after matches"), + context_callback),
+- OPT_INTEGER('B', "before-context", &opt.pre_context,
++ OPT_UNSIGNED('B', "before-context", &opt.pre_context,
+ N_("show <n> context lines before matches")),
+- OPT_INTEGER('A', "after-context", &opt.post_context,
++ OPT_UNSIGNED('A', "after-context", &opt.post_context,
+ N_("show <n> context lines after matches")),
+ OPT_INTEGER(0, "threads", &num_threads,
+ N_("use <n> worker threads")),
+diff --git a/git-compat-util.h b/git-compat-util.h
+index cf733b38ac..1218fcf81a 100644
+--- a/git-compat-util.h
++++ b/git-compat-util.h
+@@ -110,12 +110,19 @@ DISABLE_WARNING(-Wsign-compare)
+ # define BARF_UNLESS_COPYABLE(dst, src) \
+ BUILD_ASSERT_OR_ZERO(__builtin_types_compatible_p(__typeof__(*(dst)), \ + __typeof__(*(src)))) ++
++# define BARF_UNLESS_SIGNED(var) BUILD_ASSERT_OR_ZERO(((__typeof__(var)) -1) < 0)
++# define BARF_UNLESS_UNSIGNED(var) BUILD_ASSERT_OR_ZERO(((__typeof__(var)) -1) > 0)
+ #else
+ # define BARF_UNLESS_AN_ARRAY(arr) 0
+ # define BARF_UNLESS_COPYABLE(dst, src) \
+ BUILD_ASSERT_OR_ZERO(0 ? ((*(dst) = *(src)), 0) : \
+ sizeof(*(dst)) == sizeof(*(src)))
++
++# define BARF_UNLESS_SIGNED(var) 0
++# define BARF_UNLESS_UNSIGNED(var) 0
+ #endif
++
+ /*
+ * ARRAY_SIZE - get the number of elements in a visible array
+ * @x: the array whose size you want.
+diff --git a/parse-options.h b/parse-options.h
+index dc460a26ff..91c3e3c29b 100644
+--- a/parse-options.h
++++ b/parse-options.h
+@@ -218,7 +218,7 @@ struct option {
+ .type = OPTION_INTEGER, \
+ .short_name = (s), \
+ .long_name = (l), \
+- .value = (v), \
++ .value = (v) + BARF_UNLESS_SIGNED(*(v)), \
+ .precision = sizeof(*v), \
+ .argh = N_("n"), \
+ .help = (h), \
+@@ -280,7 +280,7 @@ struct option {
+ .type = OPTION_UNSIGNED, \
+ .short_name = (s), \
+ .long_name = (l), \
+- .value = (v), \
++ .value = (v) + BARF_UNLESS_UNSIGNED(*(v)), \
+ .precision = sizeof(*v), \
+ .argh = N_("n"), \
+ .help = (h), \
+--
+2.39.5
+
diff -Nru git-2.49.0/debian/patches/series git-2.49.0/debian/patches/series
--- git-2.49.0/debian/patches/series 2025-05-29 17:25:41.000000000 +0200
+++ git-2.49.0/debian/patches/series 2025-06-06 18:07:16.000000000 +0200
@@ -1 +1,7 @@
-0001-parse-options-detect-mismatches-in-integer-signedness.diff +0001-parse-fix-off-by-one-for-minimum-signed-values.patch +0002-global-use-designated-initializers-for-options.patch +0003-parse-options-support-unit-factors-in-OPT_INTEGER.patch +0004-parse-options-rename-OPT_MAGNITUDE-to-OPT_UNSIGNED.patch +0005-parse-options-introduce-precision-handling-for-OPTIO.patch +0006-parse-options-introduce-precision-handling-for-OPTIO.patch +0007-parse-options-detect-mismatches-in-integer-signednes.patch
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)