summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/clang-warnings/developer-general3
-rw-r--r--config/clang-warnings/error-general79
-rw-r--r--config/clang-warnings/general26
-rw-r--r--config/clang-warnings/no-developer-general1
-rw-r--r--config/cmake/CTestCustom.cmake4
-rw-r--r--config/cmake/HDF5UseFortran.cmake71
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake441
-rw-r--r--config/cmake/HDFCompilerFlags.cmake301
-rw-r--r--config/cmake/HDFFortranCompilerFlags.cmake147
-rw-r--r--config/cmake/libhdf5.settings.cmake.in11
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake26
-rw-r--r--config/cmake_ext_mod/HDFTests.c79
-rw-r--r--config/commence.am2
-rw-r--r--config/gnu-cxxflags312
-rw-r--r--config/gnu-fflags163
-rw-r--r--config/gnu-flags890
-rw-r--r--config/gnu-warnings/4.2-4.33
-rw-r--r--config/gnu-warnings/4.2-4.42
-rw-r--r--config/gnu-warnings/4.2-4.62
-rw-r--r--config/gnu-warnings/4.2-4.last3
-rw-r--r--config/gnu-warnings/4.32
-rw-r--r--config/gnu-warnings/4.43
-rw-r--r--config/gnu-warnings/4.51
-rw-r--r--config/gnu-warnings/4.5-4.63
-rw-r--r--config/gnu-warnings/4.62
-rw-r--r--config/gnu-warnings/4.75
-rw-r--r--config/gnu-warnings/4.81
-rw-r--r--config/gnu-warnings/4.91
-rw-r--r--config/gnu-warnings/52
-rw-r--r--config/gnu-warnings/69
-rw-r--r--config/gnu-warnings/77
-rw-r--r--config/gnu-warnings/83
-rw-r--r--config/gnu-warnings/92
-rw-r--r--config/gnu-warnings/cxx-4.91
-rw-r--r--config/gnu-warnings/cxx-general (renamed from config/intel-warnings-general)13
-rw-r--r--config/gnu-warnings/developer-4.57
-rw-r--r--config/gnu-warnings/developer-4.61
-rw-r--r--config/gnu-warnings/developer-4.77
-rw-r--r--config/gnu-warnings/developer-4.81
-rw-r--r--config/gnu-warnings/developer-71
-rw-r--r--config/gnu-warnings/developer-83
-rw-r--r--config/gnu-warnings/developer-general (renamed from config/gnu-warnings-developer-general)5
-rw-r--r--config/gnu-warnings/error-512
-rw-r--r--config/gnu-warnings/error-89
-rw-r--r--config/gnu-warnings/error-general94
-rw-r--r--config/gnu-warnings/general (renamed from config/gnu-warnings-general)2
-rw-r--r--config/gnu-warnings/gfort-4.42
-rw-r--r--config/gnu-warnings/gfort-4.51
-rw-r--r--config/gnu-warnings/gfort-4.72
-rw-r--r--config/gnu-warnings/gfort-4.85
-rw-r--r--config/gnu-warnings/gfort-51
-rw-r--r--config/gnu-warnings/gfort-61
-rw-r--r--config/gnu-warnings/gfort-81
-rw-r--r--config/gnu-warnings/gfort-general12
-rw-r--r--config/gnu-warnings/no-developer-4.51
-rw-r--r--config/gnu-warnings/no-developer-4.61
-rw-r--r--config/gnu-warnings/no-developer-4.72
-rw-r--r--config/gnu-warnings/no-developer-4.81
-rw-r--r--config/gnu-warnings/no-developer-82
-rw-r--r--config/gnu-warnings/no-developer-general (renamed from config/gnu-warnings-no-developer-general)0
-rw-r--r--config/intel-fflags44
-rw-r--r--config/intel-flags66
-rw-r--r--config/intel-warnings/general2
-rw-r--r--config/intel-warnings/ifort-general1
-rw-r--r--config/linux-gnueabihf16
-rw-r--r--config/linux-gnulibc113
-rw-r--r--config/netbsd56
-rw-r--r--config/sanitizer/sanitizers.cmake109
-rw-r--r--config/solaris1
-rw-r--r--config/toolchain/intel.cmake13
70 files changed, 1946 insertions, 1170 deletions
diff --git a/config/clang-warnings/developer-general b/config/clang-warnings/developer-general
new file mode 100644
index 0000000..aa8c32e
--- /dev/null
+++ b/config/clang-warnings/developer-general
@@ -0,0 +1,3 @@
+-Wformat-nonliteral
+-Wmissing-noreturn
+-Wswitch-enum
diff --git a/config/clang-warnings/error-general b/config/clang-warnings/error-general
new file mode 100644
index 0000000..a9aa516
--- /dev/null
+++ b/config/clang-warnings/error-general
@@ -0,0 +1,79 @@
+#
+# HDF5 code should not trigger the following warnings under any
+# circumstances, so ask the compiler to treat them as errors:
+#
+-Werror=bad-function-cast
+-Werror=implicit-function-declaration
+-Werror=incompatible-pointer-types
+-Werror=missing-declarations
+-Werror=packed
+-Werror=shadow
+-Werror=sometimes-uninitialized
+-Werror=switch
+#
+#-Werror=discarded-qualifiers
+#
+#
+# NOTE: File Driver files are not compatible with these warnings as errors
+# H5FDdirect.c,H5FDmpio.c,H5FDros3.c,
+# -Werror=unused-function
+#
+-Wunused-function
+#
+# H5FDdrvr_module.h
+# -Werror=unused-variable
+#
+-Wunused-variable
+#
+# H5VLpassthru.c
+# -Werror=unused-parameter
+#
+-Wunused-parameter
+#
+#
+#
+# NOTE: Tools files are not compatible with these warnings as errors
+# lib/h5tools.c
+# -Werror=cast-align
+#
+-Wcast-align
+#
+# lib/h5tools_utils.c
+# -Werror=unused-parameter
+#
+#
+# NOTE: JNI files are not compatible with these warnings as errors
+# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c
+# jni/h5sImp.c,jni/h5tImp.c
+# -Werror=cast-align
+# jni/h5util.c
+# -Werror=format(-overflow)
+#
+-Wformat
+#
+#
+#Examples and tests do not use the same set of extensive warning flags as libraries
+# Here is a list of tests and examples that have issues with the stricter warnings as error
+#
+# NOTE: Test files are not compatible with these warnings as errors
+# thread_id.c,
+# -Werror=unused-function
+# dsets.c
+# -Werror=unused-parameter
+#
+#
+# NOTE: Examples files are not compatible with these warnings as errors
+# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c
+# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c
+# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c
+# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c
+# h5_reference_deprec.c
+# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c
+# -Werror=strict-prototypes
+# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c
+# -Werror=old-style-definition
+# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,
+# -Werror=unused-variable
+# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c
+# -Werror=unused-parameter
+
diff --git a/config/clang-warnings/general b/config/clang-warnings/general
new file mode 100644
index 0000000..f0c9b93
--- /dev/null
+++ b/config/clang-warnings/general
@@ -0,0 +1,26 @@
+# general clang warnings flags
+-Wall
+-Warray-bounds
+-Wcast-qual
+-Wconversion
+-Wdouble-promotion
+-Wextra
+-Wformat=2
+-Wframe-larger-than=16384
+-Wimplicit-fallthrough
+#
+# 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.
+#
+-Wno-c++-compat
+#
+# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
+# it to the developer flags.
+#
+-Wno-format-nonliteral
+-Wnull-dereference
+-Wunused-const-variable
+-Wwrite-strings
+-Wpedantic
+-Wvolatile-register-var
diff --git a/config/clang-warnings/no-developer-general b/config/clang-warnings/no-developer-general
new file mode 100644
index 0000000..2f4e0c5
--- /dev/null
+++ b/config/clang-warnings/no-developer-general
@@ -0,0 +1 @@
+-Wmissing-noreturn
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
index fd901f8..0a1c5bd 100644
--- a/config/cmake/CTestCustom.cmake
+++ b/config/cmake/CTestCustom.cmake
@@ -30,11 +30,11 @@ set (CTEST_CUSTOM_WARNING_EXCEPTION
"POSIX name for this item is deprecated"
"disabling jobserver mode"
"config.cmake.xlatefile.c"
- "warning.*implicit declaration of function"
"warning.*unknown pragma"
"warning.*unrecognized .pragma"
"note: expanded from macro"
-# "fpp:[ \t]*warning:[ \t]*cannot remove H5_DEBUG_API - not a predefined macro"
+ # HDDFFV-11074
+ "This directive is not standard"
)
set (CTEST_CUSTOM_MEMCHECK_IGNORE
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index c5d8200..12df64a 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -406,22 +406,6 @@ endif ()
set (${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE})
-# remove the invalid kind from the list
-if (NOT(${${HDF_PREFIX}_SIZEOF___FLOAT128} EQUAL 0))
- if (NOT(${${HDF_PREFIX}_SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof})
- AND NOT(${${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof})
- # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles,
- # so we don't want to remove the 8-byte fortran doubles.
- AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof}))
- message (WARNING "
- Fortran REAL(KIND=${max_real_fortran_kind}) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size
- !!! Fortran interfaces will not be generated for REAL(KIND=${max_real_fortran_kind}) !!!")
- string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS})
- string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF})
- math (EXPR NUM_RKIND "${NUM_RKIND} - 1")
- endif ()
-endif ()
-
set (${HDF_PREFIX}_H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}")
string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS})
@@ -435,7 +419,7 @@ set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) ::
ENABLE_LANGUAGE (C)
if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
-include (CheckCSourceRuns)
+ include (CheckCSourceRuns)
else ()
#-----------------------------------------------------------------------------
# The provided CMake C macros don't provide a general compile/run function
@@ -489,59 +473,6 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
endmacro ()
endif ()
-set (PROG_SRC
- "
-#include <float.h>
-#include <stdio.h>
-#define CHECK_FLOAT128 ${${HDF_PREFIX}_SIZEOF___FLOAT128}
-#if CHECK_FLOAT128!=0
-# if ${${HDF_PREFIX}_HAVE_QUADMATH_H}!=0
-#include <quadmath.h>
-# endif
-# ifdef FLT128_DIG
-#define C_FLT128_DIG FLT128_DIG
-# else
-#define C_FLT128_DIG 0
-# endif
-#else
-#define C_FLT128_DIG 0
-#endif
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define C_LDBL_DIG DECIMAL_DIG
-#else
-#define C_LDBL_DIG LDBL_DIG
-#endif
- int main() {
- printf(\"%d\\\\n%d\\\\n\", C_LDBL_DIG, C_FLT128_DIG)\\\;
- return 1\\\;
- }
- "
-)
-
-if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_c_source_runs (${PROG_SRC} PROG_OUTPUT)
-else ()
- C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT)
-endif ()
-
-# dnl The output from the above program will be:
-# dnl -- LINE 1 -- long double decimal precision
-# dnl -- LINE 2 -- __float128 decimal precision
-
-# Convert the string to a list of strings by replacing the carriage return with a semicolon
-string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}")
-
-list (GET PROG_OUTPUT 0 LDBL_DIG)
-list (GET PROG_OUTPUT 1 FLT128_DIG)
-
-if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0)
- set (${HDF_PREFIX}_HAVE_FLOAT128 0)
- set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
- set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG})
-else ()
- set(${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG})
-endif ()
-
# Setting definition if there is a 16 byte fortran integer
string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos)
diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake
new file mode 100644
index 0000000..6aa8784
--- /dev/null
+++ b/config/cmake/HDFCXXCompilerFlags.cmake
@@ -0,0 +1,441 @@
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+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}")
+#-----------------------------------------------------------------------------
+# Compiler specific flags : Shouldn't there be compiler tests for these
+#-----------------------------------------------------------------------------
+if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
+ if (${HDF_CFG_NAME} MATCHES "Debug")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common")
+ endif ()
+ else ()
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt")
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to disable compiler warnings
+#-----------------------------------------------------------------------------
+if (HDF5_DISABLE_COMPILER_WARNINGS)
+ message (STATUS "....Compiler warnings are suppressed")
+ # MSVC uses /w to suppress warnings. It also complains if another
+ # warning level is given, so remove it.
+ if (MSVC)
+ set (HDF5_WARNINGS_BLOCKED 1)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
+ endif ()
+ endif ()
+ if (WIN32)
+ add_definitions (-D_CRT_SECURE_NO_WARNINGS)
+ endif ()
+
+ # Most compilers use -w to suppress warnings.
+ if (NOT HDF5_WARNINGS_BLOCKED)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# HDF5 library compile options
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# CDash is configured to only allow 3000 warnings, so
+# break into groups (from the config/gnu-flags file)
+#-----------------------------------------------------------------------------
+if (NOT MSVC)
+ if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP")
+ else ()
+ # 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
+ # 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 at configure time.
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general")
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
+ list (APPEND H5_CXXFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow")
+ 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
+ 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")
+ endif ()
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform")
+ endif ()
+ message (STATUS "CMAKE_CXX_FLAGS_GENERAL=${HDF5_CMAKE_CXX_FLAGS}")
+ endif ()
+
+ #-----------------------------------------------------------------------------
+ # Option to allow the user to enable developer warnings
+ # Developer warnings (suggestions from gcc, not code problems)
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ message (STATUS "....HDF5 developer group warnings are enabled")
+ # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ # list (APPEND H5_CXXFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing")
+ # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
+ # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
+ endif ()
+ else ()
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
+ # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
+ endif ()
+ 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)
+ # 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 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
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.5+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5")
+ else ()
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.6 and less know about
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ # 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 ()
+
+ # Append more extra warning flags that only gcc 4.5-4.6 know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.6+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6")
+ else ()
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.7+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7")
+ else ()
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.8+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8")
+ else ()
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.9+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9")
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9")
+ endif ()
+
+ # Append more extra warning flags that only gcc 5.1+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5")
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5")
+ endif ()
+
+ # Append more extra warning flags that only gcc 6.x+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
+ endif ()
+
+ # Append more extra warning flags that only gcc 7.x+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
+ #else ()
+ # ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 8.x+ know about
+ 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")
+ 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")
+ else ()
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 9.x+ know about
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
+ # autotools always add the C flags with the CXX flags
+ ADD_H5_FLAGS (H5_CXXFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
+ endif ()
+ endif ()
+else ()
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/EHsc")
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable all warnings
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_ALL_WARNINGS)
+ message (STATUS "....All Warnings are enabled")
+ if (MSVC)
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668")
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
+ endif ()
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable warnings by groups
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_GROUPZERO_WARNINGS)
+ message (STATUS "....Group Zero warnings are enabled")
+ if (MSVC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1")
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS0})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable warnings by groups
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_GROUPONE_WARNINGS)
+ message (STATUS "....Group One warnings are enabled")
+ if (MSVC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2")
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS1})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable warnings by groups
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_GROUPTWO_WARNINGS)
+ message (STATUS "....Group Two warnings are enabled")
+ if (MSVC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS2})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable warnings by groups
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_GROUPTHREE_WARNINGS)
+ message (STATUS "....Group Three warnings are enabled")
+ if (MSVC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4")
+ endif ()
+ else ()
+ if (CMAKE_COMPILER_IS_GNUCC)
+ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS3})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to enable warnings by groups
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_GROUPFOUR_WARNINGS)
+ message (STATUS "....Group Four warnings are enabled")
+ 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})
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# This is in here to help some of the GCC based IDES like Eclipse
+# and code blocks parse the compiler errors and warnings better.
+#-----------------------------------------------------------------------------
+if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option for --enable-symbols
+# This option will force/override the default setting for all configurations
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
+ if(CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
+ endif ()
+ endif ()
+elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
+ if(CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option for --enable-profiling
+# This option will force/override the default setting for all configurations
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_PROFILING)
+ if(CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}")
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option for --enable-optimization
+# This option will force/override the default setting for all configurations
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_OPTIMIZATION)
+ if(CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}")
+ endif ()
+endif ()
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 17b0854..72141c0 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -23,7 +23,7 @@ macro (ADD_H5_FLAGS h5_flag_var infile)
string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}")
#message (STATUS "str_flag=${str_flag}")
if (str_flag)
- set (${h5_flag_var} "${${h5_flag_var}} ${str_flag}")
+ list (APPEND ${h5_flag_var} "${str_flag}")
endif ()
endforeach ()
endif ()
@@ -49,18 +49,6 @@ if (CMAKE_COMPILER_IS_GNUCC)
endif ()
endif ()
endif ()
-if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
- if (${HDF_CFG_NAME} MATCHES "Debug")
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common")
- endif ()
- else ()
- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt")
- endif ()
- endif ()
-endif ()
#-----------------------------------------------------------------------------
# Option to allow the user to disable compiler warnings
@@ -74,10 +62,6 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
set (HDF5_WARNINGS_BLOCKED 1)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
- endif ()
endif ()
if (WIN32)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
@@ -91,19 +75,20 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
# Most compilers use -w to suppress warnings.
if (NOT HDF5_WARNINGS_BLOCKED)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
- endif ()
endif ()
endif ()
#-----------------------------------------------------------------------------
+# HDF5 library compile options
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
-if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
+if (NOT MSVC)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP")
+ list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP")
else ()
# General flags
#
@@ -115,137 +100,160 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
# 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 at configure time.
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
- ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/intel-warnings-general")
- message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable")
+ ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general")
+ list (APPEND H5_CFLAGS0 "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith")
+ list (APPEND H5_CFLAGS0 "-Wreturn-type -Wstrict-prototypes -Wuninitialized")
+ list (APPEND H5_CFLAGS0 "-Wunknown-pragmas -Wunused-function -Wunused-variable")
# this is just a failsafe
- set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions")
+ list (APPEND H5_CFLAGS0 "-finline-functions")
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings")
+ list (APPEND H5_CFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow")
+ list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings")
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-general")
- message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wcast-align")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wdeclaration-after-statement -Wdisabled-optimization")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-declarations")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunused-macros -Wunsafe-loop-optimizations")
+ 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")
# gcc automatically inlines based on the optimization level
# this is just a failsafe
- set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions")
- message (STATUS "H5_CFLAGS0=${H5_CFLAGS0}")
+ list (APPEND H5_CFLAGS0 "-finline-functions")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
+ list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform")
endif ()
+ message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
endif ()
- #-----------------------------------------------------------------------------
- # Option to allow the user to enable developer warnings
- # Developer warnings (suggestions from gcc, not code problems)
- #-----------------------------------------------------------------------------
- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF)
- if (HDF5_ENABLE_DEV_WARNINGS)
- message (STATUS "....HDF5 developer group warnings are enabled")
- if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing")
- elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-developer-general")
- set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_DEV_GENERAL}")
- endif ()
- else ()
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-no-developer-general")
- set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_NO_DEV_GENERAL}")
- endif ()
+ #-----------------------------------------------------------------------------
+ # Option to allow the user to enable developer warnings
+ # Developer warnings (suggestions from gcc, not code problems)
+ #-----------------------------------------------------------------------------
+ option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF)
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ message (STATUS "....HDF5 developer group warnings are enabled")
+ if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
+ endif ()
+ else ()
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
endif ()
+ endif ()
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- # 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
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla")
-
- # Append more extra warning flags that only gcc 4.4+ know about
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat")
+ 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)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last")
+ 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")
endif ()
# Append more extra warning flags that only gcc 4.5+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init")
- if (HDF5_ENABLE_DEV_WARNINGS)
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunsuffixed-float-constants")
- else ()
- set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-unsuffixed-float-constants")
- endif ()
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5")
+ else ()
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5")
+ endif ()
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.6 and less know about
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.5-4.6 know about
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6")
endif ()
# Append more extra warning flags that only gcc 4.6+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6")
if (HDF5_ENABLE_DEV_WARNINGS)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6")
else ()
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=const")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6")
endif ()
endif ()
# Append more extra warning flags that only gcc 4.7+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7")
if (HDF5_ENABLE_DEV_WARNINGS)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7")
else ()
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7")
endif ()
endif ()
# Append more extra warning flags that only gcc 4.8+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8")
if (HDF5_ENABLE_DEV_WARNINGS)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8")
else ()
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=format")
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8")
endif ()
endif ()
# Append more extra warning flags that only gcc 4.9+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
- set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
+ 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
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1)
- set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat")
+ 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")
endif ()
# Append more extra warning flags that only gcc 6.x+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
- set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
endif ()
# Append more extra warning flags that only gcc 7.x+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
- set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
+ ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
+ #else ()
+ # ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
+ endif ()
endif ()
# Append more extra warning flags that only gcc 8.x+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
- set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
+ ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
+ else ()
+ ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
+ endif ()
endif ()
# Append more extra warning flags that only gcc 9.x+ know about
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
- set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias=2 -Wmissing-profile")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
+ ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
endif ()
-elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=inform")
+ endif ()
endif ()
#-----------------------------------------------------------------------------
@@ -257,22 +265,14 @@ if (HDF5_ENABLE_ALL_WARNINGS)
if (MSVC)
if (HDF5_ENABLE_DEV_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /wd4668")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /wd4668")
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668")
else ()
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
endif ()
else ()
if (CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4})
endif ()
endif ()
endif ()
@@ -284,15 +284,11 @@ option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF)
if (HDF5_ENABLE_GROUPZERO_WARNINGS)
message (STATUS "....Group Zero warnings are enabled")
if (MSVC)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1")
- endif ()
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "/W1")
else ()
if (CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0})
endif ()
endif ()
endif ()
@@ -304,14 +300,12 @@ option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF)
if (HDF5_ENABLE_GROUPONE_WARNINGS)
message (STATUS "....Group One warnings are enabled")
if (MSVC)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2")
- endif ()
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "/W2")
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}")
+ if (CMAKE_COMPILER_IS_GNUCC)
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1})
+ endif ()
endif ()
endif ()
@@ -322,14 +316,12 @@ option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF)
if (HDF5_ENABLE_GROUPTWO_WARNINGS)
message (STATUS "....Group Two warnings are enabled")
if (MSVC)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
- endif ()
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}")
+ if (CMAKE_COMPILER_IS_GNUCC)
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2})
+ endif ()
endif ()
endif ()
@@ -340,14 +332,12 @@ option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF)
if (HDF5_ENABLE_GROUPTHREE_WARNINGS)
message (STATUS "....Group Three warnings are enabled")
if (MSVC)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
- endif ()
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "/W4")
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}")
+ if (CMAKE_COMPILER_IS_GNUCC)
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3})
+ endif ()
endif ()
endif ()
@@ -358,7 +348,9 @@ option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF)
if (HDF5_ENABLE_GROUPFOUR_WARNINGS)
message (STATUS "....Group Four warnings are enabled")
if (NOT MSVC)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}")
+ if (CMAKE_COMPILER_IS_GNUCC)
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4})
+ endif ()
endif ()
endif ()
@@ -369,9 +361,6 @@ endif ()
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
endif ()
-if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
-endif ()
#-----------------------------------------------------------------------------
# Option for --enable-asserts
@@ -401,26 +390,12 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer")
endif ()
- if(CMAKE_CXX_COMPILER_LOADED)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
- endif ()
- endif ()
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
endif ()
- if(CMAKE_CXX_COMPILER_LOADED)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
- set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
- endif ()
- endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS)
@@ -430,10 +405,7 @@ MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS)
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF)
if (HDF5_ENABLE_PROFILING)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROFILE_CFLAGS}")
- if(CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_CXXFLAGS}")
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}")
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING)
@@ -443,9 +415,6 @@ MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING)
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF)
if (HDF5_ENABLE_OPTIMIZATION)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_CFLAGS}")
- if(CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTIMIZE_CXXFLAGS}")
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}")
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION)
diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake
new file mode 100644
index 0000000..a56ef28
--- /dev/null
+++ b/config/cmake/HDFFortranCompilerFlags.cmake
@@ -0,0 +1,147 @@
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# 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}")
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to disable compiler warnings
+#-----------------------------------------------------------------------------
+if (HDF5_DISABLE_COMPILER_WARNINGS)
+ message (STATUS "....Compiler warnings are suppressed")
+ # MSVC uses /w to suppress warnings. It also complains if another
+ # warning level is given, so remove it.
+ if (MSVC)
+ set (HDF5_WARNINGS_BLOCKED 1)
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /warn:none")
+ endif ()
+ endif ()
+ if (WIN32)
+ add_definitions (-D_CRT_SECURE_NO_WARNINGS)
+ endif ()
+ # Borland uses -w- to suppress warnings.
+ if (BORLAND)
+ set (HDF5_WARNINGS_BLOCKED 1)
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w-")
+ endif ()
+
+ # Most compilers use -w to suppress warnings.
+ if (NOT HDF5_WARNINGS_BLOCKED)
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w")
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# HDF5 library compile options
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# CDash is configured to only allow 3000 warnings, so
+# break into groups (from the config/gnu-flags file)
+#-----------------------------------------------------------------------------
+if (NOT MSVC)
+ # General flags
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/ifort-general")
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-stand:f03" "-free")
+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-general")
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ffree-form" "-fimplicit-none")
+ if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0 AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6)
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008ts")
+ else ()
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008")
+ endif ()
+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-Mfreeform" "-Mdclchk" "-Mstandard" "-Mallocatable=03")
+ endif ()
+ message (STATUS "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
+
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+ # Append warning flags that only gcc 4.4+ knows about
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.4")
+
+ # Append more extra warning flags that only gcc 4.5+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.5)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.5")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.6+ know about
+ #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6)
+ # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.6")
+ #endif ()
+
+ # Append more extra warning flags that only gcc 4.7+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.7)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.7")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.8+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.8)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.8")
+ endif ()
+
+ # Append more extra warning flags that only gcc 4.9+ know about
+ #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.9)
+ # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.9")
+ #endif ()
+
+ # Append more extra warning flags that only gcc 5.1+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-5")
+ endif ()
+
+ # Append more extra warning flags that only gcc 6.x+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-6")
+ endif ()
+
+ # Append more extra warning flags that only gcc 7.x+ know about
+ #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0)
+ # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-7")
+ #endif ()
+
+ # Append more extra warning flags that only gcc 8.x+ know about
+ if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0)
+ ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-8")
+ endif ()
+
+ # Append more extra warning flags that only gcc 9.x+ know about
+ #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
+ # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-9")
+ #endif ()
+ endif ()
+else ()
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+ #ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/win-ifort-general")
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "/warn:all" "/stand:f03" "/free")
+ endif ()
+endif ()
+
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 7bfadb1..4945463 100644
--- a/config/cmake/libhdf5.settings.cmake.in
+++ b/config/cmake/libhdf5.settings.cmake.in
@@ -1,12 +1,11 @@
- SUMMARY OF THE HDF5 CONFIGURATION
- =================================
+ SUMMARY OF THE HDF5 CONFIGURATION
+ =================================
General Information:
-------------------
HDF5 Version: @HDF5_PACKAGE_VERSION_STRING@
Configured on: @CONFIG_DATE@
Configured by: @CMAKE_GENERATOR@
- Configure mode: CMAKE @CMAKE_VERSION@
Host system: @CMAKE_HOST_SYSTEM@
Uname information: @CMAKE_SYSTEM_NAME@
Byte sex: @BYTESEX@
@@ -39,7 +38,7 @@ Languages:
H5_CPPFLAGS: @H5_CPPFLAGS@
AM_CPPFLAGS: @AM_CPPFLAGS@
CFLAGS: @CMAKE_C_FLAGS@
- H5_CFLAGS: @H5_CFLAGS@
+ H5_CFLAGS: @HDF5_CMAKE_C_FLAGS@
AM_CFLAGS: @AM_CFLAGS@
Shared C Library: @H5_ENABLE_SHARED_LIB@
Static C Library: @H5_ENABLE_STATIC_LIB@
@@ -48,7 +47,7 @@ Languages:
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran 2003 Compiler: @HDF5_ENABLE_F2003@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@
-@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@
@@ -56,7 +55,7 @@ Languages:
C++: @HDF5_BUILD_CPP_LIB@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@
-@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@
+@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@
@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 52cb7dd..93b977e 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -20,6 +20,7 @@ include (CheckSymbolExists)
include (CheckTypeSize)
include (CheckVariableExists)
include (TestBigEndian)
+include (CheckStructHasMember)
#-----------------------------------------------------------------------------
# APPLE/Darwin setup
@@ -273,11 +274,11 @@ if (MINGW OR NOT WINDOWS)
# systems.
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L)
+ set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)
# Need to add this so that O_DIRECT is visible for the direct
# VFD on Linux systems.
- set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE)
+ set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE)
option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN)
@@ -328,7 +329,7 @@ if (MINGW OR NOT WINDOWS)
CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO)
- HDF_FUNCTION_TEST (HAVE_STAT64_STRUCT)
+ CHECK_STRUCT_HAS_MEMBER("struct stat64" st_blocks "sys/types.h;sys/stat.h" HAVE_STAT64_STRUCT)
if (HAVE_STAT64_STRUCT)
CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64)
endif ()
@@ -438,14 +439,18 @@ if (MINGW OR NOT WINDOWS)
#-----------------------------------------------------------------------------
# Check a bunch of time functions
#-----------------------------------------------------------------------------
+ CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE_TM_GMTOFF)
+ CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE___TM_GMTOFF)
+ CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_TIME_WITH_SYS_TIME)
+ if (${HDF_PREFIX}_HAVE_SYS_TIME_H)
+ CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE)
+ else ()
+ CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE)
+ endif ()
CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY)
foreach (time_test
- HAVE_TM_GMTOFF
- HAVE___TM_GMTOFF
# HAVE_TIMEZONE
- HAVE_STRUCT_TIMEZONE
GETTIMEOFDAY_GIVES_TZ
- TIME_WITH_SYS_TIME
HAVE_TM_ZONE
HAVE_STRUCT_TM_TM_ZONE
)
@@ -453,20 +458,19 @@ if (MINGW OR NOT WINDOWS)
endforeach ()
if (NOT CYGWIN AND NOT MINGW)
HDF_FUNCTION_TEST (HAVE_TIMEZONE)
-# HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS)
endif ()
# ----------------------------------------------------------------------
# Does the struct stat have the st_blocks field? This field is not Posix.
#
- HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS)
+ CHECK_STRUCT_HAS_MEMBER("struct stat" st_blocks "sys/types.h;sys/stat.h" ${HDF_PREFIX}_HAVE_STAT_ST_BLOCKS)
# ----------------------------------------------------------------------
# How do we figure out the width of a tty in characters?
#
CHECK_FUNCTION_EXISTS (ioctl ${HDF_PREFIX}_HAVE_IOCTL)
- HDF_FUNCTION_TEST (HAVE_STRUCT_VIDEOCONFIG)
- HDF_FUNCTION_TEST (HAVE_STRUCT_TEXT_INFO)
+ CHECK_STRUCT_HAS_MEMBER ("struct videoconfig" numtextcols "" ${HDF_PREFIX}_HAVE_STRUCT_VIDEOCONFIG)
+ CHECK_STRUCT_HAS_MEMBER ("struct text_info" screenwidth "" ${HDF_PREFIX}_HAVE_STRUCT_TEXT_INFO)
CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG)
CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO)
CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE)
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 0b9b530..31a568a 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -88,25 +88,6 @@ int main(void)
}
#endif
-
-#ifdef TIME_WITH_SYS_TIME
-/* Time with sys/time test */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-
-#endif
-
#ifdef STDC_HEADERS
#include <stdlib.h>
#include <stdarg.h>
@@ -162,26 +143,6 @@ main ()
#endif /* HAVE_FUNCTION */
-#ifdef HAVE_TM_GMTOFF
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <time.h>
-SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0);
-
-#endif /* HAVE_TM_GMTOFF */
-
-#ifdef HAVE___TM_GMTOFF
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <time.h>
-SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0);
-
-#endif /* HAVE_TM___GMTOFF */
-
#ifdef HAVE_TIMEZONE
#ifdef HAVE_SYS_TIME_H
@@ -192,24 +153,6 @@ SIMPLE_TEST(timezone=0);
#endif /* HAVE_TIMEZONE */
-#ifdef HAVE_STRUCT_TIMEZONE
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <time.h>
-SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0);
-
-#endif /* HAVE_STRUCT_TIMEZONE */
-
-#ifdef HAVE_STAT_ST_BLOCKS
-
-#include <sys/stat.h>
-SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
-
-#endif /* HAVE_STAT_ST_BLOCKS */
-
#ifdef PRINTF_LL_WIDTH
#ifdef HAVE_LONG_LONG
@@ -319,16 +262,6 @@ int main()
}
#endif
-#ifdef HAVE_STAT64_STRUCT
-#include <sys/types.h>
-#include <sys/stat.h>],
-struct stat64 sb;
-int main()
-{
- return 0;
-}
-#endif
-
#ifdef TEST_DIRECT_VFD_WORKS
#include <sys/types.h>
#include <sys/stat.h>
@@ -432,18 +365,6 @@ int main ()
#endif /* HAVE_IOEO */
-#ifdef HAVE_STRUCT_VIDEOCONFIG
-
-SIMPLE_TEST(struct videoconfig w; w.numtextcols=0);
-
-#endif /* HAVE_STRUCT_VIDEOCONFIG */
-
-#ifdef HAVE_STRUCT_TEXT_INFO
-
-SIMPLE_TEST(struct text_info w; w.screenwidth=0);
-
-#endif /* HAVE_STRUCT_TEXT_INFO */
-
#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE )
#ifndef __cplusplus
#if defined( HAVE_INLINE )
diff --git a/config/commence.am b/config/commence.am
index eed5304..d4469dc 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -69,7 +69,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@
+AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@
AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@
diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags
new file mode 100644
index 0000000..e177aef
--- /dev/null
+++ b/config/gnu-cxxflags
@@ -0,0 +1,312 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+
+# This file should be sourced into configure if the compiler is the
+# GNU g++ compiler or a derivative. It is careful not to do anything
+# if the compiler is not GNU; otherwise `cxx_flags_set' is set to `yes'
+#
+
+#
+# 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-warnings/` 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_gnu_arguments()
+{
+ set -- $(for arg; do
+ sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors
+ done)
+ IFS=' ' echo "$*"
+}
+
+# Get the compiler version in a way that works for g++
+# unless a compiler version is already known
+#
+# cxx_vendor: The compiler name: g++
+# cxx_version: Version number: 2.91.60, 2.7.2.1
+#
+if test "X-" = "X-$cxx_flags_set"; then
+ # PathScale compiler spits out gcc version string too. Need to
+ # filter it out.
+ # icc beginning with version 12 includes a "gcc version compatiblilty"
+ # string, causing the gcc H5_CXXFLAGS to be erroneously added. The line
+ # "grep -v 'icc version'" causes the discarding of any output
+ # containing 'icc version'. The cxx_version for icc is correctly determined
+ # and flags added in the intel-flags script.
+ cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\
+ grep -v '^icc.*version' |\
+ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"
+ cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'`
+ cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'`
+ if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then
+ cxx_vendor=g++
+ fi
+ if test "-" != "$cxx_vendor-$cxx_version"; then
+ echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version"
+ fi
+
+ # Get the compiler version numbers
+ 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
+ cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch`
+fi
+
+if test "X-g++" = "X-$cxx_vendor"; then
+
+ ###############################
+ # Architecture-specific flags #
+ ###############################
+
+ arch=
+ case "$host_os-$host_cpu" in
+ # FreeBSD sets the information from "uname -m" to the general machine
+ # architecture, not the specific CPU for the machine, so even our
+ # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD
+ # machine, use the "sysctl" command to get the CPU hardware model.
+ freebsd*-i386)
+ host_cpu_model=`sysctl -n hw.model`
+ case "$host_cpu_model" in
+ # Hmm.. this might not catch Celerons, but it won't hurt them either...
+ *Pro*|*II*|*III*|*IV*|*Athlon*)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+ ;;
+
+ *-i686)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+
+ # C++-specific
+ H5_CXXFLAGS="$H5_CXXFLAGS $arch"
+
+ ##############
+ # Production #
+ ##############
+
+ # NDEBUG is handled explicitly by the configure script
+ if test $cxx_vers_major -le 4; then
+ PROD_CXXFLAGS=
+ else
+ PROD_CXXFLAGS="-fstdarg-opt"
+ fi
+
+ #########
+ # Debug #
+ #########
+
+ # NDEBUG is handled explicitly by the configure script
+ # -g is handled by the symbols flags
+ if test $cxx_vers_major -le 4; then
+ DEBUG_CXXFLAGS=
+ else
+ DEBUG_CXXFLAGS="-ftrapv -fno-common"
+ fi
+
+ ###########
+ # Symbols #
+ ###########
+
+ NO_SYMBOLS_CXXFLAGS="-s"
+ SYMBOLS_CXXFLAGS="-g"
+
+ #############
+ # Profiling #
+ #############
+
+ PROFILE_CXXFLAGS="-pg"
+
+ ################
+ # Optimization #
+ ################
+
+ if test $cxx_vers_major -le 4; then
+ HIGH_OPT_CXXFLAGS="-O3"
+ DEBUG_OPT_CXXFLAGS=
+ else
+ HIGH_OPT_CXXFLAGS="-O3"
+ DEBUG_OPT_CXXFLAGS="-Og"
+ fi
+ NO_OPT_CXXFLAGS="-O0"
+
+ ############
+ # Warnings #
+ ############
+
+# First load the C warnings then add CXX warnings (if needed)
+
+ ###########
+ # 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)"
+
+ ######################
+ # Developer warnings #
+ ######################
+
+ NO_DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments no-developer-general)
+ DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments developer-general)
+
+ #######################
+ # gcc 4 special cases #
+ #######################
+
+ # 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_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
+ 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
+ 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
+ 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
+ H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.last)"
+ fi
+
+ #############################
+ # 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 6)"
+ fi
+
+ # gcc >= 7
+ if test $cc_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
+ 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)"
+ NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-8)"
+ fi
+
+ # gcc 9
+ if test $cc_vers_major -ge 9; then
+ H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 9)"
+ fi
+
+ #################
+ # Flags are set #
+ #################
+ cxx_flags_set=yes
+fi
+
+# Clear cxx info if no flags set
+if test "X$cxx_flags_set" = "X"; then
+ cxx_vendor=
+ cxx_version=
+fi
diff --git a/config/gnu-fflags b/config/gnu-fflags
index 822b716..f58f10c 100644
--- a/config/gnu-fflags
+++ b/config/gnu-fflags
@@ -1,4 +1,4 @@
-# -*- shell-script -*-
+# -*- shell-script -*-
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -17,6 +17,20 @@
# if the compiler is not GNU; otherwise `f9x_flags_set' is set to `yes'
#
+#
+# Prepend `$srcdir/config/gnu-warnings/` 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_gnu_arguments()
+{
+ set -- $(for arg; do
+ sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors
+ done)
+ IFS=' ' echo "$*"
+}
+
# Get the compiler version in a way that works for GNU fortran
# gfortran unless a compiler version is already known
#
@@ -25,9 +39,8 @@
#
if test X = "X$f9x_flags_set"; then
f9x_version="`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 |grep 'gcc version' |\
- sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"
+ sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"
if test X != "X$f9x_version"; then
-# is_mpi="`$FC $FCFLAGS $H5_FCFLAGS -help 2>&1 |grep 'link MPI'`"
f9x_vendor=`echo $f9x_version |sed 's/\([a-z]*\).*/\1/'`
f9x_version=`echo $f9x_version |sed 's/[-a-z]//g'`
if test X = "X$f9x_vendor" -a X != "X$f9x_version"; then
@@ -37,24 +50,36 @@ if test X = "X$f9x_flags_set"; then
echo "compiler '$FC' is GNU $f9x_vendor-$f9x_version"
fi
- # Some version numbers
+ # Get the compiler version numbers
f9x_vers_major=`echo $f9x_version | cut -f1 -d.`
f9x_vers_minor=`echo $f9x_version | cut -f2 -d.`
f9x_vers_patch=`echo $f9x_version | cut -f3 -d.`
test -n "$f9x_vers_major" || f9x_vers_major=0
test -n "$f9x_vers_minor" || f9x_vers_minor=0
test -n "$f9x_vers_patch" || f9x_vers_patch=0
- f9x_vers_all=`expr $f9x_vers_major '*' 1000000 + $f9x_vers_minor '*' 1000 + $f9x_vers_patch`
fi
fi
-# Common GNU flags for various situations
if test "X-gfortran" = "X-$f9x_vendor"; then
- # Insert section about version specific problems from gnu-flags here, if
- # necessary.
+
+ FC_BASENAME=gfortran
+ F9XSUFFIXFLAG=""
+ FSEARCH_DIRS=""
+
+ # Need Fortran 2008 support for storage_size() in gcc 4.6 on
+ # (2008ts in some versions)
+ if test $f9x_vers_major -ge 8; then
+ H5_FCFLAGS="$H5_FCFLAGS -std=f2008"
+ elif test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 6; then
+ H5_FCFLAGS="$H5_FCFLAGS -std=f2008ts"
+ fi
+
+
+ ###############################
+ # Architecture-specific flags #
+ ###############################
arch=
- # Architecture-specific flags
# Nothing currently. (Uncomment code below and modify to add any)
#case "$host_os-$host_cpu" in
# *-i686)
@@ -62,30 +87,112 @@ if test "X-gfortran" = "X-$f9x_vendor"; then
# ;;
#esac
- # Host-specific flags
- # Nothing currently. (Uncomment code below and modify to add any)
- #case "`hostname`" in
- # sleipnir.ncsa.uiuc.edu)
- # arch="$arch -pipe"
- # ;;
- #esac
+ H5_FCFLAGS="$H5_FCFLAGS $arch"
- # General
- FC_BASENAME=gfortran40
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wconversion -Wunderflow -Wimplicit-interface -W"
+ ##############
+ # Production #
+ ##############
+
+ PROD_FCFLAGS=
+
+ #########
+ # Debug #
+ #########
+
+ if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then
+ DEBUG_FCFLAGS="-fcheck=all"
+ else
+ DEBUG_FCFLAGS="-fbounds-check"
+ fi
+
+ ###########
+ # Symbols #
+ ###########
+
+ NO_SYMBOLS_FCFLAGS="-s"
+ SYMBOLS_FCFLAGS="-g"
+
+ #############
+ # Profiling #
+ #############
+
+ PROFILE_FCFLAGS="-pg"
- # Production
- PROD_FCFLAGS="-O2 -s"
+ ################
+ # Optimization #
+ ################
- # Debug
- DEBUG_FCFLAGS="-g -fbounds-check"
+ if test $f9x_vers_major -le 4; then
+ HIGH_OPT_FCFLAGS="-O3"
+ DEBUG_OPT_FCFLAGS=
+ else
+ HIGH_OPT_FCFLAGS="-O3"
+ DEBUG_OPT_FCFLAGS="-Og"
+ fi
+ NO_OPT_FCFLAGS="-O0"
+
+ ############
+ # Warnings #
+ ############
+
+ ###########
+ # General #
+ ###########
+
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-general)"
+
+ #############################
+ # Version-specific warnings #
+ #############################
+
+ # gfortran 4.3 (nothing new)
+
+ # gfortran >= 4.4
+ if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 4; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.4)"
+ fi
+
+ # gfortran >= 4.5
+ if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.5)"
+ fi
+
+ # gfortran 4.6 (nothing new)
+
+ # gfortran >= 4.7
+ if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 7; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.7)"
+ fi
+
+ # gfortran >= 4.8
+ if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 8; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.8)"
+ fi
+
+ # gfortran 4.9 (nothing new)
+
+ # gfortran >= 5
+ if test $f9x_vers_major -ge 5; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-5)"
+ fi
+
+ # gfortran >= 6
+ if test $f9x_vers_major -ge 6; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-6)"
+ fi
+
+ # gfortran 7 (nothing new)
+
+ # gfortran >= 8
+ if test $f9x_vers_major -ge 8; then
+ H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-8)"
+ fi
- # Profile
- PROFILE_FCFLAGS="-g -pg"
+ # gfortran 9 (nothing new)
- # Flags are set
+ #################
+ # Flags are set #
+ #################
f9x_flags_set=yes
fi
diff --git a/config/gnu-flags b/config/gnu-flags
index c73ec21..ad07552 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -18,20 +18,37 @@
#
#
-# Prepend `$srcdir/config/gnu-` to the filename suffix(es) given as
+# 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-warnings/` 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()
+load_gnu_arguments()
{
set -- $(for arg; do
- sed 's,#.*$,,' $srcdir/config/gnu-${arg}
+ sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors
done)
IFS=' ' echo "$*"
}
-
# Get the compiler version in a way that works for gcc
# unless a compiler version is already known
#
@@ -47,7 +64,7 @@ if test "X-" = "X-$cc_flags_set"; then
# containing 'icc version'. The cc_version for icc is correctly determined
# and flags added in the intel-flags script.
cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 | grep -v 'PathScale' |\
- grep -v 'icc version' |\
+ grep -v '^icc.*version' |\
grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"
cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'`
cc_version=`echo $cc_version |sed 's/[-a-z]//g'`
@@ -65,13 +82,14 @@ if test "X-" = "X-$cc_flags_set"; then
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
@@ -99,742 +117,202 @@ case "$cc_vendor-$cc_version" in
;;
esac
- # Host-specific flags
- case "`hostname`" in
- sleipnir.ncsa.uiuc.edu)
- arch="$arch -pipe"
+ case "$host_os-$host_cpu" in
+ # cygwin needs the "-std=c99" flag removed, so make
+ # a specific case for Cygwin without the flag and a default
+ # case to add the flag everywhere else
+ cygwin-*)
;;
- esac
- # General
- H5_CFLAGS="$H5_CFLAGS $arch -std=c99"
- H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-general)"
-
- # Production
- case "$cc_vendor-$cc_version" in
- gcc-[34].*)
- PROD_CFLAGS="-O3"
- ;;
- gcc-5.*)
- PROD_CFLAGS="-O3 -fstdarg-opt"
- ;;
- *)
- PROD_CFLAGS="-O -finline-functions"
- ;;
- esac
- PROD_CPPFLAGS=
-
- # Debug
- case "$cc_vendor-$cc_version" in
- gcc-5.*)
- DEBUG_CFLAGS="-Og -g -ftrapv -fno-common"
- ;;
- *)
- DEBUG_CFLAGS="-g"
- ;;
+ *)
+ H5_CFLAGS="$H5_CFLAGS -std=c99"
+ ;;
esac
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined"
- DEBUG_CPPFLAGS=
-
- # Try out the new "stack protector" feature introduced in gcc 4.1
- # (We should also think about adding some of the other memory protection options)
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
-
- # Profile
- PROFILE_CFLAGS="-Og -g -pg"
- PROFILE_CPPFLAGS=
-
- # Flags are set
- cc_flags_set=yes
- ;;
-esac
-
-# Version specific GCC flags
-#
-# Please follow the pattern below by adding new versions at the top, copying
-# the information from the previous version and adding modifications to that.
-case "$cc_vendor-$cc_version" in
-
-# Closer to the gcc 5.2 release, we should check for additional flags to
-# include and break it out into it's own section, like the other versions
-# below. -QAK
- gcc-5*)
- # Append warning flags
- # Don't use the '-Wtraditional' flag, we're way past having K&R C code
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional"
- # Don't use the '-Wtraditional-conversion' flag, there's too many warnings
- # from GCC's assert macro
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional-conversion"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
-
- # Append more extra warning flags that only gcc 4.6+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
-
- # Append more extra warning flags that only gcc 4.7+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
-
- # Append more extra warning flags that only gcc 4.8+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsuggest-attribute=format"
-
- # Append more extra warning flags that only gcc 4.9+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdate-time -Wopenmp-simd"
-
- # (There was no release of gcc 5.0)
-
- # Append more extra warning flags that only gcc 5.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
- ;;
-
- gcc-4.9*)
- # Append warning flags
- # Don't use the '-Wtraditional' flag, we're way past having K&R C code
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional"
- # Don't use the '-Wtraditional-conversion' flag, there's too many warnings
- # from GCC's assert macro
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional-conversion"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
-
- # Append more extra warning flags that only gcc 4.6+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
-
- # Append more extra warning flags that only gcc 4.7+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
-
- # Append more extra warning flags that only gcc 4.8+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsuggest-attribute=format"
-
- # Append more extra warning flags that only gcc 4.9+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdate-time -Wopenmp-simd"
- ;;
-
- gcc-4.8*)
- # Append warning flags
- # Don't use the '-Wtraditional' flag, we're way past having K&R C code
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional"
- # Don't use the '-Wtraditional-conversion' flag, there's too many warnings
- # from GCC's assert macro
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional-conversion"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init"
-
- # Append more extra warning flags that only gcc 4.6+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
-
- # Append more extra warning flags that only gcc 4.7+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
-
- # Append more extra warning flags that only gcc 4.8+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsuggest-attribute=format"
- ;;
-
- gcc-4.7*)
- # Append warning flags
- # Don't use the '-Wtraditional' flag, we're way past having K&R C code
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional"
- # Don't use the '-Wtraditional-conversion' flag, there's too many warnings
- # from GCC's assert macro
- # H5_CFLAGS="$H5_CFLAGS -Wtraditional-conversion"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- # (this warning was removed in gcc 4.5+)
- #H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
-
- # Append more extra warning flags that only gcc 4.6+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
- # Append more extra warning flags that only gcc 4.7+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
- ;;
+ H5_CFLAGS="$H5_CFLAGS $arch"
- gcc-4.6*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ ##############
+ # Production #
+ ##############
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- # (this warning was removed in gcc 4.5+)
- #H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
-
- # Append more extra warning flags that only gcc 4.6+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
- ;;
-
- gcc-4.5*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- # (this warning was removed in gcc 4.5+)
- #H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
-
- # Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
- ;;
-
- gcc-4.4*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla"
-
- # Append more extra warning flags that only gcc 4.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
- ;;
-
- gcc-4.3*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning appears to be reliable now...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wvolatile-register-var"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
-
- # Append more extra warning flags that only gcc 4.3+ know 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 -Wvla"
- ;;
-
- gcc-4.2*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning does not appear to be reliable yet...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
-
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
-
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
-
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
-
- # Append more extra warning flags that only gcc 4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
-
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wvolatile-register-var"
-
- # Append more extra warning flags that only gcc 4.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow"
- ;;
-
- gcc-4.1.*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
-
- # Enable more format checking flags, beyond the basic -Wformat included
- # in -Wall
- H5_CFLAGS="$H5_CFLAGS -Wformat=2"
-
- # The "unreachable code" warning does not appear to be reliable yet...
- H5_CFLAGS="$H5_CFLAGS -Wunreachable-code"
+ # NDEBUG is handled explicitly by the configure script
+ if test $cc_vers_major -le 4; then
+ PROD_CFLAGS=
+ else
+ PROD_CFLAGS="-fstdarg-opt"
+ fi
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
+ #########
+ # Debug #
+ #########
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
+ # NDEBUG is handled explicitly by the configure script
+ # -g is handled by the symbols flags
+ if test $cc_vers_major -le 4; then
+ DEBUG_CFLAGS=
+ else
+ DEBUG_CFLAGS="-ftrapv -fno-common"
+ fi
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
+ ###########
+ # Symbols #
+ ###########
- # Append more extra warning flags that only gcc 4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
+ NO_SYMBOLS_CFLAGS="-s"
+ SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer"
- # Append more extra warning flags that only gcc 4.1+ know about
- H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wvolatile-register-var"
- ;;
+ #############
+ # Profiling #
+ #############
- gcc-4.0*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ PROFILE_CFLAGS="-pg"
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
+ ################
+ # Optimization #
+ ################
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
+ if test $cc_vers_major -le 4; then
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS=
+ else
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS="-Og"
+ fi
+ NO_OPT_CFLAGS="-O0"
- # The "format=2" warning generates too many warnings about valid
- # usage in the library.
- #CFLAGS="$CFLAGS -Wformat=2"
+ ############
+ # Warnings #
+ ############
- # The "unreachable code" warning does not appear to be reliable yet...
- #CFLAGS="$CFLAGS -Wunreachable-code"
+ ###########
+ # General #
+ ###########
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)"
- # Append warning flags from gcc-3.4* case
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
+ ######################
+ # Developer warnings #
+ ######################
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
+ NO_DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments no-developer-general)
+ DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments developer-general)
- # Append more extra warning flags that only gcc 4.0+ know about
- H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros"
- ;;
+ #######################
+ # gcc 4 special cases #
+ #######################
- gcc-3.4*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ # 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 $(load_gnu_arguments 4.2-4.6)"
+ fi
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
+ # 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 $(load_gnu_arguments 4.2-4.3)"
+ fi
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
+ # 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 $(load_gnu_arguments 4.5-4.6)"
+ fi
- # The "format=2" warning generates too many warnings about valid
- # usage in the library.
- #CFLAGS="$CFLAGS -Wformat=2"
+ # 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 $(load_gnu_arguments 4.2-4.4)"
+ fi
- # The "unreachable code" warning does not appear to be reliable yet...
- #CFLAGS="$CFLAGS -Wunreachable-code"
+ # 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 $(load_gnu_arguments 4.2-4.last)"
+ fi
- # Append warning flags from gcc-3.3* case
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
+ #############################
+ # Version-specific warnings #
+ #############################
- # Append more extra warning flags that only gcc3.4+ know about
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch"
+ # 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 $(load_gnu_arguments 4.3)"
+ fi
- # Replace old -W flag with new -Wextra flag
- H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`"
- ;;
+ # 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 $(load_gnu_arguments 4.4)"
+ fi
- gcc-3.3*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ # 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 $(load_gnu_arguments 4.5)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-4.5)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-4.5)"
+ fi
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
+ # 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 $(load_gnu_arguments 4.6)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-4.6)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-4.6)"
+ fi
- # Append warning flags from gcc-3.2* case
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
+ # 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 $(load_gnu_arguments 4.7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-4.7)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-4.7)"
+ fi
- # The "format=2" warning generates too many warnings about valid
- # usage in the library.
- #CFLAGS="$CFLAGS -Wformat=2"
+ # gcc >= 4.8
+ if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-4.8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-4.8)"
+ fi
- # The "unreachable code" warning does not appear to be reliable yet...
- #CFLAGS="$CFLAGS -Wunreachable-code"
+ # 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 $(load_gnu_arguments 4.9)"
+ fi
- # Append more extra warning flags that only gcc3.3+ know about
- H5_CFLAGS="$H5_CFLAGS -Wendif-labels"
- ;;
+ # gcc >= 5
+ if test $cc_vers_major -ge 5; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 5)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-5)"
+ fi
- gcc-3.2*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
-
- # Append warning flags from gcc-3* case
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
-
- # Append more extra warning flags that only gcc3.2+ know about
- H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization"
+ # gcc >= 6
+ if test $cc_vers_major -ge 6; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 6)"
+ fi
- # The "format=2" warning generates too many warnings about valid
- # usage in the library.
- #CFLAGS="$CFLAGS -Wformat=2"
+ # gcc >= 7
+ if test $cc_vers_major -ge 7; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-7)"
+ fi
- # The "unreachable code" warning does not appear to be reliable yet...
- #CFLAGS="$CFLAGS -Wunreachable-code"
- ;;
+ # gcc 8
+ if test $cc_vers_major -ge 8; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 8)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-8)"
+ fi
- gcc-3*)
- # Disable warnings about using 'long long' type
- H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
+ # gcc 9
+ if test $cc_vers_major -ge 9; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 9)"
+ fi
- # Append some extra warning flags that only gcc3+ know about
- # (don't use -Wpadded flag for normal builds, many of the warnings its
- # issuing can't be fixed and they are making it hard to detect other,
- # more important warnings)
- #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
- H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
- ;;
-esac
+ #################
+ # Flags are set #
+ #################
+ cc_flags_set=yes
+fi
# Clear cc info if no flags set
if test "X$cc_flags_set" = "X"; then
- cc_vendor=
- cc_version=
+ cc_vendor=
+ cc_version=
fi
+
diff --git a/config/gnu-warnings/4.2-4.3 b/config/gnu-warnings/4.2-4.3
new file mode 100644
index 0000000..1881797
--- /dev/null
+++ b/config/gnu-warnings/4.2-4.3
@@ -0,0 +1,3 @@
+# -Wvolatile-register-var was later incorporated into -Wall and
+# only needs to be specified explicitly for gcc 4.2-4.3
+-Wvolatile-register-var
diff --git a/config/gnu-warnings/4.2-4.4 b/config/gnu-warnings/4.2-4.4
new file mode 100644
index 0000000..ec4876f
--- /dev/null
+++ b/config/gnu-warnings/4.2-4.4
@@ -0,0 +1,2 @@
+# The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4
+-Wstrict-overflow
diff --git a/config/gnu-warnings/4.2-4.6 b/config/gnu-warnings/4.2-4.6
new file mode 100644
index 0000000..37df4ab
--- /dev/null
+++ b/config/gnu-warnings/4.2-4.6
@@ -0,0 +1,2 @@
+# Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier
+-Wno-long-long
diff --git a/config/gnu-warnings/4.2-4.last b/config/gnu-warnings/4.2-4.last
new file mode 100644
index 0000000..2db90fb
--- /dev/null
+++ b/config/gnu-warnings/4.2-4.last
@@ -0,0 +1,3 @@
+# -Wvla was later incorporated into -Wpedantic and
+# only needs to be specified explicitly for gcc 4
+-Wvla
diff --git a/config/gnu-warnings/4.3 b/config/gnu-warnings/4.3
new file mode 100644
index 0000000..13d8558
--- /dev/null
+++ b/config/gnu-warnings/4.3
@@ -0,0 +1,2 @@
+-Wlarger-than=2560
+-Wlogical-op
diff --git a/config/gnu-warnings/4.4 b/config/gnu-warnings/4.4
new file mode 100644
index 0000000..42929b5
--- /dev/null
+++ b/config/gnu-warnings/4.4
@@ -0,0 +1,3 @@
+-Wframe-larger-than=16384
+-Wpacked-bitfield-compat
+-Wsync-nand
diff --git a/config/gnu-warnings/4.5 b/config/gnu-warnings/4.5
new file mode 100644
index 0000000..ddb96df
--- /dev/null
+++ b/config/gnu-warnings/4.5
@@ -0,0 +1 @@
+-Wstrict-overflow=5
diff --git a/config/gnu-warnings/4.5-4.6 b/config/gnu-warnings/4.5-4.6
new file mode 100644
index 0000000..d3035fe
--- /dev/null
+++ b/config/gnu-warnings/4.5-4.6
@@ -0,0 +1,3 @@
+# -Wstrict-aliasing was later incorporated into -Wall and
+# only needs to be specified explicitly for gcc 4.5-4.6
+-Wstrict-aliasing
diff --git a/config/gnu-warnings/4.6 b/config/gnu-warnings/4.6
new file mode 100644
index 0000000..140a20c
--- /dev/null
+++ b/config/gnu-warnings/4.6
@@ -0,0 +1,2 @@
+-Wdouble-promotion
+-Wtrampolines
diff --git a/config/gnu-warnings/4.7 b/config/gnu-warnings/4.7
new file mode 100644
index 0000000..c47fe4b
--- /dev/null
+++ b/config/gnu-warnings/4.7
@@ -0,0 +1,5 @@
+#
+# -Wstack-usage=8192 warnings need to be swept up on a branch so
+# that we can stop burdening the whole development team.
+#
+-Wstack-usage=8192
diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8
new file mode 100644
index 0000000..5dc577f
--- /dev/null
+++ b/config/gnu-warnings/4.8
@@ -0,0 +1 @@
+-Wmaybe-uninitialized
diff --git a/config/gnu-warnings/4.9 b/config/gnu-warnings/4.9
new file mode 100644
index 0000000..78aa929
--- /dev/null
+++ b/config/gnu-warnings/4.9
@@ -0,0 +1 @@
+-Wdate-time
diff --git a/config/gnu-warnings/5 b/config/gnu-warnings/5
new file mode 100644
index 0000000..32cb196
--- /dev/null
+++ b/config/gnu-warnings/5
@@ -0,0 +1,2 @@
+-Warray-bounds=2
+-Wc99-c11-compat
diff --git a/config/gnu-warnings/6 b/config/gnu-warnings/6
new file mode 100644
index 0000000..736a446
--- /dev/null
+++ b/config/gnu-warnings/6
@@ -0,0 +1,9 @@
+#
+# Careful! -Wduplicated-cond, combined with HDF5's heavy use of
+# macros, can make a lot of noise.
+#
+-Wduplicated-cond
+-Whsa
+-Wnormalized
+-Wnull-dereference
+-Wunused-const-variable
diff --git a/config/gnu-warnings/7 b/config/gnu-warnings/7
new file mode 100644
index 0000000..266f5c1
--- /dev/null
+++ b/config/gnu-warnings/7
@@ -0,0 +1,7 @@
+-Walloca
+-Walloc-zero
+-Wduplicated-branches
+-Wformat-overflow=2
+-Wformat-truncation=1
+-Wimplicit-fallthrough=5
+-Wrestrict
diff --git a/config/gnu-warnings/8 b/config/gnu-warnings/8
new file mode 100644
index 0000000..5e7519d
--- /dev/null
+++ b/config/gnu-warnings/8
@@ -0,0 +1,3 @@
+-Wattribute-alias
+-Wcast-align=strict
+-Wshift-overflow=2
diff --git a/config/gnu-warnings/9 b/config/gnu-warnings/9
new file mode 100644
index 0000000..c084350
--- /dev/null
+++ b/config/gnu-warnings/9
@@ -0,0 +1,2 @@
+-Wattribute-alias=2
+-Wmissing-profile
diff --git a/config/gnu-warnings/cxx-4.9 b/config/gnu-warnings/cxx-4.9
new file mode 100644
index 0000000..046d6db
--- /dev/null
+++ b/config/gnu-warnings/cxx-4.9
@@ -0,0 +1 @@
+-Wopenmp-simd
diff --git a/config/intel-warnings-general b/config/gnu-warnings/cxx-general
index f4ed24c..ee7ee22 100644
--- a/config/intel-warnings-general
+++ b/config/gnu-warnings/cxx-general
@@ -6,5 +6,14 @@
# 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.
--Wall
--Wcheck \ No newline at end of file
+-Wabi
+-Wctor-dtor-privacy
+-Weffc++
+##-Wendif-labels
+-Wnon-virtual-dtor
+-Wold-style-cast
+-Woverloaded-virtual
+-Wreorder
+-Wsign-promo
+##-Wunreachable-code
+##-Wvariadic-macros
diff --git a/config/gnu-warnings/developer-4.5 b/config/gnu-warnings/developer-4.5
new file mode 100644
index 0000000..48df846
--- /dev/null
+++ b/config/gnu-warnings/developer-4.5
@@ -0,0 +1,7 @@
+#
+# -Wjump-misses-init makes lots of noise for a questionable benefit.
+# Can jumping over an initialization in C cause any harm, if
+# the variable is never *used* before it has been initialized?
+#
+-Wjump-misses-init
+-Wunsuffixed-float-constants
diff --git a/config/gnu-warnings/developer-4.6 b/config/gnu-warnings/developer-4.6
new file mode 100644
index 0000000..2372fbf
--- /dev/null
+++ b/config/gnu-warnings/developer-4.6
@@ -0,0 +1 @@
+-Wsuggest-attribute=const
diff --git a/config/gnu-warnings/developer-4.7 b/config/gnu-warnings/developer-4.7
new file mode 100644
index 0000000..a3b0781
--- /dev/null
+++ b/config/gnu-warnings/developer-4.7
@@ -0,0 +1,7 @@
+-Wsuggest-attribute=noreturn
+-Wsuggest-attribute=pure
+#
+# It's not clear that -Wvector-operation-performance warnings are
+# actionable, so they are demoted to "developer" warnings.
+#
+-Wvector-operation-performance
diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8
new file mode 100644
index 0000000..b0109e2
--- /dev/null
+++ b/config/gnu-warnings/developer-4.8
@@ -0,0 +1 @@
+-Wsuggest-attribute=format
diff --git a/config/gnu-warnings/developer-7 b/config/gnu-warnings/developer-7
new file mode 100644
index 0000000..2a3ce7e
--- /dev/null
+++ b/config/gnu-warnings/developer-7
@@ -0,0 +1 @@
+-Wstringop-overflow=2
diff --git a/config/gnu-warnings/developer-8 b/config/gnu-warnings/developer-8
new file mode 100644
index 0000000..a2ba7ca
--- /dev/null
+++ b/config/gnu-warnings/developer-8
@@ -0,0 +1,3 @@
+-Wstringop-overflow=4
+-Wsuggest-attribute=cold
+-Wsuggest-attribute=malloc
diff --git a/config/gnu-warnings-developer-general b/config/gnu-warnings/developer-general
index 698f0e0..b34c4b7 100644
--- a/config/gnu-warnings-developer-general
+++ b/config/gnu-warnings/developer-general
@@ -2,7 +2,12 @@
# NOTE: -Wformat-nonliteral added back in here (from being disabled in
# H5_CFLAGS)
-Waggregate-return
+-Wdisabled-optimization
-Wformat-nonliteral
-Winline
-Wmissing-format-attribute
-Wmissing-noreturn
+-Wswitch-default
+-Wswitch-enum
+-Wunsafe-loop-optimizations
+-Wunused-macros
diff --git a/config/gnu-warnings/error-5 b/config/gnu-warnings/error-5
new file mode 100644
index 0000000..f7e1138
--- /dev/null
+++ b/config/gnu-warnings/error-5
@@ -0,0 +1,12 @@
+-Werror=incompatible-pointer-types
+#
+# In GCC 4.4.7, the compiler gripes about shadowed global
+# declarations when a local variable uses the name of a
+# function that's in a system header file. For some reason,
+# later versions of GCC (e.g., 5.2.0) don't complain about
+# the shadowed globals. Maybe later versions are less fussy?
+# Anyway, the shadowing seems to be harmless, and GCC 4.4.7
+# is not a supported compiler, so let us promote shadowed globals
+# warnings to errors only for GCC 5 and later.
+#
+-Werror=shadow
diff --git a/config/gnu-warnings/error-8 b/config/gnu-warnings/error-8
new file mode 100644
index 0000000..36c1414
--- /dev/null
+++ b/config/gnu-warnings/error-8
@@ -0,0 +1,9 @@
+-Werror=cast-function-type
+#
+# For GCC 8, promote maybe-initialized warnings to an error. GCC 8
+# reports 0 maybe-uninitialized warnings where earlier versions
+# make many false reports. GCC 8 seems to analyze calls to static
+# in order to detect initializations that occur there. It's possible
+# that GCC 8 only performs that analysis at -O3, though.
+#
+-Werror=maybe-uninitialized
diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general
new file mode 100644
index 0000000..4b822a5
--- /dev/null
+++ b/config/gnu-warnings/error-general
@@ -0,0 +1,94 @@
+#
+# HDF5 code should not trigger the following warnings under any
+# circumstances, so ask the compiler to treat them as errors:
+#
+-Werror=bad-function-cast
+-Werror=declaration-after-statement
+-Werror=implicit-function-declaration
+-Werror=missing-declarations
+-Werror=missing-prototypes
+-Werror=nested-externs
+-Werror=old-style-definition
+-Werror=packed
+-Werror=pointer-sign
+-Werror=pointer-to-int-cast
+-Werror=strict-prototypes
+-Werror=switch
+#
+#-Werror=discarded-qualifiers
+#
+# NOTE: hl/src/H5LTparse.c file is not compatible with these warnings as errors
+# -Werror=redundant-decls
+#
+-Wredundant-decls
+#
+# NOTE: File Driver files are not compatible with these warnings as errors
+# H5FDdirect.c,H5FDmpio.c,H5FDros3.c,
+# -Werror=unused-function
+#
+-Wunused-function
+#
+# H5FDdrvr_module.h
+# -Werror=unused-variable
+#
+-Wunused-variable
+#
+# H5VLpassthru.c
+# -Werror=unused-parameter
+#
+-Wunused-parameter
+#
+#
+#
+# NOTE: Tools files are not compatible with these warnings as errors
+# lib/h5tools.c
+# -Werror=cast-align
+#
+-Wcast-align
+#
+# lib/h5diff_array.c
+# -Werror=unused-but-set-variable
+#
+-Wunused-but-set-variable
+#
+# lib/h5tools_utils.c
+# -Werror=unused-parameter
+#
+#
+# NOTE: JNI files are not compatible with these warnings as errors
+# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c
+# jni/h5sImp.c,jni/h5tImp.c
+# -Werror=cast-align
+# jni/h5util.c
+# -Werror=format(-overflow)
+#
+-Wformat
+#
+#
+#Examples and tests do not use the same set of extensive warning flags as libraries
+# Here is a list of tests and examples that have issues with the stricter warnings as error
+#
+# NOTE: Test files are not compatible with these warnings as errors
+# thread_id.c,
+# -Werror=unused-function
+# dsets.c
+# -Werror=unused-parameter
+# external.c,perform/sio_engine.c
+# -Werror=format(-truncation)
+#
+#
+# NOTE: Examples files are not compatible with these warnings as errors
+# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c
+# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c
+# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c
+# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c
+# h5_reference_deprec.c
+# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c
+# -Werror=strict-prototypes
+# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c
+# -Werror=old-style-definition
+# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,
+# -Werror=unused-variable
+# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c
+# -Werror=unused-parameter
+
diff --git a/config/gnu-warnings-general b/config/gnu-warnings/general
index 9e67b71..a7a20b7 100644
--- a/config/gnu-warnings-general
+++ b/config/gnu-warnings/general
@@ -29,4 +29,4 @@
-Wshadow
-Wundef
-Wwrite-strings
--pedantic \ No newline at end of file
+-pedantic
diff --git a/config/gnu-warnings/gfort-4.4 b/config/gnu-warnings/gfort-4.4
new file mode 100644
index 0000000..59fe9a2
--- /dev/null
+++ b/config/gnu-warnings/gfort-4.4
@@ -0,0 +1,2 @@
+-Warray-temporaries
+-Wintrinsics-std \ No newline at end of file
diff --git a/config/gnu-warnings/gfort-4.5 b/config/gnu-warnings/gfort-4.5
new file mode 100644
index 0000000..4490d4e
--- /dev/null
+++ b/config/gnu-warnings/gfort-4.5
@@ -0,0 +1 @@
+-Wimplicit-procedure
diff --git a/config/gnu-warnings/gfort-4.7 b/config/gnu-warnings/gfort-4.7
new file mode 100644
index 0000000..a7532bb
--- /dev/null
+++ b/config/gnu-warnings/gfort-4.7
@@ -0,0 +1,2 @@
+-Wreal-q-constant
+-Wfunction-elimination
diff --git a/config/gnu-warnings/gfort-4.8 b/config/gnu-warnings/gfort-4.8
new file mode 100644
index 0000000..1b96a51
--- /dev/null
+++ b/config/gnu-warnings/gfort-4.8
@@ -0,0 +1,5 @@
+-Wrealloc-lhs
+-Wrealloc-lhs-all
+# Turn off warnings for passing non-ANSI types to BIND().
+# We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings.
+-Wno-c-binding-type
diff --git a/config/gnu-warnings/gfort-5 b/config/gnu-warnings/gfort-5
new file mode 100644
index 0000000..c5d3850
--- /dev/null
+++ b/config/gnu-warnings/gfort-5
@@ -0,0 +1 @@
+-Wuse-without-only
diff --git a/config/gnu-warnings/gfort-6 b/config/gnu-warnings/gfort-6
new file mode 100644
index 0000000..f70466c
--- /dev/null
+++ b/config/gnu-warnings/gfort-6
@@ -0,0 +1 @@
+-Winteger-division
diff --git a/config/gnu-warnings/gfort-8 b/config/gnu-warnings/gfort-8
new file mode 100644
index 0000000..5097365
--- /dev/null
+++ b/config/gnu-warnings/gfort-8
@@ -0,0 +1 @@
+-Wfrontend-loop-interchange
diff --git a/config/gnu-warnings/gfort-general b/config/gnu-warnings/gfort-general
new file mode 100644
index 0000000..4028316
--- /dev/null
+++ b/config/gnu-warnings/gfort-general
@@ -0,0 +1,12 @@
+# Note that some of the flags listed here really should be developer
+# flags (listed in separate files, gnu-warnings-developer*) 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.
+-Waliasing
+-Wall
+-Wcharacter-truncation
+-Wextra
+-Wimplicit-interface
+-Wsurprising
+-Wunderflow
+-pedantic
diff --git a/config/gnu-warnings/no-developer-4.5 b/config/gnu-warnings/no-developer-4.5
new file mode 100644
index 0000000..ef7d38f
--- /dev/null
+++ b/config/gnu-warnings/no-developer-4.5
@@ -0,0 +1 @@
+-Wno-unsuffixed-float-constants
diff --git a/config/gnu-warnings/no-developer-4.6 b/config/gnu-warnings/no-developer-4.6
new file mode 100644
index 0000000..ea9cc66
--- /dev/null
+++ b/config/gnu-warnings/no-developer-4.6
@@ -0,0 +1 @@
+-Wno-suggest-attribute=const
diff --git a/config/gnu-warnings/no-developer-4.7 b/config/gnu-warnings/no-developer-4.7
new file mode 100644
index 0000000..5b85e1f
--- /dev/null
+++ b/config/gnu-warnings/no-developer-4.7
@@ -0,0 +1,2 @@
+-Wno-suggest-attribute=noreturn
+-Wno-suggest-attribute=pure
diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8
new file mode 100644
index 0000000..e42e09f
--- /dev/null
+++ b/config/gnu-warnings/no-developer-4.8
@@ -0,0 +1 @@
+-Wno-suggest-attribute=format
diff --git a/config/gnu-warnings/no-developer-8 b/config/gnu-warnings/no-developer-8
new file mode 100644
index 0000000..2134bad
--- /dev/null
+++ b/config/gnu-warnings/no-developer-8
@@ -0,0 +1,2 @@
+-Wno-suggest-attribute=cold
+-Wno-suggest-attribute=malloc
diff --git a/config/gnu-warnings-no-developer-general b/config/gnu-warnings/no-developer-general
index 85dc0a3..85dc0a3 100644
--- a/config/gnu-warnings-no-developer-general
+++ b/config/gnu-warnings/no-developer-general
diff --git a/config/intel-fflags b/config/intel-fflags
index 5fbdcc1..ed7ee52 100644
--- a/config/intel-fflags
+++ b/config/intel-fflags
@@ -1,4 +1,4 @@
-# -*- shell-script -*-
+# -*- shell-script -*-
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -17,6 +17,20 @@
# if the compiler is not Intel; otherwise `f9x_flags_set' is set to `yes'
#
+#
+# Prepend `$srcdir/config/intel-warnings/` 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_intel_arguments()
+{
+ set -- $(for arg; do
+ sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg}
+ done)
+ IFS=' ' echo "$*"
+}
+
# Get the compiler version in a way that works for ifort
# ifort unless a compiler version is already known
#
@@ -44,8 +58,8 @@ fi
# Common Intel flags for various situations
if test "X-ifort" = "X-$f9x_vendor"; then
- # Insert section about version specific problems from gnu-flags here, if
- # necessary.
+ # Insert section about version specific problems from compiler flags here,
+ # if necessary.
arch=
# Architecture-specific flags
@@ -68,19 +82,31 @@ if test "X-ifort" = "X-$f9x_vendor"; then
FC_BASENAME=ifort
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- H5_FCFLAGS="$H5_FCFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS -stand:f03 -free"
+ H5_FCFLAGS="$H5_FCFLAGS $(load_intel_arguments ifort-general)"
# Production
- PROD_FCFLAGS="-O3"
+ PROD_FCFLAGS=
# Debug
- DEBUG_FCFLAGS="-g -check all"
+ DEBUG_FCFLAGS="-check all"
- # Profile
+ # Symbols
+ SYMBOLS_FCFLAGS="-g"
+ NO_SYMBOLS_FCFLAGS=
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_FCFLAGS="-g -p"
+ PROFILE_FCFLAGS="-p"
+
+ # Optimization
+ HIGH_OPT_FCFLAGS="-O3"
+ DEBUG_OPT_FCFLAGS=
+ NO_OPT_FCFLAGS=
- # Flags are set
+ #################
+ # Flags are set #
+ #################
f9x_flags_set=yes
fi
diff --git a/config/intel-flags b/config/intel-flags
index 139ea49..100e68a 100644
--- a/config/intel-flags
+++ b/config/intel-flags
@@ -18,7 +18,7 @@
#
#
-# Prepend `$srcdir/config/intel-` to the filename suffix(es) given as
+# Prepend `$srcdir/config/intel-warnings/` 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.
@@ -26,7 +26,7 @@
load_intel_arguments()
{
set -- $(for arg; do
- sed 's,#.*$,,' $srcdir/config/intel-${arg}
+ sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg}
done)
IFS=' ' echo "$*"
}
@@ -81,49 +81,63 @@ if test "X-icc" = "X-$cc_vendor"; then
# General
# Default to C99 standard.
H5_CFLAGS="$H5_CFLAGS $arch -std=c99"
- H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments warnings-general)"
- # Production is set to default; see settings for specific version further down
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
+ # Production
+ PROD_CFLAGS=
# Debug
- DEBUG_CFLAGS="-Wcheck -Wall -g -O0"
- DEBUG_CPPFLAGS=
+ # NDEBUG is handled explicitly in configure
+ DEBUG_CFLAGS=
- # Profile
+ # Symbols
+ SYMBOLS_CFLAGS="-g"
+ NO_SYMBOLS_CFLAGS="-Wl,-s"
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_CFLAGS="-g -p"
- PROFILE_CPPFLAGS=
+ PROFILE_CFLAGS="-p"
- # Flags are set
- cc_flags_set=yes
+ # Optimization
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS="-O0"
+ NO_OPT_CFLAGS="-O0"
-fi
+ ############
+ # Warnings #
+ ############
+
+ ###########
+ # General #
+ ###########
+
+ H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments general)"
+
+ #############################
+ # Version-specific warnings #
+ #############################
-# Version specific ICC flags
-#
-# Please follow the pattern below by adding new versions at the top, copying
-# the information from the previous version and adding modifications to that.
-# The default at the bottom will apply if no earlier version matches.
case "$cc_vendor-$cc_version" in
icc-1[5-6]*)
H5_CFLAGS="$H5_CFLAGS -Wcomment -Wdeprecated -Wextra-tokens -Wformat -Wformat-security -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-variable -Wwrite-strings"
;;
icc-10*)
- PROD_CFLAGS="-O1 -Wl,-s"
+ HIGH_OPT_CFLAGS="-O1"
;;
icc-8.0*)
- # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2.
- PROD_CFLAGS="-O2 -Wl,-s"
- ;;
+ # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2.
+ HIGH_OPT_CFLAGS="-O2"
+ ;;
icc-*)
- # -s became obsolete; we also fixed bugs that allow us to enable higher level
- # of optimization starting with 1.8.7
- PROD_CFLAGS="-O3"
;;
esac
+ #################
+ # Flags are set #
+ #################
+ cc_flags_set=yes
+
+fi
+
# Clear cc info if no flags set
if test "X-$cc_flags_set" = "X-"; then
cc_vendor=
diff --git a/config/intel-warnings/general b/config/intel-warnings/general
new file mode 100644
index 0000000..d0b2e25
--- /dev/null
+++ b/config/intel-warnings/general
@@ -0,0 +1,2 @@
+-Wall
+-Wcheck \ No newline at end of file
diff --git a/config/intel-warnings/ifort-general b/config/intel-warnings/ifort-general
new file mode 100644
index 0000000..a9da0e5
--- /dev/null
+++ b/config/intel-warnings/ifort-general
@@ -0,0 +1 @@
+-warn:all
diff --git a/config/linux-gnueabihf b/config/linux-gnueabihf
new file mode 100644
index 0000000..326edeb
--- /dev/null
+++ b/config/linux-gnueabihf
@@ -0,0 +1,16 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+# ARM for Raspberry Pi, etc.
+# This is the same as linux-gnulibc1
+
+. $srcdir/config/linux-gnulibc1
diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1
index ce07853..51fad2a 100644
--- a/config/linux-gnulibc1
+++ b/config/linux-gnulibc1
@@ -49,7 +49,7 @@ if test "X-" = "X-$FC"; then
FC=gfortran
FC_BASENAME=gfortran
;;
- pgcc*)
+ pgcc*)
FC=pgf90
FC_BASENAME=pgf90
;;
@@ -98,12 +98,14 @@ else
echo "compiler '$FC' is $fc_version_info"
$RM $tmpfile
;;
-
*)
;;
esac
fi
+# Figure out GNU FC compiler flags
+. $srcdir/config/gnu-fflags
+
# Figure out PGI FC compiler flags
. $srcdir/config/pgi-fflags
@@ -119,10 +121,10 @@ case $FC_BASENAME in
#
f95)
# Set required flag for compiling C stubs
- H5_CFLAGS="$H5_CFLAGS"
+ H5_CFLAGS="$H5_CFLAGS"
F9XSUFFIXFLAG=""
-# We force compiler to use upper case for external names
+# We force compiler to use upper case for external names
# (just in case since this should be a default EIP)
H5_FCFLAGS="$H5_FCFLAGS"
FSEARCH_DIRS=""
@@ -173,6 +175,9 @@ if test -z "$CXX"; then
CXX_BASENAME=g++
fi
+# Figure out GNU CXX compiler flags
+. $srcdir/config/gnu-cxxflags
+
# compiler version strings
# check if the compiler_version_info is already set
diff --git a/config/netbsd b/config/netbsd
new file mode 100644
index 0000000..9a9348b
--- /dev/null
+++ b/config/netbsd
@@ -0,0 +1,56 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+#
+# See BlankForm in this directory for details.
+
+# The default compiler is `gcc'
+if test "X-" = "X-$CC"; then
+ CC=gcc
+ CC_BASENAME=gcc
+fi
+
+# Figure out C compiler flags
+. $srcdir/config/gnu-flags
+
+# Figure out Intel C compiler flags
+. $srcdir/config/intel-flags
+
+# The default Fortran 90 compiler
+if test "X-" = "X-$FC"; then
+ case $CC_BASENAME in
+ gcc*|pgcc*)
+ FC=gfortran
+ FC_BASENAME=gfortran
+ ;;
+ icc*)
+ FC=ifort
+ FC_BASENAME=ifort
+ ;;
+ mpicc*)
+ FC=mpif90
+ FC_BASENAME=mpif90
+ ;;
+ esac
+fi
+
+# Figure out FORTRAN compiler flags
+. $srcdir/config/gnu-fflags
+
+# Figure out Intel F90 compiler flags
+. $srcdir/config/intel-fflags
+
diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake
index ecee2de..0803279 100644
--- a/config/sanitizer/sanitizers.cmake
+++ b/config/sanitizer/sanitizers.cmake
@@ -29,69 +29,66 @@ function(append value)
endfunction()
message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}")
-if(USE_SANITIZER AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
- set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+if(USE_SANITIZER)
+ if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
- append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}")
+ append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}")
- if(UNIX)
-
- if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
- append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- endif()
+ if(UNIX)
+ if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+ append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ endif()
- if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)"
- OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)")
- message(STATUS "Building with Address, Undefined sanitizers")
- append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- set(MEMCHECK_TYPE AddressSanitizer)
- elseif(USE_SANITIZER MATCHES "([Aa]ddress)")
- # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope
- message(STATUS "Building with Address sanitizer")
- append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- set(MEMCHECK_TYPE AddressSanitizer)
- elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)")
- # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2
- append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)")
- message(STATUS "Building with MemoryWithOrigins sanitizer")
- append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)"
+ OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)")
+ message(STATUS "Building with Address, Undefined sanitizers")
+ append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ set(MEMCHECK_TYPE AddressSanitizer)
+ elseif(USE_SANITIZER MATCHES "([Aa]ddress)")
+ # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope
+ message(STATUS "Building with Address sanitizer")
+ append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ set(MEMCHECK_TYPE AddressSanitizer)
+ elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)")
+ # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2
+ append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)")
+ message(STATUS "Building with MemoryWithOrigins sanitizer")
+ append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ else()
+ message(STATUS "Building with Memory sanitizer")
+ endif()
+ set(MEMCHECK_TYPE MemorySanitizer)
+ elseif(USE_SANITIZER MATCHES "([Uu]ndefined)")
+ message(STATUS "Building with Undefined sanitizer")
+ append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ if(EXISTS "${BLACKLIST_FILE}")
+ append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ endif()
+ set(MEMCHECK_TYPE UndefinedBehaviorSanitizer)
+ elseif(USE_SANITIZER MATCHES "([Tt]hread)")
+ message(STATUS "Building with Thread sanitizer")
+ append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ set(MEMCHECK_TYPE ThreadSanitizer)
+ elseif(USE_SANITIZER MATCHES "([Ll]eak)")
+ message(STATUS "Building with Leak sanitizer")
+ append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ set(MEMCHECK_TYPE LeakSanitizer)
else()
- message(STATUS "Building with Memory sanitizer")
+ message(
+ FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}")
endif()
- set(MEMCHECK_TYPE MemorySanitizer)
- elseif(USE_SANITIZER MATCHES "([Uu]ndefined)")
- message(STATUS "Building with Undefined sanitizer")
- append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- if(EXISTS "${BLACKLIST_FILE}")
- append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ elseif(MSVC)
+ if(USE_SANITIZER MATCHES "([Aa]ddress)")
+ message(STATUS "Building with Address sanitizer")
+ append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ else()
+ message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}")
endif()
- set(MEMCHECK_TYPE UndefinedBehaviorSanitizer)
- elseif(USE_SANITIZER MATCHES "([Tt]hread)")
- message(STATUS "Building with Thread sanitizer")
- append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- set(MEMCHECK_TYPE ThreadSanitizer)
- elseif(USE_SANITIZER MATCHES "([Ll]eak)")
- message(STATUS "Building with Leak sanitizer")
- append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- set(MEMCHECK_TYPE LeakSanitizer)
else()
- message(
- FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}")
+ message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.")
endif()
- elseif(MSVC)
- if(USE_SANITIZER MATCHES "([Aa]ddress)")
- message(STATUS "Building with Address sanitizer")
- append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- else()
- message(
- FATAL_ERROR
- "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}"
- )
- endif()
- else()
- message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.")
endif()
-
endif()
diff --git a/config/solaris b/config/solaris
index 394daaf..4c55f54 100644
--- a/config/solaris
+++ b/config/solaris
@@ -67,6 +67,7 @@ fi
if test "X-" = "X-$f9x_flags_set"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
+
H5_FCFLAGS="$H5_FCFLAGS"
# -g produces rather slow code. "-g -O" produces much faster code with some
# loss of debugger functions such as not able to print local variables.
diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake
index 97f6a64..ae1d2f8 100644
--- a/config/toolchain/intel.cmake
+++ b/config/toolchain/intel.cmake
@@ -3,9 +3,16 @@
set(CMAKE_COMPILER_VENDOR "intel")
-set(CMAKE_C_COMPILER icc)
-set(CMAKE_CXX_COMPILER icpc)
-set(CMAKE_Fortran_COMPILER ifort)
+if(USE_SANITIZER)
+ set(CMAKE_C_COMPILER icl)
+ set(CMAKE_CXX_COMPILER icl++)
+ set(CMAKE_Fortran_COMPILER ifort)
+ set(INTEL_CLANG ON)
+else ()
+ set(CMAKE_C_COMPILER icc)
+ set(CMAKE_CXX_COMPILER icpc)
+ set(CMAKE_Fortran_COMPILER ifort)
+endif ()
# the following is used if cross-compiling
set(CMAKE_CROSSCOMPILING_EMULATOR "")