diff options
author | Quincey Koziol <koziol@lbl.gov> | 2019-06-29 00:30:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2019-06-29 00:30:41 (GMT) |
commit | f97ea92fe5450cefd4c4d9fb266e7f42a952f2f9 (patch) | |
tree | a90c9464b052898428c596e7c085683024141890 /config/gnu-flags | |
parent | 13d951d37205bcd48723330a898e5d67c5e1ecb2 (diff) | |
parent | 6ced6457c3048bd10bf6f470b329b4810d9be826 (diff) | |
download | hdf5-f97ea92fe5450cefd4c4d9fb266e7f42a952f2f9.zip hdf5-f97ea92fe5450cefd4c4d9fb266e7f42a952f2f9.tar.gz hdf5-f97ea92fe5450cefd4c4d9fb266e7f42a952f2f9.tar.bz2 |
Merge pull request #1784 in HDFFV/hdf5 from ~KOZIOL/hdf5:feature/update_gcc_flags to develop
* commit '6ced6457c3048bd10bf6f470b329b4810d9be826':
Move the -Wformat-nonliteral warning to the developer flags. Fix bugs I introduced in the last commit.
Updated configure & CMake compiler flags for GCC 8.x, along with corresponding changes to warnhist script (and some extra improvements for condensing C++ and Java warnings), and fixed a bunch of warnings.
Diffstat (limited to 'config/gnu-flags')
-rw-r--r-- | config/gnu-flags | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/config/gnu-flags b/config/gnu-flags index c55391d..fc3a6ce 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -113,11 +113,14 @@ case "$cc_vendor-$cc_version" in # 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. H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" - H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" + H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + # As of GCC 8.x, the -Wunsafe-loop-optimizations has been removed H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -149,7 +152,8 @@ case "$cc_vendor-$cc_version" in esac # Developer warnings (suggestions from gcc, not code problems) - DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn" + # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) + DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn -Wformat-nonliteral" NO_DEVELOPER_WARNING_CFLAGS="-Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn" # Symbols @@ -187,10 +191,10 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 8.x release is out, we should check for additional flags to +# When the gcc 9.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[789].*) + gcc-[89].*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) @@ -198,7 +202,56 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + 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" + + # Append warning flags that only gcc 4.7+ knows about + 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" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + + # Append warning flags that only gcc 7.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + + # Append warning flags that only gcc 8.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + ;; + + + gcc-7*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -242,7 +295,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -282,7 +335,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -319,7 +372,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -353,7 +406,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -384,7 +437,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -414,7 +467,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -439,7 +492,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -459,7 +512,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" |