bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] diffseq: simplify lint removal


From: Paul Eggert
Subject: [PATCH] diffseq: simplify lint removal
Date: Sat, 5 Aug 2023 10:07:54 -0700

* lib/diffseq.h (IF_LINT): Remove.
Instead, always ignore the diagnostic, as that’s simpler
now that we have the pragma change installed in May.
This removes the last IF_LINT from diffutils, though not
the last use of GCC_LINT.
---
 ChangeLog     |  9 +++++++++
 lib/diffseq.h | 24 +++++-------------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a6b3a10da2..e1437b1b41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-08-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       diffseq: simplify lint removal
+       * lib/diffseq.h (IF_LINT): Remove.
+       Instead, always ignore the diagnostic, as that’s simpler
+       now that we have the pragma change installed in May.
+       This removes the last IF_LINT from diffutils, though not
+       the last use of GCC_LINT.
+
 2023-08-04  Bruno Haible  <bruno@clisp.org>
 
        unistr/{u8-mbtouc,u8-mbsnlen}: Fix test failures (regr. 2023-07-25).
diff --git a/lib/diffseq.h b/lib/diffseq.h
index 06e1465bf1..3f85ab2ec4 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -92,20 +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.  */
+/* 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
-#endif
-#ifndef IF_LINT
-# if defined GCC_LINT || defined lint
-#  define IF_LINT(Code) Code
-# else
-#  define IF_LINT(Code) /* empty */
-#  if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
-#   pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#  endif
-# endif
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 #endif
 
 /*
@@ -388,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);
@@ -412,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]);
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]