From: Bruno Haible Date: Mon, 19 Jun 2023 13:05:34 +0000 (+0200) Subject: build: Silence most warnings from gcc 11. X-Git-Tag: v0.23~424 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=225d113080413a7c174a3923d7d5684ba844d7b1;p=thirdparty%2Fgettext.git build: Silence most warnings from gcc 11. * m4/more-warnings.m4 (gt_MORE_WARNINGS): With gcc 11 or older, silence three more types of warnings. --- diff --git a/m4/more-warnings.m4 b/m4/more-warnings.m4 index 42c168b10..d0ebdf348 100644 --- a/m4/more-warnings.m4 +++ b/m4/more-warnings.m4 @@ -1,4 +1,4 @@ -# more-warnings.m4 serial 1 (gettext-0.21.2) +# more-warnings.m4 serial 2 (gettext-0.23) dnl Copyright (C) 2023 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -135,6 +135,18 @@ AS_HELP_STRING([[--disable-more-warnings]], [obey exactly the warning options sp dnl that the compiler could often infer and which have little effect on the dnl performance of the generated code. nw="$nw -Wsuggest-attribute=cold" + dnl With GCC 11 and older, there warnings are pointless: + dnl "warning: stack protector not protecting local variables: variable + dnl length buffer [-Wstack-protector]", "[-Wanalyzer-use-after-free], + dnl "[-Wanalyzer-free-of-non-heap]". + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ + #if __GNUC__ > 11 + #error "You are lucky" + #endif + ]])], + [nw="$nw -Wstack-protector" + nw="$nw -Wanalyzer-use-after-free -Wanalyzer-free-of-non-heap" + ]) dnl Setup the list of meaningful warning options for the C compiler. dnl The list comes from manywarnings.m4. Warning options that are not