From fa1dfbbd8dc1cc226e440d6a9462a4b02009f11b Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 22 Nov 2019 14:23:07 -0600 Subject: Only promote maybe-uninitialized warnings to errors on GCC 8. Even on GCC 8, there may be false positives at low optimization levels? I need to check. --- config/gnu-flags | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/gnu-flags b/config/gnu-flags index c71974b..d228c8b 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -199,7 +199,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # H5_ECFLAGS="$H5_ECFLAGS -Werror=discarded-qualifiers" H5_ECFLAGS="$H5_ECFLAGS -Werror=implicit-function-declaration" H5_ECFLAGS="$H5_ECFLAGS -Werror=incompatible-pointer-types" - H5_ECFLAGS="$H5_ECFLAGS -Werror=maybe-uninitialized" + H5_ECFLAGS="$H5_ECFLAGS -Wmaybe-uninitialized" H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-sign" H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-to-int-cast" H5_ECFLAGS="$H5_ECFLAGS -Werror=switch" @@ -347,6 +347,12 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 8 if test $cc_vers_major -ge 8; then + # For GCC 8, promote maybe-initialized warnings to an error. GCC 8 + # reports 0 maybe-uninitialized warnings where earlier versions + # make many false reports. GCC 8 seems to analyze calls to static + # in order to detect initializations that occur there. It's possible + # that GCC 8 only performs that analysis at -O3, though. + H5_ECFLAGS="$H5_ECFLAGS -Werror=maybe-uninitialized" H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-function-type" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" -- cgit v0.12