diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-04-23 18:44:32 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-04-23 18:44:32 (GMT) |
commit | 79cb6eaf7d974251859b015c61d8e43ff40ee7b2 (patch) | |
tree | 5f05e33ae724b9a8f1b0479ec28bfad26f2f9f4e | |
parent | ec569a663ae98a2b5a1928c7c3bebb35121ecd5e (diff) | |
parent | 5ea58acf8a2bdf8ca19d4c86d9ef94fbc4ac449f (diff) | |
download | hdf5-79cb6eaf7d974251859b015c61d8e43ff40ee7b2.zip hdf5-79cb6eaf7d974251859b015c61d8e43ff40ee7b2.tar.gz hdf5-79cb6eaf7d974251859b015c61d8e43ff40ee7b2.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '5ea58acf8a2bdf8ca19d4c86d9ef94fbc4ac449f':
Add missing ')'.
Add C++ warnings treated as error for autotools builds.
Move macro ADD_H5_CFLAGS to cmake_ext_mod/HDFMacros.cmake and remove duplicate versions.
Address PR suggestions and add overlooked GCC compiler version flags.
Don't add general warnings flags for unsupported old versions of gcc and g++ (older than gcc/g++ 4.2). Correct gnu-cxxflags to determine warnings flags to be added based on C++ compiler version instead of C compiler version.
-rw-r--r-- | config/cmake/HDFCXXCompilerFlags.cmake | 62 | ||||
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 50 | ||||
-rw-r--r-- | config/cmake/HDFFortranCompilerFlags.cmake | 18 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 18 | ||||
-rw-r--r-- | config/commence.am | 2 | ||||
-rw-r--r-- | config/gnu-cxxflags | 50 | ||||
-rw-r--r-- | config/gnu-flags | 6 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/libhdf5.settings.in | 2 |
9 files changed, 107 insertions, 104 deletions
diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 6aa8784..ec3b498 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -13,24 +13,6 @@ set(CMAKE_CXX_STANDARD 98) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS OFF) -macro (ADD_H5_FLAGS h5_flag_var infile) - file (STRINGS ${infile} TEST_FLAG_STREAM) - #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") - list (LENGTH TEST_FLAG_STREAM len_flag) - if (len_flag GREATER 0) - math (EXPR _FP_LEN "${len_flag} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET TEST_FLAG_STREAM ${line} str_flag) - string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") - #message (STATUS "str_flag=${str_flag}") - if (str_flag) - list (APPEND ${h5_flag_var} "${str_flag}") - endif () - endforeach () - endif () - #message (STATUS "h5_flag_var=${${h5_flag_var}}") -endmacro () - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") message (STATUS "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}") #----------------------------------------------------------------------------- @@ -103,10 +85,13 @@ if (NOT MSVC) list (APPEND H5_CXXFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - # autotools always add the C flags with the CXX flags + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + # autotools adds the C flags with the CXX flags for g++ compiler + # versions 4.2 and above. ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") + ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") endif () elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") @@ -141,17 +126,31 @@ if (NOT MSVC) endif () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # Append warning flags that only gcc 4.3+ knows about - # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") - # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... Only needed for gcc 4.X - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") endif () + # Append warning flags for gcc 4.2-4.3 + # autotools always add the C flags with the CXX flags + if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.3") + endif () + + # Append warning flags for gcc 4.2-4.4 + # autotools always add the C flags with the CXX flags + if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.4 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.4") + endif () + + # Append warning flags that only gcc 4.3+ knows about + # autotools always add the C flags with the CXX flags + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") + endif() + # Append more extra warning flags that only gcc 4.4+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) # autotools always add the C flags with the CXX flags @@ -172,7 +171,7 @@ if (NOT MSVC) endif () # Append more extra warning flags that only gcc 4.6 and less know about - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6") endif () @@ -255,6 +254,7 @@ if (NOT MSVC) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") @@ -313,7 +313,7 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) else () if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS0}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0}) endif () endif () endif () @@ -332,7 +332,7 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS) else () if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS1}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS1}) endif () endif () endif () @@ -351,7 +351,7 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS) else () if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS2}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS2}) endif () endif () endif () @@ -370,7 +370,7 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS) else () if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS3}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS3}) endif () endif () endif () @@ -384,7 +384,7 @@ if (HDF5_ENABLE_GROUPFOUR_WARNINGS) if (NOT MSVC) if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS4}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS4}) endif () endif () endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 72141c0..02bc8b1 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -12,24 +12,6 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED TRUE) -macro (ADD_H5_FLAGS h5_flag_var infile) - file (STRINGS ${infile} TEST_FLAG_STREAM) - #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") - list (LENGTH TEST_FLAG_STREAM len_flag) - if (len_flag GREATER 0) - math (EXPR _FP_LEN "${len_flag} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET TEST_FLAG_STREAM ${line} str_flag) - string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") - #message (STATUS "str_flag=${str_flag}") - if (str_flag) - list (APPEND ${h5_flag_var} "${str_flag}") - endif () - endforeach () - endif () - #message (STATUS "h5_flag_var=${${h5_flag_var}}") -endmacro () - set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_SANITIZER_FLAGS} ${CMAKE_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") @@ -111,8 +93,11 @@ if (NOT MSVC) list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + # Add general CFlags for GCC versions 4.2 and above + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + endif () # gcc automatically inlines based on the optimization level # this is just a failsafe list (APPEND H5_CFLAGS0 "-finline-functions") @@ -149,15 +134,27 @@ if (NOT MSVC) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - # Append warning flags that only gcc 4.3+ knows about - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") - # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... Only needed for gcc 4.X - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") endif () + # Append warning flags for gcc 4.2-4.3 + if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.3") + endif () + + # Append warning flags for gcc 4.2-4.4 + if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.4 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.4") + endif () + + # Append warning flags that only gcc 4.3+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") + endif () + # Append more extra warning flags that only gcc 4.4+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4") @@ -174,7 +171,7 @@ if (NOT MSVC) endif () # Append more extra warning flags that only gcc 4.6 and less know about - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6") endif () @@ -218,7 +215,7 @@ if (NOT MSVC) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") endif () - # Append more extra warning flags that only gcc 5.1+ know about + # Append more extra warning flags that only gcc 5.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") @@ -242,6 +239,7 @@ if (NOT MSVC) # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") if (HDF5_ENABLE_DEV_WARNINGS) ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index a56ef28..495a0ca 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -10,24 +10,6 @@ # help@hdfgroup.org. # -macro (ADD_H5_FFLAGS h5_fflag_var infile) - file (STRINGS ${infile} TEST_FLAG_STREAM) - #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") - list (LENGTH TEST_FLAG_STREAM len_flag) - if (len_flag GREATER 0) - math (EXPR _FP_LEN "${len_flag} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET TEST_FLAG_STREAM ${line} str_flag) - string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") - #message (STATUS "str_flag=${str_flag}") - if (str_flag) - list (APPEND ${h5_fflag_var} "${str_flag}") - endif () - endforeach () - endif () - #message (STATUS "h5_fflag_var=${${h5_fflag_var}}") -endmacro () - message (STATUS "Warnings Configuration: default Fortran: ${CMAKE_Fortran_FLAGS}") #----------------------------------------------------------------------------- diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index fee6def..5740740 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -429,3 +429,21 @@ macro (HDF_DIR_PATHS package_prefix) endif () endmacro () +macro (ADD_H5_FLAGS h5_flag_var infile) + file (STRINGS ${infile} TEST_FLAG_STREAM) + #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") + list (LENGTH TEST_FLAG_STREAM len_flag) + if (len_flag GREATER 0) + math (EXPR _FP_LEN "${len_flag} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET TEST_FLAG_STREAM ${line} str_flag) + string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") + #message (STATUS "str_flag=${str_flag}") + if (str_flag) + list (APPEND ${h5_flag_var} "${str_flag}") + endif () + endforeach () + endif () + #message (STATUS "h5_flag_var=${${h5_flag_var}}") +endmacro () + diff --git a/config/commence.am b/config/commence.am index 41e0f3f..6e3d9a9 100644 --- a/config/commence.am +++ b/config/commence.am @@ -72,7 +72,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++ AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@ -AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@ AM_LDFLAGS=@AM_LDFLAGS@ @H5_LDFLAGS@ diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index e177aef..b3b082d 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -79,9 +79,9 @@ if test "X-" = "X-$cxx_flags_set"; then cxx_vers_major=`echo $cxx_version | cut -f1 -d.` cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` - test -n "$cc_vers_major" || cxx_vers_major=0 - test -n "$cc_vers_minor" || cxx_vers_minor=0 - test -n "$cc_vers_patch" || cxx_vers_patch=0 + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` fi @@ -180,10 +180,12 @@ if test "X-g++" = "X-$cxx_vendor"; then # General # ########### - H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments general)" - H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-general)" - H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-general)" - #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-cxx-general)" + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2 -o $cxx_vers_major -gt 4; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments general)" + H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-general)" + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-general)" + #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-cxx-general)" + fi ###################### # Developer warnings # @@ -197,27 +199,27 @@ if test "X-g++" = "X-$cxx_vendor"; then ####################### # 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 + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -le 6; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.6)" fi # 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 + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -le 3; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.3)" fi # 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 + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -le 6; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.5-4.6)" fi # 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 + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2 -a $cxx_vers_major -eq 4 -a $cxx_vers_minor -le 4; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.4)" fi # GCC 4.2 through the end of GCC 4 series - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then + if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.last)" fi @@ -226,68 +228,68 @@ if test "X-g++" = "X-$cxx_vendor"; then ############################# # gcc >= 4.3 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 3; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.3)" fi # gcc >= 4.4 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 4; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.4)" fi # gcc >= 4.5 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.5)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.5)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.5)" fi # gcc >= 4.6 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 6; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.6)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.6)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.6)" fi # gcc >= 4.7 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 7; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.7)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.7)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.7)" fi # gcc >= 4.8 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.8)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.8)" fi # gcc >= 4.9 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then + if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 9; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.9)" H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-4.9)" fi # gcc >= 5 - if test $cc_vers_major -ge 5; then + if test $cxx_vers_major -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 5)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-5)" fi # gcc >= 6 - if test $cc_vers_major -ge 6; then + if test $cxx_vers_major -ge 6; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 6)" fi # gcc >= 7 - if test $cc_vers_major -ge 7; then + if test $cxx_vers_major -ge 7; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 7)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-7)" fi # gcc 8 - if test $cc_vers_major -ge 8; then + if test $cxx_vers_major -ge 8; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 8)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-8)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-8)" @@ -295,7 +297,7 @@ if test "X-g++" = "X-$cxx_vendor"; then fi # gcc 9 - if test $cc_vers_major -ge 9; then + if test $cxx_vers_major -ge 9; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 9)" fi diff --git a/config/gnu-flags b/config/gnu-flags index ad07552..dba9324 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -188,8 +188,10 @@ if test "X-gcc" = "X-$cc_vendor"; then # General # ########### - H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -gt 4; then + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" + fi ###################### # Developer warnings # diff --git a/configure.ac b/configure.ac index 81e985e..db0cddf 100644 --- a/configure.ac +++ b/configure.ac @@ -104,13 +104,14 @@ AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) ## -## H5_ECFLAGS is for warnings that should be treated as errors. +## H5_ECFLAGS (and company) are for warnings that should be treated as errors. ## AC_SUBST([H5_CFLAGS]) AC_SUBST([H5_ECFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) +AC_SUBST([H5_ECXXFLAGS]) AC_SUBST([H5_JNIFLAGS]) AC_SUBST([H5_JAVACFLAGS]) AC_SUBST([H5_JAVAFLAGS]) diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 192fc6f..fb9deec 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -56,7 +56,7 @@ Languages: C++: @HDF_CXX@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CXX_VERSION@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CXXFLAGS@ -@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ +@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @H5_ECXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @enable_shared@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@ |