summaryrefslogtreecommitdiff
path: root/lib/diffseq.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diffseq.h')
-rw-r--r--lib/diffseq.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/diffseq.h b/lib/diffseq.h
index ec5189921aa..0c5bc9cbc6d 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -1,7 +1,7 @@
/* Analyze differences between two vectors.
- Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2024 Free
- Software Foundation, Inc.
+ Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2024 Free Software
+ Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,6 +48,10 @@
OFFSET A signed integer type sufficient to hold the
difference between two indices. Usually
something like ptrdiff_t.
+ OFFSET_MAX (Optional) The maximum value of OFFSET (e.g.,
+ PTRDIFF_MAX). If omitted, it is inferred in a
+ way portable to the vast majority of C platforms,
+ as they lack padding bits.
EXTRA_CONTEXT_FIELDS Declarations of fields for 'struct context'.
NOTE_DELETE(ctxt, xoff) Record the removal of the object xvec[xoff].
NOTE_INSERT(ctxt, yoff) Record the insertion of the object yvec[yoff].
@@ -74,8 +78,10 @@
*/
/* Maximum value of type OFFSET. */
-#define OFFSET_MAX \
- ((((OFFSET)1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
+#ifndef OFFSET_MAX
+# define OFFSET_MAX \
+ ((((OFFSET) 1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
+#endif
/* Default to no early abort. */
#ifndef EARLY_ABORT
@@ -86,14 +92,11 @@
# define NOTE_ORDERED false
#endif
-/* Use this to suppress gcc's "...may be used before initialized" warnings.
- Beware: The Code argument must not contain commas. */
-#ifndef IF_LINT
-# if defined GCC_LINT || defined lint
-# define IF_LINT(Code) Code
-# else
-# define IF_LINT(Code) /* empty */
-# endif
+/* Suppress gcc's "...may be used before initialized" warnings,
+ generated by GCC versions up to at least GCC 13.2. */
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
/*
@@ -376,13 +379,8 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
and report halfway between our best results so far. */
if (c >= ctxt->too_expensive)
{
- OFFSET fxybest;
- OFFSET fxbest IF_LINT (= 0);
- OFFSET bxybest;
- OFFSET bxbest IF_LINT (= 0);
-
/* Find forward diagonal that maximizes X + Y. */
- fxybest = -1;
+ OFFSET fxybest = -1, fxbest;
for (d = fmax; d >= fmin; d -= 2)
{
OFFSET x = MIN (fd[d], xlim);
@@ -400,7 +398,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
}
/* Find backward diagonal that minimizes X + Y. */
- bxybest = OFFSET_MAX;
+ OFFSET bxybest = OFFSET_MAX, bxbest;
for (d = bmax; d >= bmin; d -= 2)
{
OFFSET x = MAX (xoff, bd[d]);
@@ -556,6 +554,10 @@ compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
#undef XREF_YREF_EQUAL
}
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic pop
+#endif
+
#undef ELEMENT
#undef EQUAL
#undef OFFSET