summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST37
-rwxr-xr-xbin/trace1
-rw-r--r--c++/src/CMakeLists.txt6
-rw-r--r--config/cmake/HDFCompilerFlags.cmake185
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake22
-rw-r--r--config/cmake_ext_mod/HDFTests.c79
-rw-r--r--config/commence.am2
-rw-r--r--config/gnu-flags144
-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-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-general91
-rw-r--r--config/gnu-warnings/general (renamed from config/gnu-warnings-general)2
-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/sanitizer/sanitizers.cmake109
-rw-r--r--config/toolchain/intel.cmake13
-rw-r--r--configure.ac4
-rw-r--r--hl/c++/src/CMakeLists.txt6
-rw-r--r--hl/src/CMakeLists.txt6
-rw-r--r--java/src/jni/CMakeLists.txt3
-rw-r--r--java/src/jni/h5aImp.c6
-rw-r--r--java/src/jni/h5eImp.c6
-rw-r--r--java/src/jni/h5lImp.c6
-rw-r--r--java/src/jni/h5oImp.c6
-rw-r--r--release_docs/RELEASE.txt33
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/H5.c81
-rw-r--r--src/H5FL.c484
-rw-r--r--src/H5FLprivate.h16
-rw-r--r--src/H5MM.c49
-rw-r--r--src/H5MMprivate.h1
-rw-r--r--src/H5Rint.c8
-rw-r--r--src/H5Sall.c3
-rw-r--r--src/H5Snone.c3
-rw-r--r--src/H5Spkg.h11
-rw-r--r--src/H5Spoint.c3
-rw-r--r--src/H5Tconv.c2
-rw-r--r--src/H5VLconnector.h2
-rw-r--r--src/H5public.h16
-rw-r--r--src/H5trace.c2
-rw-r--r--src/libhdf5.settings.in2
-rw-r--r--test/CMakeLists.txt21
-rw-r--r--test/tmisc.c143
-rw-r--r--tools/lib/CMakeLists.txt6
-rw-r--r--tools/src/h5copy/CMakeLists.txt2
-rw-r--r--tools/src/h5diff/CMakeLists.txt2
-rw-r--r--tools/src/h5dump/CMakeLists.txt2
-rw-r--r--tools/src/h5dump/h5dump_ddl.c24
-rw-r--r--tools/src/h5dump/h5dump_xml.c36
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt2
-rw-r--r--tools/src/h5ls/CMakeLists.txt2
-rw-r--r--tools/src/h5repack/CMakeLists.txt2
-rw-r--r--tools/src/h5stat/CMakeLists.txt2
-rw-r--r--tools/src/misc/CMakeLists.txt8
82 files changed, 1242 insertions, 570 deletions
diff --git a/MANIFEST b/MANIFEST
index 33fab2f..04fbfdd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -143,9 +143,40 @@
./config/solaris
#warnings files for both autotools and CMake
-./config/gnu-warnings-general
-./config/gnu-warnings-developer-general
-./config/gnu-warnings-no-developer-general
+./config/gnu-warnings/4.2-4.3
+./config/gnu-warnings/4.2-4.4
+./config/gnu-warnings/4.2-4.6
+./config/gnu-warnings/4.2-4.last
+./config/gnu-warnings/4.3
+./config/gnu-warnings/4.4
+./config/gnu-warnings/4.5
+./config/gnu-warnings/4.5-4.6
+./config/gnu-warnings/4.6
+./config/gnu-warnings/4.7
+./config/gnu-warnings/4.8
+./config/gnu-warnings/4.9
+./config/gnu-warnings/5
+./config/gnu-warnings/6
+./config/gnu-warnings/7
+./config/gnu-warnings/8
+./config/gnu-warnings/9
+./config/gnu-warnings/developer-4.5
+./config/gnu-warnings/developer-4.6
+./config/gnu-warnings/developer-4.7
+./config/gnu-warnings/developer-4.8
+./config/gnu-warnings/developer-7
+./config/gnu-warnings/developer-8
+./config/gnu-warnings/developer-general
+./config/gnu-warnings/error-5
+./config/gnu-warnings/error-8
+./config/gnu-warnings/error-general
+./config/gnu-warnings/general
+./config/gnu-warnings/no-developer-4.5
+./config/gnu-warnings/no-developer-4.6
+./config/gnu-warnings/no-developer-4.7
+./config/gnu-warnings/no-developer-4.8
+./config/gnu-warnings/no-developer-8
+./config/gnu-warnings/no-developer-general
./config/intel-warnings-general
./config/site-specific/BlankForm
diff --git a/bin/trace b/bin/trace
index de6a83f..15baa8a 100755
--- a/bin/trace
+++ b/bin/trace
@@ -132,6 +132,7 @@ $Source = "";
"H5VL_blob_optional_t" => "VA",
"void" => "x",
"FILE" => "x",
+ "H5_alloc_stats_t" => "x",
"H5A_operator_t" => "x",
"H5A_operator1_t" => "x",
"H5A_operator2_t" => "x",
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 39f0f3a..fa15c9e 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -90,6 +90,9 @@ if (NOT ONLY_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_CXX_FLAGS}"
+ )
target_compile_definitions(${HDF5_CPP_LIB_TARGET}
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
)
@@ -107,6 +110,9 @@ if (BUILD_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE "${HDF5_CMAKE_CXX_FLAGS}"
+ )
target_compile_definitions(${HDF5_CPP_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 17b0854..5faffc2 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 (${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,24 @@ 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")
endif ()
endif ()
@@ -152,100 +148,125 @@ 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")
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")
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")
+ list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform")
endif ()
#-----------------------------------------------------------------------------
@@ -257,22 +278,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 +305,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 +325,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 +343,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 +361,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 +379,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 +451,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 +464,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_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 52cb7dd..33d4d6e 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
@@ -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 a16eee5..830c494 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -70,7 +70,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 11aaa71..ca0e1b4 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 "$*"
}
@@ -171,142 +189,120 @@ if test "X-gcc" = "X-$cc_vendor"; then
# General #
###########
- # 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 from the
- # environment variable at configure time.
- #
- # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
- # it to the developer flags.
- #
- # NOTE: Due to the divergence in the C and C++, we're dropping support for
- # compiling the C library with a C++ compiler and dropping the -Wc++-compat
- # warning.
- H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-general)"
- H5_CFLAGS="$H5_CFLAGS -Wbad-function-cast -Wcast-align"
- H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wdisabled-optimization"
- H5_CFLAGS="$H5_CFLAGS -Wmissing-declarations"
- H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked"
- H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default"
- H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)"
######################
# Developer warnings #
######################
- # (suggestions from gcc, not code problems)
- # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS)
- NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general)
- DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general)
+ NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general)
+ DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments developer-general)
#######################
# gcc 4 special cases #
#######################
- # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier
+ # 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 -Wno-long-long"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.6)"
fi
- # -Wvolatile-register-var was later incorporated into -Wall and
- # only needs to be specified explicitly for gcc 4.2-4.3
+ # 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 -Wvolatile-register-var"
- fi
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.3)"
+ fi
- # -Wstrict-aliasing was later incorporated into -Wall and
- # only needs to be specified explicitly for gcc 4.5-4.6
+ # 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 -Wstrict-aliasing"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5-4.6)"
fi
- # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4
+ # 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 -Wstrict-overflow"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.4)"
fi
- # -Wvla was later incorporated into -Wpedantic and
- # only needs to be specified explicitly for gcc 4
+ # 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 -Wvla"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.last)"
fi
#############################
# Version-specific warnings #
#############################
- # gcc 4.3
+ # gcc >= 4.3
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then
- H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560"
- fi
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.3)"
+ fi
- # gcc 4.4
+ # 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 -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.4)"
fi
- # gcc 4.5
+ # 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 -Wstrict-overflow=5 -Wjump-misses-init"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsuffixed-float-constants"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-unsuffixed-float-constants"
+ 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
+ # 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 -Wdouble-promotion -Wtrampolines"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const"
+ 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
+ # 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 -Wstack-usage=8192 -Wvector-operation-performance"
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn"
+ 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
+ # gcc >= 4.8
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format"
+ 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
+ # 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 -Wdate-time"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)"
fi
- # gcc 5
+ # gcc >= 5
if test $cc_vers_major -ge 5; then
- H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)"
fi
- # gcc 6
+ # gcc >= 6
if test $cc_vers_major -ge 6; then
- H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)"
fi
- # gcc 7
+ # gcc >= 7
if test $cc_vers_major -ge 7; then
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2"
- H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict"
+ 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
- DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc"
- NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc"
- H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2"
+ 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 -Wattribute-alias=2 -Wmissing-profile"
+ H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)"
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
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..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
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/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/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/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 "")
diff --git a/configure.ac b/configure.ac
index 0eada60..5851b32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,11 @@ AC_SUBST([AR_FLAGS])
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
+##
+## H5_ECFLAGS is for warnings that should be treated as errors.
+##
AC_SUBST([H5_CFLAGS])
+AC_SUBST([H5_ECFLAGS])
AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 866f372..01c8126 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -14,6 +14,9 @@ if (NOT ONLY_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_CXX_FLAGS}"
+ )
TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}")
@@ -28,6 +31,9 @@ if (BUILD_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET}
+ PRIVATE "${HDF5_CMAKE_CXX_FLAGS}"
+ )
target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
)
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 55d84c7..7975a1a 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -38,6 +38,9 @@ if (NOT ONLY_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0)
@@ -52,6 +55,9 @@ if (BUILD_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_LIBSH_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
target_compile_definitions(${HDF5_HL_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
)
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index d945c33..dc9b223 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -79,6 +79,9 @@ add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JA
target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
+target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+)
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index fb933ad..8b3f9e5 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -2167,7 +2167,7 @@ H5A_iterate_cb
jobject visit_callback = wrapper->visit_callback;
jstring str;
JNIEnv *cbenv = NULL;
- jclass cls;
+ jclass cbcls;
jvalue args[4];
void *op_data = (void *)wrapper->op_data;
jint status = -1;
@@ -2177,10 +2177,10 @@ H5A_iterate_cb
H5_JNI_FATAL_ERROR(CBENVONLY, "H5A_iterate_cb: failed to attach current thread to JVM");
}
- if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 7ea4223..80e23a1 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -523,7 +523,7 @@ H5E_walk_cb
jobject cb_info_t = NULL;
jvalue args[7];
JNIEnv *cbenv = NULL;
- jclass cls;
+ jclass cbcls;
void *op_data = (void *)wrapper->op_data;
jint status = FAIL;
@@ -532,10 +532,10 @@ H5E_walk_cb
H5_JNI_FATAL_ERROR(CBENVONLY, "H5E_walk_cb: failed to attach current thread to JVM");
}
- if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
args[0].j = info->cls_id;
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index e60e1ab..b5312bd 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -672,7 +672,7 @@ H5L_iterate_cb
jobject visit_callback = wrapper->visit_callback;
jstring str;
JNIEnv *cbenv = NULL;
- jclass cls;
+ jclass cbcls;
jvalue args[5];
void *op_data = (void *)wrapper->op_data;
jint status = -1;
@@ -683,10 +683,10 @@ H5L_iterate_cb
}
/* Get the Method ID for the "callback" function of the H5L_iterate_t class */
- if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 1d828a1..33bec85 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -548,7 +548,7 @@ H5O_iterate_cb
jobject token;
jstring str;
JNIEnv *cbenv = NULL;
- jclass cls;
+ jclass cbcls;
jvalue args[12];
void *op_data = (void *)wrapper->op_data;
jint status = FAIL;
@@ -558,10 +558,10 @@ H5O_iterate_cb
H5_JNI_FATAL_ERROR(CBENVONLY, "H5O_iterate_cb: failed to attach current thread to JVM");
}
- if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_opdata_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_opdata_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index ff024c3..5451e85 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -48,6 +48,28 @@ New Features
Configuration:
-------------
+ - CMake ConfigureChecks.cmake file now uses CHECK_STRUCT_HAS_MEMBER
+
+ Some handcrafted tests in HDFTests.c has been removed and the CMake
+ CHECK_STRUCT_HAS_MEMBER module has been used.
+
+ (ADB - 2020/03/24, TRILAB-24)
+
+ - Both build systems use same set of warnings flags
+
+ GNU C warnings flags were moved to files in a config sub-folder
+ named gnu-warnings. Flags that only are available for a specific
+ version of the compiler are in files named with that version.
+
+ There are flags in named "error-xxx" files with warnings that may
+ be promoted to errors. Some source files may still need fixes.
+
+ There are also pairs of files named "developer-xxx" and "no-developer-xxx"
+ that are chosen by the CMake option:HDF5_ENABLE_DEV_WARNINGS or the
+ configure option:--enable-developer-warnings.
+
+ (ADB - 2020/03/24, TRILAB-192)
+
- Added test script for file size compare
if CMake minimum version is at least 3.14, the fileCompareTest.cmake
@@ -419,6 +441,17 @@ New Features
(ADB - 2018/09/18, HDFFV-10332)
+ - Fix shutdown failure when using H5VLregister_connector_by_name/value
+
+ When using H5VLregister_connector_by_name/value to dynamically load a
+ VOL connector plugin, the library can experience segmentation faults
+ when the library is closed. This is due to the library unloading
+ the plugin interface before the virtual object layer. Then, when the
+ VOL shutdown occurs, it will attempt to close the VOL connector,
+ however this will fail since the plugin will already have been unloaded.
+
+ (DER - 2020/03/18, HDFFV-11057)
+
Parallel Library:
-----------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f582056..3f7d73a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1137,6 +1137,9 @@ if (NOT ONLY_SHARED_LIBS)
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
target_compile_definitions(${HDF5_LIB_TARGET}
PUBLIC
${HDF_EXTRA_C_FLAGS}
@@ -1173,6 +1176,9 @@ if (BUILD_SHARED_LIBS)
PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_LIBSH_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
target_compile_definitions(${HDF5_LIBSH_TARGET}
PUBLIC
"H5_BUILT_AS_DYNAMIC_LIB"
diff --git a/src/H5.c b/src/H5.c
index 62a1c09..59882e3 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -558,6 +558,87 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5get_free_list_sizes
+ *
+ * Purpose: Gets the current size of the different kinds of free lists that
+ * the library uses to manage memory. The free list sizes can be set with
+ * H5set_free_list_limits and garbage collected with H5garbage_collect.
+ * These lists are global for the entire library.
+ *
+ * Parameters:
+ * size_t *reg_size; OUT: The current size of all "regular" free list memory used
+ * size_t *arr_size; OUT: The current size of all "array" free list memory used
+ * size_t *blk_size; OUT: The current size of all "block" free list memory used
+ * size_t *fac_size; OUT: The current size of all "factory" free list memory used
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 6, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size,
+ size_t *fac_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size);
+
+ /* Call the free list function to actually get the sizes */
+ if(H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5get_free_list_sizes() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5get_alloc_stats
+ *
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * --enable-memory-alloc-sanity-check option was given when building the
+ * library. Applications can check whether this option was enabled by
+ * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
+ * option is enabled by default for debug builds of the library and
+ * disabled by default for non-debug builds. If the option is not enabled,
+ * all the values returned with be 0. These statistics are global for the
+ * entire library, but don't include allocations from chunked dataset I/O
+ * filters or non-native VOL connectors.
+ *
+ * Parameters:
+ * H5_alloc_stats_t *stats; OUT: Memory allocation statistics
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, March 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5get_alloc_stats(H5_alloc_stats_t *stats)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*x", stats);
+
+ /* Call the internal allocation stat routine to get the values */
+ if(H5MM_get_alloc_stats(stats) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5get_alloc_stats() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5_debug_mask
*
* Purpose: Set runtime debugging flags according to the string S. The
diff --git a/src/H5FL.c b/src/H5FL.c
index 9ed867d..66d27fb 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -130,17 +130,23 @@ static H5FL_track_t *H5FL_out_head_g = NULL;
#endif /* H5FL_TRACK */
/* Forward declarations of local static functions */
+static void * H5FL__malloc(size_t mem_size);
+static herr_t H5FL__reg_init(H5FL_reg_head_t *head);
static herr_t H5FL__reg_gc(void);
static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head);
static int H5FL__reg_term(void);
-static herr_t H5FL__arr_gc(void);
-static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head);
-static int H5FL__arr_term(void);
-static herr_t H5FL__blk_gc(void);
+static H5FL_blk_node_t *H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size);
+static H5FL_blk_node_t *H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size);
+static herr_t H5FL__blk_init(H5FL_blk_head_t *head);
static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head);
+static herr_t H5FL__blk_gc(void);
static int H5FL__blk_term(void);
-static herr_t H5FL__fac_gc(void);
+static herr_t H5FL__arr_init(H5FL_arr_head_t *head);
+static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head);
+static herr_t H5FL__arr_gc(void);
+static int H5FL__arr_term(void);
static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head);
+static herr_t H5FL__fac_gc(void);
static int H5FL__fac_term_all(void);
/* Declare a free list to manage the H5FL_blk_node_t struct */
@@ -217,7 +223,7 @@ H5FL_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5FL_malloc
+ * Function: H5FL__malloc
*
* Purpose: Attempt to allocate space using malloc. If malloc fails, garbage
* collect and try again. If malloc fails again, then return NULL.
@@ -228,16 +234,14 @@ H5FL_term_package(void)
* Programmer: Quincey Koziol
* Tuesday, August 1, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
-H5FL_malloc(size_t mem_size)
+H5FL__malloc(size_t mem_size)
{
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Attempt to allocate the memory requested */
if(NULL==(ret_value=H5MM_malloc(mem_size))) {
@@ -252,11 +256,11 @@ H5FL_malloc(size_t mem_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_malloc() */
+} /* end H5FL__malloc() */
/*-------------------------------------------------------------------------
- * Function: H5FL_reg_init
+ * Function: H5FL__reg_init
*
* Purpose: Initialize a free list for a certain type. Right now, this just
* adds the free list to the list of things to garbage collect.
@@ -267,17 +271,15 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_reg_init(H5FL_reg_head_t *head)
+H5FL__reg_init(H5FL_reg_head_t *head)
{
H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
herr_t ret_value=SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t))))
@@ -304,7 +306,7 @@ H5FL_reg_init(H5FL_reg_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_reg_init() */
+} /* end H5FL__reg_init() */
/*-------------------------------------------------------------------------
@@ -317,8 +319,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -403,8 +403,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -419,7 +417,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
- if(H5FL_reg_init(head)<0)
+ if(H5FL__reg_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
/* Check for nodes available on the free list first */
@@ -438,7 +436,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
} /* end if */
/* Otherwise allocate a node */
else {
- if (NULL==(ret_value = H5FL_malloc(head->size)))
+ if(NULL == (ret_value = H5FL__malloc(head->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
@@ -480,8 +478,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -524,35 +520,34 @@ static herr_t
H5FL__reg_gc_list(H5FL_reg_head_t *head)
{
H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
FUNC_ENTER_STATIC_NOERR
- /* Calculate the total memory used on this list */
- total_mem = head->onlist * head->size;
-
/* For each free list being garbage collected, walk through the nodes and free them */
free_list = head->list;
while(free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_reg_node_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
-
+ /* Free the block */
H5MM_free(free_list);
- free_list = (H5FL_reg_node_t *)tmp;
+ /* Advance to the next node */
+ free_list = tmp;
} /* end while */
+ /* Decrement the count of nodes allocated and free the node */
+ head->allocated -= head->onlist;
+
+ /* Decrement global count of free memory on "regular" lists */
+ H5FL_reg_gc_head.mem_freed -= (head->onlist * head->size);
+
/* Indicate no free nodes on the free list */
head->list = NULL;
head->onlist = 0;
- /* Decrement global count of free memory on "regular" lists */
- H5FL_reg_gc_head.mem_freed -= total_mem;
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FL__reg_gc_list() */
@@ -568,10 +563,6 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head)
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- * Broke into two parts, one for looping over all the free lists and
- * another for freeing each list - QAK 7/25/00
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -670,7 +661,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_find_list
+ * Function: H5FL__blk_find_list
*
* Purpose: Finds the free list for blocks of a given size. Also moves that
* free list node to the head of the priority queue (if it isn't there
@@ -684,16 +675,14 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
-H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
+H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size)
{
H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Find the correct free list */
temp=*head;
@@ -729,11 +718,11 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
} /* end if */
FUNC_LEAVE_NOAPI(temp)
-} /* end H5FL_blk_find_list() */
+} /* end H5FL__blk_find_list() */
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_create_list
+ * Function: H5FL__blk_create_list
*
* Purpose: Creates a new free list for blocks of the given size at the
* head of the priority queue.
@@ -745,47 +734,38 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
-H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size)
+H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size)
{
- H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */
H5FL_blk_node_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate room for the new free list node */
- if(NULL==(temp=H5FL_MALLOC(H5FL_blk_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk info")
+ if(NULL == (ret_value = H5FL_CALLOC(H5FL_blk_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info")
/* Set the correct values for the new free list */
- temp->size=size;
- temp->list=NULL;
+ ret_value->size = size;
/* Attach to head of priority queue */
- if(*head==NULL) {
- *head=temp;
- temp->next=temp->prev=NULL;
- } /* end if */
+ if(NULL == *head)
+ *head = ret_value;
else {
- temp->next=*head;
- (*head)->prev=temp;
- temp->prev=NULL;
- *head=temp;
+ ret_value->next = *head;
+ (*head)->prev = ret_value;
+ *head = ret_value;
} /* end else */
- ret_value=temp;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_blk_create_list() */
+} /* end H5FL__blk_create_list() */
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_init
+ * Function: H5FL__blk_init
*
* Purpose: Initialize a priority queue of a certain type. Right now, this just
* adds the PQ to the list of things to garbage collect.
@@ -796,17 +776,15 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_blk_init(H5FL_blk_head_t *head)
+H5FL__blk_init(H5FL_blk_head_t *head)
{
H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
herr_t ret_value=SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t))))
@@ -824,7 +802,7 @@ H5FL_blk_init(H5FL_blk_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_blk_init() */
+} /* end H5FL__blk_init() */
/*-------------------------------------------------------------------------
@@ -839,8 +817,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -856,10 +832,11 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size)
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
- if((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL)
+ if((free_list = H5FL__blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL)
ret_value = TRUE;
else
ret_value = FALSE;
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_blk_free_block_avail() */
@@ -878,8 +855,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size)
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -897,31 +872,40 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
- if(H5FL_blk_init(head)<0)
+ if(H5FL__blk_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
- if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) {
+ if(NULL != (free_list = H5FL__blk_find_list(&(head->head), size)) && NULL != free_list->list) {
/* Remove the first node from the free list */
temp=free_list->list;
free_list->list=free_list->list->next;
/* Decrement the number of blocks & memory used on free list */
+ free_list->onlist--;
head->onlist--;
head->list_mem-=size;
/* Decrement the amount of global "block" free list memory in use */
H5FL_blk_gc_head.mem_freed-=size;
-
} /* end if */
/* No free list available, or there are no nodes on the list, allocate a new node to give to the user */
else {
+ /* Check if there was no free list for native blocks of this size */
+ if(NULL == free_list)
+ /* Create a new list node and insert it to the queue */
+ free_list = H5FL__blk_create_list(&(head->head), size);
+ HDassert(free_list);
+
/* Allocate new node, with room for the page info header and the actual page data */
- if(NULL == (temp = (H5FL_blk_list_t *)H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size)))
+ if(NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk")
- /* Increment the number of blocks allocated */
+ /* Increment the number of blocks of this size */
+ free_list->allocated++;
+
+ /* Increment the total number of blocks allocated */
head->allocated++;
} /* end else */
@@ -970,8 +954,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1011,8 +993,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1055,7 +1035,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
#endif /* H5FL_TRACK */
/* Get the pointer to the native block info header in front of the native block to free */
- temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
+ temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
/* Save the block's size for later */
free_size=temp->size;
@@ -1064,20 +1044,18 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
HDmemset(temp,255,free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE);
#endif /* H5FL_DEBUG */
- /* check if there is a free list for native blocks of this size */
- if((free_list=H5FL_blk_find_list(&(head->head),free_size))==NULL) {
+ /* Check if there is a free list for native blocks of this size */
+ if(NULL == (free_list = H5FL__blk_find_list(&(head->head), free_size)))
/* No free list available, create a new list node and insert it to the queue */
- free_list=H5FL_blk_create_list(&(head->head),free_size);
- HDassert(free_list);
- } /* end if */
+ free_list = H5FL__blk_create_list(&(head->head), free_size);
+ HDassert(free_list);
/* Prepend the free'd native block to the front of the free list */
- if(free_list!=NULL) {
- temp->next=free_list->list; /* Overwrites the size field in union */
- free_list->list=temp;
- } /* end if */
+ temp->next = free_list->list; /* Note: Overwrites the size field in union */
+ free_list->list = temp;
/* Increment the number of blocks on free list */
+ free_list->onlist++;
head->onlist++;
head->list_mem += free_size;
@@ -1113,8 +1091,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1191,44 +1167,70 @@ done:
static herr_t
H5FL__blk_gc_list(H5FL_blk_head_t *head)
{
+ H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list page node */
+
FUNC_ENTER_STATIC_NOERR
/* Loop through all the nodes in the block free list queue */
- while(head->head != NULL) {
- H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */
- void *temp; /* Temp. ptr to the free list page node */
+ blk_head = head->head;
+ while(blk_head != NULL) {
+ H5FL_blk_node_t *blk_next; /* Temp. ptr to the next free list node */
+ H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */
- temp = head->head->next;
+ /* Sanity check */
+ HDassert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list));
/* Loop through all the blocks in the free list, freeing them */
- list = head->head->list;
+ list = blk_head->list;
while(list != NULL) {
- void *next; /* Temp. ptr to the free list list node */
+ H5FL_blk_list_t *next; /* Temp. ptr to the free list list node */
+ /* Get the pointer to the next node */
next = list->next;
- /* Decrement the number of blocks & memory allocated from this PQ */
- head->allocated--;
- head->list_mem -= head->head->size;
-
- /* Decrement global count of free memory on "block" lists */
- H5FL_blk_gc_head.mem_freed -= head->head->size;
-
/* Free the block */
H5MM_free(list);
- list = (H5FL_blk_list_t *)next;
+ /* Advance to the next node */
+ list = next;
} /* end while */
- /* Free the free list node */
- head->head = H5FL_FREE(H5FL_blk_node_t, head->head);
+ /* Decrement the number of blocks allocated from this list */
+ blk_head->allocated -= blk_head->onlist;
+ head->allocated -= blk_head->onlist;
+
+ /* Decrement count of free memory on this "block" list */
+ head->list_mem -= (blk_head->onlist * blk_head->size);
+
+ /* Decrement global count of free memory on "block" lists */
+ H5FL_blk_gc_head.mem_freed -= (blk_head->onlist * blk_head->size);
+
+ /* Indicate no free nodes on the free list */
+ blk_head->list = NULL;
+ blk_head->onlist = 0;
- /* Advance to the next free list */
- head->head = (H5FL_blk_node_t *)temp;
+ /* Get pointer to next node */
+ blk_next = blk_head->next;
+
+ /* Check for list completely unused now */
+ if(0 == blk_head->allocated) {
+ /* Patch this node out of the PQ */
+ if(head->head == blk_head)
+ head->head = blk_head->next;
+ if(blk_head->prev)
+ blk_head->prev->next = blk_head->next;
+ if(blk_head->next)
+ blk_head->next->prev = blk_head->prev;
+
+ /* Free the free list node */
+ H5FL_FREE(H5FL_blk_node_t, blk_head);
+ } /* end if */
+
+ /* Advance to the next node */
+ blk_head = blk_next;
} /* end while */
/* Indicate no free nodes on the free list */
- head->head = NULL;
head->onlist = 0;
/* Double check that all the memory on this list is recycled */
@@ -1257,7 +1259,7 @@ H5FL__blk_gc(void)
H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */
herr_t ret_value = SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Walk through all the free lists, free()'ing the nodes */
gc_node = H5FL_blk_gc_head.first;
@@ -1341,7 +1343,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f
/*-------------------------------------------------------------------------
- * Function: H5FL_arr_init
+ * Function: H5FL__arr_init
*
* Purpose: Initialize a free list for a arrays of certain type. Right now,
* this just adds the free list to the list of things to garbage collect.
@@ -1352,18 +1354,16 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_arr_init(H5FL_arr_head_t *head)
+H5FL__arr_init(H5FL_arr_head_t *head)
{
H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
size_t u; /* Local index variable */
herr_t ret_value=SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t))))
@@ -1389,7 +1389,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_arr_init() */
+} /* end H5FL__arr_init() */
/*-------------------------------------------------------------------------
@@ -1403,8 +1403,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1481,8 +1479,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1500,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Make certain the list is initialized first */
if(!head->init)
- if(H5FL_arr_init(head)<0)
+ if(H5FL__arr_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
/* Sanity check that the number of elements is supported */
@@ -1527,10 +1523,13 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
} /* end if */
/* Otherwise allocate a node */
else {
- if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size)))
+ if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t)+mem_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Increment the number of blocks allocated in list */
+ /* Increment the number of blocks of this size */
+ head->list_arr[elem].allocated++;
+
+ /* Increment the number of blocks allocated in list, of all sizes */
head->allocated++;
} /* end else */
@@ -1556,8 +1555,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1594,8 +1591,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1667,34 +1662,35 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head)
for(u = 0; u < (unsigned)head->maxelem; u++) {
if(head->list_arr[u].onlist > 0) {
H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
-
- /* Calculate the total memory used on this list */
- total_mem = head->list_arr[u].onlist * head->list_arr[u].size;
/* For each free list being garbage collected, walk through the nodes and free them */
arr_free_list = head->list_arr[u].list;
while(arr_free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_arr_list_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = arr_free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
+ /* Free the node */
H5MM_free(arr_free_list);
- arr_free_list = (H5FL_arr_list_t *)tmp;
+ /* Advance to the next node */
+ arr_free_list = tmp;
} /* end while */
- /* Indicate no free nodes on the free list */
- head->list_arr[u].list = NULL;
- head->list_arr[u].onlist = 0;
+ /* Decrement the count of nodes allocated */
+ head->list_arr[u].allocated -= head->list_arr[u].onlist;
+ head->allocated -= head->list_arr[u].onlist;
/* Decrement count of free memory on this "array" list */
- head->list_mem -= total_mem;
+ head->list_mem -= (head->list_arr[u].onlist * head->list_arr[u].size);
/* Decrement global count of free memory on "array" lists */
- H5FL_arr_gc_head.mem_freed -= total_mem;
+ H5FL_arr_gc_head.mem_freed -= (head->list_arr[u].onlist * head->list_arr[u].size);
+
+ /* Indicate no free nodes on the free list */
+ head->list_arr[u].list = NULL;
+ head->list_arr[u].onlist = 0;
} /* end if */
} /* end for */
@@ -1820,8 +1816,6 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.f
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1856,8 +1850,6 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1889,8 +1881,6 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1922,8 +1912,6 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1955,11 +1943,6 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void * obj, size_t new_elem H5FL_TRACK_P
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
H5FL_fac_head_t *
@@ -2032,11 +2015,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2120,11 +2098,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2155,7 +2128,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
} /* end if */
/* Otherwise allocate a node */
else {
- if (NULL==(ret_value = H5FL_malloc(head->size)))
+ if(NULL == (ret_value = H5FL__malloc(head->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
@@ -2197,11 +2170,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2245,35 +2213,34 @@ static herr_t
H5FL__fac_gc_list(H5FL_fac_head_t *head)
{
H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
FUNC_ENTER_STATIC_NOERR
- /* Calculate the total memory used on this list */
- total_mem = head->onlist * head->size;
-
/* For each free list being garbage collected, walk through the nodes and free them */
free_list = head->list;
while(free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_fac_node_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
-
+ /* Free the block */
H5MM_free(free_list);
- free_list = (H5FL_fac_node_t *)tmp;
+ /* Advance to the next node */
+ free_list = tmp;
} /* end while */
+ /* Decrement the count of nodes allocated and free the node */
+ head->allocated -= head->onlist;
+
+ /* Decrement global count of free memory on "factory" lists */
+ H5FL_fac_gc_head.mem_freed -= (head->onlist * head->size);
+
/* Indicate no free nodes on the free list */
head->list = NULL;
head->onlist = 0;
- /* Decrement global count of free memory on "factory" lists */
- H5FL_fac_gc_head.mem_freed -= total_mem;
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FL__fac_gc_list() */
@@ -2329,11 +2296,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2438,8 +2400,6 @@ HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_h
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2495,10 +2455,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, August 2, 2000
*
- * Modifications: Neil Fortner
- * Wednesday, April 8, 2009
- * Added support for factory free lists
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2531,3 +2487,127 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_set_free_list_limits() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FL_get_free_list_sizes
+ *
+ * Purpose: Gets the current size of the different kinds of free lists.
+ * These lists are global for the entire library. The size returned
+ * included nodes that are freed and awaiting garbage collection /
+ * reallocation.
+ *
+ * Parameters:
+ * size_t *reg_size; OUT: The current size of all "regular" free list memory used
+ * size_t *arr_size; OUT: The current size of all "array" free list memory used
+ * size_t *blk_size; OUT: The current size of all "block" free list memory used
+ * size_t *fac_size; OUT: The current size of all "factory" free list memory used
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 6, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size,
+ size_t *fac_size)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Retrieve the amount of "regular" memory used */
+ if(reg_size) {
+ H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of lists */
+
+ /* Walk through all the free lists, counting the amount of memory */
+ *reg_size = 0;
+ gc_node = H5FL_reg_gc_head.first;
+ while(gc_node != NULL) {
+ H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */
+
+ /* Sanity check */
+ HDassert(reg_list->init);
+
+ /* Add the amount of memory for this list */
+ *reg_size += (reg_list->size * reg_list->allocated);
+
+ /* Go on to the next free list */
+ gc_node = gc_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "array" memory used */
+ if(arr_size) {
+ H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */
+
+ /* Walk through all the free lists, counting the amount of memory */
+ *arr_size = 0;
+ gc_arr_node = H5FL_arr_gc_head.first;
+ while(gc_arr_node != NULL) {
+ H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */
+
+ /* Sanity check */
+ HDassert(head->init);
+
+ /* Check for any allocated elements in this list */
+ if(head->allocated > 0) {
+ unsigned u;
+
+ /* Walk through the free lists for array sizes */
+ for(u = 0; u < (unsigned)head->maxelem; u++)
+ /* Add the amount of memory for this size */
+ *arr_size += head->list_arr[u].allocated * head->list_arr[u].size;
+ } /* end if */
+
+ /* Go on to the next free list */
+ gc_arr_node = gc_arr_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "block" memory used */
+ if(blk_size) {
+ H5FL_blk_gc_node_t *gc_blk_node; /* Pointer into the list of things */
+
+ /* Walk through all the free lists */
+ gc_blk_node = H5FL_blk_gc_head.first;
+ *blk_size = 0;
+ while(gc_blk_node != NULL) {
+ H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list block node */
+
+ /* Loop through all the nodes in the block free list queue */
+ blk_head = gc_blk_node->pq->head;
+ while(blk_head != NULL) {
+ /* Add size of blocks on this list */
+ *blk_size += (blk_head->allocated * blk_head->size);
+
+ /* Get pointer to next node */
+ blk_head = blk_head->next;
+ } /* end while */
+
+ /* Go on to the next free list */
+ gc_blk_node = gc_blk_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "factory" memory used */
+ if(fac_size) {
+ H5FL_fac_gc_node_t *gc_fac_node; /* Pointer into the list of things to garbage collect */
+
+ /* Walk through all the free lists */
+ gc_fac_node = H5FL_fac_gc_head.first;
+ *fac_size = 0;
+ while(gc_fac_node != NULL) {
+ H5FL_fac_head_t *fac_head = gc_fac_node->list; /* Head node for factory list */
+
+ /* Add size of blocks on this list */
+ *fac_size += (fac_head->allocated * fac_head->size);
+
+ /* Go on to the next free list to garbage collect */
+ gc_fac_node = gc_fac_node->next;
+ } /* end while */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FL_get_free_list_sizes() */
+
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index d5a68d7..94a51e5 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -157,6 +157,8 @@ typedef union H5FL_blk_list_t {
/* Data structure for priority queue node of block free lists */
typedef struct H5FL_blk_node_t {
size_t size; /* Size of the blocks in the list */
+ unsigned allocated; /* Number of blocks of this size allocated */
+ unsigned onlist; /* Number of blocks on free list */
H5FL_blk_list_t *list; /* List of free blocks */
struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */
struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */
@@ -165,9 +167,9 @@ typedef struct H5FL_blk_node_t {
/* Data structure for priority queue of native block free lists */
typedef struct H5FL_blk_head_t {
hbool_t init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
- unsigned onlist; /* Number of blocks on free list */
- size_t list_mem; /* Amount of memory in block on free list */
+ unsigned allocated; /* Total number of blocks allocated */
+ unsigned onlist; /* Total number of blocks on free list */
+ size_t list_mem; /* Total amount of memory in blocks on free list */
const char *name; /* Name of the type */
H5FL_blk_node_t *head; /* Pointer to first free list in queue */
} H5FL_blk_head_t;
@@ -228,7 +230,9 @@ typedef union H5FL_arr_list_t {
/* Data structure for each size of array element */
typedef struct H5FL_arr_node_t {
- size_t size; /* Size of the blocks in the list */
+ size_t size; /* Size of the blocks in the list (in bytes) */
+ /* (Note: base_size + <# of elem> * elem_size) */
+ unsigned allocated; /* Number of blocks allocated of this element size */
unsigned onlist; /* Number of blocks on free list */
H5FL_arr_list_t *list; /* List of free blocks */
} H5FL_arr_node_t;
@@ -236,7 +240,7 @@ typedef struct H5FL_arr_node_t {
/* Data structure for free list of array blocks */
typedef struct H5FL_arr_head_t {
hbool_t init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
+ unsigned allocated; /* Total number of blocks allocated */
size_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
int maxelem; /* Maximum number of elements in an array */
@@ -423,6 +427,8 @@ H5_DLL herr_t H5FL_garbage_coll(void);
H5_DLL herr_t H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim,
int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim,
int fac_global_lim, int fac_list_lim);
+H5_DLL herr_t H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size,
+ size_t *blk_size, size_t *fac_size);
H5_DLL int H5FL_term_interface(void);
#endif
diff --git a/src/H5MM.c b/src/H5MM.c
index 94bd542..0add640 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -108,8 +108,8 @@ static H5MM_block_t H5MM_block_head_s;
/* Statistics about block allocations */
static unsigned long long H5MM_total_alloc_bytes_s = 0;
-static unsigned long long H5MM_curr_alloc_bytes_s = 0;
-static unsigned long long H5MM_peak_alloc_bytes_s = 0;
+static size_t H5MM_curr_alloc_bytes_s = 0;
+static size_t H5MM_peak_alloc_bytes_s = 0;
static size_t H5MM_max_block_size_s = 0;
static size_t H5MM_total_alloc_blocks_count_s = 0;
static size_t H5MM_curr_alloc_blocks_count_s = 0;
@@ -235,7 +235,7 @@ H5MM_final_sanity_check(void)
HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s);
#ifdef H5MM_PRINT_MEMORY_STATS
HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s);
- HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s);
+ HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %zu\n", __func__, H5MM_peak_alloc_bytes_s);
HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s);
HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s);
HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s);
@@ -625,3 +625,46 @@ H5MM_memcpy(void *dest, const void *src, size_t n)
} /* end H5MM_memcpy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_get_alloc_stats
+ *
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. If the macro is not
+ * defined, zeros are returned. These statistics are global for the
+ * entire library.
+ *
+ * Parameters:
+ * H5_alloc_stats_t *stats; OUT: Memory allocation statistics
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, March 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5MM_get_alloc_stats(H5_alloc_stats_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ if(stats) {
+ stats->total_alloc_bytes = H5MM_total_alloc_bytes_s;
+ stats->curr_alloc_bytes = H5MM_curr_alloc_bytes_s;
+ stats->peak_alloc_bytes = H5MM_peak_alloc_bytes_s;
+ stats->max_block_size = H5MM_max_block_size_s;
+ stats->total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s;
+ stats->curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s;
+ stats->peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s;
+ } /* end if */
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ if(stats)
+ HDmemset(stats, 0, sizeof(H5_alloc_stats_t));
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5MM_get_alloc_stats() */
+
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 240b931..0787eb2 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -47,6 +47,7 @@ H5_DLL char *H5MM_strdup(const char *s);
H5_DLL void *H5MM_xfree(void *mem);
H5_DLL void *H5MM_xfree_const(const void *mem);
H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
+H5_DLL herr_t H5MM_get_alloc_stats(H5_alloc_stats_t *stats);
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
H5_DLL void H5MM_sanity_check_all(void);
H5_DLL void H5MM_final_sanity_check(void);
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 1df8a20..30f3dbb 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -1768,6 +1768,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
H5O_token_t token = { 0 };
size_t data_size;
const uint8_t *p;
+ H5S_t *space = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -1788,7 +1789,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
if(space_ptr) {
H5O_loc_t oloc; /* Object location */
- H5S_t *space = NULL;
/* Initialize the object location */
H5O_loc_reset(&oloc);
@@ -1812,6 +1812,12 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
done:
H5MM_free(data);
+
+ if(ret_value < 0) {
+ if(space && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ }
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_token_region_compat() */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 4a4245d..77fb582 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -690,6 +690,9 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(*p, version);
+ if(version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection")
+
/* Skip over the remainder of the header */
*p += 8;
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 0949b2a..630d1d5 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -648,6 +648,9 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(*p, version);
+ if(version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection")
+
/* Skip over the remainder of the header */
*p += 8;
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index e139bce..da2dd4a 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -47,14 +47,17 @@
#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3
/* Versions for H5S_SEL_POINTS selection info */
-#define H5S_POINT_VERSION_1 1
-#define H5S_POINT_VERSION_2 2
+#define H5S_POINT_VERSION_1 1
+#define H5S_POINT_VERSION_2 2
+#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_2
/* Versions for H5S_SEL_NONE selection info */
-#define H5S_NONE_VERSION_1 1
+#define H5S_NONE_VERSION_1 1
+#define H5S_NONE_VERSION_LATEST H5S_NONE_VERSION_1
/* Versions for H5S_SEL_ALL selection info */
-#define H5S_ALL_VERSION_1 1
+#define H5S_ALL_VERSION_1 1
+#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1
/* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */
#define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 721211e..6948125 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -1413,6 +1413,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(pp, version);
+ if(version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection")
+
if(version >= (uint32_t)H5S_POINT_VERSION_2)
/* Decode size of point info */
enc_size = *(pp)++;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 29fd582..2b1283e 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3213,7 +3213,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* necessary. If the SEQ_LEN is 0, allocate a minimal size buffer.
*/
if(!seq_len && !conv_buf) {
- conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
+ conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE;
if(NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 39d9b14..7951a32 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -194,7 +194,7 @@ typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_FILE, /* object file */
H5VL_OBJECT_GET_NAME, /* object name */
H5VL_OBJECT_GET_TYPE, /* object type */
- H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */
+ H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */
} H5VL_object_get_t;
/* types for object SPECIFIC callback */
diff --git a/src/H5public.h b/src/H5public.h
index 3312cf4..f592ab9 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -378,6 +378,19 @@ typedef struct H5O_token_t {
uint8_t __data[H5O_MAX_TOKEN_SIZE];
} H5O_token_t;
+/*
+ * Allocation statistics info struct
+ */
+typedef struct H5_alloc_stats_t {
+ unsigned long long total_alloc_bytes; /* Running count of total # of bytes allocated */
+ size_t curr_alloc_bytes; /* Current # of bytes allocated */
+ size_t peak_alloc_bytes; /* Peak # of bytes allocated */
+ size_t max_block_size; /* Largest block allocated */
+ size_t total_alloc_blocks_count; /* Running count of total # of blocks allocated */
+ size_t curr_alloc_blocks_count; /* Current # of blocks allocated */
+ size_t peak_alloc_blocks_count; /* Peak # of blocks allocated */
+} H5_alloc_stats_t;
+
/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);
@@ -386,6 +399,9 @@ H5_DLL herr_t H5garbage_collect(void);
H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim,
int arr_global_lim, int arr_list_lim, int blk_global_lim,
int blk_list_lim);
+H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size,
+ size_t *blk_size, size_t *fac_size);
+H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats);
H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
unsigned *relnum);
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum,
diff --git a/src/H5trace.c b/src/H5trace.c
index 7168d5d..03d9e7c 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -155,7 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
/* Get time for event */
- if(H5_DBL_ABS_EQUAL(first_time.etime, 0.0))
+ if(H5_DBL_ABS_EQUAL(first_time.etime, (double)0.0f))
H5_timer_begin(&first_time);
if(H5_debug_g.ttimes)
H5_timer_begin(&event_time);
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 1591bed..0c2be75 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -39,7 +39,7 @@ Languages:
H5_CPPFLAGS: @H5_CPPFLAGS@
AM_CPPFLAGS: @AM_CPPFLAGS@
C Flags: @CFLAGS@
- H5 C Flags: @H5_CFLAGS@
+ H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@
AM C Flags: @AM_CFLAGS@
Shared C Library: @enable_shared@
Static C Library: @enable_static@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2594477..7929e2c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -287,7 +287,7 @@ set (H5_TESTS
cache_logging
cork
swmr
- thread_id
+ thread_id # special link
vol
)
@@ -310,6 +310,7 @@ set (H5_TESTS_MULTIPLE
testhdf5
cache_image
ttsafe
+ thread_id # special link
)
# Only build single source tests here
foreach (h5_test ${H5_TESTS})
@@ -389,6 +390,24 @@ else ()
endif ()
set_target_properties (ttsafe PROPERTIES FOLDER test)
+######### Special handling for extra link lib of threads #############
+#-- Adding test for thread_id
+add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c)
+target_include_directories (thread_id PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (thread_id STATIC)
+ target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIB_TARGET})
+ if (NOT WIN32)
+ target_link_libraries (thread_id
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+ endif ()
+else ()
+ TARGET_C_PROPERTIES (thread_id SHARED)
+ target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
+endif ()
+set_target_properties (thread_id PROPERTIES FOLDER test)
+
##############################################################################
### A D D I T I O N A L T E S T S ###
##############################################################################
diff --git a/test/tmisc.c b/test/tmisc.c
index 0ea9c4c..539a027 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -329,6 +329,14 @@ typedef struct
/* and bad offset values are written to that file for testing */
#define MISC33_FILE "bad_offset.h5"
+/* Definitions for misc. test #35 */
+#define MISC35_SPACE_RANK 3
+#define MISC35_SPACE_DIM1 3
+#define MISC35_SPACE_DIM2 15
+#define MISC35_SPACE_DIM3 13
+#define MISC35_NPOINTS 10
+
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -5684,6 +5692,140 @@ test_misc34(void)
/****************************************************************
**
+** test_misc35(): Check operation of free-list routines
+**
+****************************************************************/
+static void
+test_misc35(void)
+{
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hsize_t dims[] = {MISC35_SPACE_DIM1, MISC35_SPACE_DIM2, MISC35_SPACE_DIM3}; /* Dataspace dims */
+ hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK]; /* Coordinates for point selection */
+ size_t reg_size_start; /* Initial amount of regular memory allocated */
+ size_t arr_size_start; /* Initial amount of array memory allocated */
+ size_t blk_size_start; /* Initial amount of block memory allocated */
+ size_t fac_size_start; /* Initial amount of factory memory allocated */
+ size_t reg_size_final; /* Final amount of regular memory allocated */
+ size_t arr_size_final; /* Final amount of array memory allocated */
+ size_t blk_size_final; /* Final amount of block memory allocated */
+ size_t fac_size_final; /* Final amount of factory memory allocated */
+ H5_alloc_stats_t alloc_stats; /* Memory stats */
+ herr_t ret; /* Return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Free-list API calls"));
+
+ /* Create dataspace */
+ /* (Allocates array free-list nodes) */
+ sid = H5Screate_simple(MISC35_SPACE_RANK, dims, NULL);
+ CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Select sequence of ten points */
+ coord[0][0]=0; coord[0][1]=10; coord[0][2]= 5;
+ coord[1][0]=1; coord[1][1]= 2; coord[1][2]= 7;
+ coord[2][0]=2; coord[2][1]= 4; coord[2][2]= 9;
+ coord[3][0]=0; coord[3][1]= 6; coord[3][2]=11;
+ coord[4][0]=1; coord[4][1]= 8; coord[4][2]=13;
+ coord[5][0]=2; coord[5][1]=12; coord[5][2]= 0;
+ coord[6][0]=0; coord[6][1]=14; coord[6][2]= 2;
+ coord[7][0]=1; coord[7][1]= 0; coord[7][2]= 4;
+ coord[8][0]=2; coord[8][1]= 1; coord[8][2]= 6;
+ coord[9][0]=0; coord[9][1]= 3; coord[9][2]= 8;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)MISC35_NPOINTS, (const hsize_t *)coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+
+ /* Retrieve initial free list values */
+ ret = H5get_free_list_sizes(&reg_size_start, &arr_size_start, &blk_size_start, &fac_size_start);
+ CHECK(ret, FAIL, "H5get_free_list_sizes");
+
+#if !defined H5_USING_MEMCHECKER
+ /* All the free list values should be >0 */
+ if(0 == reg_size_start)
+ ERROR("reg_size_start == 0");
+ if(0 == arr_size_start)
+ ERROR("arr_size_start == 0");
+ if(0 == blk_size_start)
+ ERROR("blk_size_start == 0");
+ if(0 == fac_size_start)
+ ERROR("fac_size_start == 0");
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ /* All the values should be == 0 */
+ if(0 != reg_size_start)
+ ERROR("reg_size_start != 0");
+ if(0 != arr_size_start)
+ ERROR("arr_size_start != 0");
+ if(0 != blk_size_start)
+ ERROR("blk_size_start != 0");
+ if(0 != fac_size_start)
+ ERROR("fac_size_start != 0");
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+ /* Garbage collect the free lists */
+ ret = H5garbage_collect();
+ CHECK(ret, FAIL, "H5garbage_collect");
+
+ /* Retrieve free list values again */
+ ret = H5get_free_list_sizes(&reg_size_final, &arr_size_final, &blk_size_final, &fac_size_final);
+ CHECK(ret, FAIL, "H5get_free_list_sizes");
+
+ /* All the free list values should be <= previous values */
+ if(reg_size_final > reg_size_start)
+ ERROR("reg_size_final > reg_size_start");
+ if(arr_size_final > arr_size_start)
+ ERROR("arr_size_final > arr_size_start");
+ if(blk_size_final > blk_size_start)
+ ERROR("blk_size_final > blk_size_start");
+ if(fac_size_final > fac_size_start)
+ ERROR("fac_size_final > fac_size_start");
+
+ /* Retrieve memory allocation statistics */
+ ret = H5get_alloc_stats(&alloc_stats);
+ CHECK(ret, FAIL, "H5get_alloc_stats");
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ /* All the values should be >0 */
+ if(0 == alloc_stats.total_alloc_bytes)
+ ERROR("alloc_stats.total_alloc_bytes == 0");
+ if(0 == alloc_stats.curr_alloc_bytes)
+ ERROR("alloc_stats.curr_alloc_bytes == 0");
+ if(0 == alloc_stats.peak_alloc_bytes)
+ ERROR("alloc_stats.peak_alloc_bytes == 0");
+ if(0 == alloc_stats.max_block_size)
+ ERROR("alloc_stats.max_block_size == 0");
+ if(0 == alloc_stats.total_alloc_blocks_count)
+ ERROR("alloc_stats.total_alloc_blocks_count == 0");
+ if(0 == alloc_stats.curr_alloc_blocks_count)
+ ERROR("alloc_stats.curr_alloc_blocks_count == 0");
+ if(0 == alloc_stats.peak_alloc_blocks_count)
+ ERROR("alloc_stats.peak_alloc_blocks_count == 0");
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ /* All the values should be == 0 */
+ if(0 != alloc_stats.total_alloc_bytes)
+ ERROR("alloc_stats.total_alloc_bytes != 0");
+ if(0 != alloc_stats.curr_alloc_bytes)
+ ERROR("alloc_stats.curr_alloc_bytes != 0");
+ if(0 != alloc_stats.peak_alloc_bytes)
+ ERROR("alloc_stats.peak_alloc_bytes != 0");
+ if(0 != alloc_stats.max_block_size)
+ ERROR("alloc_stats.max_block_size != 0");
+ if(0 != alloc_stats.total_alloc_blocks_count)
+ ERROR("alloc_stats.total_alloc_blocks_count != 0");
+ if(0 != alloc_stats.curr_alloc_blocks_count)
+ ERROR("alloc_stats.curr_alloc_blocks_count != 0");
+ if(0 != alloc_stats.peak_alloc_blocks_count)
+ ERROR("alloc_stats.peak_alloc_blocks_count != 0");
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+} /* end test_misc35() */
+
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -5731,6 +5873,7 @@ test_misc(void)
test_misc32(); /* Test filter memory allocation functions */
test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */
test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */
+ test_misc35(); /* Test behavior of free-list & allocation statistics API calls */
} /* test_misc() */
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index 9ce7538..306c033 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -38,6 +38,9 @@ if (NOT ONLY_SHARED_LIBS)
PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_TOOLS_LIB_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG)
#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC)
@@ -57,6 +60,9 @@ if (BUILD_SHARED_LIBS)
PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_TOOLS_LIBSH_TARGET}
+ PRIVATE "${HDF5_CMAKE_C_FLAGS}"
+ )
target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
#PRIVATE H5_TOOLS_DEBUG
diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt
index 29888f2..8f230a0 100644
--- a/tools/src/h5copy/CMakeLists.txt
+++ b/tools/src/h5copy/CMakeLists.txt
@@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5COPY C)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5copy STATIC)
target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5copy PROPERTIES FOLDER tools)
@@ -18,6 +19,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5copy-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5copy-shared SHARED)
target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5copy-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
index 93e99cf..eec7246 100644
--- a/tools/src/h5diff/CMakeLists.txt
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -10,6 +10,7 @@ if (NOT ONLY_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
)
target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff STATIC)
target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -24,6 +25,7 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
)
target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions (h5diff-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff-shared SHARED)
target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
index dbf92cf..0b6c968 100644
--- a/tools/src/h5dump/CMakeLists.txt
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -11,6 +11,7 @@ if (NOT ONLY_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
)
target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5dump STATIC)
target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dump PROPERTIES FOLDER tools)
@@ -26,6 +27,7 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
)
target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5dump-shared SHARED)
target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5dump-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index a410fda..9414f5b 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -816,14 +816,14 @@ dump_group(hid_t gid, const char *name)
/* dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++)
if(!type_table->objs[u].recorded) {
- char *obj_addr_str = NULL;
+ char *obj_tok_str = NULL;
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
- HDsprintf(type_name, "#%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
+ HDsprintf(type_name, "#%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
@@ -1258,11 +1258,11 @@ dump_fcontents(hid_t fid)
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded) {
- char *obj_addr_str = NULL;
+ char *obj_tok_str = NULL;
- H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_addr_str);
- PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_tok_str);
+ PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_tok_str);
+ H5free_memory(obj_tok_str);
}
}
}
@@ -1914,12 +1914,12 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
char name[128];
if(!type_table->objs[idx].recorded) {
- char *obj_addr_string = NULL;
+ char *obj_tok_str = NULL;
/* unamed datatype */
- H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_addr_string);
- HDsprintf(name, "/#%s", obj_addr_string);
- H5free_memory(obj_addr_string);
+ H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_tok_str);
+ HDsprintf(name, "/#%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
if(!HDstrcmp(name, real_name))
break;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index d9f1f67..4f58b73 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -578,7 +578,7 @@ int
xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen)
{
H5O_token_t obj_token;
- char *obj_addr_str = NULL;
+ char *obj_tok_str = NULL;
int lookup_ret;
if (outlen < 22) return 1;
@@ -591,9 +591,9 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
if (gen) {
ref_path_table_gen_fake(str, &obj_token);
- H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
- HDsprintf(outstr, "xid_%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
+ HDsprintf(outstr, "xid_%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
return 0;
}
@@ -606,9 +606,9 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
if (gen) {
ref_path_table_gen_fake(str, &obj_token);
- H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
- HDsprintf(outstr, "xid_%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
+ HDsprintf(outstr, "xid_%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
return 0;
}
@@ -618,9 +618,9 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
}
}
- H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
- HDsprintf(outstr, "xid_%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
+ HDsprintf(outstr, "xid_%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
return 0;
}
@@ -2659,14 +2659,14 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
- char *obj_addr_str = NULL;
+ char *obj_tok_str = NULL;
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
- HDsprintf(type_name, "#%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
+ HDsprintf(type_name, "#%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
@@ -2747,14 +2747,14 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
- char *obj_addr_str = NULL;
+ char *obj_tok_str = NULL;
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
- HDsprintf(type_name, "#%s", obj_addr_str);
- H5free_memory(obj_addr_str);
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
+ HDsprintf(type_name, "#%s", obj_tok_str);
+ H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
index 70c07ee..863ecbe 100644
--- a/tools/src/h5format_convert/CMakeLists.txt
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5FC C)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5format_convert STATIC)
target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5format_convert PROPERTIES FOLDER tools)
@@ -17,6 +18,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5format_convert-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5format_convert-shared SHARED)
target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
index 7be33b5..c1ce006 100644
--- a/tools/src/h5ls/CMakeLists.txt
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5LS C)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5ls STATIC)
target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -19,6 +20,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5ls-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions(h5ls-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5ls-shared SHARED)
target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt
index 967e8d7..a4aa1ef 100644
--- a/tools/src/h5repack/CMakeLists.txt
+++ b/tools/src/h5repack/CMakeLists.txt
@@ -17,6 +17,7 @@ set (REPACK_COMMON_SOURCES
if (NOT ONLY_SHARED_LIBS)
add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repack STATIC)
target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5repack PROPERTIES FOLDER tools)
@@ -28,6 +29,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5repack-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repack-shared SHARED)
target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5repack-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt
index f6cc542..f0722fd 100644
--- a/tools/src/h5stat/CMakeLists.txt
+++ b/tools/src/h5stat/CMakeLists.txt
@@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5STAT C)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5stat STATIC)
target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5stat PROPERTIES FOLDER tools)
@@ -18,6 +19,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5stat-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5stat-shared SHARED)
target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5stat-shared PROPERTIES FOLDER tools)
diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt
index 16e4555..1e9cacc 100644
--- a/tools/src/misc/CMakeLists.txt
+++ b/tools/src/misc/CMakeLists.txt
@@ -8,6 +8,7 @@ project (HDF5_TOOLS_SRC_MISC C)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5debug STATIC)
target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5debug PROPERTIES FOLDER tools)
@@ -15,6 +16,7 @@ if (NOT ONLY_SHARED_LIBS)
add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repart STATIC)
target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5repart PROPERTIES FOLDER tools)
@@ -22,6 +24,7 @@ if (NOT ONLY_SHARED_LIBS)
add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5mkgrp STATIC)
target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5mkgrp PROPERTIES FOLDER tools)
@@ -29,6 +32,7 @@ if (NOT ONLY_SHARED_LIBS)
add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5clear STATIC)
target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5clear PROPERTIES FOLDER tools)
@@ -45,12 +49,14 @@ if (BUILD_SHARED_LIBS)
add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5debug-shared SHARED)
+ target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5debug-shared PROPERTIES FOLDER tools)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared")
add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repart-shared SHARED)
target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5repart-shared PROPERTIES FOLDER tools)
@@ -58,6 +64,7 @@ if (BUILD_SHARED_LIBS)
add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5mkgrp-shared SHARED)
target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools)
@@ -65,6 +72,7 @@ if (BUILD_SHARED_LIBS)
add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5clear-shared SHARED)
target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5clear-shared PROPERTIES FOLDER tools)