diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-07-10 17:49:55 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-07-10 17:49:55 (GMT) |
commit | 924d4c01a8b32d1a1c2496ca68a066b5bd9343e9 (patch) | |
tree | ce7f7689579db53df8b1c12b29959e01eb4f6b3b | |
parent | 59f94cd8f84f4911b9157b101bb01b1d53a04781 (diff) | |
download | hdf5-924d4c01a8b32d1a1c2496ca68a066b5bd9343e9.zip hdf5-924d4c01a8b32d1a1c2496ca68a066b5bd9343e9.tar.gz hdf5-924d4c01a8b32d1a1c2496ca68a066b5bd9343e9.tar.bz2 |
Reworked the config/gnu-flags file to be more organized and robust.
-rw-r--r-- | config/gnu-flags | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/config/gnu-flags b/config/gnu-flags index 585c2b4..3d7331b 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -14,7 +14,7 @@ # This file should be sourced into configure if the compiler is the # GNU gcc compiler or a derivative. It is careful not to do anything -# if the compiler is not GNU; otherwise `cc_flags_set' is set to `yes' +# if the compiler is not GNU; otherwise 'cc_flags_set' is set to 'yes' # # Get the compiler version in a way that works for gcc @@ -43,20 +43,21 @@ if test X = "X$cc_flags_set"; then echo "compiler '$CC' is GNU $cc_vendor-$cc_version" fi - # Some version numbers + # Get the compiler version numbers cc_vers_major=`echo $cc_version | cut -f1 -d.` cc_vers_minor=`echo $cc_version | cut -f2 -d.` cc_vers_patch=`echo $cc_version | cut -f3 -d.` test -n "$cc_vers_major" || cc_vers_major=0 test -n "$cc_vers_minor" || cc_vers_minor=0 test -n "$cc_vers_patch" || cc_vers_patch=0 - cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` fi -# Common GCC flags for various situations -case "$cc_vendor-$cc_version" in - gcc*) - # Architecture-specific flags +if test "X-gcc" = "X-$cc_vendor"; then + + ############################### + # Architecture-specific flags # + ############################### + arch= case "$host_os-$host_cpu" in # FreeBSD sets the information from "uname -m" to the general machine @@ -96,15 +97,65 @@ case "$cc_vendor-$cc_version" in ;; esac - # Host-specific flags - case "`hostname`" in - sleipnir.ncsa.uiuc.edu) - arch="$arch -pipe" - ;; - esac + H5_CFLAGS="$H5_CFLAGS $arch" + + ############## + # Production # + ############## + + # NDEBUG is handled explicitly by the configure script + if test $cc_vers_major -eq 4; then + PROD_CFLAGS= + else + PROD_CFLAGS="-fstdarg-opt" + fi + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags + if test $cc_vers_major -eq 4; then + DEBUG_CFLAGS= + else + DEBUG_CFLAGS="-ftrapv -fno-common" + fi + + ########### + # Symbols # + ########### + + NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer" + + ############# + # Profiling # + ############# + + PROFILE_CFLAGS="-pg" + + ################ + # Optimization # + ################ + + if test $cc_vers_major -eq 4; then + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + else + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + fi + NO_OPT_CFLAGS="-O0" + + ############ + # Warnings # + ############ + + ########### + # General # + ########### - # General flags - # # 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 @@ -117,81 +168,25 @@ case "$cc_vendor-$cc_version" in # 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 -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 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" 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" - # Production - # NDEBUG is handled explicitly by the configure script - case "$cc_vendor-$cc_version" in - gcc-4.*) - PROD_CFLAGS= - ;; - gcc-[56789].*) - PROD_CFLAGS="-fstdarg-opt" - ;; - *) - # gcc automatically inlines based on the optimization level - # this is just a failsafe - PROD_CFLAGS="-finline-functions" - ;; - esac - - # Debug - # NDEBUG is handled explicitly by the configure script - # -g is handled by the symbols flags - case "$cc_vendor-$cc_version" in - gcc-[56789].*) - DEBUG_CFLAGS="-ftrapv -fno-common" - ;; - *) - DEBUG_CFLAGS= - ;; - esac + ###################### + # Developer warnings # + ###################### - # Developer warnings (suggestions from gcc, not code problems) + # (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" - # Symbols - NO_SYMBOLS_CFLAGS="-s" - SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer" - - # Profile - PROFILE_CFLAGS="-pg" - - # Optimization - case "$cc_vendor-$cc_version" in - gcc-4.*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS= - ;; - gcc-[56789].*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-Og" - ;; - *) - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS= - ;; - esac - NO_OPT_CFLAGS="-O0" - - # Flags are set - cc_flags_set=yes - ;; -esac - -# Version-specific GCC flags -if test "X-gcc" = "X-$cc_vendor"; then - - # - # Special cases - # + ####################### + # gcc 4 special cases # + ####################### # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier 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 @@ -221,9 +216,9 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wvla" fi - # - # Main version-specific flags - # + ############################# + # Version-specific warnings # + ############################# # gcc 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then @@ -292,6 +287,11 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 9; then H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" fi + + ################# + # Flags are set # + ################# + cc_flags_set=yes fi # Clear cc info if no flags set |