]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
manywarnings: simplify C warning audits
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 May 2026 16:02:37 +0000 (09:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 May 2026 16:05:34 +0000 (09:05 -0700)
* build-aux/gcc-warning.spec: Omit many c++, objc, obcj++,
fortran warnings as we no longer need to track them here.
Mark a few of these warnings as now being defaults (for C too).
* m4/manywarnings.m4: In comment that says how to audit this file,
use ‘gcc --help=c,warnings’ and ‘gcc --help=common,warnings’
instead of ‘gcc --help=warnings’, as the latter outputs irrelevant
warnings about c++, objc, obcj++, fortran.

ChangeLog
build-aux/gcc-warning.spec
m4/manywarnings.m4

index a7fcf8b4a685b22feeb84454b50734c61f6f0216..9dbc2f82e94ed6825a2980a656be5a84cd9d16ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2026-05-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       manywarnings: simplify C warning audits
+       * build-aux/gcc-warning.spec: Omit many c++, objc, obcj++,
+       fortran warnings as we no longer need to track them here.
+       Mark a few of these warnings as now being defaults (for C too).
+       * m4/manywarnings.m4: In comment that says how to audit this file,
+       use ‘gcc --help=c,warnings’ and ‘gcc --help=common,warnings’
+       instead of ‘gcc --help=warnings’, as the latter outputs irrelevant
+       warnings about c++, objc, obcj++, fortran.
+
 2026-05-01  Bruno Haible  <bruno@clisp.org>
 
        stdc_rotate_left tests, stdc_rotate_right tests: Fix gcc warning.
index 8bac144d45636691e632f43fda261633e5960309..151beba02761568fdca31f19838e4cf9cc72bd2e 100644 (file)
@@ -4,22 +4,17 @@
 -W                                     alias for -Wextra
 -WNSObject-attribute                   objc and objc++
 -Wabi                                  this is now a no-op
--Wabi-tag                              c++ and objc++
 -Wabi=                                 c++
 -Wabsolute-value                       enabled by -Wextra
 -Waddress                              enabled by -Wall
 -Waddress-of-packed-member             default
 -Waggregate-return                     obsolescent
 -Waggressive-loop-optimizations                default
--Waliasing                             fortran
--Walign-commons                                fortran
--Waligned-new=[none|global|all]                c++
 -Walloc-size                           enabled by -Wextra
 -Walloc-size-larger-than=<bytes>       defaults to PTRDIFF_MAX
 -Walloc-zero                           Gnulib fixes this problem
 -Walloca                               we like alloca in small doses
 -Walloca-larger-than=<number>          FIXME: choose something sane?
--Wampersand                            fortran
 -Wanalyzer-allocation-size             enabled by -fanalyzer
 -Wanalyzer-deref-before-check          enabled by -fanalyzer
 -Wanalyzer-double-fclose               enabled by -fanalyzer
@@ -76,8 +71,6 @@
 -Warray-compare                                enabled by -Wall
 -Warray-parameter                      enabled by -Wall
 -Warray-parameter=<0,2>                        enabled by -Wall
--Warray-temporaries                    fortran
--Wassign-intercept                     objc/objc++
 -Wattribute-alias                      covered by -Wattribute-alias=2
 -Wattribute-alias=<0,2>                        handled specially by gl_MANYWARN_ALL_GCC
 -Wattribute-warning                    default
 -Wbuiltin-declaration-mismatch         default
 -Wbuiltin-macro-redefined              default
 -Wc++-compat                           only useful for code meant to be compiled by a C++ compiler
--Wc++0x-compat                         c++
--Wc++11-compat                         c++
--Wc++11-extensions                     c++
--Wc++14-compat                         c++
--Wc++14-extensions                     c++
--Wc++17-compat                         c++
--Wc++17-extensions                     c++
--Wc++1z-compat                         c++
--Wc++20-compat                         c++
--Wc++20-extensions                     c++
--Wc++23-extensions                     c++
--Wc++26-extensions                     c++
--Wc++2a-compat                         c++
--Wc-binding-type                       fortran
 -Wc11-c23-compat                       c compatibility
 -Wc23-c2y-compat                       c compatibility
 -Wc90-c99-compat                       c compatibility
 -Wcast-align                           enabled by -Wcast-align=strict
 -Wcast-function-type                   enabled by -Wextra
 -Wcast-qual                            FIXME maybe? too much noise; encourages bad changes
--Wcast-result                          D
--Wcast-user-defined                    default
--Wcatch-value                          c++
--Wcatch-value=<0,3>                    c++
--Wchanges-meaning                      c++
 -Wchar-subscripts                      enabled by -Wall
--Wcharacter-truncation                 fortran
 -Wchkp                                 deprecated
--Wclass-conversion                     c++ and objc++
--Wclass-memaccess                      c++
 -Wclobbered                            enabled by -Wextra
--Wcomma-subscript                      c++ and objc++
 -Wcomment                              enabled by -Wall
 -Wcomments                             alias for -Wcomment
 -Wcompare-distinct-pointer-types       default
--Wcompare-reals                                fortran
 -Wcomplain-wrong-lang                  default
--Wconditionally-supported              c++ and objc++
 -Wconversion                           FIXME maybe? too much noise; encourages bad changes
--Wconversion-extra                     fortran
--Wconversion-null                      c++ and objc++
 -Wcoverage-invalid-line-number         default if --coverage
 -Wcoverage-mismatch                    default
 -Wcoverage-too-many-conditions         default
 -Wcoverage-too-many-paths              default
 -Wcpp                                  default
--Wctad-maybe-unsupported               c++ and objc++
--Wctor-dtor-privacy                    c++ and objc++
 -Wdangling-else                                enabled by -Wparentheses
 -Wdangling-pointer                     enabled by -Wall
 -Wdangling-pointer=<0,2>               enabled by -Wall
--Wdangling-reference                   c++ and objc++
 -Wdeclaration-after-statement          needed only for pre-C99, so obsolete
 -Wdeclaration-missing-parameter-type   default
--Wdefaulted-function-deleted           default, c++ and objc++
--Wdelete-incomplete                    c++ and objc++
--Wdelete-non-virtual-dtor              c++ and objc++
 -Wdeprecated                           default
--Wdeprecated-copy                      c++ and objc++
--Wdeprecated-copy-dtor                 c++ and objc++
 -Wdeprecated-declarations              default
--Wdeprecated-enum-enum-conversion      c++ and objc++
--Wdeprecated-enum-float-conversion     c++ and objc++
--Wdeprecated-literal-operator          c++ and objc++
 -Wdeprecated-non-prototype             c compatibility
--Wdeprecated-variadic-comma-omission   c++ and objc+++ compatibility
 -Wdesignated-init                      default
 -Wdisabled-optimization                        warns about compiler not about program
 -Wdiscarded-array-qualifiers           default
 -Wdiscarded-qualifiers                 default
 -Wdiv-by-zero                          default
--Wdo-subscript                         fortran
 -Wduplicate-decl-specifier             enabled by -Wall
--Weffc++                               c++
--Welaborated-enum-base                 default, c++11+
 -Wempty-body                           enabled by -Wextra
 -Wendif-labels                         default
 -Wenum-compare                         enabled by -Wall
 -Wenum-conversion                      enabled by -Wextra
 -Wenum-int-mismatch                    enabled by -Wall
 -Werror-implicit-function-declaration  deprecated
--Wexceptions                           c++ and objc++
 -Wexpansion-to-defined                 enabled by -Wextra
--Wexternal-argument-mismatch           fortran
--Wextra-semi                           c++
 -Wfloat-conversion                     FIXME maybe? borderline.  some will want this
 -Wfloat-equal                          FIXME maybe? borderline.  some will want this
 -Wformat                               covered by -Wformat=2
 -Wframe-larger-than=<byte-size>                FIXME: choose something sane?
 -Wfree-labels                          c and objc compatibility
 -Wfree-nonheap-object                  default
--Wfunction-elimination                 fortran
--Wglobal-module                                default, c++ and objc++
 -Whardened                             default
 -Wheader-guard                         enabled by -Wall
 -Whsa                                  default
 -Wimplicit-fallthrough=<0,5>           handled specially by gl_MANYWARN_ALL_GCC
 -Wimplicit-function-declaration                enabled by -Wimplicit
 -Wimplicit-int                         enabled by -Wimplicit
--Wimplicit-interface                   fortran
--Wimplicit-procedure                   fortran
--Winaccessible-base                    c++ and objc++
 -Wincompatible-pointer-types           default
 -Winfinite-recursion                   enabled by -Wall
--Winherited-variadic-ctor              c++
--Winit-list-lifetime                   c++ and objc++
 -Wint-conversion                       default
 -Wint-in-bool-context                  enabled by -Wall
 -Wint-to-pointer-cast                  default
--Winteger-division                     fortran
--Winterference-size                    c++
--Wintrinsic-shadow                     fortran
--Wintrinsics-std                       fortran
--Winvalid-constexpr                    c++
--Winvalid-imported-macros              c++
 -Winvalid-memory-model                 default
--Winvalid-offsetof                     c++ and objc++
 -Winvalid-utf8                         enabled by -finput-charset=UTF-8
 -Wjump-misses-init                     only useful for code meant to be compiled by a C++ compiler
 -Wlarger-than-                         gcc --help=warnings artifact
 -Wlarger-than=<byte-size>              FIXME: choose something sane?
 -Wleading-whitespace=                  specific to project coding style
--Wline-truncation                      fortran
--Wliteral-suffix                       c++ and objc++
 -Wlogical-not-parentheses              enabled by -Wall
 -Wlong-long                            obsolescent
--Wlto-type-mismatch                    c++ and objc++
+-Wlto-type-mismatch                    default
 -Wmain                                 enabled by -Wall
 -Wmaybe-musttail-local-addr            enabled by -Wextra
 -Wmaybe-uninitialized                  enabled by -Wall or -Wextra
 -Wmemset-transposed-args               enabled by -Wall
 -Wmisleading-indentation               enabled by -Wall
 -Wmismatched-dealloc                   default
--Wmismatched-new-delete                        default, c++ and objc++
--Wmismatched-special-enum              d
--Wmismatched-tags                      c++ and objc++
 -Wmissing-attributes                   enabled by -Wall
 -Wmissing-braces                       enabled by -Wall
 -Wmissing-field-initializers           enabled by -Wextra
 -Wmissing-parameter-name               c and objc compatibility
 -Wmissing-parameter-type               enabled by -Wextra
 -Wmissing-profile                      default
--Wmissing-requires                     default, c++
--Wmissing-template-keyword             default, c++
 -Wmultichar                            default
--Wmultiple-inheritance                 c++ and objc++
 -Wmultistatement-macros                        enabled by -Wall
 -Wmusttail-local-addr                  default
--Wnamespaces                           c++
 -Wnarrowing                            enabled by -Wall
 -Wno-alloc-size-larger-than            see -Walloc-size-larger-than
 -Wno-alloca-larger-than                        see -Walloca-larger-than
 -Wno-larger-than                       see -Wlarger-than
 -Wno-stack-usage                       see -Wstack-usage
 -Wno-vla-larger-than                   see -Wvla-larger-than
--Wnoexcept                             c++
--Wnoexcept-type                                c++
--Wnon-template-friend                  c++
--Wnon-virtual-dtor                     c++
 -Wnonnull                              enabled by -Wall or -Wformat
 -Wnonnull-compare                      enabled by -Wall
 -Wnormalized                           default
 -Wnormalized=[none|id|nfc|nfkc]                defaults to nfc
--Wnrvo                                 c++ and objc++
--Wobjc-root-class                      objc and objc++
 -Wodr                                  default
--Wold-style-cast                       c++ and objc++
 -Wold-style-declaration                        enabled by -Wextra
 -Wopenacc-parallelism                  OpenACC
 -Wopenmp                               default
 -Woverflow                             default
--Woverloaded-virtual                   c++
--Woverloaded-virtual=<0,2>             c++
 -Woverride-init                                enabled by -Wextra
--Woverride-init-side-effects           c++ and objc++
--Woverwrite-recursive                  fortran
+-Woverride-init-side-effects           default
 -Wpacked-bitfield-compat               default
 -Wpacked-not-aligned                   enabled by -Wall
 -Wpadded                               FIXME maybe?  warns about "stabil" member in /usr/include/bits/timex.h
 -Wparentheses                          enabled by -Wall
 -Wpedantic                             FIXME: too strict?
--Wpessimizing-move                     c++ and objc++
--Wplacement-new                                c++
--Wplacement-new=<0,2>                  c++
--Wpmf-conversions                      c++ and objc++
 -Wpointer-compare                      default
 -Wpointer-sign                         enabled by -Wall
 -Wpointer-to-int-cast                  default
 -Wpragma-once-outside-header           default
 -Wpragmas                              default
--Wprio-ctor-dtor                       c++
--Wproperty-assign-default              objc++
--Wprotocol                             objc++
+-Wprio-ctor-dtor                       default
 -Wpsabi                                        default
--Wrange-loop-construct                 c++ and objc++
--Wreal-q-constant                      fortran
--Wrealloc-lhs                          fortran
--Wrealloc-lhs-all                      fortran
 -Wredundant-decls                      FIXME maybe? many _gl_cxxalias_dummy FPs
--Wredundant-move                       c++ and objc++
--Wredundant-tags                       c++ and objc++
--Wregister                             c++ and objc++
--Wreorder                              c++ and objc++
 -Wrestrict                             enabled by -Wall
 -Wreturn-local-addr                    default
 -Wreturn-mismatch                      default
 -Wreturn-type                          enabled by -Wall
 -Wscalar-storage-order                 default
--Wselector                             objc and objc++
--Wself-move                            c++ and objc++
 -Wsequence-point                       enabled by -Wall
 -Wshadow-compatible-local              covered by -Wshadow
--Wshadow-ivar                          objc
 -Wshadow-local                         covered by -Wshadow
 -Wshadow=compatible-local              covered by -Wshadow
 -Wshadow=global                                covered by -Wshadow
 -Wshift-overflow=<0,2>                 gcc --help=warnings artifact
 -Wsign-compare                         enabled by -Wextra
 -Wsign-conversion                      FIXME maybe? borderline.  some will want this
--Wsign-promo                           c++ and objc++
--Wsized-deallocation                   c++ and objc++
 -Wsizeof-array-argument                        default
 -Wsizeof-array-div                     enabled by -Wall
 -Wsizeof-pointer-div                   enabled by -Wall
 -Wstack-usage=<byte-size>              FIXME: choose something sane?
 -Wstrict-aliasing                      enabled by -Wall
 -Wstrict-aliasing=<0,3>                        FIXME: choose something sane?
--Wstrict-null-sentinel                 c++ and objc++
 -Wstrict-overflow=<0,5>                        FIXME: choose something sane?
--Wstrict-selector-match                        objc and objc++
 -Wstring-compare                       enabled by -Wextra
 -Wstringop-overflow                    covered by -Wstringop-overflow=2
 -Wstringop-overflow=<0,4>              defaults to 2
 -Wstringop-overread                    default
 -Wstringop-truncation                  default
--Wsubobject-linkage                    c++ and objc++
 -Wsuggest-attribute=returns_nonnull    https://gcc.gnu.org/PR114833
 -Wsuggest-final-methods                        c++
 -Wsuggest-final-types                  c++
--Wsuggest-override                     c++
--Wsurprising                           fortran
 -Wswitch                               enabled by -Wall
 -Wswitch-bool                          default
 -Wswitch-default                       https://lists.gnu.org/r/bug-gnulib/2018-05/msg00179.html
 -Wswitch-enum                          FIXME maybe? borderline.  some will want this
 -Wswitch-outside-range                 default
 -Wswitch-unreachable                   default
--Wsynth                                        deprecated
 -Wsystem-headers                       warns about system headers on macOS and #include_next in gnulib headers
--Wtabs                                 fortran
--Wtarget-lifetime                      fortran
 -Wtautological-compare                 enabled by -Wall
--Wtemplate-body                                default, c++ and objc++
--Wtemplate-id-cdtor                    default, c++ and objc++
--Wtemplate-names-tu-local              enabled by -Wextra, c++
--Wtemplates                            c++ and objc++
--Wterminate                            c++ and objc++
 -Wtraditional                          obsolescent
 -Wtraditional-conversion               obsolescent
 -Wtrailing-whitespace                  specific to project coding style
 -Wtrivial-auto-var-init                        subsumed by -Wmaybe-uninitialized
 -Wtsan                                 default
 -Wtype-limits                          enabled by -Wextra
--Wundeclared-selector                  objc and objc++
 -Wundef                                        FIXME maybe? too many false positives
--Wundefined-do-loop                    fortran
--Wunderflow                            fortran
 -Wunicode                              default
 -Wunreachable-code                     obsolescent no-op
 -Wunsuffixed-float-constants           triggers warning in gnulib's timespec.h
 -Wunused-but-set-variable              enabled by -Wunused
 -Wunused-const-variable                        covered by -Wunused-const-variable=2
 -Wunused-const-variable=<0,2>          gcc --help=warnings artifact
--Wunused-dummy-argument                        fortran
 -Wunused-function                      enabled by -Wunused
 -Wunused-label                         enabled by -Wunused
 -Wunused-local-typedefs                        enabled by -Wunused
--Wunused-parameter                     enabled by -Wextra -Wunused
 -Wunused-result                                enabled by -Wunused
 -Wunused-value                         enabled by -Wunused
 -Wunused-variable                      enabled by -Wunused
 -Wuse-after-free                       handled specially by gl_MANYWARN_ALL_GCC
 -Wuse-after-free=<0,3>                 handled specially by gl_MANYWARN_ALL_GCC
--Wuse-without-only                     fortran
 -Wuseless-cast                         c++ and objc++
 -Wvarargs                              default
--Wvexing-parse                         c++ and objc++
--Wvirtual-inheritance                  c++
--Wvirtual-move-assign                  c++
 -Wvla-larger-than=<number>             handled specially by gl_MANYWARN_ALL_GCC
 -Wvla-parameter                                enabled by -Wall
--Wvolatile                             c++ and objc++
 -Wvolatile-register-var                        enabled by -Wall
 -Wxor-used-as-pow                      default
 -Wzero-as-null-pointer-constant                handled specially by gl_MANYWARN_ALL_GCC
 -Wzero-length-bounds                   enabled by -Wall
--Wzerotrip                             fortran
--frequire-return-statement             go
index 85c5a08551b9c5b3bd4de059b73b20af441f0fa2..88e7ad66462126551e0d12d20bc7c2c6b2315dc3 100644 (file)
@@ -1,5 +1,5 @@
 # manywarnings.m4
-# serial 33
+# serial 34
 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,
@@ -97,7 +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=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
+  #  <((gcc --help=c,warnings && gcc --help=common,warnings) \
+  #    | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
 
   $1=
   for gl_manywarn_item in -fanalyzer -fstrict-flex-arrays \