On 2026-05-28 14:25, Bruno Haible wrote:
Do you happen to know whether gcc 17 will, when invoked with the option
-Wstrict-overflow, report

   gcc: error: unrecognized command-line option ‘-Wstrict-overflow’

or will this be at most a warning?

Surely the latter; that's the usual approach, taken for example with -Wunsafe-loop-optimizations.

Come to think of it, Gnulib shouldn't suggest options that are now ignored. I installed the attached further patch.
From 8a3d80316044aaaad10ecf42c5c146696d44c4f8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Thu, 28 May 2026 17:48:00 -0700
Subject: [PATCH] manywarnings: deprecate -Whsa etc. too

-Whsa, -Wunreachable-code and -Wunsafe-loop-optimizations
are now ignored, so stop worrying about them too.
---
 ChangeLog                  | 10 +++++++---
 HACKING                    |  2 --
 build-aux/gcc-warning.spec |  2 --
 doc/manywarnings.texi      |  3 +--
 m4/manywarnings-c++.m4     | 11 +++++------
 m4/manywarnings.m4         |  5 ++---
 6 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 977c787a34..a3aa3fc9ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,13 +3,17 @@
 	manywarnings: -Wstrict-overflow is deprecated
 	Issue reported by Drea Pinski in:
 	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101913#c6
-	* HACKING: Stop recommending -Wstrict-overflow.
+	Also, -Whsa, -Wunreachable-code and -Wunsafe-loop-optimizations
+	are now ignored.
+	* HACKING: Stop recommending these options.
 	* build-aux/g++-warning.spec:
 	* build-aux/gcc-warning.spec: Say -Wstrict-overflow is deprecated.
-	* doc/manywarnings.texi (manywarnings): Stop mentioning it.
+	Remove -Whsa, -Wunreachable-code.
+	* doc/manywarnings.texi (manywarnings): Stop mentioning them.
 	* m4/manywarnings-c++.m4 (gl_MANYWARN_ALL_GCC_CXX_IMPL):
 	* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
-	Stop using it.
+	Omit them.  Change shell script in comment so that we need
+	not worry about them when comparing GCC to us.
 
 2026-05-27  Bruno Haible  <[email protected]>
 
diff --git a/HACKING b/HACKING
index f622b8be95..9782291de1 100644
--- a/HACKING
+++ b/HACKING
@@ -322,7 +322,6 @@ there are three possible approaches:
       -Wtrampolines
       -Wuninitialized
       -Wunknown-pragmas
-      -Wunsafe-loop-optimizations
       -Wvariadic-macros
       -Wvector-operation-performance
       -Wwrite-strings
@@ -406,7 +405,6 @@ there are three possible approaches:
       -Wtrampolines
       -Wuninitialized
       -Wunknown-pragmas
-      -Wunsafe-loop-optimizations
       -Wvariadic-macros
       -Wvector-operation-performance
       -Wwrite-strings
diff --git a/build-aux/gcc-warning.spec b/build-aux/gcc-warning.spec
index 6bf931808e..bf6c532c17 100644
--- a/build-aux/gcc-warning.spec
+++ b/build-aux/gcc-warning.spec
@@ -148,7 +148,6 @@
 -Wfree-nonheap-object			default
 -Whardened				default
 -Wheader-guard				enabled by -Wall
--Whsa					default
 -Wif-not-aligned			default
 -Wignored-attributes			default
 -Wignored-qualifiers			enabled by -Wextra
@@ -274,7 +273,6 @@
 -Wtype-limits				enabled by -Wextra
 -Wundef					FIXME maybe? too many false positives
 -Wunicode				default
--Wunreachable-code			obsolescent no-op
 -Wunsuffixed-float-constants		triggers warning in gnulib's timespec.h
 -Wunterminated-string-initialization	enabled by -Wextra
 -Wunused				enabled by -Wall
diff --git a/doc/manywarnings.texi b/doc/manywarnings.texi
index 27f52c2194..04075a1fb2 100644
--- a/doc/manywarnings.texi
+++ b/doc/manywarnings.texi
@@ -63,8 +63,7 @@ follows:
 @item
 Start with the newest major release of GCC.
 This will save you time, because some warning options produce many false
-alarms with older versions of GCC (such as
-@code{-Wunsafe-loop-optimizations}).
+alarms with older versions of GCC.
 @item
 Consider the platforms commonly used when enabling GCC warnings.
 This includes not only target architectures and operating systems, but also
diff --git a/m4/manywarnings-c++.m4 b/m4/manywarnings-c++.m4
index 8c59d21500..22a73870a3 100644
--- a/m4/manywarnings-c++.m4
+++ b/m4/manywarnings-c++.m4
@@ -72,11 +72,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC_CXX_IMPL],
   # List all gcc warning categories.
   # To compare this list to your installed GCC's, run this Bash command:
   #
-  # comm -3 \
-  #  <(sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings-c++.m4 | sort) \
-  #  <(gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
-  #      grep -v -x -f <(
-  #         awk '/^[^#]/ {print $1}' ../build-aux/g++-warning.spec))
+  # export LC_ALL=C && comm -3 \
+  #  <((sed -n 's/^  *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings-c++.m4; \
+  #     awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
+  #  <((gcc -Q --help=c++,warnings && gcc -Q --help=common,warnings) \
+  #    | sed -n '/\[ignored]$/d;s/^  \(-[^ ]*\) .*/\1/p' | sort)
 
   gl_manywarn_set=
   for gl_manywarn_item in \
@@ -184,7 +184,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC_CXX_IMPL],
     -Wtype-limits \
     -Wuninitialized \
     -Wunknown-pragmas \
-    -Wunsafe-loop-optimizations \
     -Wunused \
     -Wunused-but-set-parameter \
     -Wunused-but-set-variable \
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 536d7d328c..1a50006245 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -97,8 +97,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
   # export LC_ALL=C && comm -3 \
   #  <((sed -n 's/^  *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
   #     awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
-  #  <((gcc --help=c,warnings && gcc --help=common,warnings) \
-  #    | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
+  #  <((gcc -Q --help=c,warnings && gcc -Q --help=common,warnings) \
+  #    | sed -n '/\[ignored]$/d;s/^  \(-[^ ]*\) .*/\1/p' | sort)
 
   $1=
   for gl_manywarn_item in -fanalyzer -fstrict-flex-arrays \
@@ -144,7 +144,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
     -Wtrampolines \
     -Wuninitialized \
     -Wunknown-pragmas \
-    -Wunsafe-loop-optimizations \
     -Wunused-macros \
     -Wvariadic-macros \
     -Wvector-operation-performance \
-- 
2.53.0

Reply via email to