BUILD: Disable -Wshadow and -Wmissing-field-initializers before GCC 5

They just gave many false positives creating a lot of noise in build
logs for ports using an older GCC.
This commit is contained in:
Donovan Watteau 2023-03-06 17:34:58 +01:00 committed by Eugene Sandulenko
parent 3749b21f18
commit a5106d86ef
2 changed files with 10 additions and 1 deletions

View File

@ -33,7 +33,7 @@ ifeq "$(HAVE_GCC)" "1"
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
# Enable even more warnings...
CXXFLAGS+= -Wpointer-arith -Wcast-qual
CXXFLAGS+= -Wshadow -Wnon-virtual-dtor -Wwrite-strings
CXXFLAGS+= -Wnon-virtual-dtor -Wwrite-strings
# Currently we disable this gcc flag, since it will also warn in cases,
# where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))

9
configure vendored
View File

@ -2201,8 +2201,17 @@ if test "$have_gcc" = yes; then
cxx_version=`gcc_get_define __clang_version__`
cxx_version="`echo "${cxx_version}" | sed -e 's/"\([^ ]*\) .*/\1/'`"
cxx_version="clang $cxx_version, ok"
append_var CXXFLAGS "-Wshadow"
else
cxx_version="GCC $cxx_version, ok"
# Way too many false positives before GCC 5
if test $_cxx_major -ge 5; then
append_var CXXFLAGS "-Wshadow"
else
append_var CXXFLAGS "-Wno-missing-field-initializers"
fi
fi
elif test "$have_icc" = yes; then
cxx_version="`( $CXX -dumpversion ) 2>/dev/null`"