I ran into this glitch when building with GCC 4.8.5 20150623 (Red
Hat 4.8.5-44) on CentOS 7.9 (cfarm112.cfarm.net), which lacked
-Wno-unused-const-variable.  The online manuals suggested that
-Wunused-const-variable was introduced in GCC 6.1.
* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS):
Use -Wno-unused-const-variable with GCC 6.1 and later,
not with GCC 4.4 and later.
---
 ChangeLog           | 11 +++++++++++
 m4/gnulib-common.m4 |  6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f1a59c237..bce004b202 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-11-15  Paul Eggert  <[email protected]>
+
+       -Wunused-const-variable started in GCC 6.1 not 4.4
+       I ran into this glitch when building with GCC 4.8.5 20150623 (Red
+       Hat 4.8.5-44) on CentOS 7.9 (cfarm112.cfarm.net), which lacked
+       -Wno-unused-const-variable.  The online manuals suggested that
+       -Wunused-const-variable was introduced in GCC 6.1.
+       * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS):
+       Use -Wno-unused-const-variable with GCC 6.1 and later,
+       not with GCC 4.4 and later.
+
 2025-11-14  Paul Eggert  <[email protected]>
 
        openat2: fix symlink splicing bug
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 134bfba21d..73f56f57fc 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 113
+# serial 114
 dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -1406,7 +1406,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
     dnl -Wno-type-limits                      >= 4.3          >= 3.9
     dnl -Wno-undef                            >= 3            >= 3.9
     dnl -Wno-unsuffixed-float-constants       >= 4.5
-    dnl -Wno-unused-const-variable            >= 4.4          >= 3.9
+    dnl -Wno-unused-const-variable            >= 6.1          >= 3.9
     dnl -Wno-unused-function                  >= 3            >= 3.9
     dnl -Wno-unused-parameter                 >= 3            >= 3.9
     dnl
@@ -1436,7 +1436,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
       -Wno-sign-conversion
       -Wno-type-limits
       #endif
-      #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || 
(__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || 
(__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wno-unused-const-variable
       #endif
       #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
-- 
2.51.0


Reply via email to