diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-01-17 19:13:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-01-17 19:14:06 (GMT) |
commit | cf84882b3c23139f2f9b1edd60f0785d3c522a14 (patch) | |
tree | cea1e2b106b6acc5753bd80b8dc85e195b91c4fc /config/gnu-flags | |
parent | 5fadf221baee915b74918c37c1ab34b24975be87 (diff) | |
download | hdf5-cf84882b3c23139f2f9b1edd60f0785d3c522a14.zip hdf5-cf84882b3c23139f2f9b1edd60f0785d3c522a14.tar.gz hdf5-cf84882b3c23139f2f9b1edd60f0785d3c522a14.tar.bz2 |
Create common build system files for warnings
Diffstat (limited to 'config/gnu-flags')
-rw-r--r-- | config/gnu-flags | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/config/gnu-flags b/config/gnu-flags index a5f3258..f23ad68 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -17,6 +17,21 @@ # if the compiler is not GNU; otherwise 'cc_flags_set' is set to 'yes' # +# +# 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, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_gcc_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/gnu-${arg} + done) + IFS=' ' echo "$*" +} + + # Get the compiler version in a way that works for gcc # unless a compiler version is already known # @@ -138,7 +153,7 @@ if test "X-gcc" = "X-$cc_vendor"; then ################ # Optimization # ################ - + if test $cc_vers_major -le 4; then HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS= @@ -171,12 +186,13 @@ if test "X-gcc" = "X-$cc_vendor"; then # 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 -pedantic -Wall -Wextra -Wbad-function-cast -Wno-c++-compat -Wcast-align" - H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" - H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" + 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 -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" - H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" + H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations" ###################### # Developer warnings # @@ -184,8 +200,8 @@ if test "X-gcc" = "X-$cc_vendor"; then # (suggestions from gcc, not code problems) # 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" + NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general) + DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general) ####################### # gcc 4 special cases # @@ -196,11 +212,11 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wno-long-long" fi - # -Wvolatile-register-var was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.2-4.3 + # -Wvolatile-register-var was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.2-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 -Wvolatile-register-var" + fi # -Wstrict-aliasing was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.5-4.6 @@ -223,10 +239,10 @@ if test "X-gcc" = "X-$cc_vendor"; then # 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 -Wlogical-op -Wlarger-than=2560" + fi # gcc 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then |