summaryrefslogtreecommitdiffstats
path: root/config/gnu-flags
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-03-30 14:28:05 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-03-30 14:28:05 (GMT)
commitac32ce96a35d0d15bcda45779de43345da95959f (patch)
tree8a92efc089bbddb6206a9d6115d6be8dd062de30 /config/gnu-flags
parent490cb6f9cd724ef28529c8c80e73e9b5cbc5df4a (diff)
downloadhdf5-ac32ce96a35d0d15bcda45779de43345da95959f.zip
hdf5-ac32ce96a35d0d15bcda45779de43345da95959f.tar.gz
hdf5-ac32ce96a35d0d15bcda45779de43345da95959f.tar.bz2
TRILAB-192 merging warnings changes from develop
Diffstat (limited to 'config/gnu-flags')
-rw-r--r--config/gnu-flags144
1 files changed, 70 insertions, 74 deletions
diff --git a/config/gnu-flags b/config/gnu-flags
index 11aaa71..ca0e1b4 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -18,6 +18,24 @@
#
#
+# For now, do not promote any warnings to errors.
+#
+PROMOTE_ERRORS_DFLT=no
+
+#
+# This filter rewrites -Werror= as -W, in that way demoting warnings
+# promoted to errors back to warnings, if PROMOTE_ERRORS is no.
+#
+demote_errors()
+{
+ if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then
+ sed 's,-Werror=,-W,g'
+ else
+ cat
+ fi
+}
+
+#
# Prepend `$srcdir/config/gnu-` to the filename suffix(es) given as
# subroutine argument(s), remove comments starting with # and ending
# at EOL, replace spans of whitespace (including newlines) with spaces,
@@ -26,7 +44,7 @@
load_gcc_arguments()
{
set -- $(for arg; do
- sed 's,#.*$,,' $srcdir/config/gnu-${arg}
+ sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors
done)
IFS=' ' echo "$*"
}
@@ -171,142 +189,120 @@ if test "X-gcc" = "X-$cc_vendor"; then
# General #
###########
- # Note that some of the flags listed here really should be developer
- # flags (listed in a separate variable, below) but we put them here
- # because they are not raised by the current code and we'd like to
- # know if they do start showing up.
- #
- # NOTE: Don't add -Wpadded here since we can't/won't fix the (many)
- # warnings that are emitted. If you need it, add it from the
- # environment variable at configure time.
- #
- # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
- # it to the developer flags.
- #
- # NOTE: Due to the divergence in the C and C++, we're dropping support for
- # compiling the C library with a C++ compiler and dropping the -Wc++-compat
- # warning.
- H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-general)"
- H5_CFLAGS="$H5_CFLAGS -Wbad-function-cast -Wcast-align"
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wdisabled-optimization"
- H5_CFLAGS="$H5_CFLAGS -Wmissing-declarations"
- H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked"
- H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default"
- H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)"
######################
# Developer warnings #
######################
- # (suggestions from gcc, not code problems)
- # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS)
- NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general)
- DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general)
+ NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general)
+ DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments developer-general)
#######################
# gcc 4 special cases #
#######################
- # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier
+ # GCC 4.2 through 4.6
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.6)"
fi
- # -Wvolatile-register-var was later incorporated into -Wall and
- # only needs to be specified explicitly for gcc 4.2-4.3
+ # GCC 4.2 through 4.3
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then
- H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var"
- fi
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.3)"
+ fi
- # -Wstrict-aliasing was later incorporated into -Wall and
- # only needs to be specified explicitly for gcc 4.5-4.6
+ # GCC 4.5 through 4.6
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then
- H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5-4.6)"
fi
- # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4
+ # GCC 4.2 through 4.4
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.4)"
fi
- # -Wvla was later incorporated into -Wpedantic and
- # only needs to be specified explicitly for gcc 4
+ # GCC 4.2 through the end of GCC 4 series
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then
- H5_CFLAGS="$H5_CFLAGS -Wvla"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.last)"
fi
#############################
# Version-specific warnings #
#############################
- # gcc 4.3
+ # gcc >= 4.3
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then
- H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560"
- fi
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.3)"
+ fi
- # gcc 4.4
+ # gcc >= 4.4
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.4)"
fi
- # gcc 4.5
+ # gcc >= 4.5
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsuffixed-float-constants"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-unsuffixed-float-constants"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.5)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.5)"
fi
- # gcc 4.6
+ # gcc >= 4.6
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.6)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.6)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.6)"
fi
- # gcc 4.7
+ # gcc >= 4.7
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.7)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.7)"
fi
- # gcc 4.8
+ # gcc >= 4.8
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.8)"
fi
- # gcc 4.9
+ # gcc >= 4.9
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then
- H5_CFLAGS="$H5_CFLAGS -Wdate-time"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)"
fi
- # gcc 5
+ # gcc >= 5
if test $cc_vers_major -ge 5; then
- H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)"
fi
- # gcc 6
+ # gcc >= 6
if test $cc_vers_major -ge 6; then
- H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)"
fi
- # gcc 7
+ # gcc >= 7
if test $cc_vers_major -ge 7; then
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2"
- H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-7)"
fi
# gcc 8
if test $cc_vers_major -ge 8; then
- 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"
- H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 8)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-8)"
fi
# gcc 9
if test $cc_vers_major -ge 9; then
- H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)"
fi
#################