diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-03-20 22:39:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 22:39:21 (GMT) |
commit | fd5d0944e23d0ba966e7244f9e3314b84cc45f30 (patch) | |
tree | ec7c054083dec36e454bcb203f8c11f08e18527e | |
parent | b766e5f96f26805e8c92e718a05f42d073912711 (diff) | |
download | hdf5-fd5d0944e23d0ba966e7244f9e3314b84cc45f30.zip hdf5-fd5d0944e23d0ba966e7244f9e3314b84cc45f30.tar.gz hdf5-fd5d0944e23d0ba966e7244f9e3314b84cc45f30.tar.bz2 |
[1.10 Merge] Add Developer build mode to CMake (#2617)
* Add Developer build mode to CMake (#1659)
* Add Developer build mode to CMake
* Set a few CMake variables for Developer build modes
* Refactor enabling of debug and developer-level compile definitions
* Convert cache debugging macros to normal ifdef style
Normal ifdef-style instead of if-style allows build system to define macros
without warning about redefining macros with different values (0 vs. 1)
* Add HDF5 Developer compile definitions to testing files
* Temporarily disable -fanalyzer flag for GCC 12+ Developer builds
* Fix Java tests for Developer build modes (#2079)
* Minor adjustment of Developer build mode changes for 1.10 branch
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | config/cmake/HDF5DeveloperBuild.cmake | 203 | ||||
-rw-r--r-- | config/cmake/HDFCXXCompilerFlags.cmake | 2 | ||||
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 28 | ||||
-rw-r--r-- | config/cmake/HDFMacros.cmake | 8 | ||||
-rw-r--r-- | java/examples/datasets/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/examples/datatypes/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/examples/groups/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/examples/intro/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/H5AC.c | 2 | ||||
-rw-r--r-- | src/H5ACmpio.c | 14 | ||||
-rw-r--r-- | src/H5ACpkg.h | 4 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5C.c | 86 | ||||
-rw-r--r-- | src/H5Cmpio.c | 44 | ||||
-rw-r--r-- | src/H5Cpkg.h | 20 | ||||
-rw-r--r-- | src/H5Cprivate.h | 32 | ||||
-rw-r--r-- | src/H5Ctag.c | 4 | ||||
-rw-r--r-- | src/H5EAprivate.h | 4 | ||||
-rw-r--r-- | test/CMakeLists.txt | 59 | ||||
-rw-r--r-- | test/cache_tagging.c | 8 | ||||
-rw-r--r-- | test/tmisc.c | 2 | ||||
-rw-r--r-- | testpar/CMakeLists.txt | 8 |
25 files changed, 427 insertions, 130 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d116853..fb0a69d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -657,6 +657,13 @@ if (${HDF_CFG_NAME} MATCHES "Debug") endif () #----------------------------------------------------------------------------- +# Add some definitions for Developer Builds +#----------------------------------------------------------------------------- +if (${HDF_CFG_NAME} MATCHES "Developer") + include (${HDF_RESOURCES_DIR}/HDF5DeveloperBuild.cmake) +endif () + +#----------------------------------------------------------------------------- # Option to embed library info into executables #----------------------------------------------------------------------------- if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") diff --git a/config/cmake/HDF5DeveloperBuild.cmake b/config/cmake/HDF5DeveloperBuild.cmake new file mode 100644 index 0000000..53c03de --- /dev/null +++ b/config/cmake/HDF5DeveloperBuild.cmake @@ -0,0 +1,203 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +# CMake settings for HDF5 Developer mode builds + +# Set CMake C++ flags based off of Debug build flags +set (CMAKE_CXX_FLAGS_DEVELOPER ${CMAKE_CXX_FLAGS_DEBUG} CACHE STRING + "Flags used by the C++ compiler during developer builds." FORCE +) + +# Set CMake C flags based off of Debug build flags. Add in -Og +# option to disable some GCC optimizations that might affect +# debugging negatively and also include some GCC compiler passes +# that collect debugging information +set (CMAKE_C_FLAGS_DEVELOPER "${CMAKE_C_FLAGS_DEBUG} -Og" CACHE STRING + "Flags used by the C compiler during developer builds." FORCE +) + +# Set CMake binary linker flags based off of Debug binary linker flags +set (CMAKE_EXE_LINKER_FLAGS_DEVELOPER ${CMAKE_EXE_LINKER_FLAGS_DEBUG} + CACHE STRING "Flags used for linking binaries during developer builds." + FORCE +) + +# Set CMake shared library linker flags based off of Debug shared library +# linker flags +set (CMAKE_SHARED_LINKER_FLAGS_DEVELOPER ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} + CACHE STRING "Flags used by the shared libraries linker during developer builds." + FORCE +) + +mark_as_advanced ( + CMAKE_CXX_FLAGS_DEVELOPER + CMAKE_C_FLAGS_DEVELOPER + CMAKE_EXE_LINKER_FLAGS_DEVELOPER + CMAKE_SHARED_LINKER_FLAGS_DEVELOPER +) + +#----------------------------------------------------------------------------- +# Define various HDF5 macros for debugging the library +#----------------------------------------------------------------------------- + +# Enable debugging of various HDF5 modules +set (HDF5_ENABLE_DEBUG_APIS ON CACHE BOOL "Turn on extra debug output in all packages" FORCE) + +# HDF5 module debug definitions for debug code which either isn't +# currently integrated with HDF5_ENABLE_DEBUG_APIS, or which isn't +# well integrated with HDF5's H5DEBUG(X) (where 'X' is a package +# letter) system. This type of debug code usually always prints output +# to stdout, regardless of whether debugging for its particular module +# has been requested via the HDF5_DEBUG environment variable. Therefore, +# we don't automatically enable this debug code, but allow developers +# to quickly add those definitions into their build here, without +# needing to hack up source files. +option (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES "Enable printing of H5AC module dirty bytes information" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES) +if (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES) + list (APPEND HDF5_DEBUG_APIS H5AC_DEBUG_DIRTY_BYTES_CREATION) +endif () + +option (HDF5_ENABLE_DEBUG_H5FA "Enable debugging of H5FA module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FA) +if (HDF5_ENABLE_DEBUG_H5FA) + list (APPEND HDF5_DEBUG_APIS H5FA_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FD_ALLOC "Enable debugging of H5FD module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FD_ALLOC) +if (HDF5_ENABLE_DEBUG_H5FD_ALLOC) + list (APPEND HDF5_DEBUG_APIS H5FD_ALLOC_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FL "Enable debugging of H5FL module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FL) +if (HDF5_ENABLE_DEBUG_H5FL) + list (APPEND HDF5_DEBUG_APIS H5FL_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS "Enable debugging of H5FS module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS) +if (HDF5_ENABLE_DEBUG_H5FS) + list (APPEND HDF5_DEBUG_APIS H5FS_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS_SINFO "Enable debugging of H5FS module section info" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS_SINFO) +if (HDF5_ENABLE_DEBUG_H5FS_SINFO) + list (APPEND HDF5_DEBUG_APIS H5FS_SINFO_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_AGGR "Enable debugging of H5MF module aggregation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_AGGR) +if (HDF5_ENABLE_DEBUG_H5MF_AGGR) + list (APPEND HDF5_DEBUG_APIS H5MF_AGGR_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC "Enable debugging of H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE "Enable extra debugging of H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG_MORE) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP "Enable printing of debugging info for H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG_DUMP) +endif () + +option (HDF5_ENABLE_DEBUG_H5R "Enable debugging of H5R module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5R) +if (HDF5_ENABLE_DEBUG_H5R) + list (APPEND HDF5_DEBUG_APIS H5R_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5S_HYPER "Enable debugging of H5S hyperslab code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5S_HYPER) +if (HDF5_ENABLE_DEBUG_H5S_HYPER) + list (APPEND HDF5_DEBUG_APIS H5S_HYPER_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5T_REF "Enable debugging of H5T module reference code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5T_REF) +if (HDF5_ENABLE_DEBUG_H5T_REF) + list (APPEND HDF5_DEBUG_APIS H5T_REF_DEBUG) +endif () + +# HDF5 module debug definitions for debug code which may add +# considerable amounts of overhead when enabled and is usually +# only useful for specific circumstances rather than general +# developer use. +option (HDF5_ENABLE_DEBUG_H5B "Enable debugging of H5B module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5B) +if (HDF5_ENABLE_DEBUG_H5B) + list (APPEND HDF5_DEBUG_APIS H5B_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5B2 "Enable debugging of H5B2 module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5B2) +if (HDF5_ENABLE_DEBUG_H5B2) + list (APPEND HDF5_DEBUG_APIS H5B2_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS "Enable full sanity checking in H5C module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS) +if (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_SLIST_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_TAGGING_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_EXTREME_SANITY_CHECKS) + + # See note in H5Cprivate.h about this #define + # list (APPEND HDF5_DEBUG_APIS H5C_DO_MEMORY_SANITY_CHECKS=1) +endif () + +option (HDF5_ENABLE_DEBUG_H5FL_TRACK "Enable tracking of free list allocations" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FL_TRACK) +if (HDF5_ENABLE_DEBUG_H5FL_TRACK) + list (APPEND HDF5_DEBUG_APIS H5FL_TRACK) + + # Free list tracking requires the codestack functionality + set (HDF5_ENABLE_CODESTACK ON CACHE BOOL "Enable the function stack tracing (for developer debugging)." FORCE) +else () + unset (HDF5_ENABLE_CODESTACK CACHE) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS_ASSERT "Enable extra debugging of H5FS module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS_ASSERT) +if (HDF5_ENABLE_DEBUG_H5FS_ASSERT) + list (APPEND HDF5_DEBUG_APIS H5FS_DEBUG_ASSERT) +endif () + +# If HDF5 free list debugging wasn't specifically enabled, disable +# free lists entirely for developer build modes, as they can +# make certain types of issues (like references to stale pointers) +# much more difficult to debug +if (NOT HDF5_ENABLE_DEBUG_H5FL AND NOT HDF5_ENABLE_DEBUG_H5FL_TRACK) + list (APPEND HDF5_DEVELOPER_DEFS H5_NO_FREE_LISTS) +endif () + +# Enable strict checking of the file format +list (APPEND HDF5_DEVELOPER_DEFS H5_STRICT_FORMAT_CHECKS) + +# Enable printing of library memory stats +option (HDF5_ENABLE_MEMORY_STATS "Enable printing of library memory stats" OFF) +mark_as_advanced (HDF5_ENABLE_MEMORY_STATS) +if (HDF5_ENABLE_MEMORY_STATS) + list (APPEND HDF5_DEVELOPER_DEFS H5MM_PRINT_MEMORY_STATS) +endif () diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index e656146..bd730a9 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -53,7 +53,7 @@ endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index a9b1a42..48c8132 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -51,7 +51,7 @@ endif() if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () @@ -173,6 +173,10 @@ endif () # Developer warnings (suggestions from gcc, not code problems) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) +if (${HDF_CFG_NAME} MATCHES "Developer") + # Developer build modes should always have these types of warnings enabled + set (HDF5_ENABLE_DEV_WARNINGS ON CACHE BOOL "Enable HDF5 developer group warnings" FORCE) +endif () if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") @@ -280,6 +284,28 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") endif () #----------------------------------------------------------------------------- +# Option to allow the user to enable debug output +# from various HDF5 modules +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) +if (HDF5_ENABLE_DEBUG_APIS) + # Add standard debug definitions to any existing ones + list (APPEND HDF5_DEBUG_APIS + H5AC_DEBUG + H5CX_DEBUG + H5D_DEBUG + H5D_CHUNK_DEBUG + H5F_DEBUG + H5HL_DEBUG + H5I_DEBUG + H5O_DEBUG + H5S_DEBUG + H5T_DEBUG + H5Z_DEBUG + ) +endif () + +#----------------------------------------------------------------------------- # Option to allow the user to enable all warnings #----------------------------------------------------------------------------- option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" ON) diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 7483f3c..061713e 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -34,7 +34,7 @@ macro (SET_HDF_BUILD_TYPE) set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") + "MinSizeRel" "RelWithDebInfo" "Developer") endif () endmacro () @@ -80,7 +80,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (${libtype} MATCHES "SHARED") set (targetfilename $<TARGET_PDB_FILE:${libtarget}>) else () - get_property (target_name TARGET ${libtarget} PROPERTY $<IF:$<CONFIG:Debug>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + get_property (target_name TARGET ${libtarget} PROPERTY $<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) set (targetfilename $<TARGET_FILE_DIR:${libtarget}>/${target_name}.pdb) endif () install ( @@ -124,6 +124,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME ${LIB_RELEASE_NAME} # OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} + OUTPUT_NAME_DEVELOPER ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} @@ -133,6 +134,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) if (WIN32) set_target_properties (${libtarget} PROPERTIES COMPILE_PDB_NAME_DEBUG ${LIB_DEBUG_NAME} + COMPILE_PDB_NAME_DEVELOPER ${LIB_DEBUG_NAME} COMPILE_PDB_NAME_RELEASE ${LIB_RELEASE_NAME} COMPILE_PDB_NAME_MINSIZEREL ${LIB_RELEASE_NAME} COMPILE_PDB_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} @@ -158,7 +160,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index b8036e5..f73b88e 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -80,7 +80,7 @@ endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) if (example STREQUAL "H5Ex_D_External") diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 26fb116..94dda1b 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -65,7 +65,7 @@ endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index a3b328f..458c958 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -64,7 +64,7 @@ add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 0a96173..8f2269f 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -54,7 +54,7 @@ endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index c25decae..e90ae8f 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -115,7 +115,7 @@ else () endif () get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7e29d4..2e23cad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1085,10 +1085,6 @@ if (BUILD_SHARED_LIBS) ) endif () -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" -option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- @@ -1111,7 +1107,8 @@ if (BUILD_STATIC_LIBS) ${HDF_EXTRA_FLAGS} PRIVATE $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API - $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:${HDF5_DEBUG_APIS}> + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1153,7 +1150,8 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE> $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API - $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:${HDF5_DEBUG_APIS}> + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} @@ -316,7 +316,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co aux_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD; aux_ptr->dirty_bytes = 0; aux_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->dirty_bytes_propagations = 0; aux_ptr->unprotect_dirty_bytes = 0; aux_ptr->unprotect_dirty_bytes_updates = 0; diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index c0a9856..a7da851 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -763,7 +763,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -778,7 +778,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) } /* end if */ else { aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -976,7 +976,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->insert_dirty_bytes += entry_ptr->size; aux_ptr->insert_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1093,7 +1093,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) aux_ptr->dirty_bytes += entry_size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1106,7 +1106,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) else if (!entry_dirty) { aux_ptr->dirty_bytes += entry_size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -2117,7 +2117,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/m/mu) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank, aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes, aux_ptr->unprotect_dirty_bytes_updates, aux_ptr->insert_dirty_bytes, @@ -2180,7 +2180,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) /* reset the dirty bytes count */ aux_ptr->dirty_bytes = 0; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->dirty_bytes_propagations += 1; aux_ptr->unprotect_dirty_bytes = 0; aux_ptr->unprotect_dirty_bytes_updates = 0; diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 5f59c96..45fa966 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -50,7 +50,7 @@ H5FL_EXTERN(H5AC_aux_t); /* Package Private Macros */ /**************************/ -#define H5AC_DEBUG_DIRTY_BYTES_CREATION 0 +/* #define H5AC_DEBUG_DIRTY_BYTES_CREATION */ #ifdef H5_HAVE_PARALLEL @@ -372,7 +372,7 @@ typedef struct H5AC_aux_t { int32_t metadata_write_strategy; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION unsigned dirty_bytes_propagations; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 0c81b8f..18b89f9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -124,7 +124,7 @@ typedef enum { #define H5AC__DEFAULT_MIN_CLEAN_SIZE H5C__DEFAULT_MIN_CLEAN_SIZE /* Check if we are sanity checking tagging */ -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS #define H5AC_DO_TAGGING_SANITY_CHECKS 1 #else #define H5AC_DO_TAGGING_SANITY_CHECKS 0 @@ -154,11 +154,11 @@ static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_ static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, hbool_t actual); -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS static hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); #endif /* H5C_DO_SLIST_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS static herr_t H5C_validate_lru_list(H5C_t *cache_ptr); static herr_t H5C_validate_pinned_entry_list(H5C_t *cache_ptr); static herr_t H5C_validate_protected_entry_list(H5C_t *cache_ptr); @@ -390,7 +390,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, * slist_ptr initialized above. */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS cache_ptr->slist_len_increase = 0; cache_ptr->slist_size_increase = 0; #endif /* H5C_DO_SANITY_CHECKS */ @@ -872,7 +872,7 @@ H5C_dest(H5F_t *f) H5MM_xfree(cache_ptr->log_info); #ifndef NDEBUG -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (cache_ptr->get_entry_ptr_from_addr_counter > 0) { @@ -982,7 +982,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag HDassert(type); HDassert(H5F_addr_defined(addr)); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1017,7 +1017,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry") done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_lru_list(cache_ptr) < 0) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1075,7 +1075,7 @@ done: herr_t H5C_flush_cache(H5F_t *f, unsigned flags) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int i; uint32_t index_len = 0; size_t index_size = (size_t)0; @@ -1099,7 +1099,7 @@ H5C_flush_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->slist_ptr); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); @@ -1125,7 +1125,7 @@ H5C_flush_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr->slist_size == slist_size); #endif /* H5C_DO_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -1300,7 +1300,7 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u HDassert(H5F_addr_defined(addr)); HDassert(thing); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS /* no need to verify that entry is not already in the index as */ /* we already make that check below. */ if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || @@ -1491,7 +1491,7 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done") @@ -1530,7 +1530,7 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u #endif done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") @@ -1855,7 +1855,7 @@ H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, hadd HDassert(H5F_addr_defined(new_addr)); HDassert(H5F_addr_ne(old_addr, new_addr)); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -1961,7 +1961,7 @@ H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, hadd H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") @@ -2008,7 +2008,7 @@ H5C_resize_entry(void *thing, size_t new_size) if (!(entry_ptr->is_pinned || entry_ptr->is_protected)) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2104,7 +2104,7 @@ H5C_resize_entry(void *thing, size_t new_size) } /* end if */ done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2144,7 +2144,7 @@ H5C_pin_protected_entry(void *thing) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -2159,7 +2159,7 @@ H5C_pin_protected_entry(void *thing) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") @@ -2223,7 +2223,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); HDassert(H5F_addr_defined(addr)); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry") @@ -2328,7 +2328,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign } /* end if */ #endif /* H5_HAVE_PARALLEL */ -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS { /* Verify tag value */ if (cache_ptr->ignore_tags != TRUE) { @@ -2611,7 +2611,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign #endif /* H5_HAVE_PARALLEL */ done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit") @@ -3086,7 +3086,7 @@ H5C_unpin_entry(void *_entry_ptr) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -3097,7 +3097,7 @@ H5C_unpin_entry(void *_entry_ptr) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry from client") done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") @@ -3265,7 +3265,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) dirtied |= entry_ptr->dirtied; was_clean = !(entry_ptr->is_dirty); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) @@ -3532,7 +3532,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) @@ -5347,7 +5347,7 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr->slist_ptr); HDassert(cache_ptr->slist_enabled); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS { int32_t i; uint32_t index_len = 0; @@ -5524,7 +5524,7 @@ H5C_flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) H5SL_node_t *node_ptr = NULL; H5C_cache_entry_t *entry_ptr = NULL; H5C_cache_entry_t *next_entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS uint32_t initial_slist_len = 0; size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ @@ -5606,7 +5606,7 @@ H5C_flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) * that the slist will not be empty after we finish the scan. */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* Depending on circumstances, H5C__flush_single_entry() will * remove dirty entries from the slist as it flushes them. * Thus for sanity checks we must make note of the initial @@ -5782,7 +5782,7 @@ H5C_flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) } /* end if */ } /* end while loop scanning skip list */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* It is possible that entries were added to the slist during * the scan, either before or after scan pointer. The following * asserts take this into account. @@ -6045,7 +6045,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) H5SL_node_t *node_ptr = NULL; H5C_cache_entry_t *entry_ptr = NULL; H5C_cache_entry_t *next_entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS uint32_t initial_slist_len = 0; size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ @@ -6062,7 +6062,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HDassert(ring > H5C_RING_UNDEFINED); HDassert(ring < H5C_RING_NTYPES); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) @@ -6103,7 +6103,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) flushed_entries_last_pass = FALSE; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* For sanity checking, try to verify that the skip list has * the expected size and number of entries at the end of each * internal while loop (see below). @@ -6276,7 +6276,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) } /* end if */ } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* Verify that the slist size and length are as expected. */ HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == cache_ptr->slist_len); @@ -6292,7 +6292,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (!flush_marked_entries) { HDassert(cache_ptr->slist_ring_len[ring] == 0); @@ -6489,7 +6489,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) } /* end if */ /* run initial sanity checks */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (cache_ptr->slist_enabled) { if (entry_ptr->in_slist) { @@ -6590,7 +6590,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) HDassert(entry_ptr->is_dirty); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if ((cache_ptr->check_write_permitted) && (!(cache_ptr->write_permitted))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") @@ -7760,7 +7760,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS static herr_t H5C_validate_lru_list(H5C_t *cache_ptr) @@ -7862,7 +7862,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS static herr_t H5C_validate_pinned_entry_list(H5C_t *cache_ptr) @@ -7969,7 +7969,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS static herr_t H5C_validate_protected_entry_list(H5C_t *cache_ptr) @@ -8072,7 +8072,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS static hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) @@ -8545,7 +8545,7 @@ H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, const H5C_cache_en herr_t H5C__serialize_cache(H5F_t *f) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int i; uint32_t index_len = 0; size_t index_size = (size_t)0; @@ -8568,7 +8568,7 @@ H5C__serialize_cache(H5F_t *f) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->slist_ptr); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); @@ -8594,7 +8594,7 @@ H5C__serialize_cache(H5F_t *f) HDassert(cache_ptr->slist_size == slist_size); #endif /* H5C_DO_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 8c85145..6babb9c 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -168,7 +168,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; H5C_cache_entry_t *entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG @@ -247,7 +247,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha } /* end else */ HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* Verify that the candidate assignment table has the expected form */ for (u = 1; u < (unsigned)(mpi_size - 1); u++) { unsigned a, b; @@ -283,7 +283,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha addr = candidates_list_ptr[u]; HDassert(H5F_addr_defined(addr)); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (u > 0) { if (last_addr == addr) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "duplicate entry in cleaned list") @@ -341,7 +341,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha } /* end if */ } /* end for */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS m = 0; n = 0; for (u = 0; u < H5C_RING_NTYPES; u++) { @@ -682,7 +682,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr unsigned initial_list_len; haddr_t addr; unsigned pinned_entries_marked = 0; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS unsigned protected_entries_marked = 0; unsigned other_entries_marked = 0; haddr_t last_addr; @@ -703,7 +703,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr HDassert(ce_array_len > 0); HDassert(ce_array_ptr != NULL); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -712,7 +712,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr for (u = 0; u < ce_array_len; u++) { addr = ce_array_ptr[u]; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (u == 0) last_addr = addr; else { @@ -722,7 +722,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cleaned list not sorted") } /* end else */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed in for loop") @@ -734,14 +734,14 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) if (entry_ptr == NULL) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u, addr); #endif /* H5C_DO_SANITY_CHECKS */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?") } /* end if */ else if (!entry_ptr->is_dirty) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr); #endif /* H5C_DO_SANITY_CHECKS */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") @@ -762,7 +762,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr entry_ptr->clear_on_unprotect = TRUE; if (entry_ptr->is_pinned) pinned_entries_marked++; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS else if (entry_ptr->is_protected) protected_entries_marked++; else @@ -817,7 +817,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr entries_examined++; } /* end while */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(entries_cleared == other_entries_marked); #endif /* H5C_DO_SANITY_CHECKS */ @@ -848,14 +848,14 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr } /* end while */ } /* end while */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(entries_cleared == pinned_entries_marked + other_entries_marked); HDassert(entries_cleared + protected_entries_marked == ce_array_len); #endif /* H5C_DO_SANITY_CHECKS */ HDassert((entries_cleared == ce_array_len) || ((ce_array_len - entries_cleared) <= cache_ptr->pl_len)); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS u = 0; entry_ptr = cache_ptr->pl_head_ptr; while (entry_ptr != NULL) { @@ -869,7 +869,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr #endif /* H5C_DO_SANITY_CHECKS */ done: -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") @@ -1119,7 +1119,7 @@ static herr_t H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES], unsigned entries_to_clear[H5C_RING_NTYPES]) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int i; uint32_t index_len = 0; size_t index_size = (size_t)0; @@ -1146,7 +1146,7 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES HDassert(entries_to_flush[H5C_RING_UNDEFINED] == 0); HDassert(entries_to_clear[H5C_RING_UNDEFINED] == 0); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); @@ -1172,7 +1172,7 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES HDassert(cache_ptr->slist_size == slist_size); #endif /* H5C_DO_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") @@ -1241,7 +1241,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu hbool_t restart_scan = FALSE; unsigned entries_flushed = 0; unsigned entries_cleared = 0; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS unsigned init_index_len; #endif /* H5C_DO_SANITY_CHECKS */ unsigned clear_flags = @@ -1264,13 +1264,13 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu HDassert(ring > H5C_RING_UNDEFINED); HDassert(ring < H5C_RING_NTYPES); -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* index len should not change */ init_index_len = cache_ptr->index_len; #endif /* H5C_DO_SANITY_CHECKS */ @@ -1553,7 +1553,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu * ( progress ) ) */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS HDassert(init_index_len == cache_ptr->index_len); #endif /* H5C_DO_SANITY_CHECKS */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 6afa38f..adc43e9 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -169,7 +169,7 @@ * ****************************************************************************/ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ if ( ( (head_ptr) == NULL ) || \ @@ -334,7 +334,7 @@ if ( ( (new_size) > (dll_size) ) || \ H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ } /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ if ( ( (hd_ptr) == NULL ) || \ @@ -471,7 +471,7 @@ if ( ( (entry_ptr) == NULL ) || \ } \ } /* H5C__AUX_DLL_REMOVE() */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ if ( ( (hd_ptr) == NULL ) || \ @@ -996,7 +996,7 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ #define H5C__HASH_FCN(x) (int)((unsigned)((x) & H5C__HASH_MASK) >> 3) -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ if ( ( (cache_ptr) == NULL ) || \ @@ -1600,7 +1600,7 @@ if ( ( (cache_ptr)->index_size != \ * two #defines are easy to confuse. */ -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS #define ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ H5C_entry_in_skip_list((cache_ptr), (entry_ptr)) @@ -1612,7 +1612,7 @@ if ( ( (cache_ptr)->index_size != \ #endif /* H5C_DO_SLIST_SANITY_CHECKS */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ { \ @@ -1746,7 +1746,7 @@ if ( ( (cache_ptr)->index_size != \ *------------------------------------------------------------------------- */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ { \ HDassert( (cache_ptr) ); \ @@ -1883,7 +1883,7 @@ if ( ( (cache_ptr)->index_size != \ *------------------------------------------------------------------------- */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ { \ @@ -3307,7 +3307,7 @@ if ( ( (cache_ptr)->index_size != \ #ifdef H5_HAVE_PARALLEL -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS #define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ if ( ( (hd_ptr) == NULL ) || \ @@ -4861,7 +4861,7 @@ struct H5C_t { size_t slist_ring_size[H5C_RING_NTYPES]; H5SL_t * slist_ptr; uint32_t num_last_entries; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int32_t slist_len_increase; int64_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5d5f9ca..e7513f9 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -206,20 +206,24 @@ #define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */ /* Debugging/sanity checking/statistics settings */ -#ifndef NDEBUG -#define H5C_DO_SANITY_CHECKS 1 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 1 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#else /* NDEBUG */ -/* With rare exceptions, the following defines should be set - * to 0 if NDEBUG is defined +/* #define H5C_DO_SANITY_CHECKS */ +/* #define H5C_DO_SLIST_SANITY_CHECKS */ +/* #define H5C_DO_TAGGING_SANITY_CHECKS */ +/* #define H5C_DO_EXTREME_SANITY_CHECKS */ + +/* + * If not already set externally (e.g., from the build + * system), set a few debugging options for debug builds. */ -#define H5C_DO_SANITY_CHECKS 0 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 0 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#endif /* NDEBUG */ +#ifndef NDEBUG +#ifndef H5C_DO_SANITY_CHECKS +#define H5C_DO_SANITY_CHECKS +#endif + +#ifndef H5C_DO_TAGGING_SANITY_CHECKS +#define H5C_DO_TAGGING_SANITY_CHECKS +#endif +#endif /* Cork actions: cork/uncork/get cork status of an object */ #define H5C__SET_CORK 0x1 @@ -2236,7 +2240,7 @@ H5_DLL herr_t H5C_force_cache_image_load(H5F_t *f); H5_DLL herr_t H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global); H5_DLL herr_t H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags); H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag); -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS herr_t H5C_verify_tag(int id, haddr_t tag); #endif H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f); diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 87af41f..67f44c9 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -230,7 +230,7 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) if (!H5F_addr_defined(tag)) tag = H5AC__IGNORE_TAG; } -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS else { /* Perform some sanity checks to ensure that a correct tag is being applied */ if (H5C_verify_tag(entry->type->id, tag) < 0) @@ -629,7 +629,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__mark_tagged_entries() */ -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS /*------------------------------------------------------------------------- * diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index eddbb87..93f3fcc 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -150,8 +150,4 @@ H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); -/* Debugging routines */ -#ifdef H5EA_DEBUGGING -#endif /* H5EA_DEBUGGING */ - #endif /* H5EAprivate_H */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 21af76b..c6467ba 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,7 +35,9 @@ if (BUILD_STATIC_LIBS) ) target_compile_options(${HDF5_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_TEST_LIB_TARGET} - PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} @@ -57,8 +59,11 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} @@ -299,6 +304,10 @@ macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -339,6 +348,10 @@ endforeach () #-- Adding test for chunk_info add_executable (chunk_info ${HDF5_TEST_SOURCE_DIR}/chunk_info.c) target_compile_options(chunk_info PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(chunk_info + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (chunk_info PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk_info STATIC) @@ -359,6 +372,10 @@ endif () #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) target_compile_options(direct_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(direct_chunk + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (direct_chunk STATIC) @@ -380,6 +397,10 @@ endif () #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) target_compile_options(testhdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(testhdf5 + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf5 STATIC) @@ -400,6 +421,10 @@ endif () #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) target_compile_options(cache_image PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(cache_image + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (cache_image PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (cache_image STATIC) @@ -420,6 +445,10 @@ endif () #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) target_compile_options(ttsafe PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(ttsafe + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (ttsafe PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (ttsafe STATIC) @@ -446,6 +475,10 @@ endif () #-- Adding test for thread_id add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c) target_compile_options(thread_id PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(thread_id + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (thread_id PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (thread_id STATIC) @@ -552,6 +585,10 @@ macro (ADD_H5_VDS_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c ${HDF5_TEST_SOURCE_DIR}/vds_swmr.h) target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -578,6 +615,10 @@ endforeach () # and it can't be renamed (i.e., no <foo>-shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) target_compile_options(accum_swmr_reader PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(accum_swmr_reader + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (accum_swmr_reader STATIC) @@ -622,6 +663,10 @@ endif () set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) target_compile_options(use_append_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(use_append_chunk + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_chunk STATIC) @@ -642,6 +687,10 @@ endif () set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) target_compile_options(use_append_mchunks PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(use_append_mchunks + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_mchunks STATIC) @@ -662,6 +711,10 @@ endif () set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) target_compile_options(use_disable_mdc_flushes PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(use_disable_mdc_flushes + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 583c665..62ae5a4 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4262,7 +4262,7 @@ error: static unsigned check_invalid_tag_application(void) { -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS /* Variables */ H5F_t *f = NULL; hid_t fid = -1; @@ -4274,7 +4274,7 @@ check_invalid_tag_application(void) /* Testing Macro */ TESTING("failure on invalid tag application"); -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -4337,13 +4337,13 @@ check_invalid_tag_application(void) return 0; +#ifdef H5C_DO_TAGGING_SANITY_CHECKS error: -#if H5C_DO_TAGGING_SANITY_CHECKS if (api_ctx_pushed) H5CX_pop(); -#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ } /* check_invalid_tag_application */ /*------------------------------------------------------------------------- diff --git a/test/tmisc.c b/test/tmisc.c index 8c431f5..d0a1c63 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5756,7 +5756,7 @@ test_misc35(void) ret = H5get_free_list_sizes(®_size_start, &arr_size_start, &blk_size_start, &fac_size_start); CHECK(ret, FAIL, "H5get_free_list_sizes"); -#if !defined H5_USING_MEMCHECKER +#if !defined H5_NO_FREE_LISTS && !defined H5_USING_MEMCHECKER /* All the free list values should be >0 */ CHECK(reg_size_start, 0, "H5get_free_list_sizes"); CHECK(arr_size_start, 0, "H5get_free_list_sizes"); diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 2dde7ae..74f5bd9 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -23,6 +23,10 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(testphdf5 + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (testphdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) @@ -49,6 +53,10 @@ endif () macro (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + $<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}> + ) target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) |