Thanks for your feedback, Simon and Paul.
> Given that basic idea, when in doubt it's better to not omit debatable 
> warnings, so that the maintainer can back out unwanted warnings.

OK.

> Of the warnings Bruno listed, -Wgnu-include-next seems a no-brainer 
> given that Gnulib uses include_next so often.

So I'm committing this minimal set of options to disable, leaving the
rest to the package maintainers.


2026-03-03  Bruno Haible  <[email protected]>

        manywarnings: Eliminate some never-useful clang warnings.
        * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)): Disable the
        -Wgnu-include-next, -Wstring-plus-int, -Wstring-plus-char warnings.

diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 0824226fa7..85c5a08551 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
 # manywarnings.m4
-# serial 32
+# serial 33
 dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -194,6 +194,20 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C
   # These options are not supported by gcc, but are useful with clang.
   AS_VAR_APPEND([$1], [' -Wthread-safety'])
 
+  # These options are not supported by gcc, only by clang.  clang enables
+  # them by default, but they are never useful.  So, disable them.
+  # Note! This applies *only* to options that are really never useful.
+  #       When in doubt, let the package maintainer decide.  The principle
+  #       of this module is to enable *all* possible warnings and then allow
+  #       the package maintainer to disable warnings they find not useful
+  #       in the context of their package.
+  # Gnulib uses #include_next in many .h files.
+  AS_VAR_APPEND([$1], [' -Wno-gnu-include-next'])
+  # C programmers know what '+' does. These warning options are targeted
+  # at fresh C programmers that are used to JavaScript, Java, or C#.
+  AS_VAR_APPEND([$1], [' -Wno-string-plus-int'])
+  AS_VAR_APPEND([$1], [' -Wno-string-plus-char'])
+
   # Disable specific options as needed.
   if test "$gl_cv_cc_nomfi_needed" = yes; then
     AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])




Reply via email to