* lib/mini-gmp-gnulib.c: Don’t bother pacifying
-Wsuggest-attribute=const, -Wsuggest-attribute=pure as the old
compilers with that problem are pretty much dead now.
Don’t pacify -Wsuggest-attribute=malloc for GCC 14 and later,
as it’s not needed there.
---
 ChangeLog             | 7 +++++++
 lib/mini-gmp-gnulib.c | 9 ++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c76c1df20..c5f0aff07b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2026-11-11  Paul Eggert  <[email protected]>
 
+       libgmp-mpz: modernize GCC pacification
+       * lib/mini-gmp-gnulib.c: Don’t bother pacifying
+       -Wsuggest-attribute=const, -Wsuggest-attribute=pure as the old
+       compilers with that problem are pretty much dead now.
+       Don’t pacify -Wsuggest-attribute=malloc for GCC 14 and later,
+       as it’s not needed there.
+
        regex: fix double-frees
        Problem and fix reported by Adhemerval Zanella in:
        https://sourceware.org/pipermail/libc-alpha/2026-November/182054.html
diff --git a/lib/mini-gmp-gnulib.c b/lib/mini-gmp-gnulib.c
index fb8b88b4f7..705011e06d 100644
--- a/lib/mini-gmp-gnulib.c
+++ b/lib/mini-gmp-gnulib.c
@@ -34,12 +34,7 @@
 # pragma GCC diagnostic ignored "-Wunused-parameter"
 #endif
 
-/* Pacify GCC -Wsuggest-attribute=const, pure, malloc.  */
-#if _GL_GNUC_PREREQ (4, 6)
-# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
-# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-#endif
-#if _GL_GNUC_PREREQ (8, 0)
+#if _GL_GNUC_PREREQ (8, 0) && !_GL_GNUC_PREREQ (14, 0)
 # pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc"
 #endif
 
@@ -53,7 +48,7 @@
 
 /* Pacify GCC -Wunused-variable for variables used only in 'assert' calls.  */
 #if (defined NDEBUG \
-     && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__))
+     && (_GL_GNUC_PREREQ (4, 6) || defined __clang__))
 # pragma GCC diagnostic ignored "-Wunused-variable"
 #endif
 
-- 
2.56.0


Reply via email to