From 91f94f3076fc1dbb952e183e6c405c483e2790ce Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 5 Aug 2023 10:04:41 -0700 Subject: [PATCH] diffseq: simplify lint removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * 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 + + 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 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.5