summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-03-31 12:38:25 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-03-31 12:38:25 (GMT)
commitd9d6e19d6faa2fb60df8c8e011b4d0d66201de5c (patch)
tree85240d9da990b85cf0bc15ba2bc63f1b4a79d9ea /config
parent9cc69ae1f308336e0e522c989d4cee9f72090815 (diff)
downloadhdf5-d9d6e19d6faa2fb60df8c8e011b4d0d66201de5c.zip
hdf5-d9d6e19d6faa2fb60df8c8e011b4d0d66201de5c.tar.gz
hdf5-d9d6e19d6faa2fb60df8c8e011b4d0d66201de5c.tar.bz2
TRILAB-192 merging warnings changes from develop
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/HDFCompilerFlags.cmake197
-rw-r--r--config/cmake/libhdf5.settings.cmake.in9
-rw-r--r--config/commence.am2
-rw-r--r--config/gnu-flags756
-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/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-general13
-rw-r--r--config/gnu-warnings/error-512
-rw-r--r--config/gnu-warnings/error-89
-rw-r--r--config/gnu-warnings/error-general91
-rw-r--r--config/gnu-warnings/general32
-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/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
48 files changed, 803 insertions, 713 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/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 17b0854..03c6936 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 ()
@@ -98,12 +98,16 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
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,32 +119,30 @@ 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")
+ message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
+ 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")
+ message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
+ 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")
+ message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
+ 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 ()
endif ()
@@ -152,100 +154,127 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
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")
+ list (APPEND 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}")
+ 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 (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}")
+ 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
+ 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... -QAK
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla")
+ # 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
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4")
+ endif ()
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 ()
+ 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_ID STREQUAL "GNU" AND 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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND 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")
+ 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")
+ 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)
+ 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")
+ 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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND 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")
+ 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")
+ 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")
+ 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")
+ 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 ()
#-----------------------------------------------------------------------------
@@ -257,22 +286,22 @@ 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")
+ list (APPEND HDF5_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")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668")
endif ()
else ()
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
+ list (APPEND HDF5_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")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
endif ()
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 +313,15 @@ 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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_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")
+ 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)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0})
endif ()
endif ()
endif ()
@@ -304,14 +333,14 @@ 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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2")
endif ()
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1})
endif ()
endif ()
@@ -322,14 +351,14 @@ 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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
endif ()
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2})
endif ()
endif ()
@@ -340,14 +369,14 @@ 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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
+ list (APPEND HDF5_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")
+ string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4")
endif ()
else ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3})
endif ()
endif ()
@@ -358,7 +387,7 @@ 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}")
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4})
endif ()
endif ()
@@ -430,9 +459,9 @@ 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}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}")
if(CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_CXXFLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}")
endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING)
@@ -443,9 +472,9 @@ 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}")
+ list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}")
if(CMAKE_CXX_COMPILER_LOADED)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTIMIZE_CXXFLAGS}")
+ list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}")
endif ()
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION)
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 7bfadb1..ddc1e65 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@
@@ -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/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-flags b/config/gnu-flags
index c73ec21..9f9deb1 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -18,6 +18,24 @@
#
#
+# 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-` 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,
@@ -26,7 +44,7 @@
load_gcc_arguments()
{
set -- $(for arg; do
- sed 's,#.*$,,' $srcdir/config/gnu-${arg}
+ sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors
done)
IFS=' ' echo "$*"
}
@@ -71,7 +89,11 @@ fi
# Common GCC flags for various situations
case "$cc_vendor-$cc_version" in
gcc*)
- # Architecture-specific flags
+
+ ###############################
+ # Architecture-specific flags #
+ ###############################
+
arch=
case "$host_os-$host_cpu" in
# FreeBSD sets the information from "uname -m" to the general machine
@@ -99,578 +121,63 @@ 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-*)
+ ;;
+
+ *)
+ H5_CFLAGS="$H5_CFLAGS -std=c99"
;;
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
+ H5_CFLAGS="$H5_CFLAGS $arch"
+
+ ##############
+ # Production #
+ ##############
+
+ # NDEBUG is handled explicitly by the configure script
+ if test $cc_vers_major -le 4; then
+ PROD_CFLAGS=
+ else
+ PROD_CFLAGS="-fstdarg-opt"
+ fi
PROD_CPPFLAGS=
- # Debug
- case "$cc_vendor-$cc_version" in
- gcc-5.*)
- DEBUG_CFLAGS="-Og -g -ftrapv -fno-common"
- ;;
- *)
- DEBUG_CFLAGS="-g"
- ;;
- esac
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined"
+ #########
+ # Debug #
+ #########
+
+ # 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
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"
+ #############
+ # Profiling #
+ #############
- # Profile
- PROFILE_CFLAGS="-Og -g -pg"
+ PROFILE_CFLAGS="-pg"
PROFILE_CPPFLAGS=
-
- # Flags are set
- cc_flags_set=yes
;;
esac
+ ############
+ # Warnings #
+ ############
+
# 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"
- ;;
-
- gcc-4.6*)
- # 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"
-
- # 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"
- ;;
-
+ # older compiler versions
gcc-4.1.*)
# Disable warnings about using 'long long' type
H5_CFLAGS="$H5_CFLAGS -Wno-long-long"
@@ -831,10 +338,139 @@ case "$cc_vendor-$cc_version" in
#H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded"
H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute"
;;
+
+ gcc-*)
+
+ ###########
+ # General #
+ ###########
+
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)"
+
+ ######################
+ # Developer warnings #
+ ######################
+
+ NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general)
+ DEVELOPER_WARNING_CFLAGS=$(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.5)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.6)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.6)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.7)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_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_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)"
+ fi
+
+ # gcc >= 5
+ if test $cc_vers_major -ge 5; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)"
+ fi
+
+ # gcc >= 6
+ if test $cc_vers_major -ge 6; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)"
+ fi
+
+ # gcc >= 7
+ if test $cc_vers_major -ge 7; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 7)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-7)"
+ fi
+
+ # gcc 8
+ if test $cc_vers_major -ge 8; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 8)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-8)"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-8)"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-8)"
+ fi
+
+ # gcc 9
+ if test $cc_vers_major -ge 9; then
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)"
+ fi
+ ;;
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/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
new file mode 100644
index 0000000..b34c4b7
--- /dev/null
+++ b/config/gnu-warnings/developer-general
@@ -0,0 +1,13 @@
+# (suggestions from gcc, not code problems)
+# 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..f0e61f8
--- /dev/null
+++ b/config/gnu-warnings/error-general
@@ -0,0 +1,91 @@
+#
+# 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=redundant-decls
+-Werror=strict-prototypes
+-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/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
new file mode 100644
index 0000000..a7a20b7
--- /dev/null
+++ b/config/gnu-warnings/general
@@ -0,0 +1,32 @@
+# 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.
+#
+# 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
+-Wcast-qual
+-Wconversion
+-Wextra
+-Wfloat-equal
+-Wformat=2
+-Winit-self
+-Winvalid-pch
+-Wmissing-include-dirs
+#
+# 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
+-Wshadow
+-Wundef
+-Wwrite-strings
+-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/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 "")