From 2b786ffe5a189c203530e42ea0edf7b4a0b93c1a Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Fri, 19 Aug 2022 19:18:30 -0500 Subject: [WIP] 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 --- CMakeLists.txt | 7 ++ config/cmake/HDF5DeveloperBuild.cmake | 203 +++++++++++++++++++++++++++++++++ config/cmake/HDFCXXCompilerFlags.cmake | 2 +- config/cmake/HDFCompilerFlags.cmake | 38 +++++- config/cmake/HDFMacros.cmake | 20 ++-- config/gnu-warnings/developer-12 | 4 + src/CMakeLists.txt | 10 +- src/H5AC.c | 2 +- src/H5ACmpio.c | 14 +-- src/H5ACpkg.h | 4 +- src/H5ACprivate.h | 2 +- src/H5C.c | 86 +++++++------- src/H5Cmpio.c | 48 ++++---- src/H5Cpkg.h | 20 ++-- src/H5Cprivate.h | 36 +++--- src/H5Ctag.c | 4 +- src/H5EAprivate.h | 4 - test/CMakeLists.txt | 63 +++++++++- test/cache_tagging.c | 6 +- test/tmisc.c | 2 +- testpar/CMakeLists.txt | 8 ++ 21 files changed, 449 insertions(+), 134 deletions(-) create mode 100644 config/cmake/HDF5DeveloperBuild.cmake create mode 100644 config/gnu-warnings/developer-12 diff --git a/CMakeLists.txt b/CMakeLists.txt index 476ddf1..3c73597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -659,6 +659,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 e20ed6b..e654db3 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 61218dc..c724547 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -52,7 +52,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 () @@ -174,6 +174,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") @@ -268,6 +272,38 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") endif () endif () + + # Append more extra warning flags that only gcc 12.x+ knows about + # or which should only be enabled for gcc 12.x+ + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-12") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-12") + endif () + endif () +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 () #----------------------------------------------------------------------------- diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 6f517bd..9d98408 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 $) else () - get_property (target_name TARGET ${libtarget} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + get_property (target_name TARGET ${libtarget} PROPERTY $,$>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) set (targetfilename $/${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}) @@ -391,12 +393,12 @@ macro (HDF_DIR_PATHS package_prefix) endif () #set the default debug suffix for all library targets - if(NOT CMAKE_DEBUG_POSTFIX) - if (WIN32) - set (CMAKE_DEBUG_POSTFIX "_D") - else () - set (CMAKE_DEBUG_POSTFIX "_debug") - endif () + if(NOT CMAKE_DEBUG_POSTFIX) + if (WIN32) + set (CMAKE_DEBUG_POSTFIX "_D") + else () + set (CMAKE_DEBUG_POSTFIX "_debug") + endif () endif () SET_HDF_BUILD_TYPE() diff --git a/config/gnu-warnings/developer-12 b/config/gnu-warnings/developer-12 new file mode 100644 index 0000000..0835d96 --- /dev/null +++ b/config/gnu-warnings/developer-12 @@ -0,0 +1,4 @@ +# Enable GCC's static analyzer for GCC 12+ +# (Temporarily disabled as the analyzer currently adds significant +# compile time overhead for a few test files like cache.c) +# -fanalyzer diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a835ebd..9feda96 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1209,10 +1209,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 #----------------------------------------------------------------------------- @@ -1235,7 +1231,8 @@ if (NOT ONLY_SHARED_LIBS) ${HDF_EXTRA_FLAGS} PRIVATE $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:${HDF5_DEBUG_APIS}> + $<$:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1277,7 +1274,8 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:H5_HAVE_THREADSAFE> $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:${HDF5_DEBUG_APIS}> + $<$:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} diff --git a/src/H5AC.c b/src/H5AC.c index 593193d..a51a49b 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -287,7 +287,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 a64c4a4..7c77a94 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 704788f..4de3d61 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -51,7 +51,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 @@ -373,7 +373,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 67a310b..0e0c80c 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -125,7 +125,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 diff --git a/src/H5C.c b/src/H5C.c index 907b076..a62bdf8 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -361,7 +361,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 */ @@ -843,7 +843,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) { @@ -953,7 +953,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 */ @@ -988,7 +988,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 */ @@ -1046,7 +1046,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; @@ -1069,7 +1069,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); @@ -1095,7 +1095,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") @@ -1269,7 +1269,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) || @@ -1461,7 +1461,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") @@ -1500,7 +1500,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") @@ -1825,7 +1825,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") @@ -1931,7 +1931,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") @@ -1978,7 +1978,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 */ @@ -2074,7 +2074,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 */ @@ -2114,7 +2114,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") @@ -2129,7 +2129,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") @@ -2193,7 +2193,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") @@ -2298,7 +2298,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) { @@ -2581,7 +2581,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") @@ -3056,7 +3056,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") @@ -3067,7 +3067,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") @@ -3235,7 +3235,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)) @@ -3502,7 +3502,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)) @@ -4143,7 +4143,7 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t up { herr_t ret_value = SUCCEED; /* Return value */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS FUNC_ENTER_PACKAGE #else FUNC_ENTER_PACKAGE_NOERR @@ -4164,7 +4164,7 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t up /* Update the stats for an unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS done: #endif FUNC_LEAVE_NOAPI(ret_value) @@ -5326,7 +5326,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; @@ -5503,7 +5503,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 */ @@ -5585,7 +5585,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 @@ -5761,7 +5761,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. @@ -6024,7 +6024,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 */ @@ -6041,7 +6041,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)) @@ -6082,7 +6082,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). @@ -6255,7 +6255,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); @@ -6271,7 +6271,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); @@ -6468,7 +6468,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) { @@ -6569,7 +6569,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!?!?!") @@ -7733,7 +7733,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS herr_t H5C_validate_lru_list(H5C_t *cache_ptr) { @@ -7807,7 +7807,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS herr_t H5C_validate_pinned_entry_list(H5C_t *cache_ptr) { @@ -7884,7 +7884,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS herr_t H5C_validate_protected_entry_list(H5C_t *cache_ptr) { @@ -7959,7 +7959,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) { @@ -8427,7 +8427,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; @@ -8450,7 +8450,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); @@ -8476,7 +8476,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 8103989..2c4d3f8 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -169,7 +169,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 @@ -246,7 +246,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; @@ -282,7 +282,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") @@ -340,7 +340,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++) { @@ -681,7 +681,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; @@ -702,7 +702,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") @@ -711,7 +711,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 { @@ -721,7 +721,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") @@ -733,14 +733,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?!?!?") @@ -761,7 +761,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 @@ -816,7 +816,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 */ @@ -847,14 +847,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) { @@ -868,7 +868,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") @@ -898,7 +898,7 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) H5C_cache_entry_t *entry_ptr = NULL; herr_t ret_value = SUCCEED; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS FUNC_ENTER_NOAPI_NOINIT #else FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -923,7 +923,7 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) entry_ptr = prev_ptr; } /* end while */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS done: #endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -1087,7 +1087,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; @@ -1114,7 +1114,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); @@ -1140,7 +1140,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") @@ -1209,7 +1209,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 = @@ -1232,13 +1232,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 */ @@ -1521,7 +1521,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 cfa8a66..4ebce35 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -170,7 +170,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 ) || \ @@ -335,7 +335,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 ) || \ @@ -472,7 +472,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 ) || \ @@ -997,7 +997,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 ) || \ @@ -1601,7 +1601,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)) @@ -1613,7 +1613,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) \ { \ @@ -1747,7 +1747,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) ); \ @@ -1884,7 +1884,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) \ { \ @@ -3308,7 +3308,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 ) || \ @@ -4862,7 +4862,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 66ffc62..fa0ad91 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -207,20 +207,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_flush_tagged_entries(H5F_t *f, haddr_t tag); 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); @@ -2292,11 +2296,11 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t * H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr); H5_DLL herr_t H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS H5_DLL hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); #endif -#if H5C_DO_EXTREME_SANITY_CHECKS +#ifdef H5C_DO_EXTREME_SANITY_CHECKS H5_DLL herr_t H5C_validate_lru_list(H5C_t *cache_ptr); H5_DLL herr_t H5C_validate_pinned_entry_list(H5C_t *cache_ptr); H5_DLL herr_t H5C_validate_protected_entry_list(H5C_t *cache_ptr); diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 556d0e5..b252d38 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -231,7 +231,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) @@ -630,7 +630,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 c9c3f8b..060ea63 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -146,8 +146,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 3149454..4c79110 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,7 +35,9 @@ if (NOT ONLY_SHARED_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}" + $<$:${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}" + $<$:${HDF5_DEVELOPER_DEFS}> ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} @@ -392,6 +397,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};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + $<$:${HDF5_DEVELOPER_DEFS}> + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -432,6 +441,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (chunk_info PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk_info STATIC) @@ -452,6 +465,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (direct_chunk STATIC) @@ -473,6 +490,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf5 STATIC) @@ -493,6 +514,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (cache_image PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (cache_image STATIC) @@ -513,6 +538,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (ttsafe PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (ttsafe STATIC) @@ -539,6 +568,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (thread_id PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (thread_id STATIC) @@ -645,6 +678,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};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + $<$:${HDF5_DEVELOPER_DEFS}> + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -671,6 +708,10 @@ endforeach () # and it can't be renamed (i.e., no -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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (accum_swmr_reader STATIC) @@ -741,6 +782,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_chunk STATIC) @@ -762,6 +807,10 @@ if (HDF5_BUILD_UTILS) # requires mirror server set (use_append_chunk_mirror_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk_mirror.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_chunk_mirror ${use_append_chunk_mirror_SOURCES}) target_compile_options(use_append_chunk_mirror PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(use_append_chunk_mirror + PRIVATE + $<$:${HDF5_DEVELOPER_DEFS}> + ) target_include_directories (use_append_chunk_mirror PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_chunk_mirror STATIC) @@ -783,6 +832,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_mchunks STATIC) @@ -803,6 +856,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${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 6d15ee0..71260a8 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4454,7 +4454,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; @@ -4467,7 +4467,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 Fapl */ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; @@ -4537,7 +4537,7 @@ check_invalid_tag_application(void) return 0; -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS error: if (api_ctx_pushed) H5CX_pop(FALSE); diff --git a/test/tmisc.c b/test/tmisc.c index db48c11..c8da98c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5909,7 +5909,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 907fd0a..7066d66 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -24,6 +24,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 + $<$:${HDF5_DEVELOPER_DEFS}> +) target_include_directories (testphdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) @@ -50,6 +54,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 + $<$:${HDF5_DEVELOPER_DEFS}> + ) target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -- cgit v0.12