[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diffseq: Silence gcc warning
From: |
Bruno Haible |
Subject: |
diffseq: Silence gcc warning |
Date: |
Fri, 26 May 2023 14:56:55 +0200 |
In gettext and diffutils, I'm still seeing these warnings:
diffseq.h:424:36: warning: 'fxbest' may be used uninitialized
[-Wmaybe-uninitialized]
diffseq.h:431:36: warning: 'bxbest' may be used uninitialized
[-Wmaybe-uninitialized]
Like done on 2023-05-18, I'm silencing this through a #pragma GCC diagnostic.
But in this case, it seems worthwhile to keep a way to have the
-Wmaybe-uninitialized warnings still enabled if the developer wishes to see
warnings about other variables in this complicated function; namely by using
-Dlint or -DGCC_LINT.
2023-05-24 Bruno Haible <bruno@clisp.org>
diffseq: Silence gcc warning.
* lib/diffseq.h: Add #pragma GCC diagnostic.
diff --git a/lib/diffseq.h b/lib/diffseq.h
index c9375cd696..bab8256f64 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -94,11 +94,17 @@
/* Use this to suppress gcc's "...may be used before initialized" warnings.
Beware: The Code argument must not contain commas. */
+#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
#endif
@@ -444,6 +450,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
bool find_minimal,
#undef XREF_YREF_EQUAL
}
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic pop
+#endif
+
/* Compare in detail contiguous subsequences of the two vectors
which are known, as a whole, to match each other.
- diffseq: Silence gcc warning,
Bruno Haible <=