From b3b6dcb44abef88b767a64c24098ada09c28db24 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Jun 2019 17:10:46 -0500 Subject: Correct CMake issues --- config/cmake/jrunTest.cmake | 2 +- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/FindSZIP.cmake | 2 +- config/cmake_ext_mod/HDFMacros.cmake | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index fc49275..44ac15b 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -9,7 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# runTest.cmake executes a command and captures the output in a file. File is then compared +# jrunTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. cmake_policy(SET CMP0007 NEW) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index bbd5170..63d9ee9 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -28,7 +28,7 @@ if (APPLE) list (LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) if (ARCH_LENGTH GREATER 1) set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE) - message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" + message (FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" "due to technical reasons. The best approach would be build each architecture in separate directories" "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'" "variable has been set to a blank value which will build the default architecture for this system.") diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 97a2336..152f8ac 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -27,7 +27,7 @@ # Result variables ################### -This module will set the following variables in your project: +# This module will set the following variables in your project: # SZIP_FOUND, true if the SZIP headers and libraries were found. # SZIP_INCLUDE_DIR, the directory containing the SZIP headers. diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index e971224..9da5006 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -28,7 +28,7 @@ macro (SET_HDF_BUILD_TYPE) endif() endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + message (STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") 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" @@ -224,10 +224,9 @@ macro (TARGET_C_PROPERTIES wintarget libtype) $<$:${WIN_COMPILE_FLAGS}> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries(${wintarget} INTERFACE - $<$:${WIN_LINK_FLAGS}> - $<$:${WIN_LINK_FLAGS}> - ) + if(MSVC) + set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") + endif() endmacro () #----------------------------------------------------------------------------- -- cgit v0.12 From 562cd7f3ab9fc929cda5772e61195c4ffcff88c0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Jun 2019 10:35:55 -0500 Subject: Cleanup possible CMake target conflicts --- fortran/test/CMakeLists.txt | 9 ++++---- tools/test/h5copy/CMakeLists.txt | 22 +++++++++---------- tools/test/h5diff/CMakeLists.txt | 22 +++++++++---------- tools/test/h5dump/CMakeLists.txt | 22 +++++++++---------- tools/test/h5ls/CMakeLists.txt | 22 +++++++++---------- tools/test/h5repack/CMakeLists.txt | 44 ++++++++++++++++++------------------- tools/test/perform/pio_standalone.c | 4 ++++ 7 files changed, 74 insertions(+), 71 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 3f049af..738638a 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -31,13 +31,12 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) -endif () -if (NOT ONLY_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +else () + file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () #----------------------------------------------------------------------------- diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index 57c8fc6..ecf371f 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5COPY_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") + set (H5COPY_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5COPY_TOOL_PLUGIN_LIB_CORENAME}") + set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) + target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5COPY_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index b01cbc4..0a874ec 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DIFF_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") + set (H5DIFF_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) + target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DIFF_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index df90ed4..1672774 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5DUMP C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DUMP_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (H5DUMP_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,12 +21,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DUMP_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index f5c5671..0da03c5 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5LS C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5LS_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (H5LS_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5LS_TOOL_PLUGIN_LIB_CORENAME}") + set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,12 +21,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5LS_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 1f4428f..92b61fc 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -43,24 +43,24 @@ set_target_properties (h5repacktest PROPERTIES FOLDER tools) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") - set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (H5REPACK_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_TARGET ${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (H5REPACK_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") - add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) - target_include_directories (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -68,20 +68,20 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index bd5fb6f..d5f681e 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -170,6 +170,7 @@ print_version(const char *progname) MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ #endif +#if 0 int h5_set_info_object(void) { @@ -277,3 +278,6 @@ h5_dump_info_object(MPI_Info info) } } + +#endif + -- cgit v0.12 From 08df37027c1660024cb8a7251a29386f2451c818 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Jun 2019 13:59:49 -0500 Subject: HDFFV-10805 Fix test of library libinfo --- test/CMakeTests.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 1e7ddff..3d986d2 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -867,12 +867,19 @@ set_tests_properties (H5TEST-links_env PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -#-- Adding test for libinfo -add_test (NAME H5TEST-testlibinfo - COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) +if (NOT BUILD_SHARED_LIBS) + #-- Adding test for libinfo + add_test (NAME H5TEST-testlibinfo + COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +else () + #-- Adding test for libinfo + add_test (NAME H5TEST-testlibinfo + COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +endif () ############################################################################## ### F I L T E R P L U G I N T E S T S -- cgit v0.12 From aa9a979fbb07c56ebe5ccebb9b92c8eb58b9bacd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Jun 2019 15:42:35 -0500 Subject: Add missing fortran mods --- fortran/src/CMakeLists.txt | 2 ++ tools/test/misc/CMakeTestsMkgrp.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 4e60361..b01e4d4 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -383,6 +383,7 @@ if (NOT ONLY_SHARED_LIBS) ${MOD_BUILD_DIR}/h5r.mod ${MOD_BUILD_DIR}/h5s.mod ${MOD_BUILD_DIR}/h5t.mod + ${MOD_BUILD_DIR}/h5vl.mod ${MOD_BUILD_DIR}/h5z.mod ${MOD_BUILD_DIR}/h5_gen.mod ) @@ -415,6 +416,7 @@ if (BUILD_SHARED_LIBS) ${MODSH_BUILD_DIR}/h5r.mod ${MODSH_BUILD_DIR}/h5s.mod ${MODSH_BUILD_DIR}/h5t.mod + ${MODSH_BUILD_DIR}/h5vl.mod ${MODSH_BUILD_DIR}/h5z.mod ${MODSH_BUILD_DIR}/h5_gen.mod ) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index 3ac5fc1..db1f805 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -82,7 +82,7 @@ if (last_test) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) add_test ( NAME H5MKGRP-${resultfile}-h5ls -- cgit v0.12 From b106b883cc620dee06f560598acc159dd106b7cd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Jun 2019 06:31:01 -0500 Subject: HDFFV-10805 cleanup examples and test code --- examples/CMakeLists.txt | 1 - hl/tools/gif2h5/CMakeTests.cmake | 16 +++++++++++----- hl/tools/h5watch/CMakeTests.cmake | 12 +++++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 0c1157f..6e1f79d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -49,7 +49,6 @@ foreach (example ${examples}) TARGET_C_PROPERTIES (${example} SHARED) target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET}) endif () - target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (${example} PROPERTIES FOLDER examples) endforeach () diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 61c004e..1cc989c 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -27,6 +27,12 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "$ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files") add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list}) +if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") +else () + set (tgt_ext "-shared") +endif () + # Remove any output file left over from previous test run add_test ( NAME HL_TOOLS-clear-objects @@ -38,19 +44,19 @@ add_test ( image24.gif ) -add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index e5a7641..fba8484 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -68,12 +68,18 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -91,7 +97,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -116,7 +122,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -- cgit v0.12 From c24f11070aea56331110628d7645332534e4f227 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Jun 2019 08:54:49 -0500 Subject: Add H5_HLDLL prefix for windows link --- hl/src/H5LDprivate.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hl/src/H5LDprivate.h b/hl/src/H5LDprivate.h index b52928b..203bcea 100644 --- a/hl/src/H5LDprivate.h +++ b/hl/src/H5LDprivate.h @@ -19,9 +19,9 @@ #include "H5LDpublic.h" /* Store information for a field in for a compound data type */ -/* +/* * Note: This data structure is used by both H5LD.c and hl/tools/h5watch - * This declaration is repeated in tools/lib/h5tools_str.c + * This declaration is repeated in tools/lib/h5tools_str.c */ typedef struct H5LD_memb_t { size_t tot_offset; @@ -30,7 +30,10 @@ typedef struct H5LD_memb_t { char **names; } H5LD_memb_t; -/* +#ifdef __cplusplus +extern "C" { +#endif +/* * Note that these two private routines are called by hl/tools/h5watch. * Have considered the following options: * 1) Repeat the coding in both H5LD.c and h5watch @@ -40,8 +43,12 @@ typedef struct H5LD_memb_t { * #2: these two routines are too specific to be made as public routines * Decide to do #3 at this point of time after some discussion. */ -void H5LD_clean_vector(H5LD_memb_t *listv[]); -int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid); +H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]); +H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid); + +#ifdef __cplusplus +} +#endif #endif /* end _H5LDprivate_H */ -- cgit v0.12 From 61b2dddc25483f43be5869d3436ee20e9864e05a Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 20 Jun 2019 16:14:33 -0500 Subject: Checkin for new shutting down free-space manager. --- src/H5AC.c | 68 ++- src/H5ACprivate.h | 1 + src/H5Cprivate.h | 1 + src/H5Cquery.c | 28 ++ src/H5FScache.c | 60 ++- src/H5FSsection.c | 216 ++++----- src/H5Fint.c | 6 +- src/H5Fpkg.h | 11 +- src/H5Fprivate.h | 9 +- src/H5Fquery.c | 36 +- src/H5Fsuper.c | 38 +- src/H5MF.c | 482 +++++---------------- src/H5MFaggr.c | 2 +- src/H5MFdbg.c | 8 +- src/H5Ocache_image.c | 33 +- test/cache_image.c | 29 +- test/cache_tagging.c | 23 +- test/fheap.c | 57 +-- test/mf.c | 59 +-- .../SP.h5repack_fsm_aggr_nopersist.h5.ddl | 6 +- .../h5repack/testfiles/SPT.h5repack_aggr.h5.ddl | 4 +- 21 files changed, 448 insertions(+), 729 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index dc88fd4..f6243ad 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -698,46 +698,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_force_cache_image_load() - * - * Purpose: On rare occasions, it is necessary to run - * H5MF_tidy_self_referential_fsm_hack() prior to the first - * metadata cache access. This is a problem as if there is a - * cache image at the end of the file, that routine will - * discard it. - * - * We solve this issue by calling this function, which will - * load the cache image and then call - * H5MF_tidy_self_referential_fsm_hack() to discard it. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 1/11/17 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC_force_cache_image_load(H5F_t *f) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - - if(H5C_force_cache_image_load(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "Can't load cache image") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_force_cache_image_load() */ - - -/*------------------------------------------------------------------------- * Function: H5AC_get_entry_status * * Purpose: Given a file address, determine whether the metadata @@ -1744,6 +1704,33 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_get_cache_flush_in_progess + * + * Purpose: Wrapper function for H5C_get_cache_flush_in_progress(). + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 3/11/05 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(H5C_get_cache_flush_in_progress((H5C_t *)cache_ptr, flush_in_progress_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_flush_in_progress() failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_get_cache_flush_in_progress() */ + + +/*------------------------------------------------------------------------- * Function: H5AC_get_cache_hit_rate * * Purpose: Wrapper function for H5C_get_cache_hit_rate(). @@ -2682,4 +2669,3 @@ H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_l done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_get_mdc_image_info() */ - diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index e1fdedf..691f7c6 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -411,6 +411,7 @@ H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); +H5_DLL herr_t H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr); H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr); H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index d4ed6fc..bd200e0 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2258,6 +2258,7 @@ H5_DLL herr_t H5C_get_cache_image_config(const H5C_t * cache_ptr, H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); +H5_DLL herr_t H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr); H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr, hbool_t *is_dirty_ptr, diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 51ce1c2..a1267c5 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -156,6 +156,34 @@ done: /*------------------------------------------------------------------------- + * Function: H5C_get_cache_flush_in_progress + * + * Purpose: Return flush_in_progress in *flush_in_progress_ptr + * If the parameter is NULL, skip that value. + * + * Return: SUCCEED on success, and FAIL on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_get_cache_flush_in_progress(H5C_t * cache_ptr, hbool_t *flush_in_progress_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + + if(flush_in_progress_ptr != NULL) + *flush_in_progress_ptr = cache_ptr->flush_in_progress; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_get_cache_flush_in_progress() */ + + +/*------------------------------------------------------------------------- * Function: H5C_get_cache_hit_rate * * Purpose: Compute and return the current cache hit rate in diff --git a/src/H5FScache.c b/src/H5FScache.c index 7525a9a..b520458 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -517,14 +517,36 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, if(!H5F_addr_defined(fspace->sect_addr)) { /* case 1 */ haddr_t tag = HADDR_UNDEF; + haddr_t sect_addr; + hsize_t saved_sect_size, new_sect_size; /* allocate file space for the section info, and insert it * into the metadata cache. */ - if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) + saved_sect_size = fspace->sect_size; + if(HADDR_UNDEF == (sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections") - fspace->alloc_sect_size = (size_t)fspace->sect_size; + /* fspace->sect_size may change in size after H5MF_alloc(). + * If increased in size, free the previous allocation and + * allocate again with the bigger fspace->sect_size. + */ + if(fspace->sect_size > saved_sect_size) { + + new_sect_size = fspace->sect_size; + + if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, sect_addr, saved_sect_size) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + + if(HADDR_UNDEF == (sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, new_sect_size))) + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections") + fspace->sect_size = new_sect_size; + fspace->alloc_sect_size = new_sect_size; + } else { + fspace->alloc_sect_size = saved_sect_size; + fspace->sect_size = saved_sect_size; + } + fspace->sect_addr = sect_addr; /* Get the tag for this free space manager and use it to insert the entry */ if(H5AC_get_tag((const void *)fspace, &tag) < 0) @@ -593,7 +615,6 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, * a nonsense section info address. */ if(!H5F_POINT_OF_NO_RETURN(f)) { - HDassert(fspace->serial_sect_count > 0); HDassert(fspace->sect_size > 0); HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size); } /* end if */ @@ -703,9 +724,8 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, if(!H5F_POINT_OF_NO_RETURN(f)) HDassert((! H5F_addr_defined(fspace->sect_addr)) || - ((fspace->serial_sect_count > 0) && - (fspace->sect_size > 0) && - (fspace->alloc_sect_size == (size_t)fspace->sect_size))); + ((fspace->sect_size > 0) && + (fspace->alloc_sect_size == (size_t)fspace->sect_size))); /* Magic number */ H5MM_memcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -968,6 +988,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, haddr_t fs_addr; /* Free space header address */ size_t old_sect_size; /* Old section size */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *chksum_image; /* Points to chksum location */ uint32_t stored_chksum; /* Stored metadata checksum */ void * ret_value = NULL; /* Return value */ @@ -1064,10 +1085,14 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, if(H5FS_sect_add(udata->f, fspace, new_sect, H5FS_ADD_DESERIALIZING, udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, NULL, "can't add section to free space manager") } /* end for */ + + if(fspace->tot_sect_count == old_tot_sect_count) + break; + } while(image < (((const uint8_t *)_image + old_sect_size) - H5FS_SIZEOF_CHKSUM)); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == (old_sect_size - H5FS_SIZEOF_CHKSUM)); + HDassert((size_t)(image - (const uint8_t *)_image) <= (old_sect_size - H5FS_SIZEOF_CHKSUM)); HDassert(old_sect_size == fspace->sect_size); HDassert(old_tot_sect_count == fspace->tot_sect_count); HDassert(old_serial_sect_count == fspace->serial_sect_count); @@ -1077,11 +1102,14 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* checksum verification already done in verify_chksum cb */ + /* There may be empty space between entries and chksum */ + chksum_image = (const uint8_t *)(_image) + old_sect_size - H5FS_SIZEOF_CHKSUM; /* Metadata checksum */ - UINT32DECODE(image, stored_chksum); + UINT32DECODE(chksum_image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == old_sect_size); + HDassert((image == chksum_image) || + ((size_t)((image - (const uint8_t *)_image) + (chksum_image - image)) == old_sect_size)); /* Set return value */ ret_value = sinfo; @@ -1177,10 +1205,6 @@ H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, HDassert(new_len); HDassert(flags); - /* we shouldn't be called if the section info is empty, unless we hit the point of no return. */ - if(!H5F_POINT_OF_NO_RETURN(f)) - HDassert(fspace->serial_sect_count > 0); - sinfo_addr = addr; /* this will change if we relocate the section data */ /* Check for section info at temporary address */ @@ -1246,6 +1270,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, H5FS_t *fspace; /* Free space header */ H5FS_iter_ud_t udata; /* User data for callbacks */ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint8_t *chksum_image = NULL; /* Points to chksum location */ uint32_t metadata_chksum; /* Computed metadata checksum value */ unsigned bin; /* Current bin we are on */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1290,13 +1315,16 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* There may be empty space between entries and chksum */ + chksum_image = (uint8_t *)(_image) + len - H5FS_SIZEOF_CHKSUM; + metadata_chksum = H5_checksum_metadata(_image, (size_t)(chksum_image - (uint8_t *)_image), 0); /* Metadata checksum */ - UINT32ENCODE(image, metadata_chksum); + UINT32ENCODE(chksum_image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == sinfo->fspace->sect_size); + HDassert((chksum_image == image) || + ((size_t)((image - (uint8_t *)_image) + (chksum_image - image)) == sinfo->fspace->sect_size)); HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); done: diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 27486f1..81f48dd 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -357,6 +357,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Check if section info lock count dropped to zero */ if(fspace->sinfo_lock_count == 0) { hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */ + hbool_t flush_in_progress = FALSE; /* Is flushing in progress */ + + /* Check whether cache is flush_in_progress */ + if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress") /* Check if we actually protected the section info */ if(fspace->sinfo_protected) { @@ -370,9 +375,17 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Note that we've modified the section info */ cache_flags |= H5AC__DIRTIED_FLAG; + /* On file close or flushing, does not allow section info to shrink in size */ + if(f->closing || flush_in_progress) { + if(fspace->sect_size > fspace->alloc_sect_size) + cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; + else + fspace->sect_size = fspace->alloc_sect_size; + /* Check if the section info size in the file has changed */ - if(fspace->sect_size != fspace->alloc_sect_size) + } else if(fspace->sect_size != fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; + } /* end if */ /* Sanity check */ @@ -410,11 +423,20 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* Check if the section info was modified */ if(fspace->sinfo_modified) { /* Check if we need to release section info in the file */ - if(H5F_addr_defined(fspace->sect_addr)) + if(H5F_addr_defined(fspace->sect_addr)) { /* Set flag to release section info space in file */ - release_sinfo_space = TRUE; - else + /* On file close or flushing, only need to release section info with size + bigger than previous section */ + if(f->closing || flush_in_progress) { + if(fspace->sect_size > fspace->alloc_sect_size) + release_sinfo_space = TRUE; + else + fspace->sect_size = fspace->alloc_sect_size; + } else + release_sinfo_space = TRUE; + } else HDassert(fspace->alloc_sect_size == 0); + } /* end if */ else { /* Sanity checks... */ @@ -2525,12 +2547,6 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, /* the section info should be unlocked */ HDassert(fspace->sinfo_lock_count == 0); - /* no space should be allocated */ - HDassert(*fs_addr_ptr == HADDR_UNDEF); - HDassert(fspace->addr == HADDR_UNDEF); - HDassert(fspace->sect_addr == HADDR_UNDEF); - HDassert(fspace->alloc_sect_size == 0); - /* persistent free space managers must be enabled */ HDassert(f->shared->fs_persist); @@ -2542,125 +2558,109 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, HDassert((f->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) || (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)); - if(fspace->serial_sect_count > 0) { + if(fspace->serial_sect_count > 0 && fspace->sinfo) { /* the section info is floating, so space->sinfo should be defined */ - HDassert(fspace->sinfo); - /* start by allocating file space for the header */ + if(!H5F_addr_defined(fspace->addr)) { - /* Get the EOA for the file -- need for sanity check below */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_HDR))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + /* start by allocating file space for the header */ - /* check for overlap into temporary allocation space */ - if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space") + /* Get the EOA for the file -- need for sanity check below */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_HDR))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") - hdr_alloc_size = H5FS_HEADER_SIZE(f); + /* check for overlap into temporary allocation space */ + if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space") - /* if page allocation is enabled, extend the hdr_alloc_size to the - * next page boundary. - */ - if(H5F_PAGED_AGGR(f)) { - HDassert(0 == (eoa % f->shared->fs_page_size)); + hdr_alloc_size = H5FS_HEADER_SIZE(f); - hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + if(H5F_PAGED_AGGR(f)) + HDassert(0 == (eoa % f->shared->fs_page_size)); - HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f)); - HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0); - } /* end if */ + /* Allocate space for the free space header */ + if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, hdr_alloc_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header") - /* allocate space for the hdr */ - if(HADDR_UNDEF == (fspace->addr = H5FD_alloc(f->shared->lf, H5FD_MEM_FSPACE_HDR, - f, hdr_alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space for hdr") + /* Cache the new free space header (pinned) */ + if(H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") - /* if the file alignment is 1, there should be no - * eoa fragment. Otherwise, drop any fragment on the floor. - */ - HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1)); - - /* Cache the new free space header (pinned) */ - if(H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + *fs_addr_ptr = fspace->addr; + } - *fs_addr_ptr = fspace->addr; + if(!H5F_addr_defined(fspace->sect_addr)) { - /* now allocate file space for the section info */ + /* now allocate file space for the section info */ - /* Get the EOA for the file -- need for sanity check below */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_SINFO))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "Unable to get eoa") + /* Get the EOA for the file -- need for sanity check below */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_SINFO))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "Unable to get eoa") - /* check for overlap into temporary allocation space */ - if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_BADRANGE, FAIL, "sinfo file space alloc will overlap into 'temporary' file space") + /* check for overlap into temporary allocation space */ + if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) + HGOTO_ERROR(H5E_FSPACE, H5E_BADRANGE, FAIL, "sinfo file space alloc will overlap into 'temporary' file space") - sinfo_alloc_size = fspace->sect_size; + sinfo_alloc_size = fspace->sect_size; - /* if paged allocation is enabled, extend the sinfo_alloc_size to the - * next page boundary. - */ - if(H5F_PAGED_AGGR(f)) { - HDassert(0 == (eoa % f->shared->fs_page_size)); + if(H5F_PAGED_AGGR(f)) + HDassert(0 == (eoa % f->shared->fs_page_size)); - sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + /* allocate space for the section info */ + if(HADDR_UNDEF == (sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, sinfo_alloc_size))) + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info") - HDassert(sinfo_alloc_size >= fspace->sect_size); - HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0); - } /* end if */ - - /* allocate space for the section info */ - if(HADDR_UNDEF == (sect_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_FSPACE_SINFO, - f, sinfo_alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space") - - /* if the file alignment is 1, there should be no - * eoa fragment. Otherwise, drop the fragment on the floor. - */ - HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1)); + /* update fspace->alloc_sect_size and fspace->sect_addr to reflect + * the allocation + */ + if(fspace->sect_size > sinfo_alloc_size) { + hsize_t saved_sect_size = fspace->sect_size; - /* update fspace->alloc_sect_size and fspace->sect_addr to reflect - * the allocation - */ - fspace->alloc_sect_size = fspace->sect_size; - fspace->sect_addr = sect_addr; - - /* insert the new section info into the metadata cache. */ - - /* Question: Do we need to worry about this insertion causing an - * eviction from the metadata cache? Think on this. If so, add a - * flag to H5AC_insert() to force it to skip the call to make space in - * cache. - * - * On reflection, no. - * - * On a regular file close, any eviction will not change the - * the contents of the free space manager(s), as all entries - * should have correct file space allocated by the time this - * function is called. - * - * In the cache image case, the selection of entries for inclusion - * in the cache image will not take place until after this call. - * (Recall that this call is made during the metadata fsm settle - * routine, which is called during the serialization routine in - * the cache image case. Entries are not selected for inclusion - * in the image until after the cache is serialized.) - * - * JRM -- 11/4/16 - */ - if(H5AC_insert_entry(f, H5AC_FSPACE_SINFO, sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sinfo to cache") + if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, sect_addr, sinfo_alloc_size) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + fspace->sect_size = saved_sect_size; + } else { + fspace->alloc_sect_size = sinfo_alloc_size; + fspace->sect_size = sinfo_alloc_size; + fspace->sect_addr = sect_addr; + + /* insert the new section info into the metadata cache. */ + + /* Question: Do we need to worry about this insertion causing an + * eviction from the metadata cache? Think on this. If so, add a + * flag to H5AC_insert() to force it to skip the call to make space in + * cache. + * + * On reflection, no. + * + * On a regular file close, any eviction will not change the + * the contents of the free space manager(s), as all entries + * should have correct file space allocated by the time this + * function is called. + * + * In the cache image case, the selection of entries for inclusion + * in the cache image will not take place until after this call. + * (Recall that this call is made during the metadata fsm settle + * routine, which is called during the serialization routine in + * the cache image case. Entries are not selected for inclusion + * in the image until after the cache is serialized.) + * + * JRM -- 11/4/16 + */ + if(H5AC_insert_entry(f, H5AC_FSPACE_SINFO, sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sinfo to cache") - /* We have changed the sinfo address -- Mark free space header dirty */ - if(H5AC_mark_entry_dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + /* We have changed the sinfo address -- Mark free space header dirty */ + if(H5AC_mark_entry_dirty(fspace) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") - /* since space has been allocated for the section info and the sinfo - * has been inserted into the cache, relinquish ownership (i.e. float) - * the section info. - */ - fspace->sinfo = NULL; + /* since space has been allocated for the section info and the sinfo + * has been inserted into the cache, relinquish ownership (i.e. float) + * the section info. + */ + fspace->sinfo = NULL; + } + } } /* end if */ done: diff --git a/src/H5Fint.c b/src/H5Fint.c index ee9afed..edd0e8e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -933,9 +933,9 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->fs_addr[u] = HADDR_UNDEF; f->shared->fs_man[u] = NULL; } - f->shared->first_alloc_dealloc = FALSE; - f->shared->eoa_pre_fsm_fsalloc = HADDR_UNDEF; - f->shared->eoa_post_fsm_fsalloc = HADDR_UNDEF; + /* This will be stored as eoa_pre_fsm_fsalloc in the fsinfo message */ + /* This is done to be backward compatible with 1.10 library that has the FSM hack */ + f->shared->eoa_fsm_fsalloc = HADDR_UNDEF; f->shared->eoa_post_mdci_fsalloc = HADDR_UNDEF; /* Initialization for handling file space (for paged aggregation) */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 335d0a7..4a9bbf0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -325,14 +325,9 @@ struct H5F_file_t { H5F_fs_state_t fs_state[H5F_MEM_PAGE_NTYPES]; /* State of free space manager for each type */ haddr_t fs_addr[H5F_MEM_PAGE_NTYPES]; /* Address of free space manager info for each type */ H5FS_t *fs_man[H5F_MEM_PAGE_NTYPES]; /* Free space manager for each file space type */ - hbool_t first_alloc_dealloc; /* TRUE iff free space managers */ - /* are persistent and have not */ - /* been used accessed for either */ - /* allocation or deallocation */ - /* since file open. */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ - /* for self referential FSMs */ - haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ + hbool_t null_fsm_addr; /* Used by h5clear tool to tell the library */ + /* to drop free-space to the floor */ + haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */ /* for self referential FSMs */ haddr_t eoa_post_mdci_fsalloc; /* eoa past file space allocation */ /* for metadata cache image, or */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0fa2214..43644ac 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -330,8 +330,7 @@ typedef struct H5F_t H5F_t; #define H5F_THRESHOLD(F) ((F)->shared->threshold) #define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres) #define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return) -#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc) -#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc) +#define H5F_NULL_FSM_ADDR(F) ((F)->shared->null_fsm_addr) #define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) #else /* H5F_MODULE */ @@ -389,8 +388,7 @@ typedef struct H5F_t H5F_t; #define H5F_THRESHOLD(F) (H5F_get_threshold(F)) #define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F)) #define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F)) -#define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F)) -#define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F)) +#define H5F_NULL_FSM_ADDR(F) (H5F_get_null_fsm_addr(F)) #define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) #endif /* H5F_MODULE */ @@ -744,8 +742,7 @@ H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f); H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f); -H5_DLL hbool_t H5F_get_first_alloc_dealloc(const H5F_t *f); -H5_DLL haddr_t H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f); +H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f); H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 103ad3b..c168535 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1190,40 +1190,17 @@ H5F_get_point_of_no_return(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->point_of_no_return) } /* end H5F_get_point_of_no_return() */ - /*------------------------------------------------------------------------- - * Function: H5F_get_first_alloc_dealloc + * Function: H5F_get_null_fsm_addr * - * Purpose: Retrieve the 'first alloc / dealloc' value for the file. + * Purpose: Retrieve the 'null_fsm_addr' value for the file. * - * Return: Success: Non-negative, the 'first_alloc_dealloc' + * Return: Success: Non-negative, the 'null_fsm_addr' * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t -H5F_get_first_alloc_dealloc(const H5F_t *f) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(f); - HDassert(f->shared); - - FUNC_LEAVE_NOAPI(f->shared->first_alloc_dealloc) -} /* end H5F_get_first_alloc_dealloc() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_get_eoa_pre_fsm_fsalloc - * - * Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file. - * - * Return: Success: Non-negative, the 'EOA pre-FSM fsalloc' - * Failure: (can't happen) - *------------------------------------------------------------------------- - */ -haddr_t -H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f) +H5F_get_null_fsm_addr(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1231,6 +1208,5 @@ H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f) HDassert(f); HDassert(f->shared); - FUNC_LEAVE_NOAPI(f->shared->eoa_pre_fsm_fsalloc) -} /* end H5F_get_eoa_pre_fsm_fsalloc() */ - + FUNC_LEAVE_NOAPI(f->shared->null_fsm_addr) +} /* end H5F_get_null_fsm_addr() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index aa5a85d..cc68889 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -771,13 +771,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* If message is NOT marked "unknown"--set up file space info */ if(!(flags & H5O_MSG_FLAG_WAS_UNKNOWN)) { H5O_fsinfo_t fsinfo; /* File space info message from superblock extension */ - hbool_t null_fsm_addr = FALSE; /* Whether to drop free-space to the floor */ + /* f->shared->null_fsm_addr: Whether to drop free-space to the floor */ /* The h5clear tool uses this property to tell the library * to drop free-space to the floor */ if(H5P_exist_plist(fa_plist, H5F_ACS_NULL_FSM_ADDR_NAME) > 0) - if(H5P_get(fa_plist, H5F_ACS_NULL_FSM_ADDR_NAME, &null_fsm_addr) < 0) + if(H5P_get(fa_plist, H5F_ACS_NULL_FSM_ADDR_NAME, &f->shared->null_fsm_addr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get clearance for persisting fsm addr") /* Retrieve the 'file space info' structure */ @@ -820,23 +820,22 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Initialize page end meta threshold */ f->shared->pgend_meta_thres = fsinfo.pgend_meta_thres; - if(f->shared->eoa_pre_fsm_fsalloc != fsinfo.eoa_pre_fsm_fsalloc) - f->shared->eoa_pre_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc; + if(f->shared->eoa_fsm_fsalloc != fsinfo.eoa_pre_fsm_fsalloc) + f->shared->eoa_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc; /* f->shared->eoa_pre_fsm_fsalloc must always be HADDR_UNDEF * in the absence of persistent free space managers. */ /* If the following two conditions are true: * (1) skipping EOF check (skip_eof_check) - * (2) dropping free-space to the floor (null_fsm_addr) + * (2) dropping free-space to the floor (f->shared->null_fsm_addr) * skip the asserts as "eoa_pre_fsm_fsalloc" may be undefined * for a crashed file with persistent free space managers. * #1 and #2 are enabled when the tool h5clear --increment * option is used. */ - if(!skip_eof_check && !null_fsm_addr) { - HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF)); - HDassert(!f->shared->first_alloc_dealloc); + if(!skip_eof_check && !f->shared->null_fsm_addr) { + HDassert((!f->shared->fs_persist) || (f->shared->eoa_fsm_fsalloc != HADDR_UNDEF)); } /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file @@ -846,9 +845,16 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * This will ensure that no action is done to settle things on file * close via H5MF_settle_meta_data_fsm() and H5MF_settle_raw_data_fsm(). */ - if((f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF || null_fsm_addr) && - (H5F_INTENT(f) & H5F_ACC_RDWR)) - f->shared->first_alloc_dealloc = TRUE; + /* The following check is removed: + * if((f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF || null_fsm_addr) && + * (H5F_INTENT(f) & H5F_ACC_RDWR)) + * + * --there is no more eoa_pre_fsm_fsalloc + * --the check for null_fsm_addr is directly done in H5MF_settle_meta_data_fsm() + * and H5MF_settle_raw_data_fsm() + */ + + f->shared->fs_addr[0] = HADDR_UNDEF; for(u = 1; u < NELMTS(f->shared->fs_addr); u++) @@ -856,17 +862,17 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* If the following two conditions are true: * (1) file is persisting free-space - * (2) dropping free-space to the floor (null_fsm_addr) + * (2) dropping free-space to the floor (f->shared->null_fsm_addr) * nullify the addresses of the FSMs */ - if(f->shared->fs_persist && null_fsm_addr) + if(f->shared->fs_persist && f->shared->null_fsm_addr) for(u = 0; u < NELMTS(fsinfo.fs_addr); u++) f->shared->fs_addr[u] = fsinfo.fs_addr[u] = HADDR_UNDEF; /* For fsinfo.mapped: remove the FSINFO message from the superblock extension and write a new message to the extension */ - /* For null_fsm_addr: just update FSINFO message in the superblock extension */ - if(((fsinfo.mapped || null_fsm_addr) && (rw_flags & H5AC__READ_ONLY_FLAG) == 0)) { + /* For f->shared->null_fsm_addr: just update FSINFO message in the superblock extension */ + if(((fsinfo.mapped || f->shared->null_fsm_addr) && (rw_flags & H5AC__READ_ONLY_FLAG) == 0)) { /* Do the same kluge until we know for sure. VC */ #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ @@ -880,7 +886,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) f->shared->sblock = sblock; #endif /* JRM */ - if(null_fsm_addr) { + if(f->shared->null_fsm_addr) { if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") } diff --git a/src/H5MF.c b/src/H5MF.c index 0d368d4..d825d86 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -50,6 +50,10 @@ #define H5MF_FSPACE_SHRINK 80 /* Percent of "normal" size to shrink serialized free space size */ #define H5MF_FSPACE_EXPAND 120 /* Percent of "normal" size to expand serialized free space size */ +#define H5MF_CHECK_FSM(FSM, CF) \ + if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ + *CF = TRUE; + /******************/ /* Local Typedefs */ /******************/ @@ -90,6 +94,8 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); static hbool_t H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type); static hbool_t H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace); +static herr_t H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, + H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); /* Free-space type manager routines */ static herr_t H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type); @@ -794,12 +800,6 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HDassert(f->shared->lf); HDassert(size > 0); - if(f->shared->first_alloc_dealloc) { - HDassert(! H5AC_cache_image_pending(f)); - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "tidy of self referential fsm hack failed") - } /* end if */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE @@ -1107,12 +1107,6 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ - if(f->shared->first_alloc_dealloc) { - HDassert(!H5AC_cache_image_pending(f)); - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") - } /* end if */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ @@ -1302,12 +1296,6 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r HDassert(f); HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - if(f->shared->first_alloc_dealloc) { - HDassert(! H5AC_cache_image_pending(f)); - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") - } /* end if */ - /* Set mapped type, treating global heap as raw data */ map_type = (alloc_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : alloc_type; @@ -1680,16 +1668,6 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * H5MF_tidy_self_referential_fsm_hack() to discard the cache image * block. */ - if(f->shared->first_alloc_dealloc) { - if(H5AC_cache_image_pending(f)) { - if(H5AC_force_cache_image_load(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "forced cache image load failed") - } /* end if */ - else { - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") - } /* end else */ - } /* end if */ /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initially set the ring in @@ -1834,7 +1812,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.threshold = f->shared->fs_threshold; fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; - fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; + fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc; /* Write the free space manager message -- message must already exist */ if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) @@ -1891,7 +1869,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * been no file space allocation or deallocation since file * open. */ - HDassert((f->shared->first_alloc_dealloc) || (final_eoa == f->shared->eoa_post_fsm_fsalloc)); + HDassert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc); } /* end if */ else { /* super_vers can be 0, 1, 2 */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) @@ -1997,7 +1975,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); */ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype-1] = f->shared->fs_addr[ptype]; - fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; + fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc; /* Write the free space manager message -- message must already exist */ if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) @@ -2058,8 +2036,8 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * the file driver layer. However, as this possibility seems remote, * it is ignored in the following assert. */ - HDassert((f->shared->first_alloc_dealloc) || - (final_eoa == f->shared->eoa_post_fsm_fsalloc) || + HDassert((H5F_NULL_FSM_ADDR(f)) || + (final_eoa == f->shared->eoa_fsm_fsalloc) || ((H5F_addr_defined(f->shared->eoa_post_mdci_fsalloc)) && (final_eoa == f->shared->eoa_post_mdci_fsalloc))); } /* end if */ @@ -2392,16 +2370,6 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t * H5MF_tidy_self_referential_fsm_hack() to discard the cache image * block. */ - if(f->shared->first_alloc_dealloc) { - if(H5AC_cache_image_pending(f)) { - if(H5AC_force_cache_image_load(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "forced cache image load failed") - } /* end if */ - else { - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "tidy of self referential fsm hack failed") - } /* end else */ - } /* end if */ if(type == H5FD_MEM_DEFAULT) { start_type = H5F_MEM_PAGE_SUPER; @@ -2676,7 +2644,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* Only need to settle things if we are persisting the free space info * and allocation/deallocation has occurred. */ - if(f->shared->fs_persist && !f->shared->first_alloc_dealloc) { + if(f->shared->fs_persist && !H5F_NULL_FSM_ADDR(f)) { hbool_t fsm_opened[H5F_MEM_PAGE_NTYPES]; /* State of FSM */ hbool_t fsm_visited[H5F_MEM_PAGE_NTYPES]; /* State of FSM */ @@ -3014,7 +2982,9 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF_settle_raw_data_fsm() */ + +/* NEED TO remove/modify the comments in this routine */ /*------------------------------------------------------------------------- * Function: H5MF_settle_meta_data_fsm() * @@ -3128,10 +3098,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5FS_t *sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */ H5FS_t *lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */ H5FS_t *lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ - /* for self referential FSMs */ - haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ + haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */ /* for self referential FSMs */ + hbool_t continue_alloc_fsm = FALSE; /* Continue allocating addr and sect_addr for FSMs */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3145,7 +3114,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* Only need to settle things if we are persisting the free space info * and allocation/deallocation has occurred. */ - if(f->shared->fs_persist && !f->shared->first_alloc_dealloc) { + if(f->shared->fs_persist && !H5F_NULL_FSM_ADDR(f)) { /* Sanity check */ HDassert(f->shared->lf); @@ -3193,7 +3162,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) { H5FS_stat_t fs_stat; /* Information for hdr FSM */ - /* Verify that sm_hdr_fspace is floating if it exists */ if(sm_hdr_fspace) { /* Query free space manager info for this type */ if(H5FS_stat_info(f, sm_hdr_fspace, &fs_stat) < 0) @@ -3293,9 +3261,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * without a file format change. However, the code to * do so does not exist at present. */ - if(HADDR_UNDEF == (eoa_pre_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") - /* ******************* PROBLEM: ******************** * @@ -3345,30 +3310,40 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * This is isn't good, but due to schedule pressure, we will just drop * the fragment on the floor for now. */ - if(sm_hdr_fspace) - if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, sm_hdr_fspace, &(f->shared->fs_addr[sm_fshdr_fs_type])) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sm hdr FSM file space") - if(sm_sinfo_fspace && (sm_sinfo_fspace != sm_hdr_fspace)) - if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, sm_sinfo_fspace, &(f->shared->fs_addr[sm_fssinfo_fs_type])) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sm sinfo FSM file space") - if(H5F_PAGED_AGGR(f)) { - if(lg_hdr_fspace) - if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, lg_hdr_fspace, &(f->shared->fs_addr[lg_fshdr_fs_type])) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg hdr FSM file space") + do { + continue_alloc_fsm = FALSE; + if(sm_hdr_fspace) + if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, sm_hdr_fspace, &(f->shared->fs_addr[sm_fshdr_fs_type])) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sm hdr FSM file space") - if(lg_sinfo_fspace && (lg_sinfo_fspace != lg_hdr_fspace)) - if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, lg_sinfo_fspace, &(f->shared->fs_addr[lg_fssinfo_fs_type])) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") - } /* end if */ + if(sm_sinfo_fspace && (sm_sinfo_fspace != sm_hdr_fspace)) + if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, sm_sinfo_fspace, &(f->shared->fs_addr[sm_fssinfo_fs_type])) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sm sinfo FSM file space") + + if(H5F_PAGED_AGGR(f)) { + if(lg_hdr_fspace) + if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, lg_hdr_fspace, &(f->shared->fs_addr[lg_fshdr_fs_type])) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg hdr FSM file space") + + if(lg_sinfo_fspace && (lg_sinfo_fspace != lg_hdr_fspace)) + if(H5FS_vfd_alloc_hdr_and_section_info_if_needed(f, lg_sinfo_fspace, &(f->shared->fs_addr[lg_fssinfo_fs_type])) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") + } /* end if */ + + sm_hdr_fspace = f->shared->fs_man[sm_fshdr_fs_type]; + sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; + if(H5F_PAGED_AGGR(f)) { + lg_hdr_fspace = f->shared->fs_man[lg_fshdr_fs_type]; + lg_sinfo_fspace = f->shared->fs_man[lg_fssinfo_fs_type]; + } + + if(H5MF__continue_alloc_fsm(f, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") + + } while(continue_alloc_fsm); - /* Get the eoa after allocation of file space for the self referential - * free space managers. Assuming no cache image, this should be the - * final EOA of the file. - */ - if(HADDR_UNDEF == (eoa_post_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") /* All free space managers should have file space allocated for them * now, and should see no further allocations / deallocations. Store @@ -3376,13 +3351,19 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * for use when we actually write the free space manager superblock * extension message. */ - f->shared->eoa_pre_fsm_fsalloc = eoa_pre_fsm_fsalloc; - f->shared->eoa_post_fsm_fsalloc = eoa_post_fsm_fsalloc; + /* Get the eoa after allocation of file space for the self referential + * free space managers. Assuming no cache image, this should be the + * final EOA of the file. + */ + if(HADDR_UNDEF == (eoa_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + f->shared->eoa_fsm_fsalloc = eoa_fsm_fsalloc; /* Indicate that the FSM was settled successfully */ *fsm_settled = TRUE; } /* end if */ + done: /* Reset the ring in the API context */ if(orig_ring != H5AC_RING_INV) @@ -3393,6 +3374,59 @@ done: /*------------------------------------------------------------------------- + * Function: H5MF__continue_alloc_fsm + * + * Purpose: To determine whether any of the input FSMs has allocated its + * its "addr" and "sect_addr". + * Return TRUE or FALSE in *continue_alloc_fsm. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, + H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(continue_alloc_fsm); + + /* Check sm_hdr_fspace */ + if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) { + H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); + } + + if(!(*continue_alloc_fsm)) { + if(sm_sinfo_fspace && sm_sinfo_fspace != sm_hdr_fspace && + sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) { + H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); + } + } + + if(H5F_PAGED_AGGR(f) && !(*continue_alloc_fsm)) { + /* Check lg_hdr_fspace */ + if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { + H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); + } + + /* Check lg_sinfo_fspace */ + if(!(*continue_alloc_fsm)) { + if(lg_sinfo_fspace && lg_sinfo_fspace != lg_hdr_fspace && + lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { + H5MF_CHECK_FSM(lg_sinfo_fspace, continue_alloc_fsm); + } + } + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5MF__continue_alloc_fsm() */ + + +/*------------------------------------------------------------------------- * Function: H5MF__fsm_type_is_self_referential() * * Purpose: Return TRUE if the indicated free space manager allocates @@ -3497,303 +3531,3 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) FUNC_LEAVE_NOAPI(result) } /* H5MF__fsm_is_self_referential() */ - - -/*------------------------------------------------------------------------- - * Function: H5MF_tidy_self_referential_fsm_hack - * - * Purpose: As discussed in the comments of the settle routines above, - * the existence of self referential free space managers - * as currently implemented creates the possibility of - * infinite loops at file close. - * - * As a hack to avoid this, we have added code to settle - * self referential free space managers, and then allocate - * space for them directly from the file driver. - * - * To avoid dropping ever increasing amounts of file space - * on the floor with each subsequent file close/open cycle, - * we need to clean this up on file open. To avoid this, - * this function is called on the first file space allocation - * or deallocation after file open to float the self referential - * free space managers and reduce the EOA to the value it - * had before the direct allocation of space for the self - * referential free space managers. - * - * The function proceeds as follows: - * - * 1) Verify that f->shared->first_alloc_dealloc is TRUE, - * and then set it to FALSE. - * - * 2) Get the current EOA. Verify that it is greater than - * or equal to f->shared->eoa_pre_fsm_fsalloc. If the - * current eoa is equal to f->shared->eoa_pre_fsm_fsalloc, - * no self referential FSMs were stored, and we are done. - * - * NOTE: This will have to be reworked somewhat for - * cache image. - * - * 3) Load the self referential FSMs. In passing verify that - * the lowest address of a FSM header is equal to - * f->shared->eoa_pre_fsm_fsalloc. - * - * Note that we don't have to use any special I/O for - * this -- we can use the regular I/O methods even if - * paged aggregation and page buffering is enabled. - * - * 4) Float the FSMs. Ensure that the file space is NOT - * released. - * - * 5) Set EOA equal to f->shared->eoa_pre_fsm_fsalloc, - * and then set f->shared->eoa_pre_fsm_fsalloc to - * HADDR_UNDEF. - * - * If page buffering, verify that the new EOA is - * on a page boundary, and expunge any pages in the - * page buffer after the new EOA. - * - * Note that this function is also called from test code - * when it is necessary to startup a self referential - * free space manager prior to the first file space - * allocation / deallocation. Failure to do so will - * result in assertion failures in this function on - * the first file space allocation / deallocation. - * - * Return: SUCCEED/FAIL - * - * Programmer: John Mainzer - * 12/11/16 - * - *------------------------------------------------------------------------- - */ -herr_t -H5MF_tidy_self_referential_fsm_hack(H5F_t *f) -{ - haddr_t eoa; /* EOA of file */ - hsize_t tail_size = 0; /* Size of chunk to free */ - H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - haddr_t first_srfsm_hdr = HADDR_UNDEF; /* Addr of first self referential */ - /* fsm header in file */ - H5FS_stat_t fs_stat; /* Information for hdr FSM */ - H5F_mem_page_t sm_fshdr_fs_type; /* Small fs hdr fsm */ - H5F_mem_page_t sm_fssinfo_fs_type; /* Small fs sinfo fsm */ - H5F_mem_page_t lg_fshdr_fs_type; /* Large fs hdr fsm */ - H5F_mem_page_t lg_fssinfo_fs_type; /* Large fs sinfo fsm */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) - - /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->fs_persist); - HDassert(f->shared->first_alloc_dealloc); - - /* Set the ring type in the API context. Since we are only dealing with - * self referential FSMs, we will only need H5AC_RING_MDFSM. - */ - H5AC_set_ring(H5AC_RING_MDFSM, &orig_ring); - - /* 1) Verify that f->shared->first_alloc_dealloc is TRUE, - * and then set it to FALSE. - */ - HDassert(f->shared->first_alloc_dealloc); - f->shared->first_alloc_dealloc = FALSE; - - - /* 2) Get the current EOA. Verify that it is greater than - * or equal to f->shared->eoa_pre_fsm_fsalloc. If the - * current eoa is equal to f->shared->eoa_pre_fsm_fsalloc, - * no self referential FSMs were stored, and we are done. - * - * NOTE: This will have to be reworked somewhat for - * cache image. - */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") - HDassert(H5F_addr_le(f->shared->eoa_pre_fsm_fsalloc, eoa)); - - if(H5F_addr_eq(f->shared->eoa_pre_fsm_fsalloc, eoa)) - HGOTO_DONE(SUCCEED) - - - /* 3) Load the self referential FSMs. In passing verify that - * the lowest address of a FSM header is equal to - * f->shared->eoa_pre_fsm_fsalloc.' - * - * Note that we don't have to use any special I/O for - * this -- we can use the regular I/O methods even if - * paged aggregation and page buffering is enabled. - */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); - HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); - HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); - - HDassert(sm_fssinfo_fs_type > H5F_MEM_PAGE_DEFAULT); - HDassert(sm_fssinfo_fs_type < H5F_MEM_PAGE_LARGE_SUPER); - - HDassert(NULL == f->shared->fs_man[sm_fshdr_fs_type]); - HDassert(NULL == f->shared->fs_man[sm_fssinfo_fs_type]); - - if(H5F_addr_defined(f->shared->fs_addr[sm_fshdr_fs_type])) { - first_srfsm_hdr = f->shared->fs_addr[sm_fshdr_fs_type]; - - /* open the FSM */ - if(H5MF__open_fstype(f, sm_fshdr_fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") - - HDassert(f->shared->fs_man[sm_fshdr_fs_type]); - } /* end if */ - - if((sm_fshdr_fs_type != sm_fssinfo_fs_type) && - (H5F_addr_defined(f->shared->fs_addr[sm_fssinfo_fs_type]))) { - - if(!H5F_addr_defined(first_srfsm_hdr) || - (H5F_addr_defined(first_srfsm_hdr) && - H5F_addr_lt(f->shared->fs_addr[sm_fssinfo_fs_type], first_srfsm_hdr))) - first_srfsm_hdr = f->shared->fs_addr[sm_fssinfo_fs_type]; - - HDassert(NULL == f->shared->fs_man[sm_fssinfo_fs_type]); - - /* open the FSM */ - if(H5MF__open_fstype(f, sm_fssinfo_fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") - - HDassert(f->shared->fs_man[sm_fssinfo_fs_type]); - } /* end if */ - - if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); - - HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); - - HDassert(lg_fssinfo_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(lg_fssinfo_fs_type < H5F_MEM_PAGE_NTYPES); - - HDassert(NULL == f->shared->fs_man[lg_fshdr_fs_type]); - HDassert(NULL == f->shared->fs_man[lg_fssinfo_fs_type]); - - if(H5F_addr_defined(f->shared->fs_addr[lg_fshdr_fs_type])) { - if(!H5F_addr_defined(first_srfsm_hdr) || - (H5F_addr_defined(first_srfsm_hdr) && - H5F_addr_lt(f->shared->fs_addr[lg_fshdr_fs_type], first_srfsm_hdr))) - first_srfsm_hdr = f->shared->fs_addr[lg_fshdr_fs_type]; - - HDassert(NULL == f->shared->fs_man[lg_fshdr_fs_type]); - - /* open the FSM */ - if(H5MF__open_fstype(f, lg_fshdr_fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") - HDassert(f->shared->fs_man[lg_fshdr_fs_type]); - } /* end if */ - - if(lg_fshdr_fs_type != lg_fssinfo_fs_type && H5F_addr_defined(f->shared->fs_addr[lg_fssinfo_fs_type])) { - if(!H5F_addr_defined(first_srfsm_hdr) || - (H5F_addr_defined(first_srfsm_hdr) && - H5F_addr_lt(f->shared->fs_addr[lg_fssinfo_fs_type], first_srfsm_hdr))) - first_srfsm_hdr = f->shared->fs_addr[lg_fssinfo_fs_type]; - - HDassert(NULL == f->shared->fs_man[lg_fssinfo_fs_type]); - - /* open the FSM */ - if(H5MF__open_fstype(f, lg_fssinfo_fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") - HDassert(f->shared->fs_man[lg_fssinfo_fs_type]); - } /* end if */ - } /* end if */ - HDassert(H5F_addr_eq(first_srfsm_hdr, f->shared->eoa_pre_fsm_fsalloc)); - - /* 4) Float the FSMs. Ensure that the file space is NOT released. */ - if(f->shared->fs_man[sm_fshdr_fs_type]) { - /* Sanity check: Query free space manager info for this type */ - if(H5FS_stat_info(f, f->shared->fs_man[sm_fshdr_fs_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info") - - HDassert(H5F_addr_defined(fs_stat.addr)); - HDassert(H5F_addr_defined(fs_stat.sect_addr)); - if(H5FS_free(f, f->shared->fs_man[sm_fshdr_fs_type], FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free-space headers") - f->shared->fs_addr[sm_fshdr_fs_type] = HADDR_UNDEF; - } /* end if */ - - if(sm_fshdr_fs_type != sm_fssinfo_fs_type && f->shared->fs_man[sm_fssinfo_fs_type]) { - /* Sanity check: Query free space manager info for this type */ - if(H5FS_stat_info(f, f->shared->fs_man[sm_fssinfo_fs_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info") - - HDassert(H5F_addr_defined(fs_stat.addr)); - HDassert(H5F_addr_defined(fs_stat.sect_addr)); - if(H5FS_free(f, f->shared->fs_man[sm_fssinfo_fs_type], FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free-space headers") - f->shared->fs_addr[sm_fssinfo_fs_type] = HADDR_UNDEF; - } /* end if */ - - if(H5F_PAGED_AGGR(f)) { - if(f->shared->fs_man[lg_fshdr_fs_type]) { - /* Sanity check: Query free space manager info for this type */ - if(H5FS_stat_info(f, f->shared->fs_man[lg_fshdr_fs_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") - - HDassert(H5F_addr_defined(fs_stat.addr)); - HDassert(H5F_addr_defined(fs_stat.sect_addr)); - if(H5FS_free(f, f->shared->fs_man[lg_fshdr_fs_type], FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't float free-space headers") - f->shared->fs_addr[lg_fshdr_fs_type] = HADDR_UNDEF; - } /* end if */ - - if(lg_fshdr_fs_type != lg_fssinfo_fs_type && f->shared->fs_man[lg_fssinfo_fs_type]) { - /* Sanity check: Query free space manager info for this type */ - if(H5FS_stat_info(f, f->shared->fs_man[lg_fssinfo_fs_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") - - HDassert(H5F_addr_defined(fs_stat.addr)); - HDassert(H5F_addr_defined(fs_stat.sect_addr)); - if(H5FS_free(f, f->shared->fs_man[lg_fssinfo_fs_type], FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't float free-space headers") - f->shared->fs_addr[lg_fssinfo_fs_type] = HADDR_UNDEF; - } /* end if */ - } /* end if */ - - /* 5) Set EOA equal to f->shared->eoa_pre_fsm_fsalloc, - * and then set f->shared->eoa_pre_fsm_fsalloc to - * HADDR_UNDEF. - * - * If page buffering, verify that the new EOA is - * on a page boundary, and expunge any pages in the - * page buffer after the new EOA. - */ - if(!H5F_PAGED_AGGR(f)) { - /* Verify that the aggregators are still shutdown. */ - HDassert(f->shared->sdata_aggr.tot_size == 0); - HDassert(f->shared->sdata_aggr.addr == 0); - HDassert(f->shared->sdata_aggr.size == 0); - - HDassert(f->shared->meta_aggr.tot_size == 0); - HDassert(f->shared->meta_aggr.addr == 0); - HDassert(f->shared->meta_aggr.size == 0); - } /* end if */ - - tail_size = (hsize_t)(eoa - f->shared->eoa_pre_fsm_fsalloc); - - /* Release file space allocated to self referential FSMs */ - if(H5F__free(f, H5FD_MEM_DEFAULT, f->shared->eoa_pre_fsm_fsalloc, tail_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed") - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") - HDassert(H5F_addr_eq(f->shared->eoa_pre_fsm_fsalloc, eoa)); - - f->shared->eoa_pre_fsm_fsalloc = HADDR_UNDEF; - - HDassert((!H5F_PAGED_AGGR(f)) || (0 == (eoa % f->shared->fs_page_size))); - -done: - /* Reset the ring in the API context */ - if(orig_ring != H5AC_RING_INV) - H5AC_set_ring(orig_ring, NULL); - - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5MF_tidy_self_referential_fsm_hack() */ - diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 3db7f73..c69b245 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -183,7 +183,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); * allocate "generic" space and sub-allocate out of that, if possible. * Otherwise just allocate through H5F__alloc(). */ - if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE) { + if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->closing) { haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */ hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */ hsize_t alignment; /* Alignment of this section */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index eedb72e..e11476b 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -215,14 +215,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_sects_dump(H5F_t *f, FILE *stream) +H5MF__sects_dump(H5F_t *f, FILE *stream) { haddr_t eoa; /* End of allocated space in the file */ int indent = 0; /* Amount to indent */ int fwidth = 50; /* Field width */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -261,7 +261,7 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); udata.fwidth = MAX(0, fwidth - 6); /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, f->shared->fs_man[ptype], H5MF_sects_debug_cb, &udata) < 0) + if(H5FS_sect_iterate(f, f->shared->fs_man[ptype], H5MF__sects_debug_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") } /* end if */ else @@ -314,7 +314,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, udata.fwidth = MAX(0, fwidth - 6); /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, f->shared->fs_man[atype], H5MF_sects_debug_cb, &udata) < 0) + if(H5FS_sect_iterate(f, f->shared->fs_man[atype], H5MF__sects_debug_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") } /* end if */ else /* No sections of this type */ diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 591ac4a..7336211 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -27,11 +27,12 @@ */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ +#include "H5Fpkg.h" /* Files */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Opkg.h" /* Object headers */ #include "H5MFprivate.h" /* File space management */ @@ -275,16 +276,16 @@ H5O__mdci_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) +H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) { H5O_mdci_t *mesg = (H5O_mdci_t *)_mesg; - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t final_eoa; /* For sanity check */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* check args */ HDassert(f); - HDassert(open_oh); HDassert(mesg); /* Free file space for cache image */ @@ -321,16 +322,24 @@ H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) * before the first metadata cache access. However, given * time constraints, I don't want to go there now. */ - if(H5F_FIRST_ALLOC_DEALLOC(f)) { - HDassert(HADDR_UNDEF != H5F_EOA_PRE_FSM_FSALLOC(f)); - HDassert(H5F_addr_ge(mesg->addr, H5F_EOA_PRE_FSM_FSALLOC(f))); - if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") - } /* end if */ - else { + + + + if(f->closing) { + + /* Get the eoa, and verify that it has the expected value */ + if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size") + + HDassert(H5F_addr_eq(final_eoa, mesg->addr + mesg->size)); + + if(H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image") + } else { if(H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") - } /* end else */ + } + } /* end if */ done: diff --git a/test/cache_image.c b/test/cache_image.c index ee49502..f8252ac 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -93,6 +93,7 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd); #define DSET_SIZE (40 * CHUNK_SIZE) #define MAX_NUM_DSETS 256 + static void create_datasets(hid_t file_id, int min_dset, int max_dset) { @@ -3717,8 +3718,7 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + /* 4) Open the file. * * Verify that the metadata cache is instructed to load the @@ -4486,6 +4486,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) if ( show_progress ) HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass); + } /* end while */ cp += 3; @@ -4638,7 +4639,6 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) FUNC, failure_mssg); return !pass; - } /* cache_image_smoke_check_4() */ @@ -5111,8 +5111,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) * extension message has been deleted. */ i = min_group; - while ( ( pass ) && ( i <= max_group ) ) { - + while ( ( pass ) && ( i <= max_group ) ) { sprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } @@ -7513,10 +7512,9 @@ get_free_sections_test(hbool_t single_file_vfd) /* file_ptr->shared->first_alloc_dealloc is set to FALSE if the * file is opened R/O. */ - if ( ( file_ptr->shared->first_alloc_dealloc ) || - ( ! H5F_addr_defined(file_ptr->shared->eoa_pre_fsm_fsalloc) ) || + if ( ( ! H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc) ) || ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) || - ( H5F_addr_gt(file_ptr->shared->eoa_pre_fsm_fsalloc, + ( H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc, file_ptr->shared->cache->image_addr) ) ) { pass = FALSE; @@ -7554,11 +7552,8 @@ get_free_sections_test(hbool_t single_file_vfd) pass = FALSE; failure_mssg = "cache image not loaded (1).\n"; - } else if ( file_ptr->shared->first_alloc_dealloc ) { + } - pass = FALSE; - failure_mssg = "self referential FSMs not floated (1).\n"; - } } if ( show_progress ) @@ -7634,10 +7629,9 @@ get_free_sections_test(hbool_t single_file_vfd) */ if ( pass ) { - if ( ( ! file_ptr->shared->first_alloc_dealloc ) || - ( ! H5F_addr_defined(file_ptr->shared->eoa_pre_fsm_fsalloc) ) || + if ( ( ! H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc) ) || ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) || - ( H5F_addr_gt(file_ptr->shared->eoa_pre_fsm_fsalloc, + ( H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc, file_ptr->shared->cache->image_addr) ) ) { pass = FALSE; @@ -7675,11 +7669,8 @@ get_free_sections_test(hbool_t single_file_vfd) pass = FALSE; failure_mssg = "cache image not loaded (2).\n"; - } else if ( file_ptr->shared->first_alloc_dealloc ) { + } - pass = FALSE; - failure_mssg = "self referential FSMs not floated (2).\n"; - } } if ( show_progress ) diff --git a/test/cache_tagging.c b/test/cache_tagging.c index e03defa..04fdfce 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -1664,21 +1664,11 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; /* - * 3 calls to verify_tag() for verifying free space: - * one freespace header tag for H5FD_MEM_DRAW manager, - * one freespace header tag for H5FD_MEM_SUPER manager - * one freespace section info tag for H5FD_MEM_SUPER manager + * one freespace header tag for H5FD_MEM_DRAW manager, + * one freespace header tag for H5FD_MEM_SUPER manager */ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; - - /* If the free space managers are persistent, the - * H5MF_tidy_self_referential_fsm_hack() must have been run. - * Since this function floats all self referential free space - * managers, the H5FD_MEM_SUPER FSM will not be in the metadata - * cache. - */ - if(!persistent_fsms && verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0) TEST_ERROR; - if(!persistent_fsms && verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0) TEST_ERROR; + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; /* verify btree header and leaf node belonging to group */ if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR; @@ -1828,13 +1818,16 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* * 2 calls to verify_tag() for verifying free space: - * one freespace header tag for free-space header, - * one freespace header tag for free-space section info + * one freespace header tag for free-space header raw data + * one freespace header tag for free-space section info raw data + * one freespace header tag for free-space header metadata */ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) + TEST_ERROR; #if 0 /* If the free space managers are persistent, the diff --git a/test/fheap.c b/test/fheap.c index c7f6ff0..acf5d0b 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -1904,7 +1904,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) TEST_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) FAIL_STACK_ERROR /* Delete heap */ @@ -6643,7 +6643,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) TEST_ERROR /* Close the file */ @@ -6834,7 +6834,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) TEST_ERROR /* Close the file */ @@ -7001,7 +7001,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -7239,7 +7239,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) TEST_ERROR /* Close the file */ @@ -7541,7 +7541,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh) < 0) + if((fh = H5HF_close(fh)) < 0) TEST_ERROR /* Close the file */ @@ -13682,23 +13682,23 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ - H5HF_create_t tmp_cparam; /* Local heap creation parameters */ - fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - size_t id_len; /* Size of fractal heap IDs */ - h5_stat_size_t empty_size; /* Size of a file with an empty heap */ - h5_stat_size_t file_size; /* Size of file currently */ - unsigned char *heap_id = NULL; /* Heap ID for object */ - size_t obj_size; /* Size of object */ - size_t robj_size; /* Size of object read */ - unsigned char obj_type; /* Type of storage for object */ - fheap_heap_state_t state; /* State of fractal heap */ - unsigned deflate_level; /* Deflation level */ - size_t old_actual_id_len =0 ; /* Old actual ID length */ - hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */ - const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */ + H5HF_create_t tmp_cparam; /* Local heap creation parameters */ + fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ + size_t id_len; /* Size of fractal heap IDs */ + h5_stat_size_t empty_size; /* Size of a file with an empty heap */ + h5_stat_size_t file_size; /* Size of file currently */ + unsigned char *heap_id = NULL; /* Heap ID for object */ + size_t obj_size; /* Size of object */ + size_t robj_size; /* Size of object read */ + unsigned char obj_type; /* Type of storage for object */ + fheap_heap_state_t state; /* State of fractal heap */ + unsigned deflate_level; /* Deflation level */ + size_t old_actual_id_len =0 ; /* Old actual ID length */ + hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */ + const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */ - /* Copy heap creation properties */ - HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); + /* Copy heap creation properties */ + HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); /* Set an I/O filter for heap data */ deflate_level = 6; @@ -13866,7 +13866,9 @@ error: H5MM_xfree(heap_id); if(fh) H5HF_close(fh); - H5Fclose(file); + if(&tmp_cparam.pline) + H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */ + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_filtered_huge() */ @@ -15570,9 +15572,12 @@ error: H5MM_xfree(keep_ids.ids); H5MM_xfree(keep_ids.lens); H5MM_xfree(keep_ids.offs); + + if(tparam->comp == FHEAP_TEST_COMPRESS) + H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */ if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_random() */ @@ -15788,7 +15793,9 @@ error: H5MM_xfree(keep_ids.offs); if(fh) H5HF_close(fh); - H5Fclose(file); + if(tparam->comp == FHEAP_TEST_COMPRESS) + H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */ + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_random_pow2() */ diff --git a/test/mf.c b/test/mf.c index 4dccae6..8c17df5 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6822,16 +6822,6 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(!H5F_addr_defined(f->shared->fs_addr[tt])) TEST_ERROR - /* Since we are about to open a self referential free space - * manager prior to the first file space allocation / deallocation - * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid - * assertion failures on the first file space alloc / dealloc. - */ - if((f->shared->first_alloc_dealloc) && - (SUCCEED != - H5MF_tidy_self_referential_fsm_hack(f))) - FAIL_STACK_ERROR - /* Start up H5FD_MEM_SUPER free-space manager */ if(!(f->shared->fs_man[tt])) if(H5MF__open_fstype(f, (H5F_mem_page_t)tt) < 0) @@ -6925,7 +6915,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) haddr_t addrx; H5FD_mem_t fs_type; hbool_t contig_addr_vfd; - hbool_t ran_H5MF_tidy_self_referential_fsm_hack = FALSE; + if(new_format) TESTING("File's free-space is going away with new library format") @@ -6944,9 +6934,13 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Copy the file access property list */ if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR - if(new_format) + if(new_format) { if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + } else { + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR + } /* Set to aggregation and persisting free-space */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) @@ -7022,17 +7016,6 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Since we are about to open a self referential free space - * manager prior to the first file space allocation / deallocation - * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid - * assertion failures on the first file space alloc / dealloc. - */ - if(f->shared->first_alloc_dealloc){ - if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) - FAIL_STACK_ERROR - ran_H5MF_tidy_self_referential_fsm_hack = TRUE; - } - /* Start up H5FD_MEM_SUPER free-space manager */ if(!(f->shared->fs_man[fs_type])) if(H5MF__open_fstype(f, (H5F_mem_page_t)fs_type) < 0) @@ -7042,24 +7025,18 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(H5FS_stat_info(f, f->shared->fs_man[fs_type], &fs_stat) < 0) FAIL_STACK_ERROR - /* if we ran H5MF_tidy_self_referential_fsm_hack(), the - * H5FD_MEM_SUPER free space manager must be floating. - * Thus fs_stat.addr must be undefined. - */ - if((!ran_H5MF_tidy_self_referential_fsm_hack) && - (!H5F_addr_defined(fs_stat.addr))) + if(!H5F_addr_defined(fs_stat.addr)) TEST_ERROR if(fs_stat.tot_space < TBLOCK_SIZE3) TEST_ERROR - /* Put block #4 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0) - FAIL_STACK_ERROR - - if(!new_format) { - /* Need to take up this space so that the free-space manager will go away */ - if(HADDR_UNDEF == (addrx = H5MF_alloc(f, type, (hsize_t)103))) + /* Allocate/free space accordingly so that the free-space manager will go away */ + if(new_format) { + if(H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0) + FAIL_STACK_ERROR + } else { + if(HADDR_UNDEF == (addrx = H5MF_alloc(f, type, (hsize_t)3))) FAIL_STACK_ERROR } @@ -7741,16 +7718,6 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Since we are about to open a self referential free space - * manager prior to the first file space allocation / deallocation - * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid - * assertion failures on the first file space alloc / dealloc. - */ - if(f->shared->first_alloc_dealloc){ - if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) - FAIL_STACK_ERROR - } - /* Set up to use the small metadata manager */ if(!(f->shared->fs_man[fs_type])) if(H5MF__open_fstype(f, fs_type) < 0) diff --git a/tools/test/h5repack/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl b/tools/test/h5repack/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl index affa93b..e78c5e2 100644 --- a/tools/test/h5repack/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl +++ b/tools/test/h5repack/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl @@ -11,6 +11,6 @@ File space page size: 4096 bytes Summary of file space information: File metadata: 1602 bytes Raw data: 400 bytes - Amount/Percent of tracked free space: 6307 bytes/38.5% - Unaccounted space: 8075 bytes -Total space: 16384 bytes + Amount/Percent of tracked free space: 6190 bytes/75.6% + Unaccounted space: 0 bytes +Total space: 8192 bytes diff --git a/tools/test/h5repack/testfiles/SPT.h5repack_aggr.h5.ddl b/tools/test/h5repack/testfiles/SPT.h5repack_aggr.h5.ddl index 1ce06b2..3ecf9b1 100644 --- a/tools/test/h5repack/testfiles/SPT.h5repack_aggr.h5.ddl +++ b/tools/test/h5repack/testfiles/SPT.h5repack_aggr.h5.ddl @@ -11,6 +11,6 @@ File space page size: 4096 bytes Summary of file space information: File metadata: 1485 bytes Raw data: 400 bytes - Amount/Percent of tracked free space: 680 bytes/26.5% + Amount/Percent of tracked free space: 563 bytes/23.0% Unaccounted space: 0 bytes -Total space: 2565 bytes +Total space: 2448 bytes -- cgit v0.12 From 1ccbdfee589d9f56d71983506313879fa47c4e90 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 21 Jun 2019 10:05:34 -0500 Subject: Add support for GCC 7.x warnings, update warnhist script to account for them, clean up warnings. --- bin/warnhist | 38 +++++++++++++++++++++++--- config/gnu-flags | 50 ++++++++++++++++++++++++++++++++--- fortran/src/H5Fff.F90 | 1 - fortran/src/H5VLff.F90 | 1 - fortran/test/tH5O_F03.F90 | 2 -- hl/fortran/src/H5TBff.F90 | 4 +-- hl/fortran/test/tstimage.F90 | 2 +- hl/fortran/test/tsttable.F90 | 2 +- hl/src/H5LT.c | 19 ++++++------- hl/test/test_ds.c | 2 +- src/H5Clog_trace.c | 2 +- src/H5Dint.c | 1 - src/H5Fint.c | 2 ++ src/H5Fprivate.h | 16 +++++------ src/H5Fsuper.c | 11 +++----- src/H5Gloc.c | 5 +++- src/H5Gname.c | 1 + src/H5Gtest.c | 1 + src/H5I.c | 2 +- src/H5O.c | 1 + src/H5Oflush.c | 1 + src/H5Oint.c | 1 + src/H5Opkg.h | 4 +-- src/H5SM.c | 1 + src/H5Shyper.c | 8 ++++++ src/H5T.c | 1 + src/H5Tnative.c | 12 +++++++++ src/H5VLint.c | 1 + src/H5Zshuffle.c | 14 ++++++++++ src/H5checksum.c | 11 ++++++++ src/H5private.h | 3 +++ src/H5trace.c | 2 +- test/cache_logging.c | 6 ++--- test/cache_tagging.c | 2 +- test/cmpd_dset.c | 2 +- test/direct_chunk.c | 10 +++---- test/dsets.c | 16 ++++++----- test/evict_on_close.c | 6 ++--- test/external_common.h | 5 ---- test/external_env.c | 5 ++++ test/fheap.c | 11 ++++---- test/file_image.c | 2 +- test/flush1.c | 2 +- test/flush2.c | 2 +- test/hyperslab.c | 8 ++---- test/links.c | 2 ++ test/page_buffer.c | 4 +-- test/tattr.c | 2 +- test/tfile.c | 1 + test/th5s.c | 1 + test/tselect.c | 6 ++--- tools/lib/h5diff.c | 1 - tools/lib/h5diff_array.c | 11 ++++---- tools/src/h5repack/h5repack.c | 14 +++++----- tools/src/h5repack/h5repack_copy.c | 30 +++------------------ tools/src/h5repack/h5repack_filters.c | 10 +++---- tools/src/h5stat/h5stat.c | 3 +-- tools/test/h5dump/h5dumpgentest.c | 24 +++++------------ tools/test/h5repack/h5repacktst.c | 12 ++++----- tools/test/perform/chunk_cache.c | 24 ++++++++--------- 60 files changed, 271 insertions(+), 173 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 6b7ef73..5750c77 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -155,6 +155,7 @@ while (<>) { my $toss; my $offset; my $warning; + my $extra; # Retain last FORTRAN compile line, which comes a few lines before warning if($_ =~ /.*\.[fF]90:.*/) { @@ -176,12 +177,12 @@ while (<>) { if($_ =~ /^cc1: warning:.*/) { $name = $last_c_name; $line = "??"; - ($toss, $toss, $warning) = split /\:/, $_; + ($toss, $toss, $warning, $extra) = split /\:/, $_; # Check for FORTRAN warning output } elsif($_ =~ /^Warning:.*/) { $name = $last_fort_name; $line = $last_fort_line; - ($toss, $warning) = split /\:/, $_; + ($toss, $warning, $extra) = split /\:/, $_; #print "1:",$.,":",$_; # $_ = <>; #print "2:",$.,":",$_; @@ -203,12 +204,19 @@ while (<>) { } else { # Check for 'character offset' field if($_ =~ /^.*[0-9]+\:[0-9]+\:/) { - ($name, $line, $offset, $toss, $warning) = split /\:/, $_; + ($name, $line, $offset, $toss, $warning, $extra) = split /\:/, $_; } else { - ($name, $line, $toss, $warning) = split /\:/, $_; + ($name, $line, $toss, $warning, $extra) = split /\:/, $_; } } + # Check for extra ':' followed by more text in original warning string, + # and append the ':' and text back onto the parsed warning + # (Use 'length $extra' idiom to avoid warning when $extra is undefined) + if(length $extra ) { + $warning = join ':', $warning, $extra; + } + # Trim leading '..' paths from filename while($name =~ /^\.\.\//) { $name =~ s/^\.\.\///g; @@ -401,6 +409,28 @@ while (<>) { } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; + } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast \[-Wint-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute \[-Wsuggest-attribute=format\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing up to [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; } # Increment count for [generic] warning diff --git a/config/gnu-flags b/config/gnu-flags index 7df72c7..9cdd2bd 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -117,7 +117,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" - H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum" + H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -187,10 +187,54 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 7.x release is out, we should check for additional flags to +# When the gcc 8.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[6789].*) + gcc-[789].*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + + # Append warning flags that only gcc 4.7+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa" + + # Append warning flags that only gcc 7.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wnormalized -Wrestrict" + ;; + + gcc-6*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index ac3a1c0..8574c06 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -591,7 +591,6 @@ CONTAINS ! is an HDF5 file INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER(HID_T) :: access_prp_default CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine ! to define status value. diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 9abc157..e21f38f 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -217,7 +217,6 @@ CONTAINS !***** CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name INTEGER(SIZE_T) :: l - TYPE(C_PTR) :: f_ptr INTERFACE INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index d1a9ddb..78b6453 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -270,8 +270,6 @@ CONTAINS ! A(8) = tm_yday int days since January 1 0-365 ! A(9) = tm_isdst int Daylight Saving Time flag ! - INTEGER(C_INT), DIMENSION(:), POINTER :: c_atime, c_btime, c_ctime, c_mtime - INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime INTEGER :: len, i INTEGER :: idx INTEGER :: ierr diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index d18d023..40adf95 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -939,10 +939,10 @@ CONTAINS INTEGER(size_t), DIMENSION(nfields), INTENT(inout) :: field_offsets ! field offsets INTEGER(size_t), INTENT(inout):: type_size ! type size INTEGER :: errcode ! error code - INTEGER, OPTIONAL :: maxlen_out ! maximum character len of the field names + INTEGER(size_t), OPTIONAL :: maxlen_out ! maximum character len of the field names INTEGER(size_t) :: namelen ! name length INTEGER(size_t), DIMENSION(nfields) :: namelen2 ! name lengths - INTEGER(hsize_t) :: i ! general purpose integer + INTEGER(hsize_t) :: i ! general purpose integer INTEGER(size_t) :: maxlen INTEGER(size_t) :: c_maxlen_out diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90 index d6bd1e2..8586e68 100644 --- a/hl/fortran/test/tstimage.F90 +++ b/hl/fortran/test/tstimage.F90 @@ -62,7 +62,7 @@ character(len=4), parameter :: dsetname2 = "img2" ! dataset name character(len=15), parameter :: il ="INTERLACE_PIXEL"! dataset name integer(hid_t) :: file_id ! file identifier integer(hsize_t), parameter :: width = 500 ! width of image -integer(hsize_t), parameter :: height = 200 ! height of image +integer(hsize_t), parameter :: height = 270 ! height of image integer, parameter :: pal_entries = 9 ! palette number of entries integer, dimension(width*height) :: buf1 ! data buffer integer, dimension(width*height) :: bufr1 ! data buffer diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 38cfa86..840d33d 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -93,7 +93,7 @@ SUBROUTINE test_table1() INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offsetr ! field offset INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_sizesr ! field sizes INTEGER(SIZE_T) :: type_sizeout = 0 ! size of the datatype - INTEGER :: maxlen = 0 ! max chararter length of a field name + INTEGER(SIZE_T) :: maxlen = 0 ! max character length of a field name INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double INTEGER :: SIZEOF_X LOGICAL :: Exclude_double diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0074d02..3ebca95 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2264,7 +2264,7 @@ out: *------------------------------------------------------------------------- */ static char* -realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) +realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add) { size_t size_str_to_add, size_str; @@ -2360,7 +2360,6 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ int nmembs; /*number of members */ char tmp_str[TMP_LEN]; int nchars; /*number of output characters */ @@ -2418,17 +2417,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), ""); + HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + tmp_str[MAX(3, 19 - nchars)] = '\0'; if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + (size_t)i * dst_size; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; @@ -2450,8 +2447,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) out: if(0 == nmembs) { - HDsnprintf(tmp_str, TMP_LEN, "\n%*s ", (int)(indt + 4), ""); + str = realloc_and_append(no_ubuf, str_len, str, "\n"); + HDassert((indt + 4) < TMP_LEN); + HDmemset(tmp_str, ' ', (indt + 4) + 1); + tmp_str[(indt + 4)] = '\0'; str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " "); } /* end if */ /* Release resources */ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 95178fc..d7af9e9 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1138,7 +1138,7 @@ static int test_detachscales(void) int rank3 = 3; hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/ int *buf = NULL; - char dname[10]; + char dname[16]; int i; /* This tests creates two three dimensional datasets; then it creates diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 7c1305c..713f333 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -41,7 +41,7 @@ /****************/ /* Max log message size */ -#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048 +#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096 /******************/ diff --git a/src/H5Dint.c b/src/H5Dint.c index 220f026..63d1160 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1095,7 +1095,6 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ size_t file_prefix_len; /* length of expanded prefix */ - H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Fint.c b/src/H5Fint.c index ee9afed..030fda8 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -509,6 +509,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") @@ -3610,6 +3611,7 @@ H5F__get_file(void *obj, H5I_type_t type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0fa2214..e9b6c32 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -160,16 +160,16 @@ typedef struct H5F_t H5F_t; (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ - (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ - ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & 0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ + ((*(p) & 0x80) ? ~0xffffffffULL : 0x0ULL))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index aa5a85d..ef52844 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -513,15 +513,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #endif /* H5_HAVE_PARALLEL */ /* Check if superblock address is different from base address and adjust - * base address and "end of address" address if so. + * base address and "end of file" address if so. */ if(!H5F_addr_eq(super_addr, sblock->base_addr)) { - /* Check if the superblock moved earlier in the file */ - if(H5F_addr_lt(super_addr, sblock->base_addr)) - udata.stored_eof -= (sblock->base_addr - super_addr); - else - /* The superblock moved later in the file */ - udata.stored_eof += (super_addr - sblock->base_addr); + /* If the superblock moved in the file, adjust the EOF */ + /* (Handles moving earlier & later) */ + udata.stored_eof -= (sblock->base_addr - super_addr); /* Adjust base address for offsets of the HDF5 data in the file */ sblock->base_addr = super_addr; diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 5724031..e47d3be 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -226,7 +226,10 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") case H5I_VOL: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) connector") + + case H5I_SPACE_SEL_ITER: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a dataspace selection iterator") case H5I_UNINIT: case H5I_BADID: diff --git a/src/H5Gname.c b/src/H5Gname.c index fa0a925..16c1ca7 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -828,6 +828,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") diff --git a/src/H5Gtest.c b/src/H5Gtest.c index af6acb3..0b431b1 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -616,6 +616,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") diff --git a/src/H5I.c b/src/H5I.c index 87ff04a..cdc849b 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2171,7 +2171,6 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) { H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) @@ -2384,6 +2383,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ diff --git a/src/H5O.c b/src/H5O.c index 0fdb9be..093d429 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1102,6 +1102,7 @@ H5Oclose(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oflush.c b/src/H5Oflush.c index da9d1d0..f5ede4a 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -491,6 +491,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oint.c b/src/H5Oint.c index 60aae45..45a8046 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -1848,6 +1848,7 @@ H5O_get_loc(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type") diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 668f4f0..4afa452 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -134,9 +134,9 @@ ) : 0)) \ ) #define H5O_SIZEOF_MSGHDR_OH(O) \ - H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) + (unsigned)H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) #define H5O_SIZEOF_MSGHDR_F(F, C) \ - H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) + (unsigned)H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) /* * Size of chunk "header" for each chunk diff --git a/src/H5SM.c b/src/H5SM.c index 3946f51..290e575 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -274,6 +274,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag) case H5O_FILL_ID: type_id = H5O_FILL_NEW_ID; /* Fall through... */ + H5_ATTR_FALLTHROUGH case H5O_SDSPACE_ID: case H5O_DTYPE_ID: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4c8e458..2acc135 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2142,18 +2142,25 @@ loc += fast_dim_buf_off; do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -10013,6 +10020,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], if(op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */ break; /* Else fall through to error */ + H5_ATTR_FALLTHROUGH case H5S_SEL_ERROR: case H5S_SEL_N: diff --git a/src/H5T.c b/src/H5T.c index 8c8a9b7..3098325 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1738,6 +1738,7 @@ H5Tcopy(hid_t type_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 3554f75..f40d81b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -551,6 +551,9 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) { match = H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); @@ -570,6 +573,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, match = H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) { match = H5T_NATIVE_INT_MATCH_LLONG; @@ -694,6 +698,9 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali HDassert(size>0); if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(size<=sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -717,6 +724,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali native_size = sizeof(double); #endif } +#pragma GCC diagnostic pop } else { #if H5_SIZEOF_LONG_DOUBLE !=0 if(size>sizeof(double)) { @@ -810,6 +818,9 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) { tid = H5T_NATIVE_B8; native_size = 1; @@ -831,6 +842,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, native_size = 8; align = H5T_NATIVE_UINT64_ALIGN_g; } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) { tid = H5T_NATIVE_B64; diff --git a/src/H5VLint.c b/src/H5VLint.c index 1b735f5..884b2f6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1437,6 +1437,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index e70ef33..b1d0722 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -185,18 +185,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -243,18 +250,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); diff --git a/src/H5checksum.c b/src/H5checksum.c index 64d527e..4e98976 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -407,16 +407,27 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) switch(length) /* all the case statements fall through */ { case 12: c+=((uint32_t)k[11])<<24; + H5_ATTR_FALLTHROUGH case 11: c+=((uint32_t)k[10])<<16; + H5_ATTR_FALLTHROUGH case 10: c+=((uint32_t)k[9])<<8; + H5_ATTR_FALLTHROUGH case 9 : c+=k[8]; + H5_ATTR_FALLTHROUGH case 8 : b+=((uint32_t)k[7])<<24; + H5_ATTR_FALLTHROUGH case 7 : b+=((uint32_t)k[6])<<16; + H5_ATTR_FALLTHROUGH case 6 : b+=((uint32_t)k[5])<<8; + H5_ATTR_FALLTHROUGH case 5 : b+=k[4]; + H5_ATTR_FALLTHROUGH case 4 : a+=((uint32_t)k[3])<<24; + H5_ATTR_FALLTHROUGH case 3 : a+=((uint32_t)k[2])<<16; + H5_ATTR_FALLTHROUGH case 2 : a+=((uint32_t)k[1])<<8; + H5_ATTR_FALLTHROUGH case 1 : a+=k[0]; break; case 0 : goto done; diff --git a/src/H5private.h b/src/H5private.h index dad2d94..86cd615 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -309,6 +309,7 @@ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) @@ -316,12 +317,14 @@ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) +# define H5_ATTR_FALLTHROUGH __attribute__((fallthrough)); #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5trace.c b/src/H5trace.c index 9c858fc..c5d14f5 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -173,7 +173,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(current_depth < last_call_depth) { /* We are at the beginning of a line */ if(H5_debug_g.ttimes) { - char tmp[128]; + char tmp[320]; HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime); HDfprintf(out, " %*s ", (int)HDstrlen(tmp), ""); diff --git a/test/cache_logging.c b/test/cache_logging.c index 6fd48d8..c43609b 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -43,7 +43,7 @@ test_logging_api(void) hid_t fid = -1; hid_t gid = -1; hbool_t is_currently_logging; - char group_name[8]; + char group_name[12]; char filename[1024]; int i; @@ -111,8 +111,8 @@ test_logging_api(void) /* Perform some manipulations */ for(i = 0; i < N_GROUPS; i++) { - HDmemset(group_name, 0, 8); - HDsnprintf(group_name, 8, "%d", i); + HDmemset(group_name, 0, sizeof(group_name)); + HDsnprintf(group_name, sizeof(group_name), "%d", i); if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Gclose(gid) < 0) diff --git a/test/cache_tagging.c b/test/cache_tagging.c index e03defa..734c760 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -741,7 +741,7 @@ check_multi_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file outout */ - char gname[10]; /* group name buffer */ + char gname[16]; /* group name buffer */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access prop list */ haddr_t g_tag = 0; /* Group tag value */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index a8baeac..1944ce1 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -1808,7 +1808,7 @@ test_pack_ooo(void) unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */ unsigned num_free; /* Number of free slots in order */ unsigned sub_cmpd_order; /* Order to insert the inner compound */ - char name[6]; /* Member name */ + char name[16]; /* Member name */ unsigned extra_space; /* Whether to add extra space to the end of * the compound */ unsigned i, j; /* Indices */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 8de923e..9ea814c 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2008,11 +2008,11 @@ error: static int test_single_chunk(unsigned config) { - hid_t fid; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */ hsize_t offset[2] = {0,0}; /* Offset for writing */ diff --git a/test/dsets.c b/test/dsets.c index a317f14..603f785 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1233,14 +1233,19 @@ test_conv_buffer(hid_t fid) CmpField *cf = NULL; CmpFieldR *cfrR = NULL; - hid_t dataset = -1; /* dataset ID */ - hid_t space = -1; /* data space ID */ - hid_t ctype1, ctype2; /* data type ID */ - hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5; + hid_t dataset = H5I_INVALID_HID; /* dataset ID */ + hid_t space = H5I_INVALID_HID; /* data space ID */ + hid_t ctype1 = H5I_INVALID_HID, + ctype2 = H5I_INVALID_HID; /* data type ID */ + hid_t arr_type1 = H5I_INVALID_HID, + arr_type2 = H5I_INVALID_HID, + arr_type3 = H5I_INVALID_HID, + arr_type4 = H5I_INVALID_HID, + arr_type5 = H5I_INVALID_HID; hsize_t dimsa[3]; hsize_t dimsb[1]; hsize_t dimsc[1]; - hid_t xfer_list; + hid_t xfer_list = H5I_INVALID_HID; size_t size; TESTING("data type conversion buffer size"); @@ -12920,7 +12925,6 @@ test_versionbounds(void) hid_t vspace = -1; /* Virtual dset dataspaces */ hid_t srcdset = -1; /* Source datset */ hid_t vdset = -1; /* Virtual dataset */ - hid_t null_dspace = -1; /* Data space of H5S_NULL */ hsize_t dims[1] = {3}; /* Data space current size */ char srcfilename[FILENAME_BUF_SIZE]; char vfilename1[FILENAME_BUF_SIZE]; diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 9918829..b7d30a9 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -73,7 +73,7 @@ const char *FILENAMES[] = { #define SUBGROUP_NAME_SIZE 16 /* Prototypes */ -static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); +static hbool_t verify_tag_not_in_cache(const H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); static hid_t generate_eoc_test_file(hid_t fapl_id); static herr_t check_dset_scheme(hid_t fid, const char *dset_name); @@ -90,8 +90,8 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * *------------------------------------------------------------------------- */ -static hbool_t -verify_tag_not_in_cache(H5F_t *f, haddr_t tag) +static H5_ATTR_PURE hbool_t +verify_tag_not_in_cache(const H5F_t *f, haddr_t tag) { H5C_t *cache_ptr = NULL; /* cache pointer */ int i = 0; /* iterator */ diff --git a/test/external_common.h b/test/external_common.h index cc2b5fb..1e4fe7a 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -33,11 +33,6 @@ static const char *EXT_FNAME[] = { NULL }; -static const char *EXT_ENV_FNAME[] = { - "extern_env_dir/env_file_1", - NULL -}; - /* A similar collection of files is used for the tests that * perform file I/O. */ diff --git a/test/external_env.c b/test/external_env.c index 55f68be..1bf0cf0 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -16,6 +16,11 @@ */ #include "external_common.h" +static const char *EXT_ENV_FNAME[] = { + "extern_env_dir/env_file_1", + NULL +}; + /*------------------------------------------------------------------------- * Function: test_path_env diff --git a/test/fheap.c b/test/fheap.c index c7f6ff0..846f03e 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7599,7 +7599,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */ struct a_type_t1 { char a[10]; - char b[29]; + char b[40]; } obj1, obj2; /* Objects to insert/remove */ size_t id_len; /* Size of fractal heap IDs */ fheap_heap_state_t state; /* State of fractal heap */ @@ -7640,14 +7640,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ */ TESTING("incremental object insertion and removal") + HDmemset(&obj1, 0, sizeof(obj1)); + HDmemset(&obj2, 0, sizeof(obj2)); for(i = 0; i < 100; i++) { - HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); - for(j = 0; j < i; j++) { - HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); - if(H5HF_remove(fh, heap_id[j]) < 0) FAIL_STACK_ERROR + + HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); if(H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0) FAIL_STACK_ERROR } /* end for */ @@ -7658,6 +7658,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Insert object */ HDmemset(heap_id[i], 0, id_len); + HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); if(H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0) FAIL_STACK_ERROR } /* end for */ diff --git a/test/file_image.c b/test/file_image.c index 0dba236..86dd13e 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -580,7 +580,7 @@ test_core(void) file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl); VERIFY(file >= 0, "H5Fopen failed"); VERIFY((udata->used_callbacks == MALLOC) || - (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks"); + (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)), "opening a core file used the wrong callbacks"); VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open"); /* Close file */ diff --git a/test/flush1.c b/test/flush1.c index fefa8d0..ac5f9ef 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -73,7 +73,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ unsigned flags; /* file open flags */ int i; /* iterator */ diff --git a/test/flush2.c b/test/flush2.c index 6e8aee7..8ebfb75 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -135,7 +135,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ int i; /* iterator */ /* open file */ diff --git a/test/hyperslab.c b/test/hyperslab.c index feb96bd..d8c00c9 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -819,12 +819,8 @@ test_transpose(size_t nx, size_t ny) dst_stride[1] = (hsize_t)(nx * sizeof(*src)); /* Copy and transpose */ - if(nx == ny) - H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, - src_stride, src); - else - H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, - src_stride, src); + H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, + src_stride, src); /* Check */ for(i = 0; i < nx; i++) { diff --git a/test/links.c b/test/links.c index 520f784..3166954 100644 --- a/test/links.c +++ b/test/links.c @@ -7759,6 +7759,7 @@ done: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: return -1; @@ -7847,6 +7848,7 @@ done: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: return -1; diff --git a/test/page_buffer.c b/test/page_buffer.c index b9b31f8..e11a6d6 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -98,7 +98,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl) int i; int num_elements; int j; - char dset_name[10]; + char dset_name[32]; if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; @@ -235,7 +235,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, int i; int j; int num_elements; - char dset_name[10]; + char dset_name[32]; H5F_t *f = NULL; if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) diff --git a/test/tattr.c b/test/tattr.c index b83ed9f..c7a2c23 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -10065,7 +10065,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) hid_t tid; /* Datatype ID */ hid_t gcpl; /* Group creation property list */ hsize_t dims[2] = {10, 100}; /* Attribute dimensions */ - char aname[4]; /* Attribute name */ + char aname[16]; /* Attribute name */ unsigned i; /* index */ herr_t ret; /* Generic return status */ htri_t tri_ret; /* htri_t return status */ diff --git a/test/tfile.c b/test/tfile.c index 140bd14..c15064a 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1446,6 +1446,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: ERROR("H5Fget_obj_ids"); diff --git a/test/th5s.c b/test/th5s.c index 6632a4c..c5dfa97 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -30,6 +30,7 @@ * This file also needs to access the dataspace testing code. */ #define H5S_FRIEND /*suppress error about including H5Spkg */ +#define H5S_TESTING /*suppress warning about H5S testing funcs*/ #include "H5Spkg.h" /* Dataspaces */ /* diff --git a/test/tselect.c b/test/tselect.c index d912df5..ad435cb 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -10546,7 +10546,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; hid_t n_cube_0_sid; /* the fully selected hyper cube */ hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ @@ -10831,7 +10831,7 @@ test_shape_same_dr__checkerboard(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; int dims_selected = 0; hid_t n_cube_0_sid; /* the checker board selected @@ -11443,7 +11443,7 @@ test_shape_same_dr__irregular(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int edge_size = 10; int i; int j; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 594bf51..3ee5393 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ -out: opts->err_stat = opts->err_stat | ret_value; /* free table */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9d5f062..0169131 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -783,12 +783,11 @@ static hsize_t diff_datum( } /* check object type */ - if (ret_value >= 0) - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); - } + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + HGOTO_DONE (opts->err_stat); + } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { opts->err_stat = 1; diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a63e56f..e96dea5 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { hid_t did = -1; hid_t sid = -1; unsigned int i; - unsigned int uf; + int ifil; trav_table_t *travt = NULL; /* nothing to do */ @@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) { if (options->verbose) printf("...Found\n"); - for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { - if (options->op_tbl->objs[i].filter[uf].filtn < 0) + for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) { + if (options->op_tbl->objs[i].filter[ifil].filtn < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter[uf].filtn) { + switch (options->op_tbl->objs[i].filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; @@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { default: break; } - } /* for uf */ + } /* for ifil */ } /* for i */ done: diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0567269..8122d6d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -33,20 +33,6 @@ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 -/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ - H5E_BEGIN_TRY { \ - if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - hid_t _err_num = 0; \ - char _msg[80]; \ - H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ - error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - HGOTO_DONE(_fail) \ - } \ - } H5E_END_TRY; \ -} - /*------------------------------------------------------------------------- * local functions *------------------------------------------------------------------------- @@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile, #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif -static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); -/* get the major number from the error stack. */ -static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; - - return 0; -} /*------------------------------------------------------------------------- * Function: copy_objects @@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; - unsigned uf; + int ifil; int is_ref = 0; htri_t is_named; hbool_t limit_maxdims; @@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->op_tbl->objs) { for (u = 0; u < options->op_tbl->nelems; u++) { if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) { - if (options->op_tbl->objs[u].filter[uf].filtn > 0) + for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) { + if (options->op_tbl->objs[u].filter[ifil].filtn > 0) req_filter = 1; } } @@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) if (!pr) printf(FORMAT_OBJ, "dset", objname); else { - char str[255], temp[28]; + char str[512], temp[512]; HDstrcpy(str, "dset "); HDstrcat(str, strfilter); diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 3d9472a..7e32def 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ H5D_layout_t layout; int rank; /* rank of dataset */ hsize_t chsize[64]; /* chunk size in elements */ - unsigned int i; + int i; + unsigned u; /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) @@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); objout->chunk.rank = rank; - for (i = 0; i < rank; i++) - objout->chunk.chunk_lengths[i] = chsize[i]; + for (u = 0; u < (unsigned)rank; u++) + objout->chunk.chunk_lengths[u] = chsize[u]; } done: @@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest = NULL; - char *pname = NULL; - int result; + const char *pname = NULL; unsigned int i; for (i = 0; i < options->op_tbl->nelems; i++) { diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 8109b93..450f731 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -509,8 +509,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); /* Get storage info */ - if((storage = H5Dget_storage_size(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed"); + storage = H5Dget_storage_size(did); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 946ca04..3a414d1 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1889,7 +1889,7 @@ static void gent_str2(void) int i; - char buf[LENSTR+10]; + char buf[LENSTR+20]; char buf2[3*LENSTR2]; hsize_t sdim; @@ -1941,7 +1941,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1954,7 +1954,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1974,7 +1974,7 @@ static void gent_str2(void) for(i = 0;(hsize_t) i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1988,7 +1988,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2007,7 +2007,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); + sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2021,7 +2021,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -7532,16 +7532,6 @@ gent_nodata(void) { hid_t fid, dataset, space; hsize_t dims[2]; - uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits; - uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits; - uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits; - uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits; - int8_t dset8[F66_XDIM][F66_YDIM8], val8bits; - int16_t dset16[F66_XDIM][F66_YDIM16], val16bits; - int32_t dset32[F66_XDIM][F66_YDIM32], val32bits; - int64_t dset64[F66_XDIM][F66_YDIM64], val64bits; - double dsetdbl[F66_XDIM][F66_YDIM8]; - unsigned int i, j; fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 0ae570b..a89bf10 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -2907,10 +2907,10 @@ out: static int make_all_filters(hid_t loc_id) { - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ + hid_t dtid = H5I_INVALID_HID; + hid_t dsid = H5I_INVALID_HID; #if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; @@ -3083,7 +3083,7 @@ int make_early(void) hid_t tid=-1; hid_t dcpl=-1; int i; - char name[10]; + char name[16]; int iter=100; if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3178,7 +3178,7 @@ int make_layout(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - char name[6]; + char name[16]; for (i=n=0; i Date: Fri, 21 Jun 2019 13:46:46 -0500 Subject: Add lib dir for testing plugins --- tools/test/h5copy/CMakeTests.cmake | 6 ++++++ tools/test/h5diff/CMakeTests.cmake | 2 ++ tools/test/h5dump/CMakeTests.cmake | 1 + tools/test/h5ls/CMakeTests.cmake | 1 + tools/test/h5repack/CMakeTests.cmake | 2 ++ 5 files changed, 12 insertions(+) diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 856aa72..df56f1a 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -291,6 +291,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -306,6 +307,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () @@ -322,6 +324,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname}) @@ -355,6 +358,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -371,6 +375,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () @@ -387,6 +392,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index bbde8f4..604c8a5 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -463,6 +463,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -478,6 +479,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index eb55b29..13d71a6 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -785,6 +785,7 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clear-objects) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index f4babb6..cd62297 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -232,6 +232,7 @@ -D "TEST_REFERENCE=${resultfile}.ls" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clear-objects) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 3a90b2c..50be28a 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -677,6 +677,7 @@ -D "TEST_REFERENCE=${testname}.${resultfile}.tst" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects) @@ -691,6 +692,7 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}") -- cgit v0.12 From b4bd49ffdd5e313cd840698709f44f05ea323104 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 21 Jun 2019 13:18:09 -0700 Subject: Fixed some low-hanging fruit from -fsanitize in t_filters_parallel. --- src/H5Dmpio.c | 5 +++-- testpar/t_filters_parallel.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index ee8bde2..467b1b7 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2806,8 +2806,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Sort the new list in order of previous owner so that each original owner of a chunk * entry gets that entry back, with the possibly newly-modified "new_owner" field */ - HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries, - sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner); + if(shared_chunks_info_array_num_entries > 1) + HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries, + sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner); send_displacements[0] = 0; for (i = 1; i < (size_t) mpi_size; i++) diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 1f26e0d..db5bd13 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -3683,6 +3683,8 @@ test_read_filtered_dataset_point_selection(void) if (read_buf) HDfree(read_buf); if (correct_buf) HDfree(correct_buf); + HDfree(coords); + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded"); @@ -5791,6 +5793,9 @@ test_write_parallel_read_serial(void) VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + + HDfree(correct_buf); + HDfree(read_buf); } return; -- cgit v0.12 From 5aa8bc154dd9fcfdf6c7cbbe0611cb200f0a420e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 21 Jun 2019 14:13:16 -0700 Subject: Fixed the heap overflow in t_filters_parallel --- testpar/t_filters_parallel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index db5bd13..76f9276 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -5813,7 +5813,7 @@ test_write_parallel_read_serial(void) static void test_shrinking_growing_chunks(void) { - float *data = NULL; + double *data = NULL; hsize_t dataset_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS]; hsize_t chunk_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS]; hsize_t sel_dims[SHRINKING_GROWING_CHUNKS_DATASET_DIMS]; @@ -5908,9 +5908,9 @@ test_shrinking_growing_chunks(void) VRFY((H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE) >= 0), "Set DXPL MPIO succeeded"); - data_size = sel_dims[0] * sel_dims[1] * sizeof(*data); + data_size = sel_dims[0] * sel_dims[1] * sizeof(double); - data = (float *) HDcalloc(1, data_size); + data = (double *) HDcalloc(1, data_size); VRFY((NULL != data), "HDcalloc succeeded"); for (i = 0; i < SHRINKING_GROWING_CHUNKS_NLOOPS; i++) { -- cgit v0.12 From 5a6afeffd44c3ba51ce0e0fa11053c83e0807685 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 21 Jun 2019 17:30:16 -0700 Subject: Put the memcpy overlap check back into H5MM. --- src/H5MM.c | 8 +++----- src/H5Pint.c | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index 1a5a149..85d82a9 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -589,13 +589,11 @@ H5MM_memcpy(void *dest, const void *src, size_t n) HDassert(dest); HDassert(src); -#if 0 - /* Commented out while we investigate overlapping buffers in the - * parallel filter code (HDFFV-10735). - */ + + /* Check for buffer overlap */ HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n); -#endif + /* Copy */ ret = HDmemcpy(dest, src, n); FUNC_LEAVE_NOAPI(ret) diff --git a/src/H5Pint.c b/src/H5Pint.c index 04411a5..0670adc 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -3133,7 +3133,7 @@ H5P__class_get(const H5P_genclass_t *pclass, const char *name, void *value) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Copy the property value */ - HDmemcpy(value, prop->value, prop->size); + H5MM_memcpy(value, prop->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3189,7 +3189,7 @@ H5P__class_set(const H5P_genclass_t *pclass, const char *name, const void *value HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Copy the property value */ - HDmemcpy(prop->value, value, prop->size); + H5MM_memcpy(prop->value, value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 4e3a0c505c2501fc6b6cd95913d511c773287272 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 22 Jun 2019 11:41:33 -0500 Subject: Move -Wnormalized down into GCC 6.x flags --- config/gnu-flags | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 9cdd2bd..c55391d 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -227,11 +227,11 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa" + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" # Append warning flags that only gcc 7.x+ knows about DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wnormalized -Wrestrict" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" ;; gcc-6*) @@ -271,7 +271,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa" + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" ;; gcc-5*) -- cgit v0.12 From 17ae90917856e4cbab5a2f1c597197ee98802fc7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 22 Jun 2019 19:34:47 -0500 Subject: Update GCC 6 & 7 flags for CMake builds --- config/cmake/HDFCompilerFlags.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 0a39568..4712f50 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -195,7 +195,12 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 6.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized") + endif () + + # Append more extra warning flags that only gcc 7.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") endif () endif () -- cgit v0.12 From 21e147da71ef226b712ec4d087af95aad9691dec Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 23 Jun 2019 13:52:15 -0500 Subject: Fix fortran test and test library linking --- fortran/test/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 738638a..9c68860 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -50,9 +50,9 @@ if (NOT BUILD_SHARED_LIBS) INTERFACE "$/include>" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) - target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} + target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE ${HDF5_F90_C_LIB_TARGET} + PUBLIC ${HDF5_TEST_LIB_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES @@ -69,9 +69,9 @@ else () PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED) - target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE - ${HDF5_F90_C_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} + target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} + PRIVATE ${HDF5_F90_C_LIBSH_TARGET} + PUBLIC ${HDF5_TEST_LIBSH_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES -- cgit v0.12 From 8b00d921d7313cd21947992ab4a007d593c49207 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 23 Jun 2019 22:34:08 -0700 Subject: Updated H5Tcopy() to get the dataset's datatype through the VOL when that is passed in as the object ID. --- src/H5D.c | 2 +- src/H5Dint.c | 24 ------------------------ src/H5Dprivate.h | 1 - src/H5T.c | 52 ++++++++++++++++++++++++++++++++++------------------ 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 5ceee11..a8cefd9 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -437,7 +437,7 @@ H5Dget_type(hid_t dset_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - /* get the datatype */ + /* Get the datatype */ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") diff --git a/src/H5Dint.c b/src/H5Dint.c index 63d1160..cd120d0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2201,30 +2201,6 @@ H5D_nameof(const H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_typeof - * - * Purpose: Returns a pointer to the dataset's datatype. The datatype - * is not copied. - * - * Return: Success: Ptr to the dataset's datatype, uncopied. - * Failure: NULL - *------------------------------------------------------------------------- - */ -H5T_t * -H5D_typeof(const H5D_t *dset) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(dset); - HDassert(dset->shared); - HDassert(dset->shared->type); - - FUNC_LEAVE_NOAPI(dset->shared->type) -} /* end H5D_typeof() */ - - -/*------------------------------------------------------------------------- * Function: H5D__alloc_storage * * Purpose: Allocate storage for the raw data of a dataset. diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 6fb7889..bc44d2a 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -166,7 +166,6 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); -H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); H5_DLL herr_t H5D_flush_all(const H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); diff --git a/src/H5T.c b/src/H5T.c index 3098325..6fe291e 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1697,33 +1697,42 @@ done: *------------------------------------------------------------------------- */ hid_t -H5Tcopy(hid_t type_id) +H5Tcopy(hid_t obj_id) { - H5T_t *dt = NULL; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; /* Pointer to the new datatype */ + hid_t dset_tid = H5I_INVALID_HID; /* Datatype ID from dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE1("i", "i", type_id); + H5TRACE1("i", "i", obj_id); - switch(H5I_get_type(type_id)) { + switch(H5I_get_type(obj_id)) { case H5I_DATATYPE: - /* The argument is a datatype handle */ - if(NULL == (dt = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") + if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a datatype ID") break; case H5I_DATASET: - { - H5D_t *dset; /* Dataset for datatype */ + { + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID") + + /* Get the datatype from the dataset + * NOTE: This will have to be closed after we're done with it. + */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dset_tid) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype from the dataset") + + /* Unwrap the type ID */ + if(NULL == (dt = (H5T_t *)H5I_object(dset_tid))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "received invalid datatype from the dataset") - /* The argument is a dataset handle */ - if(NULL == (dset = (H5D_t *)H5VL_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") - if(NULL == (dt = H5D_typeof(dset))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype") - } break; + } case H5I_UNINIT: case H5I_BADID: @@ -1748,11 +1757,18 @@ H5Tcopy(hid_t type_id) if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy") - /* Atomize result */ + /* Get an ID for the copied datatype */ if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: + + /* If we got a type ID from a passed-in dataset, we need to close that */ + if(dset_tid != H5I_INVALID_HID) + if(H5I_dec_app_ref(dset_tid) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADATOM, FAIL, "problem freeing temporary dataset type ID") + + /* Close the new datatype on errors */ if(H5I_INVALID_HID == ret_value) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") -- cgit v0.12 From a03d35dc22a4be89c09d923e439167de697510d0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 07:27:32 -0500 Subject: HDFFV-9407 Add test --- MANIFEST | 1 + release_docs/RELEASE.txt | 18 +++++++++++------- tools/test/h5dump/CMakeTests.cmake | 30 ++++++++++++++++++++++++++++++ tools/testfiles/t128bit_float.h5 | Bin 0 -> 2160 bytes 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 tools/testfiles/t128bit_float.h5 diff --git a/MANIFEST b/MANIFEST index 9f82784..3285ec2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1698,6 +1698,7 @@ ./tools/testfiles/h5dump-help.txt ./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl +./tools/testfiles/t128bit_float.h5 ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 986b1e8..c8061f5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -59,11 +59,11 @@ New Features (ADB - 2019/06/12, HDFFV-10805) - Add options to enable or disable building tools and tests - - Configure options --enable-tests and --enable-tools were added for + + Configure options --enable-tests and --enable-tools were added for autotools configure. These options are enabled by default, and can be - disabled with either --disable-tests (or tools) or --enable-tests=no - (or --enable-tools=no). Build time is reduced ~20% when tools are + disabled with either --disable-tests (or tools) or --enable-tests=no + (or --enable-tools=no). Build time is reduced ~20% when tools are disabled, 35% when tests are disabled, 45% when both are disabled. Reenabling them after the initial build requires running configure again with the option(s) enabled. @@ -240,7 +240,6 @@ New Features (ADB - 2018/12/12, HDFVIEW-4) - - Removed H5I_REFERENCE from the Java wrappers This ID class was never used by the library and has been removed @@ -251,7 +250,12 @@ New Features Tools: ------ - - + - h5dump was fixed for 128-bit floats, but was missing a test. + + New test greps for the first 15 numbers of the 128-bit value. + + (ADB - 2019/06/23, HDFFV-9407) + High-Level APIs: --------------- @@ -286,7 +290,7 @@ Bug Fixes since HDF5-1.10.3 release H5F_LIBVER_V18, the H5Ocopy() call will fail with the error stack indicating that the fill value version is out of bounds. - This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 + This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 (from H5O_FILL_VERSION_2) for H5F_LIBVER_V18. (VC - 2019/6/14, HDFFV-10800) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 13d71a6..070e98e 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -320,6 +320,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5 ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 + ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 ) set (HDF5_ERROR_REFERENCE_TEST_FILES @@ -674,6 +675,32 @@ endif () endmacro () + macro (ADD_H5_GREP_TEST resultfile resultcode result_check) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${result_check}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + endif () + endmacro () + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -1551,6 +1578,9 @@ # test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5) + # test to verify HDFFV-9407: long double full precision + ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) + ############################################################################## ### P L U G I N T E S T S ############################################################################## diff --git a/tools/testfiles/t128bit_float.h5 b/tools/testfiles/t128bit_float.h5 new file mode 100644 index 0000000..134d510 Binary files /dev/null and b/tools/testfiles/t128bit_float.h5 differ -- cgit v0.12 From cb92adccf61d712ee8c4fcac04c1b297c05ab941 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 24 Jun 2019 14:39:51 -0500 Subject: Move pragma statements outside of routines, to make older compilers happy. --- src/H5Tnative.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/H5Tnative.c b/src/H5Tnative.c index f40d81b..d213c45 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -515,6 +515,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_type() */ +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_integer @@ -551,9 +554,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) { match = H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); @@ -573,7 +573,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, match = H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); } -#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) { match = H5T_NATIVE_INT_MATCH_LLONG; @@ -659,7 +658,11 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_integer() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_float @@ -698,9 +701,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali HDassert(size>0); if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(size<=sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -724,7 +724,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali native_size = sizeof(double); #endif } -#pragma GCC diagnostic pop } else { #if H5_SIZEOF_LONG_DOUBLE !=0 if(size>sizeof(double)) { @@ -788,7 +787,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_float() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_bitfield @@ -818,9 +821,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) { tid = H5T_NATIVE_B8; native_size = 1; @@ -842,7 +842,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, native_size = 8; align = H5T_NATIVE_UINT64_ALIGN_g; } -#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) { tid = H5T_NATIVE_B64; @@ -878,6 +877,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_bitfield() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- -- cgit v0.12 From ee07744966b28206fb843716194786ad433171b6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 15:04:07 -0500 Subject: HDFFV-9407 add autotools test --- config/cmake/CTestCustom.cmake | 1 + tools/test/h5dump/testh5dump.sh.in | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 75d73cd..6db0f6f 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -93,6 +93,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects H5DUMP_VDS-clearall-objects + H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects ######### tools/h5import ######### diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index e1c02cf..c4efd8f 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -34,6 +34,7 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' CMP='cmp' DIFF='diff -c' +GREP='grep' CP='cp' DIRNAME='dirname' LS='ls' @@ -83,6 +84,7 @@ $SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 +$SRC_H5DUMP_TESTFILES/t128bit_float.h5 $SRC_H5DUMP_TESTFILES/taindices.h5 $SRC_H5DUMP_TESTFILES/tall.h5 $SRC_H5DUMP_TESTFILES/tarray1.h5 @@ -903,6 +905,30 @@ TOOLTEST_HELP() { } +# Call the h5dump tool and grep for a value +# +GREPTEST() +{ + expectdata=$1 + actual=$TESTDIR/$2 + actual_err="$TESTDIR/`basename $2 .ddl`.oerr" + shift + + # Run test. + TESTING $DUMPER -p $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + ) >$actual 2>$actual_err + $GREP $expectdata $actual > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi +} + # Print a "SKIP" message SKIP() { TESTING $DUMPER $@ @@ -1363,6 +1389,9 @@ TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 # test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5 +# test to verify HDFFV-9407: long double full precision +GREPTEST "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 1891324419030e10c24071d0a6537a4f1631c63e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 15:45:38 -0500 Subject: Need to shift off two arguments --- tools/test/h5dump/testh5dump.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index c4efd8f..894aa5e 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -913,6 +913,7 @@ GREPTEST() actual=$TESTDIR/$2 actual_err="$TESTDIR/`basename $2 .ddl`.oerr" shift + shift # Run test. TESTING $DUMPER -p $@ -- cgit v0.12 From f6ddfd7dda8aa95b33ae89b87c70493d5c644dbe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 16:10:20 -0500 Subject: Add test cleanup --- tools/test/h5dump/testh5dump.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 894aa5e..e5680cf 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -928,6 +928,11 @@ GREPTEST() echo " FAILED" nerrors="`expr $nerrors + 1`" fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi } # Print a "SKIP" message -- cgit v0.12 From f4015bed9e7ee43468240e734232f9114b749d4f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Jun 2019 14:33:54 -0700 Subject: Updated the Java attribute test so that attribute access property lists are created and used correctly. --- java/test/TestH5A.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index 536364c..7d336e1 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -50,6 +50,7 @@ public class TestH5A { long type_id = -1; long space_id = -1; long lapl_id = -1; + long aapl_id = -1; private final void _deleteFile(String filename) { File file = new File(filename); @@ -90,8 +91,10 @@ public class TestH5A { assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); space_id = H5.H5Screate(HDF5Constants.H5S_NULL); assertTrue(space_id > 0); - lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); assertTrue(lapl_id > 0); + aapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + assertTrue(aapl_id > 0); type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE); assertTrue(type_id > 0); int status = H5.H5Tenum_insert(type_id, "test", 1); @@ -122,6 +125,8 @@ public class TestH5A { try {H5.H5Sclose(space_id);} catch (Exception ex) {} if (lapl_id > 0) try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + if (aapl_id > 0) + try {H5.H5Pclose(aapl_id);} catch (Exception ex) {} System.out.println(); } @@ -194,7 +199,6 @@ public class TestH5A { long n = 0; long attr_id = -1; long attribute_id = -1; - long aapl_id = HDF5Constants.H5P_DEFAULT; try { attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, @@ -203,7 +207,7 @@ public class TestH5A { // Opening the existing attribute, obj_name(Created by H5ACreate2) // by index, attached to an object identifier. attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, - 0, HDF5Constants.H5P_DEFAULT, lapl_id); + 0, aapl_id, lapl_id); assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); @@ -258,7 +262,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Acreate_by_name: H5Acreate_by_name", attribute_id >= 0); @@ -289,7 +293,7 @@ public class TestH5A { boolean bool_val = false; try { - attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id); + attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id); ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); @@ -328,7 +332,7 @@ public class TestH5A { try { attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id); @@ -369,7 +373,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); ret_name = H5.H5Aget_name(attribute_id); assertEquals(ret_name, attr_name); -- cgit v0.12 From d9653606d8b38689c7f4d0c757753b8acc378a04 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 24 Jun 2019 18:00:02 -0500 Subject: Fix for HDFFV-10808 H5Pset_file_space_strategy succeeds when using H5Pset_libver_bounds v18,v18. Fails file creation when non-default free-space info is set in fcpl and the library version high bound is less than v110 because free-space info message is introduced in library release v110. --- src/H5Fpkg.h | 3 + src/H5Fsuper.c | 64 +++++++++++++ src/H5MF.c | 3 + src/H5Ofsinfo.c | 10 +- src/H5Oprivate.h | 12 +++ test/tfile.c | 286 +++++++++++++++++++++++++++++++------------------------ 6 files changed, 249 insertions(+), 129 deletions(-) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 335d0a7..6c1156f 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -318,6 +318,9 @@ struct H5F_file_t { H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ hbool_t fs_persist; /* Free-space persist or not */ + unsigned fs_version; /* Free-space version: */ + /* It is used to update fsinfo message in the superblock + extension when closing down the free-space managers */ hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */ haddr_t tmp_addr; /* Next address to use for temp. space in the file */ hbool_t point_of_no_return; /* Flag to indicate that we can't go back and delete a freespace header when it's used up */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index ef52844..7d90df1 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -80,6 +80,15 @@ static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; +/* Format version bounds for fsinfo message */ +/* This message exists starting library release v1.10 */ +static const unsigned H5O_fsinfo_ver_bounds[] = { + H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ + H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ + H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ + H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; + /*------------------------------------------------------------------------- * Function: H5F__super_ext_create @@ -782,6 +791,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message") /* Update changed values */ + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + if(f->shared->fs_version != fsinfo.version) + f->shared->fs_version = fsinfo.version; + if(f->shared->fs_strategy != fsinfo.strategy) { f->shared->fs_strategy = fsinfo.strategy; @@ -1375,6 +1392,11 @@ H5F__super_init(H5F_t *f) fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.mapped = FALSE; + /* Set the version for the fsinfo message */ + if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") + f->shared->fs_version = fsinfo.version; + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; @@ -1801,3 +1823,45 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5O__fsinfo_set_version + * + * Purpose: Set the version to encode the fsinfo message with. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) +{ + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(f); + HDassert(fsinfo); + + version = H5O_FSINFO_VERSION_1; + + /* Upgrade to the version indicated by the file's low bound if higher */ + if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) { + version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); + } + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + + /* Set the message version */ + fsinfo->version = version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__fsinfo_set_version() */ diff --git a/src/H5MF.c b/src/H5MF.c index 0d368d4..8d7ab96 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1835,6 +1835,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; + fsinfo.version = f->shared->fs_version; /* Write the free space manager message -- message must already exist */ if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) @@ -1973,6 +1974,8 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; + fsinfo.version = f->shared->fs_version; + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index bb15f62..ec2328c 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -65,10 +65,6 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ H5O__fsinfo_debug /* debug the message */ }}; -/* Current version of free-space manager info information */ -#define H5O_FSINFO_VERSION_0 0 -#define H5O_FSINFO_VERSION_1 1 - /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); @@ -157,11 +153,13 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy") } /* end switch */ + fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; } else { - HDassert(vers == H5O_FSINFO_VERSION_1); + HDassert(vers >= H5O_FSINFO_VERSION_1); + fsinfo->version = vers; fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */ fsinfo->persist = *p++; /* Free-space persist or not */ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */ @@ -214,7 +212,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = H5O_FSINFO_VERSION_1; /* message version */ + *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 5987ecf..d143f31 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -804,6 +804,17 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1 */ typedef unsigned H5O_unknown_t; /* Original message type ID */ +/* To indicate an invalid version for a message that does not exist yet for the release */ +/* Message version is 1 byte so the value can be 0 to 255 */ +#define H5O_INVALID_VERSION 256 + +/* The initial version of the fsinfo message: deprecated */ +/* This version is mapped to version 1 from release 1.10.1 onwards */ +#define H5O_FSINFO_VERSION_0 0 + +/* The latest version for fsinfo message */ +#define H5O_FSINFO_VERSION_1 1 +#define H5O_FSINFO_VERSION_LATEST H5O_FSINFO_VERSION_1 /* * File space info Message. * Contains file space management info and @@ -811,6 +822,7 @@ typedef unsigned H5O_unknown_t; /* Original message type ID */ * (Data structure in memory) */ typedef struct H5O_fsinfo_t { + unsigned version; /* Version number */ H5F_fspace_strategy_t strategy; /* File space strategy */ hbool_t persist; /* Persisting free-space or not */ hsize_t threshold; /* Free-space section threshold */ diff --git a/test/tfile.c b/test/tfile.c index c15064a..0dd0700 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -181,8 +181,8 @@ const char *FILESPACE_NAME[] = { /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); -static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr); -static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr); +static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); +static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); static void test_libver_bounds_dataset(hid_t fapl); static void test_libver_bounds_dataspace(hid_t fapl); @@ -4819,7 +4819,7 @@ test_filespace_1_10_0_compatible(void) for(j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) { /* Make a copy of the test file */ status = h5_make_local_copy(OLD_1_10_0_FILENAME[j], FILE5); - CHECK(status, FAIL, "h5_make_local_copy"); + CHECK(status, FAIL, "h5_make_local_copy"); /* Open the temporary test file */ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT); @@ -5583,13 +5583,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5604,13 +5604,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5627,13 +5627,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5648,13 +5648,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5666,8 +5666,8 @@ test_libver_bounds_super(hid_t fapl) /************************************************************************************************** ** ** test_libver_bounds_super_create(): -** Verify the following when the file is created with the input fapl, fcpl, and -** with/without SWMR access: +** Verify the following when the file is created with the input fapl, fcpl, +** and with/without SWMR access: ** (a) the superblock version # ** (b) the file's low bound setting ** (c) fail or succeed in creating the file @@ -5679,7 +5679,10 @@ test_libver_bounds_super(hid_t fapl) ** in the input fapl. The next three rows list the expected results for #a to #c. ** "-->" indicates "upgrade to" ** -** Creating a file with write access +** The last table lists the expected results in creating the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** Creating a file with write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5690,7 +5693,7 @@ test_libver_bounds_super(hid_t fapl) ** File creation | succeed | ** |______________________________________________________________________________| ** -** Creating a file with SWMR-write access +** Creating a file with SWMR-write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5698,12 +5701,19 @@ test_libver_bounds_super(hid_t fapl) ** |------------------------------------------------------------------------------| ** File's low bound | -- | ->v110 | -- | ->v110 | no change | ** |------------------------------------------------------------------------------| -** File creation | fail | succeed | fail | succeed | succed | +** File creation | fail | succeed | fail | succeed | succeed | +** |______________________________________________________________________________| +** +** Creating a file with write/SWMR-write access + non-default fsinfo +** -------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | +** |______________________________________________________________________________| +** File creation | fail | succeed | fail | succeed | succeed | ** |______________________________________________________________________________| ** ******************************************************************************************************/ static void -test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { hid_t fid = -1; /* File ID */ H5F_t *f = NULL; /* Internal file pointer */ @@ -5726,8 +5736,10 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ret = H5Pget_libver_bounds(fapl, &low, &high); CHECK(ret, FAIL, "H5Pget_libver_bounds"); - if(is_swmr) { /* SWMR is enabled */ + if(non_def_fsm && high < H5F_LIBVER_V110) + VERIFY(fid, FAIL, "H5Fcreate"); + else if(is_swmr) { /* SWMR is enabled */ if(high >= H5F_LIBVER_V110) { /* Should succeed */ VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds"); @@ -5736,37 +5748,37 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } else /* Should fail */ VERIFY(fid >= 0, FALSE, "H5Fcreate"); - } - else { /* Should succeed */ + } else { /* Should succeed */ VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); switch(low) { case H5F_LIBVER_EARLIEST: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || - f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || - f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_V18: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_V110: case H5F_LIBVER_V112: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_ERROR: case H5F_LIBVER_NBOUNDS: default: - ERROR("H5Pget_libver_bounds"); + ERROR("H5Pget_libver_bounds"); } /* end switch */ - } + + } /* end else */ if(fid >= 0) { /* Close the file */ ret = H5Fclose(fid); @@ -5793,11 +5805,14 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** For file open, the file's superblock version, the low/high bounds setting in fapl, ** and with/without SWMR file access will determine the results for #a and #b. ** -** The first row for the following tables is the 5 pairs of low/high bounds setting +** The first row for the following tables (#A - #B) is the 5 pairs of low/high bounds setting ** in the input fapl. The next two rows list the expected results for #a and #b. ** "-->" indicates "upgrade to" ** -** Opening a file with write access +** The last table (#C) lists the expected results in opening the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** (A) Opening a file with write access ** ** Superblock version 0, 1 ** -------------------------------------------------------------------------------- @@ -5829,7 +5844,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** ** ** -** Opening a file with SWMR-write access +** (B) Opening a file with SWMR-write access ** ** Superblock version 0, 1, 2 ** ------------------------------------------------------------------------------- @@ -5851,9 +5866,17 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** |_____________________________________________________________________________| ** ** +** (C) Opening a file with write/SWMR-write access + non-default fsinfo +** ------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v10) | (v18, v18) | (v18, v110) | (v110, v110) | +** |_____________________________________________________________________________| +** File open | fail | succeed | fail | succeed | succeed | +** |_____________________________________________________________________________| +** +** ******************************************************************************************************/ static void -test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { hid_t fid = -1; /* File ID */ H5F_t *f = NULL; /* Internal file pointer */ @@ -5863,96 +5886,113 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ - fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + H5E_BEGIN_TRY { + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; - /* Get the internal file pointer */ - f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + /* Retrieve the low/high bounds */ + ret = H5Pget_libver_bounds(fapl, &low, &high); + CHECK(ret, FAIL, "H5Pget_libver_bounds"); - /* The file's superblock version */ - super_vers = f->shared->sblock->super_vers; + if(non_def_fsm && high < H5F_LIBVER_V110) { + VERIFY(fid, FAIL, "H5Fcreate"); - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + } else { + VERIFY(fid >= 0, TRUE, "H5Fcreate"); - /* Create a default file access property list */ - new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + /* Get the internal file pointer */ + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); - /* Loop through all the combinations of low/high bounds in new_fapl */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { - H5E_BEGIN_TRY { - ret = H5Pset_libver_bounds(new_fapl, low, high); - } H5E_END_TRY; + /* The file's superblock version */ + super_vers = f->shared->sblock->super_vers; - /* Invalid combinations */ - if (ret < 0) - continue; + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Open the file with or without SWMR access */ - H5E_BEGIN_TRY { - fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); - } H5E_END_TRY; + /* Create a default file access property list */ + new_fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(new_fapl, FAIL, "H5Pcreate"); - /* Get the internal file pointer if the open succeeds */ - if(fid >= 0) { - f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); - } + /* Loop through all the combinations of low/high bounds in new_fapl */ + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + H5E_BEGIN_TRY { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; - /* Verify the file open succeeds or fails */ - switch(super_vers) { - case 3: - if(high >= H5F_LIBVER_V110) { - /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } else /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - break; - - case 2: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; - - case 1: - case 0: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); - - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; + /* Invalid combinations */ + if (ret < 0) + continue; + + /* Open the file with or without SWMR access */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); + } H5E_END_TRY; + + if(non_def_fsm && high < H5F_LIBVER_V110) { + VERIFY(fid, FAIL, "H5Fopen"); + continue; + } + + /* Get the internal file pointer if the open succeeds */ + if(fid >= 0) { + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); + } - default: - break; - } /* end switch */ + /* Verify the file open succeeds or fails */ + switch(super_vers) { + case 3: + if(high >= H5F_LIBVER_V110) { + /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } else /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + break; + + case 2: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + case 1: + case 0: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + default: + break; + } /* end switch */ + } /* end for */ } /* end for */ - } /* end for */ - /* Close the file access property list */ - ret = H5Pclose(new_fapl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close the file access property list */ + ret = H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end else */ } /* end test_libver_bounds_super_open() */ -- cgit v0.12 From 18f65dcee9367b2c84388da331f46a1536eeea09 Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Tue, 25 Jun 2019 07:32:32 +0000 Subject: Fixed libhdf5 settings file for both autotools & CMake --- config/cmake/libhdf5.settings.cmake.in | 2 ++ configure.ac | 2 +- src/libhdf5.settings.in | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 9e91ac0..97929e6 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -68,6 +68,8 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_BUILD_HL_LIB@ + Build HDF5 Tests: @BUILD_TESTS@ + Build HDF5 Tools: @HDF5_BUILD_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ diff --git a/configure.ac b/configure.ac index 33b3251..d1d209f 100644 --- a/configure.ac +++ b/configure.ac @@ -3649,7 +3649,7 @@ AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; AC_OUTPUT -chmod 755 src/h5cc +chmod 755 bin/h5cc if test "X$HDF_CXX" = "Xyes"; then chmod 755 c++/src/h5c++ fi diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 37957a2..f856ebc 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -72,7 +72,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_HL@ Build HDF5 Tests: @HDF5_TESTS@ - Build HDF5 TOOLS: @HDF5_TOOLS@ + Build HDF5 Tools: @HDF5_TOOLS@ Threadsafety: @THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @DEPRECATED_SYMBOLS@ -- cgit v0.12 From 71de5b808818a2619fe179eac4f6c6ec892a4420 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 25 Jun 2019 11:47:33 -0500 Subject: Correct hid_t error value to H5I_INVALID_HID in tests related to libver_bounds. --- test/tfile.c | 224 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/test/tfile.c b/test/tfile.c index 0dd0700..9e17c34 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5501,16 +5501,16 @@ test_libver_bounds(void) static void test_libver_bounds_low_high(void) { - hid_t fapl = -1; /* File access property list */ - H5F_libver_t low, high; /* Low and high bounds */ - herr_t ret; /* The return value */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_libver_t low, high; /* Low and high bounds */ + herr_t ret; /* The return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing setting (low, high) format version bounds\n")); /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(fapl, FAIL, "H5Pcreate"); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high version bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) @@ -5573,13 +5573,13 @@ test_libver_bounds_low_high(void) static void test_libver_bounds_super(hid_t fapl) { - hid_t fcpl = -1; /* File creation property list */ - herr_t ret; /* The return value */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + herr_t ret; /* The return value */ /* Create a default fcpl: #A */ /* This will result in superblock version 0 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ @@ -5598,7 +5598,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with v1-btree K value enabled: #B */ /* This will result in superblock version 1 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_istore_k(fcpl, 64); CHECK(ret, FAIL, "H5Pset_istore_k"); @@ -5619,7 +5619,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with shared messages enabled: #C */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl, 1); CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes"); ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_ATTR_FLAG, 2); @@ -5642,7 +5642,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with persistent free-space manager enabled: #D */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); CHECK(ret, FAIL, "H5Pset_file_space"); @@ -5715,11 +5715,11 @@ test_libver_bounds_super(hid_t fapl) static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - H5F_libver_t low, high; /* Low and high bounds */ - hbool_t ok; /* The result is ok or not */ - herr_t ret; /* The return value */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + H5F_libver_t low, high; /* Low and high bounds */ + hbool_t ok; /* The result is ok or not */ + herr_t ret; /* The return value */ /* Try to create the file */ H5E_BEGIN_TRY { @@ -5737,7 +5737,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n CHECK(ret, FAIL, "H5Pget_libver_bounds"); if(non_def_fsm && high < H5F_LIBVER_V110) - VERIFY(fid, FAIL, "H5Fcreate"); + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); else if(is_swmr) { /* SWMR is enabled */ if(high >= H5F_LIBVER_V110) { /* Should succeed */ @@ -5878,9 +5878,9 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ herr_t ret; /* Return value */ @@ -5895,7 +5895,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non CHECK(ret, FAIL, "H5Pget_libver_bounds"); if(non_def_fsm && high < H5F_LIBVER_V110) { - VERIFY(fid, FAIL, "H5Fcreate"); + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); } else { VERIFY(fid >= 0, TRUE, "H5Fcreate"); @@ -5932,7 +5932,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non } H5E_END_TRY; if(non_def_fsm && high < H5F_LIBVER_V110) { - VERIFY(fid, FAIL, "H5Fopen"); + VERIFY(fid, H5I_INVALID_HID, "H5Fopen"); continue; } @@ -6025,10 +6025,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non static void test_libver_bounds_obj(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ H5O_info_t oinfo; /* Object info */ @@ -6041,7 +6041,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a default file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared message in the fcpl */ /* This will result in a version 2 object header */ @@ -6052,7 +6052,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create the file with the fcpl and the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -6071,7 +6071,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a file with the default fcpl and input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -6087,7 +6087,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a new default file access property list which is used to open the file in the "for" loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file with the fapl; create a group and verify the @@ -6185,11 +6185,11 @@ test_libver_bounds_obj(hid_t fapl) static void test_libver_bounds_dataset(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ H5D_t *dset = NULL; /* Internal dataset pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6206,15 +6206,15 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create the dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a contiguous dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataset pointer */ dset = (H5D_t *)H5VL_object(did); @@ -6246,9 +6246,9 @@ test_libver_bounds_dataset(hid_t fapl) with "no filter edge chunks" enabled. This will result in a version 4 layout message */ sid = H5Screate_simple(2, fix_dims2, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, fix_chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); @@ -6289,14 +6289,14 @@ test_libver_bounds_dataset(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset with 2 unlimited dimensions in the 'for' loop */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -6325,7 +6325,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal file pointer */ dset = (H5D_t *)H5VL_object(did); @@ -6409,14 +6409,14 @@ test_libver_bounds_dataset(hid_t fapl) static void test_libver_bounds_dataspace(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1, did_null = -1; /* Dataset IDs */ - hid_t did_compact = -1, did_contig = -1; /* Dataset IDs */ - hid_t sid = -1, sid_null = -1; /* Dataspace IDs */ - hid_t sid_compact = -1, sid_contig = -1; /* Dataspace IDs */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dcpl_compact = -1, dcpl_contig = -1; /* Dataset creation property lists */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID, did_null = H5I_INVALID_HID; /* Dataset IDs */ + hid_t did_compact = H5I_INVALID_HID, did_contig = H5I_INVALID_HID; /* Dataset IDs */ + hid_t sid = H5I_INVALID_HID, sid_null = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid_compact = H5I_INVALID_HID, sid_contig = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dcpl_compact = H5I_INVALID_HID, dcpl_contig = H5I_INVALID_HID; /* Dataset creation property lists */ H5S_t *space = NULL, *space_null = NULL; /* Internal dataspace pointers */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6432,19 +6432,19 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create scalar dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the scalar dataspace */ did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid = H5Dget_space(did); - CHECK(sid, FAIL, "H5Dget_space"); + CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); space = (H5S_t *)H5I_object(sid); CHECK(space, NULL, "H5I_object"); @@ -6453,15 +6453,15 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create null dataspace */ sid_null = H5Screate(H5S_NULL); - CHECK(sid_null, FAIL, "H5Screate"); + CHECK(sid_null, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the null dataspace */ did_null = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_INT, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did_null, FAIL, "H5Dcreate"); + CHECK(did_null, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid_null = H5Dget_space(did_null); - CHECK(sid_null, FAIL, "H5Dget_space"); + CHECK(sid_null, H5I_INVALID_HID, "H5Dget_space"); space_null = (H5S_t *)H5I_object(sid_null); CHECK(space_null, NULL, "H5I_object"); @@ -6487,29 +6487,29 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(1, dims, max_dims); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 1, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); /* Set up dataspace and dcpl for creating a compact dataset */ sid_compact = H5Screate_simple(1, dims, NULL); - CHECK(sid_compact, FAIL, "H5Screate_simple"); + CHECK(sid_compact, H5I_INVALID_HID, "H5Screate_simple"); dcpl_compact = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_compact, FAIL, "H5Pcreate"); + CHECK(dcpl_compact, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_compact, H5D_COMPACT); CHECK(ret, FAIL, "H5Pset_layout"); /* Set up dataspace and dcpl for creating a contiguous dataset */ sid_contig = H5Screate_simple(2, dims2, NULL); - CHECK(sid_contig, FAIL, "H5Screate_simple"); + CHECK(sid_contig, H5I_INVALID_HID, "H5Screate_simple"); dcpl_contig = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_contig, FAIL, "H5Pcreate"); + CHECK(dcpl_contig, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS); CHECK(ret, FAIL, "H5Pset_layout"); @@ -6541,31 +6541,31 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the chunked dataset */ tmp_sid = H5Dget_space(did); - CHECK(tmp_sid, FAIL, "H5Dget_space"); + CHECK(tmp_sid, H5I_INVALID_HID, "H5Dget_space"); tmp_space = (H5S_t *)H5I_object(tmp_sid); CHECK(tmp_space, NULL, "H5I_object"); /* Create the compact dataset */ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT); - CHECK(did_compact, FAIL, "H5Dcreate2"); + CHECK(did_compact, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the compact dataset */ tmp_sid_compact = H5Dget_space(did_compact); - CHECK(tmp_sid_compact, FAIL, "H5Dget_space"); + CHECK(tmp_sid_compact, H5I_INVALID_HID, "H5Dget_space"); tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact); CHECK(tmp_space_compact, NULL, "H5I_object"); /* Create the contiguous dataset */ did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT); - CHECK(did_contig, FAIL, "H5Dcreate2"); + CHECK(did_contig, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the contiguous dataset */ tmp_sid_contig = H5Dget_space(did_contig); - CHECK(tmp_sid_contig, FAIL, "H5Dget_space"); + CHECK(tmp_sid_contig, H5I_INVALID_HID, "H5Dget_space"); tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig); CHECK(tmp_space_contig, NULL, "H5I_object"); @@ -6647,8 +6647,8 @@ test_libver_bounds_dataspace(hid_t fapl) static void test_libver_bounds_datatype(hid_t fapl) { - hid_t tid = -1, tid_enum = -1, tid_array = -1; /* Datatype IDs */ - hid_t tid_compound = -1, tid_vlen = -1; /* Datatype IDs */ + hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */ + hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */ int enum_value; /* Value for enum datatype */ typedef struct s1 { /* Data structure for compound datatype */ char c; @@ -6739,13 +6739,13 @@ test_libver_bounds_datatype(hid_t fapl) static void test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File acess property list */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dtid = -1; /* Datatype ID for the dataset */ - hid_t str_tid = -1; /* String datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File acess property list */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dtid = H5I_INVALID_HID; /* Datatype ID for the dataset */ + hid_t str_tid = H5I_INVALID_HID; /* String datatype ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ hsize_t dims[1] = {1}; /* Dimension sizes */ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ @@ -6762,12 +6762,12 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create a committed datatype of string which will be used later inside the 'for' loop */ str_tid = H5Tcopy(H5T_C_S1); - CHECK(str_tid, FAIL, "H5Tcopy"); + CHECK(str_tid, H5I_INVALID_HID, "H5Tcopy"); ret = H5Tset_size(str_tid, (size_t)10); CHECK(ret, FAIL, "H5Tset_size"); ret = H5Tcommit2(fid, "datatype", str_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6777,15 +6777,15 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create dataspace */ sid = H5Screate_simple(1, dims, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); /* Create a dataset with the input tid */ did = H5Dcreate2(fid, DSET1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6827,13 +6827,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create a default file access property list */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -6877,11 +6877,11 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6974,14 +6974,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) static void test_libver_bounds_attributes(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ - hid_t tid = -1; /* Datatype ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t attr_cpl = -1; /* Attribute creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t tid = H5I_INVALID_HID; /* Datatype ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t attr_cpl = H5I_INVALID_HID; /* Attribute creation property list */ H5A_t *attr = NULL; /* Internal attribute pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6993,11 +6993,11 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Integer datatpye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create a committed datatype */ ret = H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -7005,15 +7005,15 @@ test_libver_bounds_attributes(hid_t fapl) /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with the committed datatype */ aid = H5Acreate2(gid, "attr1", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7047,13 +7047,13 @@ test_libver_bounds_attributes(hid_t fapl) /* Enable character encoding in attribute creation property list */ attr_cpl = H5Pcreate(H5P_ATTRIBUTE_CREATE); - CHECK(attr_cpl, FAIL, "H5Pcreate"); + CHECK(attr_cpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_char_encoding(attr_cpl, H5T_CSET_UTF8); CHECK(ret, FAIL, "H5Pset_char_encoding"); /* Attach an attribute to the group with character encoding set */ aid = H5Acreate2(gid, "attr3", H5T_NATIVE_INT, sid, attr_cpl, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7092,7 +7092,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a copy of the file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared datatype message */ ret = H5Pset_shared_mesg_nindexes(fcpl, 1); @@ -7102,23 +7102,23 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file with shared datatype message enabled */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create an integer datatye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with shared integer datatype */ aid = H5Acreate2(gid, ATTR_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7157,7 +7157,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a scalar dataspace to be used later for the attribute */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Loop through all the combinations of low/high bounds */ /* Open the file and group and attach an attribute to the group */ -- cgit v0.12 From b40a6f75aaf3d40c6ea5f9cc8beb74ae8aaaba96 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 25 Jun 2019 12:08:33 -0700 Subject: Fixed a memory issue in trefer.c. --- test/trefer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/trefer.c b/test/trefer.c index 4bf9caf..9af5c89 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -526,7 +526,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hssize_t hssize_ret; /* hssize_t return value */ htri_t tri_ret; /* htri_t return value */ herr_t ret; /* Generic return value */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */ hid_t dset_NA; /* Dataset id for undefined reference */ hid_t space_NA; /* Dataspace id for undefined reference */ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ @@ -744,7 +744,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Dread"); /* Try to read an unaddressed dataset */ - dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &addr); + dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg); VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef"); /* Try to open objects */ @@ -1781,8 +1781,8 @@ test_reference(void) test_reference_obj(); /* Test basic H5R object reference code */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) -- cgit v0.12 From 3768566139df18928aa29ece0eff3010b224633b Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 25 Jun 2019 14:47:53 -0500 Subject: Add release notes. --- release_docs/RELEASE.txt | 16 ++++++++++++++++ src/H5Fsuper.c | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8061f5..7c9bbfa 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -282,6 +282,22 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Fixed an issue where creating a file with non-default file space info + together with library high bound setting to H5F_LIBVER_V18. + + When setting non-default file space info in fcpl via + H5Pset_file_space_strategy() and then creating a file with + both high and low library bounds set to + H5F_LIBVER_V18 in fapl, the library succeeds in creating the file. + File creation should fail because the feature of setting non-default + file space info does not exist in library release 1.8 or earlier. + + This was fixed by setting and checking the proper version in the + file space info message based on the library low and high bounds + when creating and opening the HDF5 file. + + (VC - 2019/6/25, HDFFV-10808) + - Fixed an issue where copying a version 1.8 dataset between files using H5Ocopy fails due to an incompatible fill version diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 7d90df1..f4ff645 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1850,9 +1850,8 @@ H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) version = H5O_FSINFO_VERSION_1; /* Upgrade to the version indicated by the file's low bound if higher */ - if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) { + if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); - } /* Version bounds check */ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || -- cgit v0.12 From 8ac60adaa2af21b57185c145d70a12d16a0b7409 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 25 Jun 2019 23:19:09 -0700 Subject: Banish enum increment warnings --- test/enc_dec_plist.c | 4 ++-- test/th5s.c | 4 ++-- test/vds.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 2c8f691..23bec6e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -187,8 +187,8 @@ main(void) -1 }; /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ char* low_string; /* The low bound string */ char* high_string; /* The high bound string */ diff --git a/test/th5s.c b/test/th5s.c index c5dfa97..a48979b 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -3366,8 +3366,8 @@ test_h5s(void) test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/vds.c b/test/vds.c index af052a8..30f8eec 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12160,8 +12160,8 @@ main(void) if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ char *low_string; /* The low bound string */ char *high_string; /* The high bound string */ -- cgit v0.12 From 569d051df5b295041a7f6cb73d6220f4999a8633 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 26 Jun 2019 21:55:11 -0700 Subject: Fixed missing return value checks in VDS tests. --- test/vds.c | 18 ++++++++++++------ test/vds_env.c | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/vds.c b/test/vds.c index 30f8eec..5870d49 100644 --- a/test/vds.c +++ b/test/vds.c @@ -1212,11 +1212,14 @@ test_vds_prefix_first(unsigned config, hid_t fapl) /* Create source file if requested */ if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } else { srcfile[0] = vfile; @@ -1293,11 +1296,14 @@ test_vds_prefix_first(unsigned config, hid_t fapl) /* Reopen srcdset and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/vds_env.c b/test/vds_env.c index abdd7b7..d3a28fb 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -130,11 +130,14 @@ test_vds_prefix_second(unsigned config, hid_t fapl) /* Create source file if requested */ if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } else { srcfile[0] = vfile; @@ -211,11 +214,14 @@ test_vds_prefix_second(unsigned config, hid_t fapl) /* Reopen srcdset and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR -- cgit v0.12 From e7dd793f425b0deabe2d47798c72ae265b1c53c0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 27 Jun 2019 08:00:31 -0500 Subject: Remove unused code --- tools/test/perform/pio_standalone.c | 118 ----------------------------------- tools/test/perform/sio_standalone.c | 119 ------------------------------------ 2 files changed, 237 deletions(-) diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index d5f681e..dd6a61a 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -163,121 +163,3 @@ print_version(const char *progname) } - -/** From h5test.c **/ - -#ifdef H5_HAVE_PARALLEL -MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ -#endif - -#if 0 -int -h5_set_info_object(void) -{ - char *envp; /* environment pointer */ - int ret_value=0; - - /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ - char *next, *valp; - - - valp = envp = next = HDstrdup(envp); - - /* create an INFO object if not created yet */ - if (h5_io_info_g == MPI_INFO_NULL) - MPI_Info_create(&h5_io_info_g); - - do { - size_t len; - char *key_val, *endp, *namep; - - if (*valp == ';') - valp++; - - /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; - key_val = calloc(1, len + 1); - - /* increment the next pointer past the terminating semicolon */ - if (*next == ';') - ++next; - - namep = HDstrncpy(key_val, valp, len); - - /* pass up any beginning whitespaces */ - while (*namep && (*namep == ' ' || *namep == '\t')) - namep++; - - /* eat up any ending white spaces */ - endp = &namep[strlen(namep) - 1]; - - while (endp && (*endp == ' ' || *endp == '\t')) - *endp-- = '\0'; - - /* find the '=' */ - - valp = HDstrchr(namep, '='); - - if (valp != NULL) { /* it's a valid key/value pairing */ - char *tmp_val = valp + 1; - - /* change '=' to \0, move valp down one */ - *valp-- = '\0'; - - /* eat up ending whitespace on the "key" part */ - while (*valp == ' ' || *valp == '\t') - *valp-- = '\0'; - - valp = tmp_val; - - /* eat up beginning whitespace on the "value" part */ - while (*valp == ' ' || *valp == '\t') - *valp++ = '\0'; - - /* actually set the darned thing */ - if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); - ret_value = -1; - } - } - - valp = next; - HDfree(key_val); - } while (next && *next); - - HDfree(envp); - } - - return ret_value; -} - - -void -h5_dump_info_object(MPI_Info info) -{ - char key[MPI_MAX_INFO_KEY+1]; - char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; - - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); - if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); - } - else { - MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); - for (i=0; i Date: Thu, 27 Jun 2019 16:04:48 -0500 Subject: (1) Add/remove comments. (2) A temporary fix to address the test/objcopy.c: test_copy_group_deep() test failure with the family driver. The test failure occurs with these configurations in objcopy.c: --with shared src messages (CONFIG_SHARE_SRC) --without shared dst messages (CONFIG_SHARE_DST) --with latest format for source file (CONFIG_SRC_NEW_FORMAT) --without dense attributes (CONFIG_DENSE) --with latest format for destination file (CONFIG_DST_NEW_FORMAT) The temporary fix is in src/H5MFaggr.c (see comments above #ifdef REPLACE/#endif). --- src/H5FSsection.c | 117 +++++++++++++++++---------------------------------- src/H5Fsuper.c | 41 +++++++++--------- src/H5MF.c | 124 ++++++++++++++---------------------------------------- src/H5MFaggr.c | 14 ++++++ 4 files changed, 105 insertions(+), 191 deletions(-) diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 81f48dd..d15e299 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -307,6 +307,20 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. * + * Add the fix in this routine to resolve the potential infinite loop + * problem when allocating file space for the meta data of the + * self-referential free-space managers at file closing. + * + * On file close or flushing, when the section info is modified + * and protected/unprotected, does not allow the section info size + * to shrink: + * --if the current allocated section info size in fspace->sect_size is + * larger than the previous section info size in fpsace->alloc_sect_size, + * release the section info + * --Otherwise, set the fspace->sect_size to be the same as + * fpsace->alloc_sect_size. This means fspace->sect_size may be larger + * than what is actually needed. + * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol @@ -2436,84 +2450,31 @@ done: /*------------------------------------------------------------------------- * Function: H5FS_vfd_alloc_hdr_and_section_info_if_needed * - * Purpose: This function is part of a hack to patch over a design - * flaw in the free space managers for file space allocation. - * Specifically, if a free space manager allocates space for - * its own section info, it is possible for it to - * go into an infinite loop as it: - * - * 1) computes the size of the section info - * - * 2) allocates file space for the section info - * - * 3) notices that the size of the section info - * has changed - * - * 4) deallocates the section info file space and - * returns to 1) above. - * - * Similarly, if it allocates space for its own header, it - * can go into an infinite loop as it: - * - * 1) allocates space for the header - * - * 2) notices that the free space manager is empty - * and thus should not have file space allocated - * to its header - * - * 3) frees the space allocated to the header - * - * 4) notices that the free space manager is not - * empty and thus must have file space allocated - * to it, and thus returns to 1) above. - * - * In a nutshell, the solution applied in this hack is to - * deallocate file space for the free space manager(s) that - * handle FSM header and/or section info file space allocations, - * wait until all other allocation/deallocation requests have - * been handled, and then test to see if the free space manager(s) - * in question are empty. If they are, do nothing. If they - * are not, allocate space for them at end of file bypassing the - * usual file space allocation calls, and thus avoiding the - * potential infinite loops. - * - * The purpose of this function is to allocate file space for + * Purpose: The purpose of this function is to allocate file space for * the header and section info of the target free space manager - * directly from the VFD if needed. In this case the function - * also re-inserts the header and section info in the metadata - * cache with this allocation. - * - * When paged allocation is not enabled, allocation of space - * for the free space manager header and section info is - * straight forward -- we simply allocate the space directly - * from file driver. - * - * Note that if f->shared->alignment > 1, and EOA is not a - * multiple of the alignment, it is possible that performing - * these allocations may generate a fragment of file space in - * addition to the space allocated for the section info. This - * excess space is dropped on the floor. As shall be seen, - * it will usually be reclaimed later. - * - * When page allocation is enabled, things are more difficult, - * as there is the possibility that page buffering will be - * enabled when the free space managers are read. To allow - * for this, we must ensure that space allocated for the - * free space manager header and section info is either larger - * than a page, or resides completely within a page. - * - * Do this by allocating space for the free space header and - * section info starting at page boundaries, and extending - * allocation to the next page boundary. This of course wastes - * space, but see below. - * - * On the first free space allocation / deallocation after the - * next file open, we will read the self referential free space - * managers, float them and reduce the EOA to its value prior - * to allocation of file space for the self referential free - * space managers on the preceeding file close. This EOA value - * is stored in the free space manager superblock extension - * message. + * if they are not allocated yet. + * + * The previous hack in this routine to avoid the potential infinite + * loops by allocating file space directly from the end of the file + * is removed. The allocation can now be done via the usual + * file space allocation call H5MF_alloc(). + * + * The design flaw is addressed by not allowing the size + * of section info to shrink. This means, when trying to allocate + * section info size X via H5MF_alloc() and the section info size + * after H5MF_alloc() changes to Y: + * --if Y is larger than X, free the just allocated file space X + * via H5MF_xfree() and set fspace->sect_size to Y. + * This routine will be called again later from + * H5MF_settle_meta_data_fsm() to allocate section info with the + * larger fpsace->sect_size Y. + * --if Y is smaller than X, no further allocation is needed and + * fspace->sect_size and fspace->alloc_sect_size are set to X. + * This means fspace->sect_size may be larger than what is + * actually needed. + * + * This routine also re-inserts the header and section info in the + * metadata cache with this allocation. * * Return: Success: non-negative * Failure: negative @@ -2530,8 +2491,6 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, hsize_t hdr_alloc_size; hsize_t sinfo_alloc_size; haddr_t sect_addr = HADDR_UNDEF; /* address of sinfo */ - haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ - hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4576f3d..7685384 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -837,39 +837,40 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(f->shared->eoa_fsm_fsalloc != fsinfo.eoa_pre_fsm_fsalloc) f->shared->eoa_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc; - /* f->shared->eoa_pre_fsm_fsalloc must always be HADDR_UNDEF - * in the absence of persistent free space managers. - */ - /* If the following two conditions are true: + /* + * If the following two conditions are true: * (1) skipping EOF check (skip_eof_check) * (2) dropping free-space to the floor (f->shared->null_fsm_addr) - * skip the asserts as "eoa_pre_fsm_fsalloc" may be undefined + * skip the asserts as "eoa_fsm_fsalloc" may be undefined * for a crashed file with persistent free space managers. - * #1 and #2 are enabled when the tool h5clear --increment + * The above two conditions are enabled when the tool h5clear --increment * option is used. */ - if(!skip_eof_check && !f->shared->null_fsm_addr) { + if(!skip_eof_check && !f->shared->null_fsm_addr) HDassert((!f->shared->fs_persist) || (f->shared->eoa_fsm_fsalloc != HADDR_UNDEF)); - } - - /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file - * with persistent free space managers, therefore, set - * "first_alloc_dealloc" when the condition - * "dropping free-space to the floor is true. - * This will ensure that no action is done to settle things on file - * close via H5MF_settle_meta_data_fsm() and H5MF_settle_raw_data_fsm(). - */ - /* The following check is removed: + + /* + * A crashed file with persistent free-space managers may have + * undefined f->shared->eoa_fsm_fsalloc. + * eoa_fsm_fsalloc is the final eoa which is saved in the free-space + * info message's eoa_pre_fsm_fsalloc field for backward compatibility. + * If the tool h5clear sets to dropping free-space to the floor + * as indicated by f->shared->null_fsm_addr, we are not going to + * perform actions to settle things on file close in the routines + * H5MF_settle_meta_data_fsm() and H5MF_settle_raw_data_fsm(). + * + * We remove the following check: * if((f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF || null_fsm_addr) && * (H5F_INTENT(f) & H5F_ACC_RDWR)) + * f->shared->first_alloc_dealloc = TRUE; * - * --there is no more eoa_pre_fsm_fsalloc + * Because: + * --there is no more f->shared->eoa_pre_fsm_fsalloc and + * f->shared->first_alloc_dealloc * --the check for null_fsm_addr is directly done in H5MF_settle_meta_data_fsm() * and H5MF_settle_raw_data_fsm() */ - - f->shared->fs_addr[0] = HADDR_UNDEF; for(u = 1; u < NELMTS(f->shared->fs_addr); u++) f->shared->fs_addr[u] = fsinfo.fs_addr[u - 1]; diff --git a/src/H5MF.c b/src/H5MF.c index 00856e1..3d9ddb0 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -51,6 +51,7 @@ #define H5MF_FSPACE_EXPAND 120 /* Percent of "normal" size to expand serialized free space size */ #define H5MF_CHECK_FSM(FSM, CF) \ + HDassert(*CF == FALSE); \ if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ *CF = TRUE; @@ -2644,8 +2645,9 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(f->shared); HDassert(fsm_settled); - /* Only need to settle things if we are persisting the free space info - * and allocation/deallocation has occurred. + /* + * Only need to settle things if we are persisting free space and + * the private property in f->shared->null_fsm_addr is not enabled. */ if(f->shared->fs_persist && !H5F_NULL_FSM_ADDR(f)) { hbool_t fsm_opened[H5F_MEM_PAGE_NTYPES]; /* State of FSM */ @@ -2987,7 +2989,6 @@ done: -/* NEED TO remove/modify the comments in this routine */ /*------------------------------------------------------------------------- * Function: H5MF_settle_meta_data_fsm() * @@ -3005,7 +3006,7 @@ done: * On entry to this function, the raw data settle routine * (H5MF_settle_raw_data_fsm()) should have: * - * 1) Freed the aggregators. + * 1) Freed the aggregators. * * 2) Freed all file space allocated to the free space managers. * @@ -3041,12 +3042,12 @@ done: * 1) Verify that the free space manager(s) involved in file * space allocation for free space managers are still floating. * - * 2) Free the aggregators. + * 2) Free the aggregators. * - * 3) Reduce the EOA to the extent possible, and make note + * 3) Reduce the EOA to the extent possible, and make note * of the resulting value. This value will be stored * in the fsinfo superblock extension message and be used - * in the subsequent file open. + * in the subsequent file open. * * 4) Re-allocate space for any free space manager(s) that: * @@ -3067,21 +3068,15 @@ done: * allocation has changed the size of the section info -- * forcing us to deallocate and start the loop over again. * - * To avoid this, simply allocate file space for these - * FSM(s) directly from the VFD layer if allocation is - * indicated. This avoids the issue by bypassing the FSMs - * in this case. - * - * Note that this may increase the size of the file needlessly. - * A better solution would be to modify the FSM code to + * The solution is to modify the FSM code to * save empty FSMs to file, and to allow section info blocks - * to be oversized. However, given that the FSM code is - * also used by the fractal heaps, and that we are under - * severe time pressure at the moment, the above brute - * force solution is attractive. + * to be oversized. That is, only allow section info to increase + * in size, not shrink. The solution is now implemented. * - * 5) Make note of the EOA -- used for sanity checking on - * FSM shutdown. + * 5) Make note of the EOA -- used for sanity checking on + * FSM shutdown. This is saved as eoa_pre_fsm_fsalloc in + * the free-space info message for backward compatibility + * with the 1.10 library that has the hack. * * Return: SUCCEED/FAIL * @@ -3114,8 +3109,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(f->shared); HDassert(fsm_settled); - /* Only need to settle things if we are persisting the free space info - * and allocation/deallocation has occurred. + /* + * Only need to settle things if we are persisting free space and + * the private property in f->shared->null_fsm_addr is not enabled. */ if(f->shared->fs_persist && !H5F_NULL_FSM_ADDR(f)) { /* Sanity check */ @@ -3221,7 +3217,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * Note that the aggregators will not exist if paged aggregation * is enabled -- don't attempt to free if this is the case. */ - /* Vailin -- is this correct? */ /* (for space not at EOF, it may be put into free space managers) */ if((!H5F_PAGED_AGGR(f)) && (H5MF_free_aggrs(f) < 0)) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") @@ -3230,21 +3225,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if(H5MF__close_shrink_eoa(f) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") - /* At this point, the EOA should be set to a value that contains - * the allocation for all user data, all non self referential FSMs, - * the superblock and all superblock extension messages. - * - * Make note of the current EOA. We will store this value in the - * free space manager superblock extension message. Since space for - * everything other than the self referential FSMs (and possibly the - * cache image) has been allocated at this point, this allows us to - * to float the self referential FSMs on the first file space allocation / - * deallocation and then set the EOA to this value before we handle - * the allocation / deallocation. (If a cache image exists, the - * first allocation / deallocation will be the deallocation of space - * for the cache image). - * - * WARNING: This approach settling the self referential free space + /* WARNING: This approach settling the self referential free space * managers and allocating space for them in the file will * not work as currently implemented with the split and * multi file drivers, as the self referential free space @@ -3263,58 +3244,13 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * We should be able to support the split file driver * without a file format change. However, the code to * do so does not exist at present. + * NOTE: not sure whether to remove or keep the above comments */ - /* ******************* PROBLEM: ******************** - * - * If the file has an alignment other than 1, and if - * the EOA is not a multiple of this alignment, allocating space - * for the section via the VFD info has the potential of generating - * a fragment that will be added to the free space manager. This - * of course undoes everything we have been doing here. - * - * Need a way around this. Obvious solution is to force the EOA to - * be a multiple of the alignment. - * - * Fortunately, alignment is typically 1, so this is a non-issue in - * most cases. In cases where the alignment is not 1, for now we - * have decided to drop the fragment on the floor. - * - * Eventually, we should fix this by modifying the on disk representations - * of free space managers to allow for empty space, so as to bypass the - * issues created by self-referential free space managers, and make - * this issue moot. - */ - /* HDassert(f->shared->alignment == 1); */ - - - /* The free space manager(s) that handle space allocations for free - * space managers should be settled now, albeit without file space - * allocated to them. To avoid the possibility of changing the sizes - * of their section info blocks, allocate space for them now at the - * end of file via H5FD_alloc(). - * - * In the past, this issue of allocating space without touching the - * free space managers has been dealt with by calling - * H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc(). - * This is problematic since (if I read the code correctly) it will - * re-constitute the metadata aggregator, which will add any leftover - * space to one of the free space managers when freed. - * - * This is a non-starter, since the entire objective is to settle the - * free space managers. - * - * Hence the decision to call H5FD_alloc() directly. - * - * As discussed in PROBLEM above, if f->shared->alignment is not 1, - * this has the possibility of generating a fragment of file space - * that would typically be inserted into one of the free space managers. - * - * This is isn't good, but due to schedule pressure, we will just drop - * the fragment on the floor for now. + /* + * Continue allocating file space for the header and section info until + * they are all settled, */ - - do { continue_alloc_fsm = FALSE; if(sm_hdr_fspace) @@ -3349,10 +3285,12 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* All free space managers should have file space allocated for them - * now, and should see no further allocations / deallocations. Store - * the pre and post file space allocation for self referential FSMs EOA - * for use when we actually write the free space manager superblock - * extension message. + * now, and should see no further allocations / deallocations. + * For backward compatibility, store the eoa in f->shared->eoa_fsm_fsalloc + * which will be set to fsinfo.eoa_pre_fsm_fsalloc when we actually write + * the free-space info message to the superblock extension. + * This will allow the 1.10 library with the hack to open the file with + * the new solution. */ /* Get the eoa after allocation of file space for the self referential * free space managers. Assuming no cache image, this should be the @@ -3379,12 +3317,14 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__continue_alloc_fsm * - * Purpose: To determine whether any of the input FSMs has allocated its + * Purpose: To determine whether any of the input FSMs has allocated * its "addr" and "sect_addr". * Return TRUE or FALSE in *continue_alloc_fsm. * * Return: SUCCEED/FAIL * + * Programmer: Vailin Choi + * 6/24/2019 *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index c69b245..c726341 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -183,7 +183,21 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); * allocate "generic" space and sub-allocate out of that, if possible. * Otherwise just allocate through H5F__alloc(). */ + + /* + * Replace the following line with the line in #ifdef REPLACE/#endif. + * The line in #ifdef REPLACE triggers the following problem: + * test/objcopy.c: test_copy_group_deep() test fails with the family driver + * + * When closing the destination file after H5Ocopy, the library flushes the fractal + * heap direct block via H5HF__cache_dblock_pre_serialize(). While doing so, + * the cache eventually adjusts/evicts ageout entries and ends up flushing out the + * same entry that is being serialized (flush_in_progress). + */ + if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && (!f->closing || !f->shared->fs_persist)) { +#ifdef REPLACE if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->closing) { +#endif haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */ hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */ hsize_t alignment; /* Alignment of this section */ -- cgit v0.12 From f83d034105e2c72210dd41723044acca37a6d735 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 27 Jun 2019 16:30:19 -0700 Subject: Refactored some fsinfo code from H5Fsuper.c to H5Ofsinfo.c. --- src/H5Fsuper.c | 60 +++------------------------------------ src/H5Ofsinfo.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/H5Oprivate.h | 4 +++ 3 files changed, 93 insertions(+), 57 deletions(-) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index f4ff645..4a68f6b 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -80,15 +80,6 @@ static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; -/* Format version bounds for fsinfo message */ -/* This message exists starting library release v1.10 */ -static const unsigned H5O_fsinfo_ver_bounds[] = { - H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ - H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ - H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ - H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ -}; - /*------------------------------------------------------------------------- * Function: H5F__super_ext_create @@ -790,15 +781,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo)) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message") - /* Update changed values */ - /* Version bounds check */ - if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || - fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + if(H5O_fsinfo_check_version(H5F_HIGH_BOUND(f), &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + + /* Update changed values */ if(f->shared->fs_version != fsinfo.version) f->shared->fs_version = fsinfo.version; - if(f->shared->fs_strategy != fsinfo.strategy) { f->shared->fs_strategy = fsinfo.strategy; @@ -1393,7 +1382,7 @@ H5F__super_init(H5F_t *f) fsinfo.mapped = FALSE; /* Set the version for the fsinfo message */ - if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + if(H5O_fsinfo_set_version(H5F_LOW_BOUND(f), H5F_HIGH_BOUND(f), &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; @@ -1823,44 +1812,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ - -/*------------------------------------------------------------------------- - * Function: H5O__fsinfo_set_version - * - * Purpose: Set the version to encode the fsinfo message with. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi; June 2019 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) -{ - unsigned version; /* Message version */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(f); - HDassert(fsinfo); - - version = H5O_FSINFO_VERSION_1; - - /* Upgrade to the version indicated by the file's low bound if higher */ - if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) - version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); - - /* Version bounds check */ - if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || - version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") - - /* Set the message version */ - fsinfo->version = version; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__fsinfo_set_version() */ diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index ec2328c..52a7802 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -65,6 +65,16 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ H5O__fsinfo_debug /* debug the message */ }}; +/* Format version bounds for fsinfo message */ +/* This message exists starting library release v1.10 */ +static const unsigned H5O_fsinfo_ver_bounds[] = { + H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ + H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ + H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ + H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; +#define N_FSINFO_VERSION_BOUNDS 4 + /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); @@ -257,7 +267,7 @@ H5O_fsinfo_copy(const void *_mesg, void *_dest) /* check args */ HDassert(fsinfo); if(!dest && NULL == (dest = H5FL_CALLOC(H5O_fsinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ *dest = *fsinfo; @@ -331,6 +341,80 @@ H5O__fsinfo_free(void *mesg) /*------------------------------------------------------------------------- + * Function: H5O_fsinfo_set_version + * + * Purpose: Set the version to encode the fsinfo message with. + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; June 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo) +{ + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS); + HDassert(fsinfo); + + version = H5O_FSINFO_VERSION_1; + + /* Upgrade to the version indicated by the file's low bound if higher */ + if(H5O_fsinfo_ver_bounds[low] != H5O_INVALID_VERSION) + version = MAX(version, H5O_fsinfo_ver_bounds[low]); + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || + version > H5O_fsinfo_ver_bounds[high]) + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + + /* Set the message version */ + fsinfo->version = version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_fsinfo_set_version() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_fsinfo_check_version + * + * Purpose: Validate the fsinfo message version + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_fsinfo_check_version(H5F_libver_t high, H5O_fsinfo_t *fsinfo) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS); + HDassert(fsinfo); + + /* Check the version */ + if(H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || fsinfo->version > H5O_fsinfo_ver_bounds[high]) + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_fsinfo_check_version() */ + + +/*------------------------------------------------------------------------- * Function: H5O__fsinfo_debug * * Purpose: Prints debugging info for a message. diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index d143f31..354a00b 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -997,6 +997,10 @@ H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); /* EFL operators */ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl); +/* File space info routines */ +H5_DLL herr_t H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo); +H5_DLL herr_t H5O_fsinfo_check_version(H5F_libver_t high, H5O_fsinfo_t *fsinfo); + /* Fill value operators */ H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill); H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed); -- cgit v0.12 From de2440ae5f5227a8f513c4fef4c963990d6bb90f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 27 Jun 2019 22:38:20 -0700 Subject: Warning fixes: * fix for static/const flipped in H5Dint.c * Removed missing done target in H5Rint.c * Fixed misleading indentation in h5format_convert.c --- src/H5Dint.c | 4 ++-- src/H5Rint.c | 3 +-- tools/src/h5format_convert/h5format_convert.c | 10 ++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index cd120d0..b517f8b 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -114,8 +114,8 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ -const static char *H5D_prefix_ext_env = NULL; -const static char *H5D_prefix_vds_env = NULL; +static const char *H5D_prefix_ext_env = NULL; +static const char *H5D_prefix_vds_env = NULL; /*------------------------------------------------------------------------- diff --git a/src/H5Rint.c b/src/H5Rint.c index 8109ac0..2355ec1 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -84,12 +84,11 @@ H5R__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Mark "top" of interface as initialized */ H5R_top_package_initialize_s = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__init_package() */ diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index b9ed9ce..5fb02f4 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -260,8 +260,9 @@ convert(hid_t fid, const char *dname) h5tools_setstatus(EXIT_FAILURE); goto error; } - else if(verbose_g) + else if(verbose_g) { HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + } if(idx_type == H5D_CHUNK_IDX_BTREE) { if(verbose_g) @@ -269,8 +270,9 @@ convert(hid_t fid, const char *dname) h5tools_setstatus(EXIT_SUCCESS); goto done; } - else if (verbose_g) + else if(verbose_g) { HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); + } break; @@ -302,8 +304,8 @@ convert(hid_t fid, const char *dname) if(noop_g) { if(verbose_g) HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) -- cgit v0.12 From 1c4101c6a77dd9223483dd9e3f7bec0f9e92f435 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 28 Jun 2019 00:17:33 -0700 Subject: Fixed various warnings in testhdf5 files. --- test/titerate.c | 2 +- test/tselect.c | 1 - test/tsohm.c | 80 +++++++++++++++++++++++++++++++++------------------------ 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/test/titerate.c b/test/titerate.c index 54e9b5e..716654d 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -939,7 +939,7 @@ static void test_links(hid_t fapl) *------------------------------------------------------------------------- */ static int -find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) +find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_client_data) { int status = H5_ITER_CONT; searched_err_t *searched_err = (searched_err_t *)_client_data; diff --git a/test/tselect.c b/test/tselect.c index ad435cb..bbab868 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -14925,7 +14925,6 @@ test_sel_iter(void) hid_t sid; /* Dataspace ID */ hid_t iter_id; /* Dataspace selection iterator ID */ hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ - hsize_t dims2[] = {32}; /* 1-D dataspace dimensions */ hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ hsize_t start[2]; /* Hyperslab start */ hsize_t stride[2]; /* Hyperslab stride */ diff --git a/test/tsohm.c b/test/tsohm.c index 5c3707f..ef031c1 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -11,13 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*********************************************************** -* -* Test program: tsohm -* -* Test Shared Object Header Messages -* -*************************************************************/ +/* + * Purpose: Test Shared Object Header Messages + */ #include "testhdf5.h" @@ -582,12 +578,12 @@ error: * * Purpose: Creates object headers that use a large datatype message. * - * Set test_file_closing to 1 to add file closing and reopening + * Set test_file_closing to TRUE to add file closing and reopening * whenever possible (to test that SOHMs are written correctly * on disk and not just in memory). * - * Return: Success: file ID (may not be the same one passed in) - * Failure: Negative + * Return: Success: file ID (may not be the same one passed in) + * Failure: H5I_INVALID_HID * * Programmer: James Laird * Monday, April 10, 2006 @@ -595,13 +591,13 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; - hid_t dtype1_id = -1; - hid_t space_id = -1; - hid_t dset_id = -1; + hid_t dtype1_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; hsize_t dim1[1]; int x; @@ -635,7 +631,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos * local disks. Don't close and reopen if express testing is enabled. */ if(GetTestExpress() > 1) - test_file_closing = 0; + test_file_closing = FALSE; /* Intialize wdata */ HDmemset(&wdata, 0, sizeof(wdata)); @@ -718,6 +714,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos if(H5Dclose(dset_id) < 0) TEST_ERROR if(H5Tclose(dtype1_id) < 0) TEST_ERROR + return file; error: @@ -727,7 +724,8 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos H5Dclose(dset_id); H5Fclose(file); } H5E_END_TRY - return -1; + + return H5I_INVALID_HID; #undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */ } /* size1_helper */ @@ -744,25 +742,29 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos *---------------------------------------------------------------------------- */ static h5_stat_size_t -getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned open_close, H5O_info_t *oinfo) +getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, hbool_t test_file_closing, H5O_info_t *oinfo) { - hid_t file = -1; + hid_t fid = H5I_INVALID_HID; herr_t ret; - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, open_close); - CHECK_I(file, "size1_helper"); + /* If test_file_closing is TRUE, you will get back a different ID, + * which will need to be closed. The helper will close your passed-in + * ID. + */ + fid = size1_helper(fid, filename, fapl_id, test_file_closing); + CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - return h5_get_file_size(FILENAME, fapl_id); -} /* getsize_testsize1 */ + return h5_get_file_size(filename, fapl_id); +} /* getsize_testsize1() */ /*------------------------------------------------------------------------- @@ -784,13 +786,14 @@ test_sohm_size1(void) unsigned use_shared = 0; unsigned use_btree = 0; - unsigned open_close = 0; h5_stat_size_t file_sizes[9]; unsigned size_index = 0; hsize_t oh_sizes[3]; unsigned oh_size_index = 0; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ hsize_t norm_oh_size; +#endif /* Jira HDFFV-10646 */ hsize_t sohm_oh_size; hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; @@ -826,6 +829,8 @@ test_sohm_size1(void) for (use_shared = 0; use_shared < 2; use_shared++) { for (use_btree = 0; use_btree < 2; use_btree++) { + hbool_t test_open_close; + /* cannot use btree indexing without shared messages; skip case */ if (use_btree && !use_shared) continue; @@ -860,8 +865,10 @@ test_sohm_size1(void) file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id); /* size of populated file, with different populating behaviors */ - for (open_close = 0; open_close < 2; open_close++) - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, open_close, &oinfo); + test_open_close = TRUE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + test_open_close = FALSE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); oh_sizes[oh_size_index++] = oinfo.hdr.space.total; ret = H5Pclose(fcpl_id); @@ -886,7 +893,9 @@ test_sohm_size1(void) norm_empty_filesize = file_sizes[0]; norm_final_filesize = file_sizes[1]; norm_final_filesize2 = file_sizes[2]; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ norm_oh_size = oh_sizes[0]; +#endif /* Jira HDFFV-10646 */ sohm_empty_filesize = file_sizes[3]; sohm_final_filesize = file_sizes[4]; @@ -955,6 +964,7 @@ test_sohm_size1(void) * *--------------------------------------------------------------------------- */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ static void test_sohm_size_consistency_open_create(void) { @@ -1045,6 +1055,7 @@ test_sohm_size_consistency_open_create(void) ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); } /* test_sohm_size_consistency_open_create */ +#endif /* Jira HDFFV-10645 */ /*------------------------------------------------------------------------- @@ -1175,7 +1186,8 @@ sohm_attr_helper(hid_t fcpl_id) static void test_sohm_attrs(void) { - hid_t fcpl_id; + hid_t bad_fid = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; unsigned i = 0; #define TSOHM_TSA_NFLAGS_1 7 unsigned flags1[TSOHM_TSA_NFLAGS_1] = { @@ -1293,8 +1305,8 @@ test_sohm_attrs(void) ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - VERIFY(ret, -1, "H5Fcreate"); + bad_fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(bad_fid, H5I_INVALID_HID, "H5Fcreate"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); -- cgit v0.12 From d5130bb57332ce0049302c5836bbf666b23513cd Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 28 Jun 2019 09:10:43 -0500 Subject: Updated configure & CMake compiler flags for GCC 8.x, along with corresponding changes to warnhist script (and some extra improvements for condensing C++ and Java warnings), and fixed a bunch of warnings. --- bin/warnhist | 79 +++++++--- config/cmake/HDFCompilerFlags.cmake | 7 +- config/gnu-flags | 72 ++++++++-- fortran/src/H5Sf.c | 9 +- fortran/src/H5match_types.c | 6 +- fortran/test/tH5O_F03.F90 | 1 - hl/src/H5LT.c | 4 +- src/H5B2int.c | 9 +- src/H5C.c | 15 +- src/H5CX.c | 12 +- src/H5CXprivate.h | 4 +- src/H5Dbtree2.c | 8 +- src/H5Dchunk.c | 4 +- src/H5Dint.c | 42 +++--- src/H5Dpkg.h | 2 +- src/H5Dprivate.h | 2 +- src/H5EAhdr.c | 6 +- src/H5FL.c | 8 +- src/H5FLprivate.h | 4 +- src/H5Fsuper.c | 17 +-- src/H5I.c | 2 +- src/H5MM.c | 10 +- src/H5MP.c | 6 +- src/H5MPtest.c | 2 +- src/H5Odtype.c | 2 +- src/H5Rint.c | 1 - src/H5T.c | 4 +- src/H5Tconv.c | 42 +++--- src/H5Tdbg.c | 2 +- src/H5Tenum.c | 24 ++-- src/H5Tfields.c | 20 +-- src/H5Tnative.c | 15 ++ src/H5Tpkg.h | 2 +- src/H5Zscaleoffset.c | 36 ++--- src/H5detect.c | 5 + src/H5system.c | 13 +- test/cmpd_dset.c | 10 +- test/dt_arith.c | 50 +++---- test/dtypes.c | 101 +++++++------ test/links.c | 198 +++++++++++++------------- test/objcopy.c | 12 +- test/tarray.c | 2 +- test/tchecksum.c | 2 +- test/tconfig.c | 6 +- test/tmeta.c | 2 +- test/tsohm.c | 19 ++- test/tvlstr.c | 2 +- test/tvltypes.c | 2 +- test/vds.c | 5 - test/vds_env.c | 5 - tools/lib/h5diff_array.c | 8 +- tools/lib/h5tools.c | 6 +- tools/lib/h5tools_str.c | 6 +- tools/src/h5dump/h5dump_xml.c | 4 +- tools/src/h5format_convert/h5format_convert.c | 10 +- tools/test/misc/talign.c | 8 +- tools/test/perform/chunk_cache.c | 2 +- 57 files changed, 544 insertions(+), 413 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 5750c77..df7565e 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -156,6 +156,7 @@ while (<>) { my $offset; my $warning; my $extra; + my $extra2; # Retain last FORTRAN compile line, which comes a few lines before warning if($_ =~ /.*\.[fF]90:.*/) { @@ -168,21 +169,27 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } + # Skip lines that don't have the word "warning" next if $_ !~ /[Ww]arning:/; # Skip warnings from linker next if $_ =~ /ld: warning:/; + # "Hide" the C++ '::' symbol until we've parsed out the parts of the line + while($_ =~ /\:\:/) { + $_ =~ s/\:\:/@@@@/g; + } + # Check for weird formatting of warning message if($_ =~ /^cc1: warning:.*/) { $name = $last_c_name; $line = "??"; - ($toss, $toss, $warning, $extra) = split /\:/, $_; + ($toss, $toss, $warning, $extra, $extra2) = split /\:/, $_; # Check for FORTRAN warning output } elsif($_ =~ /^Warning:.*/) { $name = $last_fort_name; $line = $last_fort_line; - ($toss, $warning, $extra) = split /\:/, $_; + ($toss, $warning, $extra, $extra2) = split /\:/, $_; #print "1:",$.,":",$_; # $_ = <>; #print "2:",$.,":",$_; @@ -202,11 +209,11 @@ while (<>) { next } } else { - # Check for 'character offset' field + # Check for 'character offset' field appended to file & line # if($_ =~ /^.*[0-9]+\:[0-9]+\:/) { - ($name, $line, $offset, $toss, $warning, $extra) = split /\:/, $_; + ($name, $line, $offset, $toss, $warning, $extra, $extra2) = split /\:/, $_; } else { - ($name, $line, $toss, $warning, $extra) = split /\:/, $_; + ($name, $line, $toss, $warning, $extra, $extra2) = split /\:/, $_; } } @@ -216,6 +223,14 @@ while (<>) { if(length $extra ) { $warning = join ':', $warning, $extra; } + if(length $extra2 ) { + $warning = join ':', $warning, $extra2; + } + + # Restore the C++ '::' symbol now that we've parsed out the parts of the line + while($warning =~ /@@@@/) { + $warning =~ s/@@@@/\:\:/g; + } # Trim leading '..' paths from filename while($name =~ /^\.\.\//) { @@ -265,14 +280,18 @@ while (<>) { # Skip supplemental warning message next if $warning =~ /near initialization for/; + # Skip C++ supplemental warning message + next if $warning =~ /in call to/; + # Skip GCC warning that should be a note next if $_ =~ /\(this will be reported only once per input file\)/; - # Eliminate "{aka }" info - if($warning =~ /\s\{aka [A-Za-z_0-9\s\*]*\}'/) { - $warning =~ s/\s\{aka [A-Za-z_0-9\s\*]*\}//g; + # Eliminate "{aka }" and "{aka ''}" info + if($warning =~ /\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?/) { + $warning =~ s/\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?\}//g; } +# print "warning = $warning\n"; # Genericize warnings if($warning =~ /variable '[A-Za-z_0-9]*' set but not used.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; @@ -293,9 +312,9 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; } elsif($warning =~ /cast discards '[A-Za-z_0-9\(\)\s]*'.*/) { $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; - } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*]*' is [0-9]* bytes.*/) { + } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*\.]*' is [0-9]* bytes.*/) { $warning =~ s/is [0-9]* bytes/is - bytes/g; - $warning =~ s/'[A-Za-z_0-9\(\)\s\*]*'/'-'/g; + $warning =~ s/'[A-Za-z_0-9\(\)\s\*\.]*'/'-'/g; } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\(\)\s]*' from incompatible.*/) { $warning =~ s/passing argument [0-9]*/passing argument -/g; $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; @@ -416,21 +435,37 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-overflow=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-overflow=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing up to [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]' directive writing (between [0-9]+ and [0-9]+)|(up to [0-9]+) bytes into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]'/'-'/g; $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-truncation=\].*/) { + } elsif($warning =~ /'(%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+)' directive output may be truncated writing (between [0-9]+ and [0-9]+)|(up to [0-9]+)|(likely 1 or more) byte(s)? into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-truncation=\].*/) { $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/'[A-Za-z_0-9\/]+'/'-'/g; $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result \[-Wsign-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+' \[-Wsign-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + $warning =~ s/'-?[0-9]+'/'-'/g; + } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value \[-Wconversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+' \[-Woverflow\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + $warning =~ s/'-?[0-9]+'/'-'/g; + } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' \[-Wcast-function-type\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'/'-'/g; + } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type \[-Wdiscarded-qualifiers\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*' \[-Wattributes\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result \[-Wunused-result\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' \[-Wsign-promo\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list \[-Weffc\+\+\].*/) { + $warning =~ s/'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*'/'-'/g; + } elsif($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) { + $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g; } # Increment count for [generic] warning diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 4712f50..106d6d7 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -143,7 +143,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") @@ -203,6 +203,11 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") endif () + # Append more extra warning flags that only gcc 8.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") + endif () + endif () #----------------------------------------------------------------------------- diff --git a/config/gnu-flags b/config/gnu-flags index c55391d..ced54c9 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -118,6 +118,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + # As of GCC 8.x, the -Wunsafe-loop-optimizations has been removed H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -187,10 +188,10 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 8.x release is out, we should check for additional flags to +# When the gcc 9.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[789].*) + gcc-[89].*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) @@ -198,7 +199,56 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + + # Append warning flags that only gcc 4.7+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + + # Append warning flags that only gcc 7.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + + # Append warning flags that only gcc 8.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + ;; + + + gcc-7*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -242,7 +292,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -282,7 +332,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -319,7 +369,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -353,7 +403,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -384,7 +434,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -414,7 +464,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -439,7 +489,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -459,7 +509,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 1031914..e3a5809 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -1031,22 +1031,21 @@ h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_ hsize_t *c_block = NULL; H5S_seloper_t c_op; - herr_t status; int rank; int i; rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_start == NULL) goto DONE; - c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_count == NULL) goto DONE; - c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_stride == NULL) goto DONE; - c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_block == NULL) goto DONE; diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 57f7dda..e39e85a 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -143,7 +143,7 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char int main(void) { int i; - char chrA[32],chrB[32]; + char chrA[64],chrB[64]; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; @@ -347,8 +347,8 @@ int main(void) for(i=0;i 0) { - sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); - sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); + snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]); + snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]); writeToFiles("float",chrA, chrB, RealKinds[i]); } } diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index 78b6453..bc3668c 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -273,7 +273,6 @@ CONTAINS INTEGER :: len, i INTEGER :: idx INTEGER :: ierr - TYPE(C_PTR) :: cptr visit_obj_cb = 0 diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 3ebca95..bb72ce6 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2423,9 +2423,9 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) goto out; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size)))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size)))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; diff --git a/src/H5B2int.c b/src/H5B2int.c index 9940cd7..2d77276 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1573,23 +1573,20 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ /* Iterate through records, in order */ for(u = 0; u < curr_node->node_nrec && !ret_value; u++) { /* Descend into child node, if current node is an internal node */ - if(depth > 0) { + if(depth > 0) if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); - } /* end if */ /* Make callback for current record */ - if(!ret_value) { + if(!ret_value) if((ret_value = (op)(H5B2_NAT_NREC(native, hdr, u), op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "iterator function failed"); - } /* end if */ } /* end for */ /* Descend into last child node, if current node is an internal node */ - if(!ret_value && depth > 0) { + if(!ret_value && depth > 0) if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); - } /* end if */ done: /* Unpin the node if it was pinned */ diff --git a/src/H5C.c b/src/H5C.c index ad2f762..3e0cf95 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -106,6 +106,9 @@ /* Local Typedefs */ /******************/ +/* Alias for pointer to cache entry, for use when allocating sequences of them */ +typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t; + /********************/ /* Local Prototypes */ @@ -207,8 +210,8 @@ H5FL_DEFINE(H5C_tag_info_t); /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); -/* Declare a free list to manage flush dependency arrays */ -H5FL_BLK_DEFINE_STATIC(parent); +/* Declare a free list to manage arrays of cache entries */ +H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); @@ -3600,7 +3603,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Array does not exist yet, allocate it */ HDassert(!child_entry->flush_dep_parent); - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_MALLOC(parent, H5C_FLUSH_DEP_PARENT_INIT * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; } /* end if */ @@ -3608,7 +3611,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Resize existing array */ HDassert(child_entry->flush_dep_parent); - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc *= 2; } /* end else */ @@ -3766,12 +3769,12 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) /* Shrink or free the parent array if apporpriate */ if(child_entry->flush_dep_nparents == 0) { - child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_FREE(parent, child_entry->flush_dep_parent); + child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); child_entry->flush_dep_parent_nalloc = 0; } /* end if */ else if(child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, (child_entry->flush_dep_parent_nalloc / 4) * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, child_entry->flush_dep_parent_nalloc / 4))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc /= 4; } /* end if */ diff --git a/src/H5CX.c b/src/H5CX.c index 22ed893..96c1d72 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -287,9 +287,9 @@ typedef struct H5CX_t { hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */ /* Cached DAPL properties */ - char *extfile_prefix; /* Prefix for external file */ + const char *extfile_prefix; /* Prefix for external file */ hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */ - char *vds_prefix; /* Prefix for VDS */ + const char *vds_prefix; /* Prefix for VDS */ hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */ /* Cached FAPL properties */ @@ -361,8 +361,8 @@ typedef struct H5CX_dcpl_cache_t { /* Typedef for cached default dataset access property list information */ /* (Same as the cached DXPL struct, above, except for the default DXPL) */ typedef struct H5CX_dapl_cache_t { - char *extfile_prefix; /* Prefix for external file */ - char *vds_prefix; /* Prefix for VDS */ + const char *extfile_prefix; /* Prefix for external file */ + const char *vds_prefix; /* Prefix for VDS */ } H5CX_dapl_cache_t; /* Typedef for cached default file access property list information */ @@ -2491,7 +2491,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5CX_get_ext_file_prefix(char **extfile_prefix) +H5CX_get_ext_file_prefix(const char **extfile_prefix) { H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2548,7 +2548,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5CX_get_vds_prefix(char **vds_prefix) +H5CX_get_vds_prefix(const char **vds_prefix) { H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 638c32a..2f86adf 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -129,8 +129,8 @@ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks); H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag); /* "Getter" routines for DAPL properties cached in API context */ -H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile); -H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds); +H5_DLL herr_t H5CX_get_ext_file_prefix(const char **prefix_extfile); +H5_DLL herr_t H5CX_get_vds_prefix(const char **prefix_vds); /* "Getter" routines for FAPL properties cached in API context */ H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d25e0f0..56554f8 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -204,9 +204,9 @@ const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */ /* Declare a free list to manage the H5D_bt2_ctx_t struct */ H5FL_DEFINE_STATIC(H5D_bt2_ctx_t); -/* Declare a free list to manage the page elements */ -H5FL_BLK_DEFINE(chunk_dim); +/* Declare a free list to manage the page elements */ +H5FL_ARR_DEFINE_STATIC(uint32_t, H5O_LAYOUT_NDIMS); @@ -247,7 +247,7 @@ H5D__bt2_crt_context(void *_udata) ctx->ndims = udata->ndims; /* Set up the "local" information for this dataset's chunk dimension sizes */ - if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)))) + if(NULL == (my_dim = (uint32_t *)H5FL_ARR_MALLOC(uint32_t, H5O_LAYOUT_NDIMS))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims") H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); ctx->dim = my_dim; @@ -292,7 +292,7 @@ H5D__bt2_dst_context(void *_ctx) /* Free array for chunk dimension sizes */ if(ctx->dim) - (void)H5FL_BLK_FREE(chunk_dim, ctx->dim); + (void)H5FL_ARR_FREE(uint32_t, ctx->dim); /* Release callback context */ ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index a8dc398..6fdea92 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2018,7 +2018,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) if(H5S_SEL_ALL == chunk_sel_type) { /* Adjust the chunk coordinates */ for(u = 0; u < fm->f_ndims; u++) - coords[u] -= adjust[u]; + coords[u] = (hsize_t)((hssize_t)coords[u] - adjust[u]); /* Set to same shape as chunk */ if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0) @@ -6703,7 +6703,7 @@ done: */ herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]) + H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled) { hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dint.c b/src/H5Dint.c index cd120d0..2824dcd 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -50,7 +50,7 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); @@ -114,8 +114,8 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ -const static char *H5D_prefix_ext_env = NULL; -const static char *H5D_prefix_vds_env = NULL; +static const char *H5D_prefix_ext_env = NULL; +static const char *H5D_prefix_vds_env = NULL; /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) +H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ @@ -570,7 +570,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Get a datatype ID for the dataset's datatype */ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") - } + } /* end if */ /* Not a custom datatype, just use it directly */ else { if(H5I_inc_ref(type_id, FALSE) < 0) @@ -579,7 +579,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Use existing datatype */ dset->shared->type_id = type_id; dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */ - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1090,7 +1090,7 @@ done: static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/) { - char *prefix = NULL; /* prefix used to look for the file */ + const char *prefix = NULL; /* prefix used to look for the file */ char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ @@ -1109,20 +1109,20 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** * to be reentrant. */ if(H5F_PREFIX_VDS == prefix_type) { - prefix = (char *)H5D_prefix_vds_env; + prefix = H5D_prefix_vds_env; - if(prefix == NULL || *prefix == '\0') { + if(prefix == NULL || *prefix == '\0') if(H5CX_get_vds_prefix(&prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file") - } - } else if(H5F_PREFIX_EFILE == prefix_type) { - prefix = (char *)H5D_prefix_ext_env; + } /* end if */ + else if(H5F_PREFIX_EFILE == prefix_type) { + prefix = H5D_prefix_ext_env; - if(prefix == NULL || *prefix == '\0') { + if(prefix == NULL || *prefix == '\0') if(H5CX_get_ext_file_prefix(&prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file") - } - } else + } /* end else-if */ + else HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible") /* Prefix has to be checked for NULL / empty string again because the @@ -1175,7 +1175,7 @@ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id) { - const H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ + H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */ H5D_t *new_dset = NULL; H5P_genplist_t *dc_plist = NULL; /* New Property list */ @@ -1197,10 +1197,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); /* Get the dataset's datatype */ - if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) + if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") /* If this is a named datatype, get the pointer via the VOL plugin */ - type = (const H5T_t *)H5T_get_actual_type(dt); + type = H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ if(H5T_is_sensible(type) != TRUE) @@ -2196,7 +2196,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL) + FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) } /* end H5D_nameof() */ @@ -3263,7 +3263,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush_all(const H5F_t *f) +H5D_flush_all(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3273,7 +3273,7 @@ H5D_flush_all(const H5F_t *f) HDassert(f); /* Iterate over all the open datasets */ - if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, (void *)f, FALSE) < 0) /* Casting away const OK -QAK */ + if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info") done: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index db67101..638c8a5 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -646,7 +646,7 @@ H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes); H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]); + H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled); H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim); H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index bc44d2a..511e380 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -166,7 +166,7 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); -H5_DLL herr_t H5D_flush_all(const H5F_t *f); +H5_DLL herr_t H5D_flush_all(H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 18d642f..ec40298 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -63,6 +63,9 @@ /* Local Typedefs */ /******************/ +/* Alias for pointer to factory, for use when allocating sequences of them */ +typedef H5FL_fac_head_t *H5FL_fac_head_ptr_t; + /********************/ /* Package Typedefs */ @@ -83,9 +86,6 @@ /* Library Private Variables */ /*****************************/ -/* Alias for pointer to factory, for use when allocating sequences of them */ -typedef H5FL_fac_head_t *H5FL_fac_head_ptr_t; - /*******************/ /* Local Variables */ diff --git a/src/H5FL.c b/src/H5FL.c index a662713..a849ff7 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -1055,7 +1055,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) #endif /* H5FL_TRACK */ /* Get the pointer to the native block info header in front of the native block to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block-sizeof(H5FL_blk_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Save the block's size for later */ free_size=temp->size; @@ -1133,7 +1133,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */ /* Get the pointer to the chunk info header in front of the chunk to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* check if we are actually changing the size of the buffer */ if(new_size!=temp->size) { @@ -1430,7 +1430,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) HDassert(head->init); /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_list_t *)((unsigned char *)obj-sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - -sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Get the number of elements */ free_nelem=temp->nelem; @@ -1619,7 +1619,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem) HDassert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ - temp = (H5FL_arr_list_t *)((unsigned char *)obj - sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Check if the size is really changing */ if(temp->nelem != new_elem) { diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 4aa44f9..d5a68d7 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -189,10 +189,10 @@ typedef struct H5FL_blk_head_t { /* Declare a static free list to manage objects of type 't' */ #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) -/* Allocate an block of type 't' */ +/* Allocate a block of type 't' */ #define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) -/* Allocate an block of type 't' and clear it to zeros */ +/* Allocate a block of type 't' and clear it to zeros */ #define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) /* Free a block of type 't' */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index f4ff645..631937b 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -54,6 +54,7 @@ /********************/ static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr); static herr_t H5F__update_super_ext_driver_msg(H5F_t *f); +static herr_t H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo); /*********************/ @@ -1393,7 +1394,7 @@ H5F__super_init(H5F_t *f) fsinfo.mapped = FALSE; /* Set the version for the fsinfo message */ - if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + if(H5F__fsinfo_set_version(f, &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; @@ -1825,7 +1826,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__fsinfo_set_version + * Function: H5F__fsinfo_set_version * * Purpose: Set the version to encode the fsinfo message with. * @@ -1835,13 +1836,13 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) +static herr_t +H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo) { unsigned version; /* Message version */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -1855,12 +1856,12 @@ H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) /* Version bounds check */ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || - version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") /* Set the message version */ fsinfo->version = version; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__fsinfo_set_version() */ +} /* end H5F__fsinfo_set_version() */ diff --git a/src/H5I.c b/src/H5I.c index cdc849b..9fd0326 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2023,7 +2023,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) */ if((!udata->app_ref) || (item->app_count > 0)) { H5I_type_t type = udata->obj_type; - const void *obj_ptr = NULL; + void *obj_ptr; herr_t cb_ret_val; /* The stored object pointer might be an H5VL_object_t, in which diff --git a/src/H5MM.c b/src/H5MM.c index 85d82a9..ac3c26e 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -43,7 +43,7 @@ #define H5MM_SIG_SIZE 4 #define H5MM_HEAD_GUARD_SIZE 8 #define H5MM_TAIL_GUARD_SIZE 8 -#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE))) +#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((void *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE)))) #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ @@ -154,7 +154,7 @@ H5MM__is_our_block(void *mem) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE static void +static void H5MM__sanity_check_block(const H5MM_block_t *block) { HDassert(block->u.info.size > 0); @@ -180,7 +180,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE static void +static void H5MM__sanity_check(void *mem) { H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); @@ -201,7 +201,7 @@ H5MM__sanity_check(void *mem) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void H5MM_sanity_check_all(void) { H5MM_block_t *curr = NULL; @@ -226,7 +226,7 @@ H5MM_sanity_check_all(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void H5MM_final_sanity_check(void) { HDassert(0 == H5MM_curr_alloc_bytes_s); diff --git a/src/H5MP.c b/src/H5MP.c index 8c9b411..7947e7d 100644 --- a/src/H5MP.c +++ b/src/H5MP.c @@ -44,7 +44,7 @@ /* First block in page */ #define H5MP_PAGE_FIRST_BLOCK(p) \ - (H5MP_page_blk_t *)((unsigned char *)(p) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) + (H5MP_page_blk_t *)((void *)((unsigned char *)(p) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) /******************/ @@ -294,7 +294,7 @@ found: H5MP_page_blk_t *new_free; /* New free block created */ /* Carve out new free block after block to allocate */ - new_free = (H5MP_page_blk_t *)(((unsigned char *)alloc_free) + needed); + new_free = (H5MP_page_blk_t *)((void *)(((unsigned char *)alloc_free) + needed)); /* Link into existing lists */ new_free->next = alloc_free->next; @@ -361,7 +361,7 @@ H5MP_free(H5MP_pool_t *mp, void *spc) HDassert(spc); /* Get block header for space to free */ - spc_blk = (H5MP_page_blk_t *)(((unsigned char *)spc) - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))); + spc_blk = (H5MP_page_blk_t *)((void *)(((unsigned char *)spc) - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))); /* Mark block as free */ HDassert(spc_blk->is_free == FALSE); diff --git a/src/H5MPtest.c b/src/H5MPtest.c index b3f2e24..0cba847 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -134,7 +134,7 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) size_t page_free; /* Size of blocks on free list */ /* Iterate through the blocks in page, accumulating free space */ - blk = (H5MP_page_blk_t *)((unsigned char *)page + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))); + blk = (H5MP_page_blk_t *)((void *)((unsigned char *)page + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))); page_free = 0; while(blk != NULL) { if(blk->is_free) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 39d8bac..8f301af 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1765,7 +1765,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:"); for(k = 0; k < dt->shared->parent->shared->size; k++) - HDfprintf(stream, "%02x", dt->shared->u.enumer.value[i*dt->shared->parent->shared->size + k]); + HDfprintf(stream, "%02x", (unsigned)*((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->parent->shared->size) + k)); HDfprintf(stream, "\n"); } /* end for */ } /* end else if */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 8109ac0..05c6ddf 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -89,7 +89,6 @@ H5R__init_package(void) /* Mark "top" of interface as initialized */ H5R_top_package_initialize_s = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__init_package() */ diff --git a/src/H5T.c b/src/H5T.c index 6fe291e..9585121 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -4287,8 +4287,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) idx = u; } /* end else */ - tmp = HDmemcmp(dt1->shared->u.enumer.value+idx1[u]*base_size, - dt2->shared->u.enumer.value+idx2[idx]*base_size, + tmp = HDmemcmp((uint8_t *)dt1->shared->u.enumer.value + idx1[u] * base_size, + (uint8_t *)dt2->shared->u.enumer.value + idx2[idx] * base_size, base_size); if(tmp<0) HGOTO_DONE(-1); if(tmp>0) HGOTO_DONE(1); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 7d47483..48c3282 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -668,8 +668,8 @@ { \ size_t elmtno; /*element number */ \ H5T_CONV_DECL_PREC(PREC) /*declare precision variables, or not */ \ - uint8_t *src_buf; /*'raw' source buffer */ \ - uint8_t *dst_buf; /*'raw' destination buffer */ \ + void *src_buf; /*'raw' source buffer */ \ + void *dst_buf; /*'raw' destination buffer */ \ ST *src, *s; /*source buffer */ \ DT *dst, *d; /*destination buffer */ \ H5T_t *st, *dt; /*datatype descriptors */ \ @@ -745,22 +745,22 @@ /* If we're down to the last few elements, just wrap up */ \ /* with a "real" reverse copy */ \ if(safe<2) { \ - src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride); \ - dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride); \ + src = (ST *)(src_buf = (void *)((uint8_t *)buf + (nelmts - 1) * (size_t)s_stride)); \ + dst = (DT *)(dst_buf = (void *)((uint8_t *)buf + (nelmts - 1) * (size_t)d_stride)); \ s_stride = -s_stride; \ d_stride = -d_stride; \ \ safe=nelmts; \ } /* end if */ \ else { \ - src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride); \ - dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride); \ + src = (ST *)(src_buf = (void *)((uint8_t *)buf + (nelmts - safe) * (size_t)s_stride)); \ + dst = (DT *)(dst_buf = (void *)((uint8_t *)buf + (nelmts - safe) * (size_t)d_stride)); \ } /* end else */ \ } /* end if */ \ else { \ /* Single forward pass over all data */ \ - src = (ST *)(src_buf = (uint8_t*)buf); \ - dst = (DT *)(dst_buf = (uint8_t*)buf); \ + src = (ST *)(src_buf = buf); \ + dst = (DT *)(dst_buf = buf); \ safe=nelmts; \ } /* end else */ \ \ @@ -889,9 +889,9 @@ done: \ H5_GLUE(H5T_CONV_LOOP_,POST_DALIGN_GUTS)(DT) \ \ /* Advance pointers */ \ - src_buf += s_stride; \ + src_buf = (void *)((uint8_t *)src_buf + s_stride); \ src = (ST *)src_buf; \ - dst_buf += d_stride; \ + dst_buf = (void *)((uint8_t *)dst_buf + d_stride); \ dst = (DT *)dst_buf; \ } @@ -2658,11 +2658,11 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) if(1 == src->shared->size || sizeof(short) == src->shared->size || sizeof(int) == src->shared->size) { for(i = 0; i < src->shared->u.enumer.nmembs; i++) { if(1 == src->shared->size) - n = *((signed char *)(src->shared->u.enumer.value + i)); + n = *((signed char *)((uint8_t *)src->shared->u.enumer.value + i)); else if (sizeof(short) == src->shared->size) - n = *((short *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((short *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); else - n = *((int *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((int *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); if(0 == i) { domain[0] = domain[1] = n; } else { @@ -2683,11 +2683,11 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) map[i] = -1; /*entry unused*/ for(i = 0; i < src->shared->u.enumer.nmembs; i++) { if(1 == src->shared->size) - n = *((signed char *)(src->shared->u.enumer.value + i)); + n = *((signed char *)((uint8_t *)src->shared->u.enumer.value + i)); else if(sizeof(short) == src->shared->size) - n = *((short *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((short *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); else - n = *((int *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((int *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); n -= priv->base; HDassert(n >= 0 && (unsigned)n < priv->length); HDassert(map[n] < 0); @@ -2835,9 +2835,9 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(1 == src->shared->size) n = *((signed char*)s); else if(sizeof(short) == src->shared->size) - n = *((short*)s); + n = *((short *)((void *)s)); else - n = *((int*)s); + n = *((int *)((void *)s)); n -= priv->base; if(n < 0 || (unsigned)n >= priv->length || priv->src2dst[n] < 0) { /*overflow*/ @@ -2853,7 +2853,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") } else H5MM_memcpy(d, - dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size, + (uint8_t *)dst->shared->u.enumer.value + ((unsigned)priv->src2dst[n] * dst->shared->size), dst->shared->size); } /* end if */ else { @@ -2865,7 +2865,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, while(lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(s, src->shared->u.enumer.value + md * src->shared->size, + cmp = HDmemcmp(s, (uint8_t *)src->shared->u.enumer.value + (md * src->shared->size), src->shared->size); if(cmp < 0) rt = md; @@ -2889,7 +2889,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, else { HDassert(priv->src2dst[md] >= 0); H5MM_memcpy(d, - dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size, + (uint8_t *)dst->shared->u.enumer.value + ((unsigned)priv->src2dst[md] * dst->shared->size), dst->shared->size); } /* end else */ } /* end else */ diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index eb648f3..605310a 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -416,7 +416,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); for (k = 0; k < base_size; k++) - HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); + HDfprintf(stream, "%02lx", (unsigned long)((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); } /* end for */ HDfprintf(stream, "\n"); } diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ff88fab..6daa497 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -187,9 +187,7 @@ herr_t H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) { unsigned i; - char **names=NULL; - uint8_t *values=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -198,15 +196,17 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) HDassert(value); /* The name and value had better not already exist */ - for (i=0; ishared->u.enumer.nmembs; i++) { - if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) + for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { + if(!HDstrcmp(dt->shared->u.enumer.name[i], name)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition") - if (!HDmemcmp(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size)) + if(!HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition") - } + } /* end for */ /* Increase table sizes */ if(dt->shared->u.enumer.nmembs >= dt->shared->u.enumer.nalloc) { + char **names; + uint8_t *values; unsigned n = MAX(32, 2*dt->shared->u.enumer.nalloc); if(NULL == (names = (char **)H5MM_realloc(dt->shared->u.enumer.name, n * sizeof(char *)))) @@ -217,13 +217,13 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") dt->shared->u.enumer.value = values; dt->shared->u.enumer.nalloc = n; - } + } /* end for */ /* Insert new member at end of member arrays */ dt->shared->u.enumer.sorted = H5T_SORT_NONE; i = dt->shared->u.enumer.nmembs++; dt->shared->u.enumer.name[i] = H5MM_xstrdup(name); - H5MM_memcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -298,7 +298,7 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/) HDassert(dt); HDassert(value); - H5MM_memcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size); + H5MM_memcpy(value, (uint8_t *)dt->shared->u.enumer.value + (membno * dt->shared->size), dt->shared->size); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -416,7 +416,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si rt = copied_dt->shared->u.enumer.nmembs; while(lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(value, copied_dt->shared->u.enumer.value + md * copied_dt->shared->size, copied_dt->shared->size); + cmp = HDmemcmp(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), copied_dt->shared->size); if(cmp < 0) rt = md; else if(cmp > 0) @@ -569,7 +569,7 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) if (cmp!=0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type") - H5MM_memcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size); + H5MM_memcpy(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), copied_dt->shared->size); done: if(copied_dt) diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 8202c2c..be0b5f2 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -344,17 +344,17 @@ H5T__sort_value(const H5T_t *dt, int *map) HDassert(size <= sizeof(tbuf)); for(i = (nmembs - 1), swapped = TRUE; i > 0 && swapped; --i) { for(j = 0, swapped = FALSE; j < i; j++) { - if(HDmemcmp(dt->shared->u.enumer.value + (j * size), dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { + if(HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (j * size), (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { /* Swap names */ char *tmp = dt->shared->u.enumer.name[j]; dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j + 1]; dt->shared->u.enumer.name[j + 1] = tmp; /* Swap values */ - H5MM_memcpy(tbuf, dt->shared->u.enumer.value + (j * size), size); - H5MM_memcpy(dt->shared->u.enumer.value + (j * size), - dt->shared->u.enumer.value + ((j + 1) * size), size); - H5MM_memcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); + H5MM_memcpy(tbuf, (uint8_t *)dt->shared->u.enumer.value + (j * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (j * size), + (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ if(map) { @@ -371,7 +371,7 @@ H5T__sort_value(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for(i = 0; i < (nmembs - 1); i++) - HDassert(HDmemcmp(dt->shared->u.enumer.value + (i * size), dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); + HDassert(HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * size), (uint8_t *)dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); #endif } /* end if */ } /* end else */ @@ -457,10 +457,10 @@ H5T__sort_name(const H5T_t *dt, int *map) dt->shared->u.enumer.name[j+1] = tmp; /* Swap values */ - H5MM_memcpy(tbuf, dt->shared->u.enumer.value+j*size, size); - H5MM_memcpy(dt->shared->u.enumer.value+j*size, - dt->shared->u.enumer.value+(j+1)*size, size); - H5MM_memcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size); + H5MM_memcpy(tbuf, (uint8_t *)dt->shared->u.enumer.value + (j * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (j * size), + (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ if (map) { diff --git a/src/H5Tnative.c b/src/H5Tnative.c index d213c45..6daa544 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -516,6 +516,11 @@ done: } /* end H5T__get_native_type() */ /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" @@ -661,6 +666,11 @@ done: #pragma GCC diagnostic pop /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" @@ -790,6 +800,11 @@ done: #pragma GCC diagnostic pop /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index c909f18..7798e37 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -239,7 +239,7 @@ typedef struct H5T_enum_t { unsigned nalloc; /*num entries allocated */ unsigned nmembs; /*number of members defined in enum */ H5T_sort_t sorted; /*how are members sorted? */ - uint8_t *value; /*array of values */ + void *value; /*array of values */ char **name; /*array of symbol names */ } H5T_enum_t; diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index d3e8fc0..7bdc283 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -482,23 +482,23 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ + *(int *)((void *)&buf[i]) = (int)(((unsigned int)1 << *minbits) - 1); \ else \ - *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ + *(long *)((void *)&buf[i]) = (long)(((unsigned long)1 << *minbits) - 1); \ else \ - *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ + *(long long *)((void *)&buf[i]) = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ - *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ @@ -509,13 +509,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -619,16 +619,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(int *)((void *)&buf[i]) == (int)(((unsigned int)1 << minbits) - 1)) ? \ + filval : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(long *)((void *)&buf[i]) == (long)(((unsigned long)1 << minbits) - 1)) ? \ + filval : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ + filval : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -638,13 +638,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } diff --git a/src/H5detect.c b/src/H5detect.c index 4424009..32b7d34 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -46,6 +46,11 @@ static const char *FileHeader = "\n\ #include "H5Tpublic.h" #include "H5Rpublic.h" +/* Disable warning about cast increasing the alignment of the target type, + * that's _exactly_ what this code is probing. -QAK + */ +#pragma GCC diagnostic ignored "-Wcast-align" + #if defined(__has_attribute) # if __has_attribute(no_sanitize_address) # define HDF_NO_UBSAN __attribute__((no_sanitize_address)) diff --git a/src/H5system.c b/src/H5system.c index 35123db..5d2663e 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -95,12 +95,16 @@ static hbool_t H5_ntzset = FALSE; * Programmer: Robb Matzke * Thursday, April 9, 1998 * - * Modifications: - * Robb Matzke, 1999-07-27 - * The `%a' format refers to an argument of `haddr_t' type - * instead of `haddr_t*' and the return value is correct. *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the fprintf() calls with + * format_templ in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" int HDfprintf(FILE *stream, const char *fmt, ...) { @@ -426,6 +430,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) HDva_end(ap); return nout; } /* end HDfprintf() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 1944ce1..22950e9 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -910,7 +910,7 @@ initialize_stype1(unsigned char *buf, size_t num) stype1 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype1 *)buf + i; + s_ptr = (stype1 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -953,7 +953,7 @@ initialize_stype2(unsigned char *buf, size_t num) stype2 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype2 *)buf + i; + s_ptr = (stype2 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1000,7 +1000,7 @@ initialize_stype3(unsigned char *buf, size_t num) stype3 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype3 *)buf + i; + s_ptr = (stype3 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -1031,7 +1031,7 @@ initialize_stype4(unsigned char *buf, size_t num) stype4 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype4 *)buf + i; + s_ptr = (stype4 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -2219,7 +2219,7 @@ main (int argc, char *argv[]) fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); exit(EXIT_FAILURE); } - H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, H5T__conv_struct_opt); + H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); } /* Create the file */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2729ba1..645608b 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -627,7 +627,7 @@ test_hard_query(void) /* Unregister the hard conversion from int to float. Verify the conversion * is a soft conversion. */ - H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) { H5_FAILED(); printf("Can't query conversion function\n"); @@ -636,7 +636,7 @@ test_hard_query(void) /* Register the hard conversion from int to float. Verify the conversion * is a hard conversion. */ - H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); printf("Can't query conversion function\n"); @@ -2578,34 +2578,34 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); switch (dst_type) { case INT_SCHAR: - printf(" %29d\n", (int)*((signed char*)hw)); + printf(" %29d\n", (int)*((signed char*)((void *)hw))); break; case INT_UCHAR: - printf(" %29u\n", (unsigned)*((unsigned char*)hw)); + printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw))); break; case INT_SHORT: - printf(" %29hd\n", *((short*)hw)); + printf(" %29hd\n", *((short*)((void *)hw))); break; case INT_USHORT: - printf(" %29hu\n", *((unsigned short*)hw)); + printf(" %29hu\n", *((unsigned short*)((void *)hw))); break; case INT_INT: - printf(" %29d\n", *((int*)hw)); + printf(" %29d\n", *((int*)((void *)hw))); break; case INT_UINT: - printf(" %29u\n", *((unsigned*)hw)); + printf(" %29u\n", *((unsigned*)((void *)hw))); break; case INT_LONG: - printf(" %29ld\n", *((long*)hw)); + printf(" %29ld\n", *((long*)((void *)hw))); break; case INT_ULONG: - printf(" %29lu\n", *((unsigned long*)hw)); + printf(" %29lu\n", *((unsigned long*)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw))); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -4485,44 +4485,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); switch (dst_type) { case INT_SCHAR: - printf(" %29d\n", (int)*((signed char*)hw)); + printf(" %29d\n", (int)*((signed char*)((void *)hw))); break; case INT_UCHAR: - printf(" %29u\n", (unsigned)*((unsigned char*)hw)); + printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw))); break; case INT_SHORT: - printf(" %29hd\n", *((short*)hw)); + printf(" %29hd\n", *((short*)((void *)hw))); break; case INT_USHORT: - printf(" %29hu\n", *((unsigned short*)hw)); + printf(" %29hu\n", *((unsigned short*)((void *)hw))); break; case INT_INT: - printf(" %29d\n", *((int*)hw)); + printf(" %29d\n", *((int*)((void *)hw))); break; case INT_UINT: - printf(" %29u\n", *((unsigned int*)hw)); + printf(" %29u\n", *((unsigned int*)((void *)hw))); break; case INT_LONG: - printf(" %29ld\n", *((long*)hw)); + printf(" %29ld\n", *((long*)((void *)hw))); break; case INT_ULONG: - printf(" %29lu\n", *((unsigned long*)hw)); + printf(" %29lu\n", *((unsigned long*)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); + HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); + HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw))); break; case FLT_FLOAT: - printf(" %29f\n", (double)*((float*)hw)); + printf(" %29f\n", (double)*((float*)((void *)hw))); break; case FLT_DOUBLE: - printf(" %29f\n", *((double*)hw)); + printf(" %29f\n", *((double*)((void *)hw))); break; #if H5_SIZEOF_LONG_DOUBLE !=0 case FLT_LDOUBLE: - printf(" %29Lf\n", *((long double*)hw)); + printf(" %29Lf\n", *((long double*)((void *)hw))); break; #endif case OTHER: diff --git a/test/dtypes.c b/test/dtypes.c index 2056245..39fad9f 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -716,7 +716,7 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -754,8 +754,8 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -847,7 +847,7 @@ test_compound_3(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -884,8 +884,8 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || @@ -978,7 +978,7 @@ test_compound_4(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->c[0] = i*8+2; @@ -1017,8 +1017,8 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -1215,7 +1215,7 @@ test_compound_6(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->d = (i*8+6) & 0x7fff; } @@ -1244,8 +1244,8 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); @@ -1694,14 +1694,20 @@ test_compound_8(void) static int test_compound_9(void) { - typedef struct cmpd_struct { + typedef struct cmpd_struct_w { int i1; const char* str; int i2; - } cmpd_struct; + } cmpd_struct_w; - cmpd_struct wdata = {11, "variable-length string", 22}; - cmpd_struct rdata; + typedef struct cmpd_struct_r { + int i1; + char* str; + int i2; + } cmpd_struct_r; + + cmpd_struct_w wdata = {11, "variable-length string", 22}; + cmpd_struct_r rdata; hid_t file; hid_t cmpd_tid, str_id, dup_tid; hid_t space_id; @@ -1720,13 +1726,13 @@ test_compound_9(void) } /* end if */ /* Create first compound datatype */ - if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { + if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { + if(H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; @@ -1739,13 +1745,13 @@ test_compound_9(void) goto error; } /* end if */ - if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, str), str_id) < 0) { + if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) { + if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i2'\n"); goto error; @@ -2541,27 +2547,42 @@ error: static int test_compound_14(void) { - typedef struct cmpd_struct_1 { + typedef struct cmpd_struct_1_w { char c1; char c2; const char* str; - } cmpd_struct_1; + } cmpd_struct_1_w; - typedef struct cmpd_struct_2 { + typedef struct cmpd_struct_1_r { char c1; char c2; char* str; + } cmpd_struct_1_r; + + typedef struct cmpd_struct_2_w { + char c1; + char c2; + const char* str; long l1; long l2; long l3; long l4; - } cmpd_struct_2; + } cmpd_struct_2_w; - cmpd_struct_1 wdata1 = {'A', 'B', "variable-length string"}; + typedef struct cmpd_struct_2_r { + char c1; + char c2; + char* str; + long l1; + long l2; + long l3; + long l4; + } cmpd_struct_2_r; - cmpd_struct_1 rdata1; - cmpd_struct_2 wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001}; - cmpd_struct_2 rdata2; + cmpd_struct_1_w wdata1 = {'A', 'B', "variable-length string"}; + cmpd_struct_1_r rdata1; + cmpd_struct_2_w wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001}; + cmpd_struct_2_r rdata2; hid_t file; hid_t cmpd_m1_tid, cmpd_f1_tid, cmpd_m2_tid, cmpd_f2_tid, str_id; hid_t space_id; @@ -2580,19 +2601,19 @@ test_compound_14(void) } /* end if */ /* Create memory compound datatype 1 */ - if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1))) < 0) { + if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1,c1),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1_w, c1), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1,c2),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1_w, c2), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c2'\n"); goto error; @@ -2605,7 +2626,7 @@ test_compound_14(void) goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1, str), str_id) < 0) { + if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'vl_string'\n"); goto error; @@ -2637,49 +2658,49 @@ test_compound_14(void) } /* end if */ /* Create memory compound datatype 2 */ - if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2))) < 0) { + if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2,c1),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2_w, c1), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2,c2),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2_w, c2), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c2'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2, str), str_id) < 0) { + if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2,l1),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2_w, l1), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2,l2),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2_w, l2), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l2'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2,l3),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2_w, l3), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l3'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2,l4),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2_w, l4), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l4'\n"); goto error; diff --git a/test/links.c b/test/links.c index 3166954..2658101 100644 --- a/test/links.c +++ b/test/links.c @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); + HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); + HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -4628,7 +4628,7 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* set up name for target link: ":tmp/extlinks12" */ drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[32]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks12" */ @@ -4713,11 +4713,11 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* set up name for main file: ":tmp/extlinks0" */ drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[13]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":extlinks13" */ - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[33]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks13" */ @@ -4813,7 +4813,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks14" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks14" */ @@ -4906,7 +4906,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks15" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks15" */ @@ -5085,7 +5085,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* set up name for target link: ":\CWD\extlinks10" */ drive = HDgetdrive(); - sprintf(tmpname, "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); + HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "extlinks10" */ @@ -5569,7 +5569,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Create enough objects in the root group to change it into a "dense" group */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR } /* end for */ @@ -5612,7 +5612,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -5897,7 +5897,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Create enough objects in the root group to change it into a "dense" group */ for(u = 0; u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR } /* end for */ @@ -5966,7 +5966,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 3); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -10654,7 +10654,7 @@ corder_create_compact(hid_t fapl) /* Create several links, but keep group in compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10693,7 +10693,7 @@ corder_create_compact(hid_t fapl) H5L_info_t linfo; /* Link information */ /* Retrieve information for link */ - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ @@ -10774,7 +10774,7 @@ corder_create_dense(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10786,7 +10786,7 @@ corder_create_dense(hid_t fapl) } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10826,7 +10826,7 @@ corder_create_dense(hid_t fapl) H5L_info_t linfo; /* Link information */ /* Retrieve information for link */ - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ @@ -10928,13 +10928,13 @@ corder_transition(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10949,7 +10949,7 @@ corder_transition(hid_t fapl) /* Delete several links from group, until it resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -10963,7 +10963,7 @@ corder_transition(hid_t fapl) } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -10974,7 +10974,7 @@ corder_transition(hid_t fapl) /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ @@ -11012,7 +11012,7 @@ corder_transition(hid_t fapl) /* Delete several links from group, until it resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -11026,7 +11026,7 @@ corder_transition(hid_t fapl) } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -11037,7 +11037,7 @@ corder_transition(hid_t fapl) /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ @@ -11053,10 +11053,10 @@ corder_transition(hid_t fapl) /* Delete all the links */ for(u = max_compact; u > 0; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ - sprintf(objname, "filler %u", (unsigned)0); + HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Close the group */ @@ -11156,7 +11156,7 @@ corder_delete(hid_t fapl) /* Create links until the group is in dense form */ for(u = 0; u < max_compact * 2; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -11238,7 +11238,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, H5L_info_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", (unsigned)n); + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); @@ -11449,7 +11449,7 @@ link_info_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11461,7 +11461,7 @@ link_info_by_idx(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11491,7 +11491,7 @@ link_info_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11503,7 +11503,7 @@ link_info_by_idx(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11603,7 +11603,7 @@ link_info_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11621,7 +11621,7 @@ link_info_by_idx_old(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11633,10 +11633,10 @@ link_info_by_idx_old(hid_t fapl) unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ /* Make link name for increasing/native order queries */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Verify link information (in increasing order) */ if(hard_link) { @@ -11669,10 +11669,10 @@ link_info_by_idx_old(hid_t fapl) /* Make link name for decreasing order queries */ - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); /* Make link value for decreasing order queries */ - sprintf(valname, "value %02u", dec_u); + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); /* Verify link information (in decreasing order) */ if(hard_link) { @@ -11827,7 +11827,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11865,9 +11865,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", (max_compact - (u + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -11882,7 +11882,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11921,9 +11921,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - (u + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -11949,7 +11949,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11982,9 +11982,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12007,9 +12007,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12106,7 +12106,7 @@ delete_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12152,9 +12152,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12179,7 +12179,7 @@ delete_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12213,9 +12213,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12240,9 +12240,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12323,7 +12323,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (unsigned)my_info.corder); + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -12669,7 +12669,7 @@ link_iterate(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12695,7 +12695,7 @@ link_iterate(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12795,7 +12795,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -13082,7 +13082,7 @@ link_iterate_old(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13211,7 +13211,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Mount a file over a group in main group */ mnt_idx = 2; - sprintf(mntname, "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR /* Open the object that the file is mounted on */ @@ -13269,7 +13269,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13363,7 +13363,7 @@ open_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13376,7 +13376,7 @@ open_by_idx(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13398,7 +13398,7 @@ open_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13411,7 +13411,7 @@ open_by_idx(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13494,7 +13494,7 @@ open_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13540,7 +13540,7 @@ open_by_idx_old(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13553,7 +13553,7 @@ open_by_idx_old(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13637,7 +13637,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Open each object in group by name and check that it's the correct one */ for(u = 0; u < max_links; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR @@ -13705,7 +13705,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13799,7 +13799,7 @@ object_info(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13811,7 +13811,7 @@ object_info(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13824,7 +13824,7 @@ object_info(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13847,7 +13847,7 @@ object_info(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13859,7 +13859,7 @@ object_info(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13872,7 +13872,7 @@ object_info(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13950,7 +13950,7 @@ object_info_old(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13996,7 +13996,7 @@ object_info_old(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14008,7 +14008,7 @@ object_info_old(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14021,7 +14021,7 @@ object_info_old(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -14102,7 +14102,7 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14187,7 +14187,7 @@ group_info(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14221,7 +14221,7 @@ group_info(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14301,7 +14301,7 @@ group_info(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ @@ -14328,7 +14328,7 @@ group_info(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14362,7 +14362,7 @@ group_info(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14442,7 +14442,7 @@ group_info(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ @@ -14519,7 +14519,7 @@ group_info_old(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14558,7 +14558,7 @@ group_info_old(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14592,7 +14592,7 @@ group_info_old(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14672,7 +14672,7 @@ group_info_old(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ diff --git a/test/objcopy.c b/test/objcopy.c index e646c87..1f89e16 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -986,15 +986,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, * for each */ for(elmt=0; elmtlen - != ((const hvl_t *)memb2)->len) + if(((const hvl_t *)((const void *)memb1))->len + != ((const hvl_t *)((const void *)memb2))->len) TEST_ERROR /* Check vlen data */ if(!compare_data(parent1, parent2, pid, base_id, - ((const hvl_t *)memb1)->len, - ((const hvl_t *)memb1)->p, - ((const hvl_t *)memb2)->p, obj_owner)) + ((const hvl_t *)((const void *)memb1))->len, + ((const hvl_t *)((const void *)memb1))->p, + ((const hvl_t *)((const void *)memb2))->p, obj_owner)) TEST_ERROR /* Update member pointers */ @@ -13425,7 +13425,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gid = -1; /* Group ID */ int i; - char grp_name[8]; + char grp_name[16]; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; diff --git a/test/tarray.c b/test/tarray.c index d8ededf..eb71ad6 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1074,7 +1074,7 @@ test_array_free_custom(void *_mem, void *info) if(_mem != NULL) { mem = ((unsigned char *)_mem) - extra; - *mem_used -= *(size_t *)mem; + *mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ diff --git a/test/tchecksum.c b/test/tchecksum.c index ffbab45..6e509fb 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -252,7 +252,7 @@ test_checksum(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE H5_ATTR_CONST void +void cleanup_checksum(void) { /* no file to clean */ diff --git a/test/tconfig.c b/test/tconfig.c index b652ca4..1a81d50 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -83,7 +83,7 @@ test_configure(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void cleanup_configure(void) { /* no file to clean */ @@ -106,7 +106,7 @@ cleanup_configure(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void test_config_ctypes(void) { /* standard C89 basic types */ @@ -215,7 +215,7 @@ test_config_ctypes(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void test_exit_definitions(void) { /* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */ diff --git a/test/tmeta.c b/test/tmeta.c index 7eeb493..ceb7d2b 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -121,7 +121,7 @@ test_metadata(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE H5_ATTR_CONST void +void cleanup_metadata(void) { /* no file to clean */ diff --git a/test/tsohm.c b/test/tsohm.c index 5c3707f..8cf4d2f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -595,7 +595,7 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, unsigned test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; @@ -749,10 +749,10 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned o hid_t file = -1; herr_t ret; - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); CHECK_I(file, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, open_close); + file = size1_helper(file, filename, fapl_id, open_close); CHECK_I(file, "size1_helper"); ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -761,7 +761,7 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned o ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); - return h5_get_file_size(FILENAME, fapl_id); + return h5_get_file_size(filename, fapl_id); } /* getsize_testsize1 */ @@ -790,7 +790,9 @@ test_sohm_size1(void) hsize_t oh_sizes[3]; unsigned oh_size_index = 0; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ hsize_t norm_oh_size; +#endif /* Jira HDFFV-10646 */ hsize_t sohm_oh_size; hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; @@ -886,7 +888,9 @@ test_sohm_size1(void) norm_empty_filesize = file_sizes[0]; norm_final_filesize = file_sizes[1]; norm_final_filesize2 = file_sizes[2]; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ norm_oh_size = oh_sizes[0]; +#endif /* Jira HDFFV-10646 */ sohm_empty_filesize = file_sizes[3]; sohm_final_filesize = file_sizes[4]; @@ -941,6 +945,7 @@ test_sohm_size1(void) } /* test_sohm_size1 */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ /*--------------------------------------------------------------------------- * Function: test_sohm_size_consistency_open_create @@ -1045,6 +1050,7 @@ test_sohm_size_consistency_open_create(void) ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); } /* test_sohm_size_consistency_open_create */ +#endif /* Jira HDFFV-10645 */ /*------------------------------------------------------------------------- @@ -1176,6 +1182,7 @@ static void test_sohm_attrs(void) { hid_t fcpl_id; + hid_t file_id; unsigned i = 0; #define TSOHM_TSA_NFLAGS_1 7 unsigned flags1[TSOHM_TSA_NFLAGS_1] = { @@ -1293,8 +1300,8 @@ test_sohm_attrs(void) ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - VERIFY(ret, -1, "H5Fcreate"); + file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(file_id, -1, "H5Fcreate"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index 77589bb..5f715ce 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -94,7 +94,7 @@ void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; - *mem_used-=*(size_t *)mem; + *mem_used-=*(size_t *)((void *)mem); HDfree(mem); } /* end if */ } diff --git a/test/tvltypes.c b/test/tvltypes.c index 8824066..ffa2aff 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -88,7 +88,7 @@ void test_vltypes_free_custom(void *_mem, void *mem_used) */ unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */ - *(size_t *)mem_used -= *(size_t *)mem; + *(size_t *)mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ } diff --git a/test/vds.c b/test/vds.c index 5870d49..a042a75 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12152,7 +12152,6 @@ main(void) hid_t my_fapl = -1; /* File access property list */ int test_api_config; unsigned bit_config; - unsigned latest = FALSE; /* Using the latest library version bound */ H5F_libver_t low, high; /* Low and high bounds */ int nerrors = 0; @@ -12180,10 +12179,6 @@ main(void) if(high < H5F_LIBVER_V110) continue; - /* Whether to use latest hyperslab/point selection version */ - if(low >= H5F_LIBVER_V112) - latest = TRUE; - /* Set the low/high version bounds */ if(H5Pset_libver_bounds(my_fapl, low, high) < 0) TEST_ERROR diff --git a/test/vds_env.c b/test/vds_env.c index d3a28fb..9c7b698 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -302,7 +302,6 @@ main(void) hid_t fapl, my_fapl; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - unsigned latest = FALSE; /* Using the latest library version bound */ int nerrors = 0; /* Testing setup */ @@ -327,10 +326,6 @@ main(void) if(high < H5F_LIBVER_V110) continue; - /* Whether to use latest hyperslab/point selection version */ - if(low >= H5F_LIBVER_V112) - latest = TRUE; - /* Set the low/high version bounds */ if(H5Pset_libver_bounds(my_fapl, low, high) < 0) TEST_ERROR diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 0169131..ac385c9 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -516,14 +516,14 @@ static hsize_t diff_datum( if (H5Tis_variable_str(m_type)) { h5difftrace("diff_datum H5T_STRING variable\n"); /* Get pointer to first string */ - s1 = *(char**) mem1; + s1 = *(char **)((void *)mem1); if (s1) size1 = HDstrlen(s1); else size1 = 0; /* Get pointer to second string */ - s2 = *(char**) mem2; + s2 = *(char **)((void *)mem2); if (s2) size2 = HDstrlen(s2); else @@ -828,10 +828,10 @@ static hsize_t diff_datum( size = H5Tget_size(memb_type); /* get the number of sequence elements */ - nelmts = ((hvl_t *) mem1)->len; + nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d93f7b0..f103647 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1283,7 +1283,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t mem = ((unsigned char*)_mem) + block_index * size; if (H5Tis_variable_str(tid)) { - s = *(char**) mem; + s = *(char **)((void *)mem); if (s != NULL) size = HDstrlen(s); else @@ -1375,10 +1375,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; + nelmts = ((hvl_t *)((void *)mem))->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3e8f1fe..17e3f18 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -787,7 +787,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**) cp_vp; + s = *(char **)((void *)cp_vp); if(s != NULL) size = HDstrlen(s); } else { @@ -1240,7 +1240,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); /* Get the number of sequence elements */ - nelmts = ((hvl_t *) cp_vp)->len; + nelmts = ((hvl_t *)((void *)cp_vp))->len; for(i = 0; i < nelmts; i++) { if(i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); @@ -1264,7 +1264,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; /* Dump the array element */ - h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); + h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *)((void *)cp_vp))->p)) + i * size, ctx); ctx->indent_level--; } /* end for */ diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index ec76511..2fa9fd0 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source) goto error; } - refbuf = (hobj_ref_t *) buf; + refbuf = (hobj_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source) for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { - onestring = *(char **) bp; + onestring = *(char **)((void *)bp); if (onestring) str_size = HDstrlen(onestring); } diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index b9ed9ce..257a047 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -259,7 +259,7 @@ convert(hid_t fid, const char *dname) error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); goto error; - } + } else if(verbose_g) HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); @@ -268,11 +268,11 @@ convert(hid_t fid, const char *dname) HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); h5tools_setstatus(EXIT_SUCCESS); goto done; - } + } else if (verbose_g) HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - break; + break; case H5D_CONTIGUOUS: if(verbose_g) @@ -302,8 +302,8 @@ convert(hid_t fid, const char *dname) if(noop_g) { if(verbose_g) HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index ce866b4..08ebfc7 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -130,7 +130,7 @@ int main(void) set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); H5Dclose(set); out: @@ -151,7 +151,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); printf("Data comparison:\n" "%14s (%2d) %6f = %f\n" @@ -162,7 +162,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); printf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", @@ -172,7 +172,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); printf("\n" "Short circuit\n" " %6f = %f\n" diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 47734b6..3962edd 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -79,7 +79,7 @@ counter (unsigned flags, size_t cd_nelmts, } /*---------------------------------------------------------------------------*/ -double retrieve_time(void) +static double retrieve_time(void) { #ifdef H5_HAVE_GETTIMEOFDAY struct timeval t; -- cgit v0.12 From 6ced6457c3048bd10bf6f470b329b4810d9be826 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 28 Jun 2019 19:26:47 -0500 Subject: Move the -Wformat-nonliteral warning to the developer flags. Fix bugs I introduced in the last commit. --- config/gnu-flags | 7 +++++-- src/H5FL.c | 2 +- test/tsohm.c | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index ced54c9..fc3a6ce 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -113,9 +113,11 @@ case "$cc_vendor-$cc_version" in # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it from the # environment variable at configure time. + # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add + # it to the developer flags. H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" - H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" + H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" # As of GCC 8.x, the -Wunsafe-loop-optimizations has been removed @@ -150,7 +152,8 @@ case "$cc_vendor-$cc_version" in esac # Developer warnings (suggestions from gcc, not code problems) - DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn" + # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) + DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn -Wformat-nonliteral" NO_DEVELOPER_WARNING_CFLAGS="-Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn" # Symbols diff --git a/src/H5FL.c b/src/H5FL.c index a849ff7..9ed867d 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -1430,7 +1430,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) HDassert(head->init); /* Get the pointer to the info header in front of the block to free */ - temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - -sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Get the number of elements */ free_nelem=temp->nelem; diff --git a/test/tsohm.c b/test/tsohm.c index 99df6b7..9216b3e 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -950,7 +950,6 @@ test_sohm_size1(void) } /* test_sohm_size1 */ -#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ /*--------------------------------------------------------------------------- * Function: test_sohm_size_consistency_open_create -- cgit v0.12 From f250815151df8da8a93c0ff781a3cf134f1c6cbd Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 29 Jun 2019 02:38:14 -0700 Subject: Cleaned up misc warnings. --- src/H5FDlog.c | 12 +- src/H5FSsection.c | 2 +- src/H5Pfapl.c | 2 +- test/fheap.c | 67 ++++++---- test/ohdr.c | 2 +- test/twriteorder.c | 384 +++++++++++++++++++++++++++-------------------------- 6 files changed, 249 insertions(+), 220 deletions(-) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 06a0e61..ac5667f 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -331,16 +331,22 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); - /* This shallow copy is correct! The string will be properly - * copied deep down in the H5P code. + /* Duplicate the log file string + * A little wasteful, since this string will just be copied later, but + * passing it in as a pointer sets off a chain of impossible-to-resolve + * const cast warnings. */ - fa.logfile = (char *)logfile; + if(logfile != NULL && NULL == (fa.logfile = H5MM_xstrdup(logfile))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to copy log file name") fa.flags = flags; fa.buf_size = buf_size; ret_value = H5P_set_driver(plist, H5FD_LOG, &fa); done: + if(fa.logfile) + H5MM_free(fa.logfile); + FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_log() */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d15e299..9f86aea 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -2539,7 +2539,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, /* Allocate space for the free space header */ if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, hdr_alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") /* Cache the new free space header (pinned) */ if(H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 585e913..8bb2b12 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -4892,7 +4892,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) /* Prepare the VOL connector property */ vol_prop.connector_id = vol_id; - vol_prop.connector_info = vol_info; + vol_prop.connector_info = (void *)vol_info; /* Set the connector ID & info property */ if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) diff --git a/test/fheap.c b/test/fheap.c index 557fd37..91a1df5 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -683,6 +683,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, /* Close (empty) heap */ if(H5HF_close(*fh) < 0) FAIL_STACK_ERROR + *fh = NULL; } /* end if */ /* Close file */ @@ -759,6 +760,7 @@ reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr, /* Close (empty) heap */ if(H5HF_close(*fh) < 0) FAIL_STACK_ERROR + *fh = NULL; /* Re-open heap */ if(NULL == (*fh = H5HF_open(f, fh_addr))) @@ -766,10 +768,10 @@ reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr, } /* end if */ /* Success */ - return(0); + return 0; error: - return(-1); + return -1; } /* end reopen_heap() */ @@ -1904,8 +1906,9 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) TEST_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Delete heap */ if(H5HF_delete(f, fh_addr) < 0) @@ -1926,15 +1929,15 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_create() */ @@ -2020,6 +2023,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Check for closing & re-opening the file */ if(tparam->reopen_heap) { @@ -2083,7 +2087,7 @@ error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_reopen() */ @@ -2250,7 +2254,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -2258,11 +2262,11 @@ error: H5HF_close(fh); if(fh2) H5HF_close(fh2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(file); + H5Fclose(file2); } H5E_END_TRY; - return(1); + return 1; } /* test_open_twice() */ @@ -2366,6 +2370,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(fh2) { /* Close opened heap */ H5HF_close(fh2); + fh2 = NULL; /* Indicate error */ TEST_ERROR @@ -2403,6 +2408,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(fh) { /* Close opened heap */ H5HF_close(fh); + fh = NULL; /* Indicate error */ TEST_ERROR @@ -2423,7 +2429,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -2431,9 +2437,9 @@ error: H5HF_close(fh); if(fh2) H5HF_close(fh2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_delete_open() */ @@ -2769,15 +2775,15 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_id_limits() */ @@ -2878,6 +2884,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Close the file */ @@ -2891,15 +2898,15 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_filtered_create() */ @@ -3022,7 +3029,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR - + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -3031,7 +3038,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -3039,7 +3046,7 @@ error: H5HF_close(fh); H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_size() */ @@ -6643,8 +6650,9 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if((H5HF_close(fh)) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -6834,8 +6842,9 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if((H5HF_close(fh)) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7001,7 +7010,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -7239,8 +7248,9 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7541,8 +7551,9 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param FAIL_STACK_ERROR /* Close the fractal heap */ - if((fh = H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) diff --git a/test/ohdr.c b/test/ohdr.c index d15e43b..facedd5 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -809,7 +809,7 @@ oh_compare(hid_t did1, hid_t did2) * Conduct additions side-by-side with a standard datataset and one with * minimized dataset object headers. */ -#define ATTR_NAME_MAX 16 +#define ATTR_NAME_MAX 64 #define ATTR_SHORT "first" #define ATTR_LONG "second" #define N_ATTRS 64 diff --git a/test/twriteorder.c b/test/twriteorder.c index 4c86636..60ee384 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -25,7 +25,6 @@ * get the same data the write has written. * * Created: Albert Cheng, 2013/8/28. -* Modified: *************************************************************/ /*********************************************************** @@ -69,18 +68,18 @@ #ifdef H5_HAVE_FORK #define DATAFILE "twriteorder.dat" -/* #define READERS_MAX 10 */ /* max number of readers */ -#define BLOCKSIZE_DFT 1024 /* 1KB */ -#define PARTITION_DFT 2048 /* 2KB */ -#define NLINKEDBLOCKS_DFT 512 /* default 512 */ -#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ -#define Hgoto_error(val) {ret_value=val; goto done;} +/* #define READERS_MAX 10 */ /* max number of readers */ +#define BLOCKSIZE_DFT 1024 /* 1KB */ +#define PARTITION_DFT 2048 /* 2KB */ +#define NLINKEDBLOCKS_DFT 512 /* default 512 */ +#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ +#define Hgoto_error(val) {ret_value=val; goto done;} /* type declarations */ typedef enum part_t { - UC_READWRITE =0, /* both writer and reader */ - UC_WRITER, /* writer only */ - UC_READER /* reader only */ + UC_READWRITE = 0, /* both writer and reader */ + UC_WRITER, /* writer only */ + UC_READER /* reader only */ } part_t; /* prototypes */ @@ -92,9 +91,9 @@ int setup_parameters(int argc, char * const argv[]); int parse_option(int argc, char * const argv[]); /* Global Variable definitions */ -const char *progname_g="twriteorder"; /* program name */ -int write_fd_g; -int blocksize_g, part_size_g, nlinkedblock_g; +const char *progname_g="twriteorder"; /* program name */ +int write_fd_g; +int blocksize_g, part_size_g, nlinkedblock_g; part_t launch_g; /* Function definitions */ @@ -103,15 +102,15 @@ part_t launch_g; void usage(const char *prog) { - fprintf(stderr, "usage: %s [OPTIONS]\n", prog); - fprintf(stderr, " OPTIONS\n"); - fprintf(stderr, " -h Print a usage message and exit\n"); - fprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); - fprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); - fprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); - fprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); - fprintf(stderr, " where N is an integer value\n"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "usage: %s [OPTIONS]\n", prog); + HDfprintf(stderr, " OPTIONS\n"); + HDfprintf(stderr, " -h Print a usage message and exit\n"); + HDfprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); + HDfprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); + HDfprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); + HDfprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); + HDfprintf(stderr, " where N is an integer value\n"); + HDfprintf(stderr, "\n"); } /* Setup test parameters by parsing command line options. @@ -127,73 +126,73 @@ parse_option(int argc, char * const argv[]) /* suppress getopt from printing error */ opterr = 0; - while (1){ - c = getopt (argc, argv, cmd_options); - if (-1 == c) - break; - switch (c) { - case 'h': - usage(progname_g); - exit(0); - break; - case 'b': /* number of planes to write/read */ - if ((blocksize_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'n': /* number of planes to write/read */ - if ((nlinkedblock_g = atoi(optarg)) < 2){ - fprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'p': /* number of planes to write/read */ - if ((part_size_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'l': /* launch reader or writer only */ - switch (*optarg) { - case 'r': /* reader only */ - launch_g = UC_READER; - break; - case 'w': /* writer only */ - launch_g = UC_WRITER; - break; - default: - fprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); - usage(progname_g); - Hgoto_error(-1); - break; - } - printf("launch = %d\n", launch_g); - break; - case '?': - fprintf(stderr, "getopt returned '%c'.\n", c); - usage(progname_g); - Hgoto_error(-1); - default: - fprintf(stderr, "getopt returned unexpected value.\n"); - fprintf(stderr, "Unexpected value is %d\n", c); - Hgoto_error(-1); - } - } + while (1) { + c = getopt (argc, argv, cmd_options); + if (-1 == c) + break; + + switch (c) { + case 'h': + usage(progname_g); + HDexit(0); + break; + case 'b': /* number of planes to write/read */ + if ((blocksize_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'n': /* number of planes to write/read */ + if ((nlinkedblock_g = atoi(optarg)) < 2) { + HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'p': /* number of planes to write/read */ + if ((part_size_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'l': /* launch reader or writer only */ + switch (*optarg) { + case 'r': /* reader only */ + launch_g = UC_READER; + break; + case 'w': /* writer only */ + launch_g = UC_WRITER; + break; + default: + HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); + usage(progname_g); + Hgoto_error(-1); + break; + } /* end inner switch */ + HDprintf("launch = %d\n", launch_g); + break; + case '?': + HDfprintf(stderr, "getopt returned '%c'.\n", c); + usage(progname_g); + Hgoto_error(-1); + default: + HDfprintf(stderr, "getopt returned unexpected value.\n"); + HDfprintf(stderr, "Unexpected value is %d\n", c); + Hgoto_error(-1); + } /* end outer switch */ + } /* end while */ /* verify partition size must be >= blocksize */ if (part_size_g < blocksize_g ){ - fprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", - blocksize_g, part_size_g); - Hgoto_error(-1); + HDfprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", blocksize_g, part_size_g); + Hgoto_error(-1); } done: /* All done. */ - return(ret_value); + return ret_value; } /* Setup parameters for the test case. @@ -209,15 +208,16 @@ int setup_parameters(int argc, char * const argv[]) /* parse options */ if (parse_option(argc, argv) < 0){ - return(-1); + return -1; } /* show parameters and return */ - printf("blocksize = %ld\n", (long)blocksize_g); - printf("part_size = %ld\n", (long)part_size_g); - printf("nlinkedblock = %ld\n", (long)nlinkedblock_g); - printf("launch = %d\n", launch_g); - return(0); + HDprintf("blocksize = %ld\n", (long)blocksize_g); + HDprintf("part_size = %ld\n", (long)part_size_g); + HDprintf("nlinkedblock = %ld\n", (long)nlinkedblock_g); + HDprintf("launch = %d\n", launch_g); + + return 0; } /* Create the test file with initial "empty" file, that is, @@ -227,19 +227,19 @@ int setup_parameters(int argc, char * const argv[]) */ int create_wo_file(void) { - int blkaddr=0; /* blkaddress of next linked block */ - int ret_code; + int blkaddr = 0; /* blkaddress of next linked block */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Create the data file */ if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) { HDprintf("WRITER: error from open\n"); return -1; } - blkaddr=0; + blkaddr = 0; /* write it to partition 0 */ - if ((ret_code=HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ - printf("blkaddr write failed\n"); - return -1; + if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ + HDprintf("blkaddr write failed\n"); + return -1; } /* File initialized, return success */ @@ -252,38 +252,45 @@ int write_wo_file(void) int blkaddr_old=0; int i; char buffer[BLOCKSIZE_DFT]; - int ret_code; + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* write block 1, 2, ... */ - for (i=1; i Date: Tue, 2 Jul 2019 23:43:45 -0500 Subject: Add support for GCC9, update warnhist script, and clean up warnings. --- MANIFEST | 1 + bin/genparser | 2 +- bin/warnhist | 279 ++++++++++++++----- config/gnu-flags | 71 ++++- hl/src/H5LTanalyze.c | 201 +++++++------- hl/src/H5LTanalyze.l | 5 +- hl/src/H5LTparse.c | 532 +++++++++++++++++++------------------ hl/src/H5LTparse.h | 15 +- hl/tools/gif2h5/gif2mem.c | 3 +- src/H5Adense.c | 5 +- src/H5Dchunk.c | 8 +- src/H5Dint.c | 5 +- src/H5FDmulti.c | 14 +- src/H5Fint.c | 11 +- src/H5Fpkg.h | 16 +- src/H5Fsuper.c | 1 - src/H5I.c | 90 +++---- src/H5Opline.c | 4 +- src/H5Osdspace.c | 4 +- src/H5PLpath.c | 4 +- src/H5Pint.c | 2 +- src/H5T.c | 4 +- src/H5Toh.c | 1 + src/H5system.c | 4 +- test/CMakeLists.txt | 1 + test/enc_dec_plist.c | 4 +- test/external.c | 3 +- test/external_common.h | 12 +- test/external_env.c | 1 + test/external_fname.h | 37 +++ test/fheap.c | 41 +-- test/h5test.c | 2 +- test/h5test.h | 2 +- test/ohdr.c | 4 +- test/tid.c | 2 +- test/ttsafe_error.c | 2 +- test/vds.c | 4 +- test/vds_env.c | 4 +- test/vds_swmr.h | 48 ---- test/vds_swmr_gen.c | 46 ++++ test/vds_swmr_reader.c | 2 + tools/lib/h5diff_array.c | 2 +- tools/lib/h5diff_util.c | 6 +- tools/lib/h5trav.c | 2 +- tools/src/h5repack/h5repack_refs.c | 24 +- tools/test/misc/h5clear_gentest.c | 2 +- tools/test/perform/chunk_cache.c | 6 +- tools/test/perform/perf.c | 21 +- 48 files changed, 909 insertions(+), 651 deletions(-) create mode 100644 test/external_fname.h diff --git a/MANIFEST b/MANIFEST index 3285ec2..b4ee3b0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -999,6 +999,7 @@ ./test/external_common.c ./test/external_common.h ./test/external_env.c +./test/external_fname.h ./test/error_test.c ./test/err_compat.c ./test/filter_error.h5 diff --git a/bin/genparser b/bin/genparser index 8cf6ec2..e6aee5b 100755 --- a/bin/genparser +++ b/bin/genparser @@ -218,7 +218,7 @@ perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5 # will simply ignore them, but we want to avoid those warnings. for f in ${path_to_hl_src}/H5LTparse.c ${path_to_hl_src}/H5LTanalyze.c do - echo '#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 ' >> tmp.out + echo '#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out diff --git a/bin/warnhist b/bin/warnhist index df7565e..499886b 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -40,6 +40,8 @@ my @ignorenames; my %ignored_files = (); my %warn_file_indices = (); my %file_warn_indices = (); +my @warn_match_strings; +my @file_match_strings; my %file_warn = (); my %file_warn_line = (); my $current_warning = 0; @@ -49,14 +51,10 @@ my $last_c_name; my $last_fort_name; my $last_fort_line; -# declare the Perl command line flags/options we want to allow -my %options=(); -getopts("FWht:w:f:i:l", \%options); - -# Display usage, if requested -if($options{h}) { - print "Usage: 'warnhist [-h] [-t ] [-w ] [-W] [-f ] [-F] [-l] [-i [file]'\n"; - print "\t-h\tDisplay this usage\n"; +# Display usage +sub do_help { + print "Usage: 'warnhist [-h, --help] [-t ] [-w ] [-W] [-f ] [-F] [-s ] [-S ] [file]'\n"; + print "\t-h, --help\tDisplay this usage\n"; print "\t-t \tTrim pathname prefix from filenames, \n"; print "\t-w \tDisplay files for a given warning index list, \n"; print "\t\t can be a single value, a range, or a comma separated list\n"; @@ -66,6 +64,12 @@ if($options{h}) { print "\t\t can be a single value, a range, or a comma separated list\n"; print "\t\tFor example: '0' or '0,4' or '8-10' or '0,2-4,8-10,13'\n"; print "\t-F\tDisplay warnings for all files\n"; + print "\t-s \tDisplay files for warnings which contain a string, \n"; + print "\t\t is a comma separated list, with no spaces\n"; + print "\t\tFor example: 'Wunused-dummy-argument' or 'Wunused-dummy-argument,Wunused-variable'\n"; + print "\t-S \tDisplay warnings for files which contain a string, \n"; + print "\t\t is a comma separated list, with no spaces\n"; + print "\t\tFor example: 'H5Fint' or 'H5Fint,H5Gnode'\n"; print "\t-l\tDisplay line nunbers for file/warning\n"; print "\t-i \tIgnore named files, \n"; print "\t\t is a comma separated list, with no spaces\n"; @@ -75,6 +79,19 @@ if($options{h}) { exit; } +sub main::HELP_MESSAGE { + do_help(); +} + +# declare the Perl command line flags/options we want to allow +my %options=(); +getopts("FWht:w:f:s:S:i:l", \%options); + +# Display usage, if requested +if($options{h}) { + do_help(); +} + # Parse list of file names to ignore if(exists $options{i}) { @ignorenames = split /,/, $options{i}; @@ -98,13 +115,13 @@ if(exists $options{w}) { #print "start_index = '$start_index', end_index = '$end_index'\n"; for my $y ($start_index..$end_index) { #print "y = '$y'\n"; - if(!(exists $warn_file_indices{$y})) { + if(!exists $warn_file_indices{$y}) { $warn_file_indices{$y} = $y; } } } else { - if(!(exists $warn_file_indices{$x})) { + if(!exists $warn_file_indices{$x}) { $warn_file_indices{$x} = $x; } } @@ -114,6 +131,12 @@ if(exists $options{w}) { #} } +# Parse list of warning strings to expand file names +if(exists $options{s}) { + @warn_match_strings = split /,/, $options{s}; +# print @warn_match_strings; +} + # Parse list of file indices to expand warnings if(exists $options{f}) { my @tmp_indices; @@ -131,13 +154,13 @@ if(exists $options{f}) { #print "start_index = '$start_index', end_index = '$end_index'\n"; for my $y ($start_index..$end_index) { #print "y = '$y'\n"; - if(!(exists $file_warn_indices{$y})) { + if(!exists $file_warn_indices{$y}) { $file_warn_indices{$y} = $y; } } } else { - if(!(exists $file_warn_indices{$x})) { + if(!exists $file_warn_indices{$x}) { $file_warn_indices{$x} = $x; } } @@ -147,6 +170,12 @@ if(exists $options{f}) { #} } +# Parse list of warning strings for files to expand warnings +if(exists $options{S}) { + @file_match_strings = split /,/, $options{S}; +# print @file_match_strings; +} + PARSE_LINES: while (<>) { my $name; @@ -164,8 +193,8 @@ while (<>) { ($last_fort_line, $toss) = split /\./, $last_fort_line; } - # Retain last C compile line, which possibly comes a few lines before warning - if($_ =~ /.*[A-Za-z0-9_]\.c:.*/) { + # Retain last C/C++ compile line, which possibly comes a few lines before warning + if($_ =~ /.*[A-Za-z0-9_]\.[cC]:.*/) { ($last_c_name, $toss) = split /\:/, $_; } @@ -175,6 +204,9 @@ while (<>) { # Skip warnings from linker next if $_ =~ /ld: warning:/; + # Skip warnings from build_py and install_lib + next if $_ =~ /warning: (build_py|install_lib)/; + # "Hide" the C++ '::' symbol until we've parsed out the parts of the line while($_ =~ /\:\:/) { $_ =~ s/\:\:/@@@@/g; @@ -185,6 +217,11 @@ while (<>) { $name = $last_c_name; $line = "??"; ($toss, $toss, $warning, $extra, $extra2) = split /\:/, $_; + # Check for CMAKE build with warning on first line and no filename + } elsif($_ =~ /^\s*[Ww]arning:.*/) { + $name = $last_c_name; + $line = "??"; + ($toss, $warning, $extra, $extra2) = split /\:/, $_; # Check for FORTRAN warning output } elsif($_ =~ /^Warning:.*/) { $name = $last_fort_name; @@ -287,8 +324,8 @@ while (<>) { next if $_ =~ /\(this will be reported only once per input file\)/; # Eliminate "{aka }" and "{aka ''}" info - if($warning =~ /\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?/) { - $warning =~ s/\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?\}//g; + if($warning =~ /\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))/) { + $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))//g; } # print "warning = $warning\n"; @@ -297,6 +334,8 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /unused variable '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /unused function '[A-Za-z_0-9]*'.*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' when passing argument to function.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' to match other operand of binary expression.*/) { @@ -361,15 +400,21 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /Unused dummy argument '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + $warning =~ s/\([0-9]+\)/\(-\)/g; } elsif($warning =~ /Unused parameter '[A-Za-z_0-9]*' declared at.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + $warning =~ s/\([0-9]+\)/\(-\)/g; } elsif($warning =~ /Unused variable '[A-Za-z_0-9]*' declared at.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /Inequality comparison for REAL\([0-9]*\) at.*/) { $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; + $warning =~ s/\([0-9]+\)/\(-\)/g; } elsif($warning =~ /Possible change of value in conversion from INTEGER\([0-9]*\) to (INTEGER|REAL)\([0-9]*\) at.*/) { $warning =~ s/INTEGER\([0-9]*\)/INTEGER\(-\)/g; $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; + } elsif($warning =~ /Equality comparison for REAL\([0-9]*\) at.*/) { + $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; + $warning =~ s/\([0-9]+\)/\(-\)/g; } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' with different width due to prototype.*/) { $warning =~ s/passing argument [0-9]*/passing argument -/g; $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; @@ -394,8 +439,8 @@ while (<>) { $warning =~ s/'[a-z][a-z_,\s\*\(\)]*'/'-'/g; } elsif($warning =~ /implicit declaration of function '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_\.\[\]0-9]*' may be used uninitialized in this function.*/) { - $warning =~ s/'[A-Za-z_\.\[\]0-9]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*' may be used uninitialized in this function.*/) { + $warning =~ s/'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*'/'-'/g; } elsif($warning =~ /redundant redeclaration of '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /declaration of '[A-Za-z_0-9]*' shadows a parameter.*/) { @@ -411,6 +456,8 @@ while (<>) { } elsif($warning =~ /enum conversion when passing argument [0-9]* of '[A-Za-z_0-9]*' is invalid.*/) { $warning =~ s/passing argument [0-9]*/passing argument -/g; $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /enum conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' in assignment is invalid in C\+\+.*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /duplicate declaration of '[A-Za-z_0-9]*' is invalid in.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) is a dummy argument of the BIND\(C\) procedure '[A-Za-z_0-9]*' but may not be C interoperable.*/) { @@ -422,64 +469,142 @@ while (<>) { } elsif($warning =~ /Component '[A-Za-z_0-9]*' in derived type '[A-Za-z_0-9]*' at \([0-9]*\) may not be C interoperable, even though derived type '[A-Za-z_0-9]*' is BIND\(C\).*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/at \([0-9]*\)/at \(-\)/g; - } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' if it is known to return normally \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) { + } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' if it is known to return normally.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; - } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) { + } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; - } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast \[-Wint-conversion\].*/) { + } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute \[-Wsuggest-attribute=format\].*/) { + } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) { + } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]' directive writing (between [0-9]+ and [0-9]+)|(up to [0-9]+) bytes into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-overflow=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]'/'-'/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*L*[dfsu]' directive writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)) bytes into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*L*[dfsu]'/'-'/g; $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'(%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+)' directive output may be truncated writing (between [0-9]+ and [0-9]+)|(up to [0-9]+)|(likely 1 or more) byte(s)? into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-truncation=\].*/) { + } elsif($warning =~ /'((%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+))' directive output may be truncated writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)|([0-9+)|(likely 1 or more)) byte(s)? into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) { $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; $warning =~ s/'[A-Za-z_0-9\/]+'/'-'/g; $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result \[-Wsign-conversion\].*/) { + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive argument is null.*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+' \[-Wsign-conversion\].*/) { + } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+'.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; $warning =~ s/'-?[0-9]+'/'-'/g; - } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value \[-Wconversion\].*/) { + } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+' \[-Woverflow\].*/) { + } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+'.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; $warning =~ s/'-?[0-9]+'/'-'/g; - } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' \[-Wcast-function-type\].*/) { + } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'/'-'/g; - } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type \[-Wdiscarded-qualifiers\].*/) { + } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*' \[-Wattributes\].*/) { + } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*'.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result \[-Wunused-result\].*/) { + } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' \[-Wsign-promo\].*/) { + } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'.*/) { $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list \[-Weffc\+\+\].*/) { + } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list.*/) { $warning =~ s/'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*'/'-'/g; } elsif($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) { $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g; + } elsif($warning =~ /size of '[A-Za-z_\*0-9]*' [0-9]+ bytes exceeds maximum object size [0-9]+ .*/) { + $warning =~ s/'[A-Za-z_\*0-9]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'[A-Za-z_0-9]*' output truncated before terminating nul copying [0-9]+ bytes from a string of the same length.*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes pointer from integer without a cast.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes integer from pointer without a cast.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from incompatible pointer type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /ignoring attribute '[a-z]*' because it conflicts with attribute '[a-z]*'.*/) { + $warning =~ s/'[a-z]*'/'-'/g; + } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /unknown warning group '[A-Za-z-=]*', ignored.*/) { + $warning =~ s/'[A-Za-z-=]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_0-9]*' macro redefined.*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /"[A-Za-z_0-9]*" redefined.*/) { + $warning =~ s/"[A-Za-z_0-9]*"/"-"/g; + } elsif($warning =~ /incompatible (pointer|integer) to (pointer|integer) conversion assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /returning '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from a function with result type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /array index [0-9]+ is past the end of the array \(which contains [0-9]+ elements\).*/) { + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /array subscript [0-9]+ is above array bounds of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /expression which evaluates to zero treated as a null pointer constant of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /result of comparison of constant [0-9]+ with expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' is always (true|false).*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /initializing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' with an expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + } elsif($warning =~ /implicit conversion from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' changes value from -?[0-9]+ to -?[0-9]+.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; + $warning =~ s/-?[0-9]+/-/g; + } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' converts between pointers to integer types with different sign.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*'/'-'/g; + } elsif($warning =~ /address of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' will always evaluate to 'true'.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g; + } elsif($warning =~ /length modifier '[A-Za-z]' results in undefined behavior or no effect with '[A-Za-z]' conversion specifier.*/) { + $warning =~ s/'[A-Za-z]'/'-'/g; + } elsif($warning =~ /'[A-Za-z_]+' specified bound depends on the length of the source argument.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + } elsif($warning =~ /'[A-Za-z_]+' specified bound [0-9]+ equals destination size.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'[A-Za-z_]+' output may be truncated copying between [0-9]+ and [0-9]+ bytes from a string of length [0-9]+.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'[A-Za-z_]+' output may be truncated before the last format character.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + } elsif($warning =~ /'[A-Za-z_]+' output truncated before terminating nul copying as many bytes from a string as its length.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + } elsif($warning =~ /'[A-Za-z_\:0-9]+' hides overloaded virtual function.*/) { + $warning =~ s/'[A-Za-z_\:0-9]+'/'-'/g; + } elsif($warning =~ /'[A-Za-z_]+' storage class specifier is deprecated and incompatible with C\+\+1z.*/) { + $warning =~ s/'[A-Za-z_]+'/'-'/g; + } elsif($warning =~ /explicitly assigning value of variable of type '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' to itself.*/) { + $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g; + } elsif($warning =~ /private field '[A-Za-z_0-9]+' is not used.*/) { + $warning =~ s/'[A-Za-z_0-9]+'/'-'/g; + } elsif($warning =~ /field '[A-Za-z_0-9]+' will be initialized after field '[A-Za-z_0-9]+'.*/) { + $warning =~ s/'[A-Za-z_0-9]+'/'-'/g; } +# print "warning = $warning\n"; - # Increment count for [generic] warning - $warn_count{$warning}++; - $warn_file{$warning}{$name}++; - push(@{ $warn_file_line{$warning}{$name} }, $line); - - # Increment count for filename - $file_count{$name}++; - $file_warn{$name}{$warning}++; - push(@{ $file_warn_line{$name}{$warning} }, $line); - - # Increment total count of warnings - $totalcount++; + # Check if we've already seen this warning on this line in this file + # (Can happen for warnings from inside header files) + if( !exists $warn_file_line{$warning}{$name}{$line} ) { + # Increment count for [generic] warning + $warn_count{$warning}++; + $warn_file{$warning}{$name}++; + $warn_file_line{$warning}{$name}{$line}++; + + # Increment count for filename + $file_count{$name}++; + $file_warn{$name}{$warning}++; + $file_warn_line{$name}{$warning}{$line}++; + + # Increment total count of warnings + $totalcount++; + } # print "name = $name\n"; # print "line = $line\n"; @@ -487,7 +612,7 @@ while (<>) { # print "warning = \"$warning\"\n"; } -print "Total [non-ignored] warnings: $totalcount\n"; +print "Total unique [non-ignored] warnings: $totalcount\n"; print "Total ignored warnings: $ignorecount\n"; $warncount = keys %warn_count; print "Total unique kinds of warnings: $warncount\n"; @@ -499,18 +624,33 @@ print "# of Warnings by frequency (file count)\n"; print "=======================================\n"; for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) { printf ("[%2d] %4d (%2d) - %s\n", $current_warning++, $warn_count{$x}, scalar(keys %{$warn_file_line{$x}}), $x); - if((exists $options{W}) || (exists $options{w})) { + if((exists $options{W}) || (exists $options{w}) || (exists $options{s})) { my $curr_index = $current_warning - 1; - + my $match = 0; + + # Check for string from list in current warning + if(exists $options{s}) { + for my $y (@warn_match_strings) { +# print "y = '$y'\n"; + if($x =~ /$y/) { +# print "matched warning = '$x'\n"; + $match = 1; + last; + } + } + } + + # Check if current warning index matches if((exists $warn_file_indices{$curr_index}) && $curr_index == $warn_file_indices{$curr_index}) { + $match = 1; + } + + if($match) { for my $y (sort {$warn_file{$x}{$b} <=> $warn_file{$x}{$a}} keys(%{$warn_file{$x}})) { printf ("\t%4d - %s\n", $warn_file{$x}{$y}, $y); if(exists $options{l}) { - printf ("\t\tLines: "); - for my $z ( @{ $warn_file_line{$x}{$y} } ) { - printf ("%s, ", $z); - } - printf("\n"); + my $lines = join ", ", sort {$a <=> $b} keys $warn_file_line{$x}{$y}; + printf("\t\tLines: $lines \n"); } } } @@ -524,16 +664,31 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) { printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn_line{$x}}), $x); if((exists $options{F}) || (exists $options{f})) { my $curr_index = $current_file - 1; - + my $match = 0; + + # Check for string from list in current file + if(exists $options{S}) { + for my $y (@file_match_strings) { +# print "y = '$y'\n"; + if($x =~ /$y/) { +# print "matched warning = '$x'\n"; + $match = 1; + last; + } + } + } + + # Check if current file index matches if((exists $file_warn_indices{$curr_index}) && $curr_index == $file_warn_indices{$curr_index}) { + $match = 1; + } + + if($match) { for my $y (sort {$file_warn{$x}{$b} <=> $file_warn{$x}{$a}} keys(%{$file_warn{$x}})) { printf ("\t%4d - %s\n", $file_warn{$x}{$y}, $y); if(exists $options{l}) { - printf ("\t\tLines: "); - for my $z ( @{ $file_warn_line{$x}{$y} } ) { - printf ("%s, ", $z); - } - printf("\n"); + my $lines = join ", ", sort {$a <=> $b} keys $file_warn_line{$x}{$y}; + printf("\t\tLines: $lines \n"); } } } diff --git a/config/gnu-flags b/config/gnu-flags index fc3a6ce..c5c70eb 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -113,14 +113,15 @@ case "$cc_vendor-$cc_version" in # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it from the # environment variable at configure time. + # # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add # it to the developer flags. + # H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" - H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" + H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" - # As of GCC 8.x, the -Wunsafe-loop-optimizations has been removed H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -191,10 +192,60 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 9.x release is out, we should check for additional flags to +# When the gcc 10.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[89].*) + gcc-9*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + + # Append warning flags that only gcc 4.7+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + + # Append warning flags that only gcc 7.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + + # Append warning flags that only gcc 8.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" + + # Append warning flags that only gcc 9.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS " + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" + ;; + + gcc-8*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) @@ -202,7 +253,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -239,10 +290,10 @@ case "$cc_vendor-$cc_version" in # Append warning flags that only gcc 8.x+ knows about DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" ;; - gcc-7*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) @@ -251,7 +302,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -295,7 +346,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -335,7 +386,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index b6a7f58..2219263 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1,4 +1,4 @@ -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wimplicit-function-declaration" #pragma GCC diagnostic ignored "-Wlarger-than=" @@ -50,7 +50,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -88,6 +88,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -95,6 +96,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -125,8 +127,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -183,15 +183,7 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -217,7 +209,6 @@ extern FILE *H5LTyyin, *H5LTyyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -406,7 +397,7 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - H5LTyyleng = (size_t) (yy_cp - yy_bp); \ + H5LTyyleng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -893,15 +884,16 @@ char *H5LTyytext; * If you make any changes to H5LTanalyze.l, please run bin/genparser to * recreate the output files. */ -#line 23 "hl/src/H5LTanalyze.l" +#line 21 "hl/src/H5LTanalyze.l" #include #include #include #include "H5LTparse.h" -/* Turn off suggest const attribute warning in gcc */ -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +/* Turn off suggest const & malloc attribute warnings in gcc */ +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" #endif int my_yyinput(char *, int); @@ -952,7 +944,7 @@ extern hbool_t is_opq_tag; hbool_t first_quote = 1; -#line 936 "hl/src/H5LTanalyze.c" +#line 926 "hl/src/H5LTanalyze.c" #define INITIAL 0 #define TAG_STRING 1 @@ -1026,12 +1018,7 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1039,7 +1026,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout )) {} } while (0) +#define ECHO fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1050,7 +1037,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1132,6 +1119,11 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; +#line 83 "hl/src/H5LTanalyze.l" + + +#line 1104 "hl/src/H5LTanalyze.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -1164,12 +1156,6 @@ YY_DECL H5LTyy_load_buffer_state( ); } - { -#line 84 "hl/src/H5LTanalyze.l" - - -#line 1152 "hl/src/H5LTanalyze.c" - while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -1190,7 +1176,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; @@ -1206,6 +1192,7 @@ yy_match: yy_find_action: yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; +goto find_rule; /* Shut up GCC warning -Wall */ find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { @@ -1230,277 +1217,277 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 86 "hl/src/H5LTanalyze.l" +#line 85 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 87 "hl/src/H5LTanalyze.l" +#line 86 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 88 "hl/src/H5LTanalyze.l" +#line 87 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 89 "hl/src/H5LTanalyze.l" +#line 88 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 90 "hl/src/H5LTanalyze.l" +#line 89 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 90 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 92 "hl/src/H5LTanalyze.l" +#line 91 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 93 "hl/src/H5LTanalyze.l" +#line 92 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 94 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" +#line 95 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 96 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 97 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 99 "hl/src/H5LTanalyze.l" +#line 98 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 99 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 101 "hl/src/H5LTanalyze.l" +#line 100 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 102 "hl/src/H5LTanalyze.l" +#line 101 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 104 "hl/src/H5LTanalyze.l" +#line 103 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 104 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 105 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 106 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 108 "hl/src/H5LTanalyze.l" +#line 107 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 108 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 110 "hl/src/H5LTanalyze.l" +#line 109 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 111 "hl/src/H5LTanalyze.l" +#line 110 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 112 "hl/src/H5LTanalyze.l" +#line 111 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 113 "hl/src/H5LTanalyze.l" +#line 112 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 114 "hl/src/H5LTanalyze.l" +#line 113 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 116 "hl/src/H5LTanalyze.l" +#line 115 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 117 "hl/src/H5LTanalyze.l" +#line 116 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 118 "hl/src/H5LTanalyze.l" +#line 117 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 118 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 120 "hl/src/H5LTanalyze.l" +#line 119 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 121 "hl/src/H5LTanalyze.l" +#line 120 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 122 "hl/src/H5LTanalyze.l" +#line 121 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 123 "hl/src/H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 124 "hl/src/H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 126 "hl/src/H5LTanalyze.l" +#line 125 "hl/src/H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" +#line 126 "hl/src/H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 128 "hl/src/H5LTanalyze.l" +#line 127 "hl/src/H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 129 "hl/src/H5LTanalyze.l" +#line 128 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 130 "hl/src/H5LTanalyze.l" +#line 129 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 131 "hl/src/H5LTanalyze.l" +#line 130 "hl/src/H5LTanalyze.l" {return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 132 "hl/src/H5LTanalyze.l" +#line 131 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 133 "hl/src/H5LTanalyze.l" +#line 132 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 134 "hl/src/H5LTanalyze.l" +#line 133 "hl/src/H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 135 "hl/src/H5LTanalyze.l" +#line 134 "hl/src/H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 136 "hl/src/H5LTanalyze.l" +#line 135 "hl/src/H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 138 "hl/src/H5LTanalyze.l" +#line 137 "hl/src/H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 139 "hl/src/H5LTanalyze.l" +#line 138 "hl/src/H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 140 "hl/src/H5LTanalyze.l" +#line 139 "hl/src/H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 141 "hl/src/H5LTanalyze.l" +#line 140 "hl/src/H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 143 "hl/src/H5LTanalyze.l" +#line 142 "hl/src/H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 144 "hl/src/H5LTanalyze.l" +#line 143 "hl/src/H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 145 "hl/src/H5LTanalyze.l" +#line 144 "hl/src/H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 147 "hl/src/H5LTanalyze.l" +#line 146 "hl/src/H5LTanalyze.l" { if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || @@ -1513,7 +1500,7 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 157 "hl/src/H5LTanalyze.l" +#line 156 "hl/src/H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) @@ -1528,7 +1515,7 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 167 "hl/src/H5LTanalyze.l" +#line 166 "hl/src/H5LTanalyze.l" { #ifdef H5_HAVE_WIN32_API H5LTyylval.sval = _strdup(H5LTyytext); @@ -1541,52 +1528,52 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 177 "hl/src/H5LTanalyze.l" +#line 176 "hl/src/H5LTanalyze.l" {return token('{');} YY_BREAK case 59: YY_RULE_SETUP -#line 178 "hl/src/H5LTanalyze.l" +#line 177 "hl/src/H5LTanalyze.l" {return token('}');} YY_BREAK case 60: YY_RULE_SETUP -#line 179 "hl/src/H5LTanalyze.l" +#line 178 "hl/src/H5LTanalyze.l" {return token('[');} YY_BREAK case 61: YY_RULE_SETUP -#line 180 "hl/src/H5LTanalyze.l" +#line 179 "hl/src/H5LTanalyze.l" {return token(']');} YY_BREAK case 62: YY_RULE_SETUP -#line 181 "hl/src/H5LTanalyze.l" +#line 180 "hl/src/H5LTanalyze.l" {return token(':');} YY_BREAK case 63: YY_RULE_SETUP -#line 182 "hl/src/H5LTanalyze.l" +#line 181 "hl/src/H5LTanalyze.l" {return token(';');} YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 183 "hl/src/H5LTanalyze.l" +#line 182 "hl/src/H5LTanalyze.l" ; YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 184 "hl/src/H5LTanalyze.l" +#line 183 "hl/src/H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 186 "hl/src/H5LTanalyze.l" +#line 185 "hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1570 "hl/src/H5LTanalyze.c" +#line 1555 "hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TAG_STRING): yyterminate(); @@ -1718,7 +1705,6 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ } /* end of H5LTyylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1880,7 +1866,7 @@ static int yy_get_next_buffer (void) if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) @@ -1968,7 +1954,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( H5LTyywrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2104,6 +2090,10 @@ static void H5LTyy_load_buffer_state (void) H5LTyyfree((void *) b ); } +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a H5LTyyrestart() or at EOF. @@ -2308,8 +2298,8 @@ YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2317,8 +2307,7 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - yy_size_t i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index b9b492e..f16455b 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -23,9 +23,10 @@ #include #include "H5LTparse.h" -/* Turn off suggest const attribute warning in gcc */ -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +/* Turn off suggest const & malloc attribute warnings in gcc */ +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" #endif int my_yyinput(char *, int); diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 5835dcc..193ba1f 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -1,4 +1,4 @@ -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wimplicit-function-declaration" #pragma GCC diagnostic ignored "-Wlarger-than=" @@ -20,11 +20,12 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,11 +63,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -91,8 +95,8 @@ #define yylval H5LTyylval #define yychar H5LTyychar -/* Copy the first part of user declarations. */ -#line 22 "hl/src/H5LTparse.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 20 "hl/src/H5LTparse.y" #include #include @@ -145,13 +149,17 @@ hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ -#line 127 "hl/src/H5LTparse.c" /* yacc.c:339 */ +#line 131 "hl/src/H5LTparse.c" # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -163,8 +171,8 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "H5LTparse.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -241,17 +249,18 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 74 "hl/src/H5LTparse.y" /* yacc.c:355 */ +#line 72 "hl/src/H5LTparse.y" int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 232 "hl/src/H5LTparse.c" /* yacc.c:355 */ +#line 239 "hl/src/H5LTparse.c" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -263,9 +272,7 @@ hid_t H5LTyyparse (void); #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 247 "hl/src/H5LTparse.c" /* yacc.c:358 */ #ifdef short # undef short @@ -286,13 +293,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -304,7 +311,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -340,15 +347,6 @@ typedef short int yytype_int16; # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -356,7 +354,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -376,6 +374,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -518,16 +518,16 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 143 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 313 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -568,16 +568,16 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 107, 107, 108, 110, 111, 112, 113, 115, 116, - 117, 118, 119, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 151, 152, 153, 154, 155, 156, 157, 161, 160, 169, - 170, 172, 172, 209, 217, 218, 221, 223, 223, 232, - 233, 235, 236, 235, 243, 246, 252, 253, 258, 259, - 250, 267, 269, 273, 274, 282, 291, 298, 271, 322, - 323, 325, 326, 327, 329, 330, 332, 333, 337, 336, - 341, 342, 344, 344, 398, 400 + 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, + 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 149, 150, 151, 152, 153, 154, 155, 159, 158, 167, + 168, 170, 170, 207, 215, 216, 219, 221, 221, 230, + 231, 233, 234, 233, 241, 244, 250, 251, 256, 257, + 248, 265, 267, 271, 272, 280, 289, 296, 269, 320, + 321, 323, 324, 325, 327, 328, 330, 331, 335, 334, + 339, 340, 342, 342, 396, 398 }; #endif @@ -823,22 +823,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -878,37 +878,37 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -942,7 +942,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -953,7 +953,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -1057,7 +1057,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1075,7 +1078,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1153,10 +1156,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1168,6 +1171,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1179,9 +1183,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1307,23 +1312,33 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1339,14 +1354,10 @@ yyparse (void) &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1362,35 +1373,33 @@ yyparse (void) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1448,7 +1457,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1463,7 +1471,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1483,246 +1491,246 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 107 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + case 2: +#line 105 "hl/src/H5LTparse.y" { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1468 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1476 "hl/src/H5LTparse.c" break; case 3: -#line 108 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 106 "hl/src/H5LTparse.y" { return (yyval.hid);} -#line 1474 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1482 "hl/src/H5LTparse.c" break; case 13: -#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 120 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1480 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1488 "hl/src/H5LTparse.c" break; case 14: -#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 121 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1486 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1494 "hl/src/H5LTparse.c" break; case 15: -#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 122 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1492 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1500 "hl/src/H5LTparse.c" break; case 16: -#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 123 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1498 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1506 "hl/src/H5LTparse.c" break; case 17: -#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 124 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1504 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1512 "hl/src/H5LTparse.c" break; case 18: -#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 125 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1510 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1518 "hl/src/H5LTparse.c" break; case 19: -#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 126 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1516 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1524 "hl/src/H5LTparse.c" break; case 20: -#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 127 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1522 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1530 "hl/src/H5LTparse.c" break; case 21: -#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 128 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1528 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1536 "hl/src/H5LTparse.c" break; case 22: -#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 129 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1534 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1542 "hl/src/H5LTparse.c" break; case 23: -#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 130 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1540 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1548 "hl/src/H5LTparse.c" break; case 24: -#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 131 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1546 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1554 "hl/src/H5LTparse.c" break; case 25: -#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 132 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1552 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1560 "hl/src/H5LTparse.c" break; case 26: -#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 133 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1558 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1566 "hl/src/H5LTparse.c" break; case 27: -#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 134 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1564 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1572 "hl/src/H5LTparse.c" break; case 28: -#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 135 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1570 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1578 "hl/src/H5LTparse.c" break; case 29: -#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 136 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1576 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1584 "hl/src/H5LTparse.c" break; case 30: -#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 137 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1582 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1590 "hl/src/H5LTparse.c" break; case 31: -#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 138 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1588 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1596 "hl/src/H5LTparse.c" break; case 32: -#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 139 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1594 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1602 "hl/src/H5LTparse.c" break; case 33: -#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 140 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1600 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1608 "hl/src/H5LTparse.c" break; case 34: -#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 141 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1606 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1614 "hl/src/H5LTparse.c" break; case 35: -#line 144 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 142 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1612 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1620 "hl/src/H5LTparse.c" break; case 36: -#line 145 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 143 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1618 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1626 "hl/src/H5LTparse.c" break; case 37: -#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 144 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1624 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1632 "hl/src/H5LTparse.c" break; case 38: -#line 147 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 145 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1630 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1638 "hl/src/H5LTparse.c" break; case 39: -#line 148 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 146 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1636 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1644 "hl/src/H5LTparse.c" break; case 40: -#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 149 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1642 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1650 "hl/src/H5LTparse.c" break; case 41: -#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 150 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1648 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1656 "hl/src/H5LTparse.c" break; case 42: -#line 153 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 151 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1654 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1662 "hl/src/H5LTparse.c" break; case 43: -#line 154 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 152 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1660 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1668 "hl/src/H5LTparse.c" break; case 44: -#line 155 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 153 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1666 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1674 "hl/src/H5LTparse.c" break; case 45: -#line 156 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 154 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1672 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1680 "hl/src/H5LTparse.c" break; case 46: -#line 157 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 155 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1678 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1686 "hl/src/H5LTparse.c" break; case 47: -#line 161 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 159 "hl/src/H5LTparse.y" { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1684 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1692 "hl/src/H5LTparse.c" break; case 48: -#line 163 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 161 "hl/src/H5LTparse.y" { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1694 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1702 "hl/src/H5LTparse.c" break; case 51: -#line 172 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 170 "hl/src/H5LTparse.y" { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1700 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1708 "hl/src/H5LTparse.c" break; case 52: -#line 174 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 172 "hl/src/H5LTparse.y" { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -1757,117 +1765,117 @@ yyreduce: new_size = H5Tget_size(dtype_id); } -#line 1739 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1747 "hl/src/H5LTparse.c" break; case 53: -#line 210 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 208 "hl/src/H5LTparse.y" { (yyval.sval) = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1749 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1757 "hl/src/H5LTparse.c" break; case 54: -#line 217 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 215 "hl/src/H5LTparse.y" { (yyval.ival) = 0; } -#line 1755 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1763 "hl/src/H5LTparse.c" break; case 55: -#line 219 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 217 "hl/src/H5LTparse.y" { (yyval.ival) = yylval.ival; } -#line 1761 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1769 "hl/src/H5LTparse.c" break; case 57: -#line 223 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 221 "hl/src/H5LTparse.y" { asindex++; /*pushd onto the stack*/ } -#line 1767 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1775 "hl/src/H5LTparse.c" break; case 58: -#line 225 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 223 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose((yyvsp[-1].hid)); } -#line 1778 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1786 "hl/src/H5LTparse.c" break; case 61: -#line 235 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 233 "hl/src/H5LTparse.y" { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1784 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1792 "hl/src/H5LTparse.c" break; case 62: -#line 236 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 234 "hl/src/H5LTparse.y" { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1794 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1802 "hl/src/H5LTparse.c" break; case 65: -#line 247 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 245 "hl/src/H5LTparse.y" { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1800 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1808 "hl/src/H5LTparse.c" break; case 66: -#line 252 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 250 "hl/src/H5LTparse.y" { is_opq_size = 1; } -#line 1806 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1814 "hl/src/H5LTparse.c" break; case 67: -#line 253 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 251 "hl/src/H5LTparse.y" { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); is_opq_size = 0; } -#line 1816 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1824 "hl/src/H5LTparse.c" break; case 68: -#line 258 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 256 "hl/src/H5LTparse.y" { is_opq_tag = 1; } -#line 1822 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1830 "hl/src/H5LTparse.c" break; case 69: -#line 259 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 257 "hl/src/H5LTparse.y" { H5Tset_tag((yyvsp[-6].hid), yylval.sval); free(yylval.sval); yylval.sval = NULL; is_opq_tag = 0; } -#line 1833 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1841 "hl/src/H5LTparse.c" break; case 70: -#line 265 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 263 "hl/src/H5LTparse.y" { (yyval.hid) = (yyvsp[-8].hid); } -#line 1839 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1847 "hl/src/H5LTparse.c" break; case 73: -#line 273 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 271 "hl/src/H5LTparse.y" { is_str_size = 1; } -#line 1845 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1853 "hl/src/H5LTparse.c" break; case 74: -#line 274 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 272 "hl/src/H5LTparse.y" { if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; @@ -1875,11 +1883,11 @@ yyreduce: str_size = yylval.ival; is_str_size = 0; } -#line 1857 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1865 "hl/src/H5LTparse.c" break; case 75: -#line 282 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 280 "hl/src/H5LTparse.y" { if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; @@ -1888,33 +1896,33 @@ yyreduce: else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1870 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1878 "hl/src/H5LTparse.c" break; case 76: -#line 291 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 289 "hl/src/H5LTparse.y" { if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1881 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1889 "hl/src/H5LTparse.c" break; case 77: -#line 298 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 296 "hl/src/H5LTparse.y" { if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1892 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1900 "hl/src/H5LTparse.c" break; case 78: -#line 305 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 303 "hl/src/H5LTparse.y" { hid_t str_id = (yyvsp[-1].hid); @@ -1931,71 +1939,71 @@ yyreduce: (yyval.hid) = str_id; } -#line 1913 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1921 "hl/src/H5LTparse.c" break; case 79: -#line 322 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 320 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1919 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1927 "hl/src/H5LTparse.c" break; case 81: -#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 323 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1925 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1933 "hl/src/H5LTparse.c" break; case 82: -#line 326 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 324 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1931 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1939 "hl/src/H5LTparse.c" break; case 83: -#line 327 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 325 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1937 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1945 "hl/src/H5LTparse.c" break; case 84: -#line 329 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 327 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1943 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1951 "hl/src/H5LTparse.c" break; case 85: -#line 330 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 328 "hl/src/H5LTparse.y" {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1949 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1957 "hl/src/H5LTparse.c" break; case 86: -#line 332 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 330 "hl/src/H5LTparse.y" {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1955 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1963 "hl/src/H5LTparse.c" break; case 87: -#line 333 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 331 "hl/src/H5LTparse.y" {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1961 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1969 "hl/src/H5LTparse.c" break; case 88: -#line 337 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 335 "hl/src/H5LTparse.y" { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1967 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1975 "hl/src/H5LTparse.c" break; case 89: -#line 339 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 337 "hl/src/H5LTparse.y" { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1973 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1981 "hl/src/H5LTparse.c" break; case 92: -#line 344 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 342 "hl/src/H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ #ifdef H5_HAVE_WIN32_API @@ -2006,11 +2014,11 @@ yyreduce: free(yylval.sval); yylval.sval = NULL; } -#line 1988 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1996 "hl/src/H5LTparse.c" break; case 93: -#line 355 "hl/src/H5LTparse.y" /* yacc.c:1646 */ +#line 353 "hl/src/H5LTparse.y" { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -2053,11 +2061,12 @@ yyreduce: H5Tclose(super); H5Tclose(native); } -#line 2035 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 2043 "hl/src/H5LTparse.c" break; -#line 2039 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 2047 "hl/src/H5LTparse.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2082,14 +2091,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2172,12 +2180,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2239,6 +2245,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2246,6 +2253,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2256,6 +2264,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 3d7b4e8..73a76e9 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -106,17 +110,18 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 74 "hl/src/H5LTparse.y" /* yacc.c:1909 */ +#line 72 "hl/src/H5LTparse.y" int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */ +#line 122 "hl/src/H5LTparse.h" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index ec029ea..8fb575c 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -295,7 +295,8 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) fprintf(stderr, "Error reading Graphic Control Extension information\n"); - if (!*MemGif++ == 0) + (*MemGif)++; + if ((!*MemGif) == 0) fprintf(stderr, "Error reading Graphic Control Extension\n"); diff --git a/src/H5Adense.c b/src/H5Adense.c index bddfe31..7491dd2 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -299,7 +299,7 @@ done: static herr_t H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) { - H5A_t const **user_attr = (H5A_t const **)_user_attr; /* User data from v2 B-tree attribute lookup */ + const H5A_t **user_attr = (const H5A_t **)_user_attr; /* User data from v2 B-tree attribute lookup */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -308,6 +308,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) HDassert(attr); HDassert(user_attr); HDassert(took_ownership); + /* * If there is an attribute already stored in "user_attr", * we need to free the dynamially allocated spaces for the @@ -324,7 +325,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) * allocated spaces for the intermediate decoded attribute. */ if(*user_attr != NULL) { - H5A_t *old_attr = *user_attr; + H5A_t *old_attr = *(H5A_t **)_user_attr; /* Free any dynamically allocated items */ if(old_attr->shared) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6fdea92..7a07225 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -265,7 +265,7 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void * static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims); static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); -static void *H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline); +static void *H5D__chunk_mem_xfree(void *chk, const void *pline); static void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); @@ -1354,7 +1354,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) /*------------------------------------------------------------------------- * Function: H5D__chunk_mem_xfree * - * Purpose: Free space for a chunk in memory. This routine allocates + * Purpose: Free space for a chunk in memory. This routine releases * memory space for non-filtered chunks from a block free list * and uses malloc()/free() for filtered chunks. * @@ -1366,8 +1366,10 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline) +H5D__chunk_mem_xfree(void *chk, const void *_pline) { + const H5O_pline_t *pline = (const H5O_pline_t *)_pline; + FUNC_ENTER_STATIC_NOERR if(chk) { diff --git a/src/H5Dint.c b/src/H5Dint.c index 2824dcd..1e9c6ff 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -50,7 +50,7 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); @@ -522,7 +522,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) +H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ @@ -1199,6 +1199,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Get the dataset's datatype */ if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the pointer via the VOL plugin */ type = H5T_get_actual_type(dt); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 6cfef55..b1d3430 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -771,7 +771,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) buf += nseen*2*8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t*)x; + ap = (haddr_t*)((void *)x); UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; @@ -1955,6 +1955,14 @@ compute_next(H5FD_multi_t *file) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() call with + * tmp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int open_members(H5FD_multi_t *file) { @@ -1972,7 +1980,8 @@ open_members(H5FD_multi_t *file) /* Note: This truncates the user's filename down to only sizeof(tmp) * characters. -QK & JK, 2013/01/17 */ - sprintf(tmp, file->fa.memb_name[mt], file->name); + snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + tmp[sizeof(tmp) - 1] = '\0'; H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); @@ -1987,6 +1996,7 @@ open_members(H5FD_multi_t *file) return 0; } +#pragma GCC diagnostic pop #ifdef _H5private_H diff --git a/src/H5Fint.c b/src/H5Fint.c index 4021e41..6879d46 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -572,11 +572,11 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out fname_len = HDstrlen(file_name); /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 4))) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + HDsnprintf(*full_name, (prefix_len + fname_len + 4), "%s%s%s", prefix, ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name); done: @@ -2840,8 +2840,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* test to see if a buffer was provided -- if not, we are done */ if(buf_ptr != NULL) { size_t space_needed; /* size of file image */ - hsize_t tmp; - size_t tmp_size; + unsigned tmp, tmp_size; /* Check for buffer too small */ if((haddr_t)buf_len < eoa) @@ -2856,12 +2855,12 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); + /* Size of "status_flags" depends on the superblock version */ tmp_size = H5F_SUPER_STATUS_FLAGS_SIZE(file->shared->sblock->super_vers); /* Clear "status_flags" */ - HDmemset((uint8_t *)(buf_ptr) + tmp, 0, tmp_size); - + HDmemset((uint8_t *)buf_ptr + tmp, 0, tmp_size); } /* end if */ done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 5f25ddc..1dd07c1 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -140,14 +140,14 @@ /* For superblock version 0 & 1: Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */ -#define H5F_SUPER_STATUS_OFF_V01 \ - (2 /* freespace, and root group versions */ \ - + 1 /* reserved */ \ - + 3 /* shared header vers, size of address, size of lengths */ \ - + 1 /* reserved */ \ - + 4) /* group leaf k, group internal k */ - -#define H5F_SUPER_STATUS_OFF(v) (v >= 2 ? 2 : H5F_SUPER_STATUS_OFF_V01) +#define H5F_SUPER_STATUS_OFF_V01 \ + (unsigned)(2 /* freespace, and root group versions */ \ + + 1 /* reserved */ \ + + 3 /* shared header vers, size of address, size of lengths */ \ + + 1 /* reserved */ \ + + 4) /* group leaf k, group internal k */ + +#define H5F_SUPER_STATUS_OFF(v) (v >= 2 ? (unsigned)2 : H5F_SUPER_STATUS_OFF_V01) /* Offset to the file consistency flags (status_flags) in the superblock */ #define H5F_SUPER_STATUS_FLAGS_OFF(v) (H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPER_STATUS_OFF(v)) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4fcc164..5334c51 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -54,7 +54,6 @@ /********************/ static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr); static herr_t H5F__update_super_ext_driver_msg(H5F_t *f); -static herr_t H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo); /*********************/ diff --git a/src/H5I.c b/src/H5I.c index 9fd0326..6b5210d 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -117,7 +117,7 @@ static H5I_id_type_t *H5I_id_type_list_g[H5I_MAX_NUM_TYPES]; /* Starts at 1 instead of 0 because it makes trace output look nicer. If more */ /* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */ /* and/or increase size of hid_t */ -static H5I_type_t H5I_next_type = (H5I_type_t) H5I_NTYPES; +static int H5I_next_type = (int)H5I_NTYPES; /* Declare a free list to manage the H5I_id_info_t struct */ H5FL_DEFINE_STATIC(H5I_id_info_t); @@ -168,16 +168,16 @@ H5I_term_package(void) if(H5_PKG_INIT_VAR) { H5I_id_type_t *type_ptr; /* Pointer to ID type */ - H5I_type_t type; /* Type of ID */ + int type; /* Type of ID */ /* How many types are still being used? */ - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) + for(type = 0; type < H5I_next_type; type++) if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; /* If no types are used then clean up */ if(0 == n) { - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { + for(type = 0; type < H5I_next_type; type++) { type_ptr = H5I_id_type_list_g[type]; if(type_ptr) { HDassert(NULL == type_ptr->ids); @@ -226,10 +226,10 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Generate a new H5I_type_t value */ - /* Increment the number of types*/ + /* Increment the number of types */ if(H5I_next_type < H5I_MAX_NUM_TYPES) { - new_type = H5I_next_type; - H5_INC_ENUM(H5I_type_t, H5I_next_type); + new_type = (H5I_type_t)H5I_next_type; + H5I_next_type++; } /* end if */ else { hbool_t done; /* Indicate that search was successful */ @@ -247,7 +247,7 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Verify that we found a type to give out */ if(done == FALSE) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded.") + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") } /* end else */ /* Allocate new ID class */ @@ -298,7 +298,7 @@ H5I_register_type(const H5I_class_t *cls) /* Sanity check */ HDassert(cls); - HDassert(cls->type_id > 0 && cls->type_id < H5I_MAX_NUM_TYPES); + HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES); /* Initialize the type */ if(NULL == H5I_id_type_list_g[cls->type_id]) { @@ -355,13 +355,13 @@ H5Itype_exists(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); + /* Validate parameter */ if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (NULL == H5I_id_type_list_g[type]) + if(NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: @@ -400,7 +400,7 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == H5I_id_type_list_g[type]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") @@ -442,7 +442,8 @@ H5I_nmembers(H5I_type_t type) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameter */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) HGOTO_DONE(0); @@ -553,7 +554,8 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameters */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") udata.type_ptr = H5I_id_type_list_g[type]; @@ -696,7 +698,8 @@ H5I__destroy_type(H5I_type_t type) FUNC_ENTER_STATIC - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameter */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; @@ -779,7 +782,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if ((NULL == type_ptr) || (type_ptr->init_count <= 0)) @@ -846,7 +849,7 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* Get type pointer from list of types */ @@ -967,10 +970,10 @@ H5Iobject_verify(hid_t id, H5I_type_t id_type) FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); + /* Validate parameters */ if(H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - - if(id_type < 1 || id_type >= H5I_next_type) + if(id_type < 1 || (int)id_type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") ret_value = H5I_object_verify(id, id_type); @@ -1003,7 +1006,7 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) FUNC_ENTER_NOAPI_NOERR - HDassert(id_type >= 1 && id_type < H5I_next_type); + HDassert(id_type >= 1 && (int)id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { @@ -1043,7 +1046,7 @@ H5I_get_type(hid_t id) if(id > 0) ret_value = H5I_TYPE(id); - HDassert(ret_value >= H5I_BADID && ret_value < H5I_next_type); + HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ @@ -1074,7 +1077,7 @@ H5Iget_type(hid_t id) ret_value = H5I_get_type(id); - if(ret_value <= H5I_BADID || ret_value >= H5I_next_type || NULL == H5I_object(id)) + if(ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: @@ -1218,7 +1221,7 @@ H5I_remove(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if(type_ptr == NULL || type_ptr->init_count <= 0) @@ -1581,14 +1584,13 @@ H5Iinc_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type <= 0 || type >= H5I_next_type) + if(type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - - if (H5I_IS_LIB_TYPE(type)) + if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual increment operation */ - if ((ret_value = H5I__inc_type_ref(type)) < 0) + if((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") done: @@ -1615,11 +1617,11 @@ H5I__inc_type_ref(H5I_type_t type) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(type > 0 && type < H5I_next_type); + HDassert(type > 0 && (int)type < H5I_next_type); /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr) + if(NULL == type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Set return value */ @@ -1699,11 +1701,11 @@ H5I_dec_type_ref(H5I_type_t type) FUNC_ENTER_NOAPI((-1)) - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->init_count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Decrement the number of users of the atomic type. If this is the @@ -1711,14 +1713,14 @@ H5I_dec_type_ref(H5I_type_t type) * free all memory it used. The free function is invoked for each atom * being freed. */ - if (1 == type_ptr->init_count) { + if(1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; - } + } /* end if */ else { --(type_ptr->init_count); ret_value = (herr_t)type_ptr->init_count; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1744,14 +1746,13 @@ H5Iget_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type <= 0 || type >= H5I_next_type) + if(type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - - if (H5I_IS_LIB_TYPE(type)) + if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ - if ((ret_value = H5I__get_type_ref(type)) < 0) + if((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") done: @@ -2079,12 +2080,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ herr_t iter_status; /* Iteration status */ @@ -2095,7 +2096,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.obj_type = type; /* Iterate over IDs */ - if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") } /* end if */ @@ -2127,11 +2128,10 @@ H5I__find_id(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_DONE(NULL) - type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->init_count <= 0) + if(!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL) /* Locate the ID node for the ID */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 609f2eb..eae7cd6 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -459,9 +459,9 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Message header */ - ret_value = 1 + /*version */ + ret_value = (size_t)(1 + /*version */ 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0); /*reserved */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ /* Calculate size of each filter in pipeline */ for(i = 0; i < pline->nused; i++) { diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b7f70d1..b4f00ea 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -355,11 +355,11 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Basic information for all dataspace messages */ - ret_value = 1 + /* Version */ + ret_value = (size_t)(1 + /* Version */ 1 + /* Rank */ 1 + /* Flags */ 1 + /* Dataspace type/reserved */ - ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4); /* Eliminated/reserved */ + ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4)); /* Eliminated/reserved */ /* Add in the dimension sizes */ ret_value += space->rank * H5F_SIZEOF_SIZE(f); diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 04248b5..5125839 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -673,12 +673,12 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/; + len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 5 /*\0*/; if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") - HDsnprintf(path, len, "%s/%s", dir, dp->d_name); + HDsnprintf(path, len, "%s%s%s", dir, H5PL_PATH_SEPARATOR, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) diff --git a/src/H5Pint.c b/src/H5Pint.c index 0670adc..911a126 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5235,7 +5235,7 @@ H5P__get_class_path(H5P_genclass_t *pclass) /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - ret_str_len = HDstrlen(par_path) + 1 + HDstrlen(pclass->name) + 1; + ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 3 + 1; if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") diff --git a/src/H5T.c b/src/H5T.c index 9585121..8eada62 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -4732,14 +4732,14 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T_g.soft[i].conv.is_app) { if((H5T_g.soft[i].conv.u.app_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); - H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ } /* end if */ else if((H5T_g.soft[i].conv.u.lib_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); - H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ diff --git a/src/H5Toh.c b/src/H5Toh.c index b21ce72..ab6c09f 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -221,6 +221,7 @@ H5O__dtype_get_oloc(hid_t obj_id) /* Get the datatype */ if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + /* If this is a named datatype, get the VOL driver pointer to the datatype */ type = (H5T_t *)H5T_get_actual_type(dt); diff --git a/src/H5system.c b/src/H5system.c index 5d2663e..bd5f9c5 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1301,11 +1301,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) * Allocate a buffer to hold path1 + path2 + possibly the delimiter * + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 4))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, + HDsnprintf(*full_name, (path1_len + path2_len + 4), "%s%s%s", path1, (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 15d10a7..9173531 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,6 +22,7 @@ set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/h5test.h ${HDF5_TEST_SOURCE_DIR}/cache_common.h ${HDF5_TEST_SOURCE_DIR}/external_common.h + ${HDF5_TEST_SOURCE_DIR}/external_fname.h ${HDF5_TEST_SOURCE_DIR}/swmr_common.h ) diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 23bec6e..826957f 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -190,8 +190,8 @@ main(void) for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ - char* low_string; /* The low bound string */ - char* high_string; /* The high bound string */ + const char *low_string; /* The low bound string */ + const char *high_string; /* The high bound string */ /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/external.c b/test/external.c index 6aa9d1b..597878f 100644 --- a/test/external.c +++ b/test/external.c @@ -18,6 +18,7 @@ * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" +#include "external_fname.h" /*------------------------------------------------------------------------- @@ -864,7 +865,7 @@ test_path_absolute(hid_t fapl) hid_t dset = -1; /* dataset */ size_t i; /* miscellaneous counter */ char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ + char filename[1536]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ hsize_t cur_size; /* current data space size */ diff --git a/test/external_common.h b/test/external_common.h index 1e4fe7a..a2cb03e 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -23,16 +23,6 @@ /* Include test header files */ #include "h5test.h" -static const char *EXT_FNAME[] = { - "extern_1", - "extern_2", - "extern_3", - "extern_4", - "extern_dir/file_1", - "extern_5", - NULL -}; - /* A similar collection of files is used for the tests that * perform file I/O. */ @@ -42,4 +32,6 @@ static const char *EXT_FNAME[] = { #define GARBAGE_PER_FILE 10 H5TEST_DLL herr_t reset_raw_data_files(int); + #endif /* _EXTERNAL_COMMON_H */ + diff --git a/test/external_env.c b/test/external_env.c index 1bf0cf0..8ecebf6 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -15,6 +15,7 @@ * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" +#include "external_fname.h" static const char *EXT_ENV_FNAME[] = { "extern_env_dir/env_file_1", diff --git a/test/external_fname.h b/test/external_fname.h new file mode 100644 index 0000000..c5111b6 --- /dev/null +++ b/test/external_fname.h @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol + * July, 2019 + * + * Purpose: Private declaration for external.c and external_env.c + */ +#ifndef _EXTERNAL_FNAME_H +#define _EXTERNAL_FNAME_H + +/* Include test header files */ +#include "h5test.h" + +static const char *EXT_FNAME[] = { + "extern_1", + "extern_2", + "extern_3", + "extern_4", + "extern_dir/file_1", + "extern_5", + NULL +}; + +#endif /* _EXTERNAL_FNAME_H */ + diff --git a/test/fheap.c b/test/fheap.c index 91a1df5..1ad5c11 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -6650,7 +6650,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if((H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) TEST_ERROR fh = NULL; @@ -6842,7 +6842,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Close the fractal heap */ - if((H5HF_close(fh)) < 0) + if(H5HF_close(fh) < 0) TEST_ERROR fh = NULL; @@ -7012,6 +7012,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -13694,28 +13695,30 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ - H5HF_create_t tmp_cparam; /* Local heap creation parameters */ - fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - size_t id_len; /* Size of fractal heap IDs */ - h5_stat_size_t empty_size; /* Size of a file with an empty heap */ - h5_stat_size_t file_size; /* Size of file currently */ - unsigned char *heap_id = NULL; /* Heap ID for object */ - size_t obj_size; /* Size of object */ - size_t robj_size; /* Size of object read */ - unsigned char obj_type; /* Type of storage for object */ - fheap_heap_state_t state; /* State of fractal heap */ - unsigned deflate_level; /* Deflation level */ - size_t old_actual_id_len =0 ; /* Old actual ID length */ - hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */ - const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */ + H5HF_create_t tmp_cparam; /* Local heap creation parameters */ + fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ + size_t id_len; /* Size of fractal heap IDs */ + h5_stat_size_t empty_size; /* Size of a file with an empty heap */ + h5_stat_size_t file_size; /* Size of file currently */ + unsigned char *heap_id = NULL; /* Heap ID for object */ + size_t obj_size; /* Size of object */ + size_t robj_size; /* Size of object read */ + unsigned char obj_type; /* Type of storage for object */ + fheap_heap_state_t state; /* State of fractal heap */ + unsigned deflate_level; /* Deflation level */ + size_t old_actual_id_len = 0; /* Old actual ID length */ + hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */ + hbool_t pline_init = FALSE; /* Whether the I/O pipeline has been initialized */ + const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */ - /* Copy heap creation properties */ - HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); + /* Copy heap creation properties */ + HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); /* Set an I/O filter for heap data */ deflate_level = 6; if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0) FAIL_STACK_ERROR + pline_init = TRUE; /* Adjust actual ID length, if asking for IDs that can directly access 'huge' objects */ if(cparam->id_len == 1) { @@ -13878,7 +13881,7 @@ error: H5MM_xfree(heap_id); if(fh) H5HF_close(fh); - if(&tmp_cparam.pline) + if(pline_init) H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */ H5Fclose(file); } H5E_END_TRY; diff --git a/test/h5test.c b/test/h5test.c index 59ccfe4..99b2010 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2016,7 +2016,7 @@ error: * *------------------------------------------------------------------------- */ -char * +const char * h5_get_version_string(H5F_libver_t libver) { return(LIBVER_NAMES[libver]); diff --git a/test/h5test.h b/test/h5test.h index 448813e..a0c8974 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -149,7 +149,7 @@ H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_co H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); -H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver); +H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver); /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); diff --git a/test/ohdr.c b/test/ohdr.c index facedd5..c5d5ac4 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1626,8 +1626,8 @@ main(void) /* Loop through all the combinations of low/high library format bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { - char *low_string = NULL; /* Message for library version low bound */ - char *high_string = NULL; /* Message for library version high bound */ + const char *low_string; /* Message for library version low bound */ + const char *high_string; /* Message for library version high bound */ char msg[80]; /* Message for file format version */ /* Set version bounds before opening the file */ diff --git a/test/tid.c b/test/tid.c index 7f61c6a..d0ae3e4 100644 --- a/test/tid.c +++ b/test/tid.c @@ -498,7 +498,7 @@ static int test_id_type_list(void) goto out; /* Sanity check */ - if(startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) + if((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ CHECK(1, 1, "H5Iregister_type"); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 5e26888..9eeaa24 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -38,7 +38,7 @@ /* Having a common dataset name is an error */ #define DATASETNAME "commonname" -#define EXPECTED_ERROR_DEPTH 9 +#define EXPECTED_ERROR_DEPTH 10 #define WRITE_NUMBER 37 /* Typedefs */ diff --git a/test/vds.c b/test/vds.c index a042a75..25d7a0e 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12168,8 +12168,8 @@ main(void) for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ - char *low_string; /* The low bound string */ - char *high_string; /* The high bound string */ + const char *low_string; /* The low bound string */ + const char *high_string; /* The high bound string */ /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/vds_env.c b/test/vds_env.c index 9c7b698..b2ca9d0 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -315,8 +315,8 @@ main(void) for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ - char *low_string; /* The low bound string */ - char *high_string; /* The high bound string */ + const char *low_string; /* The low bound string */ + const char *high_string; /* The high bound string */ /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/vds_swmr.h b/test/vds_swmr.h index a8e4d50..eb2dcf4 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -77,48 +77,12 @@ /* Dataset dimensions */ #define SM_HEIGHT 2 /* K */ #define LG_HEIGHT 4 /* N */ -#define SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */ #define FULL_HEIGHT 18 /* (3 * K) + (3 * N) */ -#define HALF_HEIGHT 9 #define WIDTH 8 /* M */ -#define HALF_WIDTH 4 - -/* Max number of planes in the dataset */ -#define N_MAX_PLANES H5S_UNLIMITED /* Number of planes each writer will write */ #define N_PLANES_TO_WRITE 25 -/* Dataset datatypes */ -#define SOURCE_DATATYPE H5T_STD_I32LE -#define VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of datasets, both source and VDS */ -static hsize_t DIMS[N_SOURCES][RANK] = { - {0, SM_HEIGHT, WIDTH}, - {0, LG_HEIGHT, WIDTH}, - {0, SM_HEIGHT, WIDTH}, - {0, LG_HEIGHT, WIDTH}, - {0, SM_HEIGHT, WIDTH}, - {0, LG_HEIGHT, WIDTH} -}; -static hsize_t VDS_DIMS[RANK] = {0, FULL_HEIGHT, WIDTH}; - -/* Maximum size of datasets, both source and VDS. - * NOTE: Theoretical (i.e.: H5S_UNLIMITED), not the actual max - * number of planes written out by the writers before they stop. - * That number is specified separately. - */ -static hsize_t MAX_DIMS[N_SOURCES][RANK] = { - {N_MAX_PLANES, SM_HEIGHT, WIDTH}, - {N_MAX_PLANES, LG_HEIGHT, WIDTH}, - {N_MAX_PLANES, SM_HEIGHT, WIDTH}, - {N_MAX_PLANES, LG_HEIGHT, WIDTH}, - {N_MAX_PLANES, SM_HEIGHT, WIDTH}, - {N_MAX_PLANES, LG_HEIGHT, WIDTH} -}; -static hsize_t VDS_MAX_DIMS[RANK] = {N_MAX_PLANES, FULL_HEIGHT, WIDTH}; - /* Planes */ static hsize_t PLANES[N_SOURCES][RANK] = { {1, SM_HEIGHT, WIDTH}, @@ -128,7 +92,6 @@ static hsize_t PLANES[N_SOURCES][RANK] = { {1, SM_HEIGHT, WIDTH}, {1, LG_HEIGHT, WIDTH} }; -static hsize_t VDS_PLANE[RANK] = {1, FULL_HEIGHT, WIDTH}; /* File names for source datasets */ static char FILE_NAMES[N_SOURCES][NAME_LEN] = { @@ -144,20 +107,9 @@ static char FILE_NAMES[N_SOURCES][NAME_LEN] = { static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; /* Dataset names */ -static char SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static int32_t FILL_VALUES[N_SOURCES] = { - -1, - -2, - -3, - -4, - -5, - -6 -}; -static int32_t VDS_FILL_VALUE = -9; - #endif /* VDS_SWMR_H */ diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 1cb9744..2589653 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -14,6 +14,52 @@ #include "h5test.h" #include "vds_swmr.h" +/* Max number of planes in the dataset */ +#define N_MAX_PLANES H5S_UNLIMITED + +/* Dataset datatypes */ +#define SOURCE_DATATYPE H5T_STD_I32LE +#define VDS_DATATYPE H5T_STD_I32LE + +/* Starting size of datasets, both source and VDS */ +static hsize_t DIMS[N_SOURCES][RANK] = { + {0, SM_HEIGHT, WIDTH}, + {0, LG_HEIGHT, WIDTH}, + {0, SM_HEIGHT, WIDTH}, + {0, LG_HEIGHT, WIDTH}, + {0, SM_HEIGHT, WIDTH}, + {0, LG_HEIGHT, WIDTH} +}; +static hsize_t VDS_DIMS[RANK] = {0, FULL_HEIGHT, WIDTH}; + +/* Maximum size of datasets, both source and VDS. + * NOTE: Theoretical (i.e.: H5S_UNLIMITED), not the actual max + * number of planes written out by the writers before they stop. + * That number is specified separately. + */ +static hsize_t MAX_DIMS[N_SOURCES][RANK] = { + {N_MAX_PLANES, SM_HEIGHT, WIDTH}, + {N_MAX_PLANES, LG_HEIGHT, WIDTH}, + {N_MAX_PLANES, SM_HEIGHT, WIDTH}, + {N_MAX_PLANES, LG_HEIGHT, WIDTH}, + {N_MAX_PLANES, SM_HEIGHT, WIDTH}, + {N_MAX_PLANES, LG_HEIGHT, WIDTH} +}; +static hsize_t VDS_MAX_DIMS[RANK] = {N_MAX_PLANES, FULL_HEIGHT, WIDTH}; + +static char SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; + +static int32_t FILL_VALUES[N_SOURCES] = { + -1, + -2, + -3, + -4, + -5, + -6 +}; + +static int32_t VDS_FILL_VALUE = -9; + int main(void) { diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index d0ec77b..eb9a82b 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -14,6 +14,8 @@ #include "h5test.h" #include "vds_swmr.h" +static hsize_t VDS_PLANE[RANK] = {1, FULL_HEIGHT, WIDTH}; + int main(void) { diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index ac385c9..a9a87c9 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -831,7 +831,7 @@ static hsize_t diff_datum( nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index d4fc3a2..41a40f1 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -211,7 +211,7 @@ diff_basename(const char *name) * Purpose: Returns the type as a string *------------------------------------------------------------------------- */ -H5_ATTR_PURE H5_ATTR_CONST const char* +H5_ATTR_CONST const char* get_type(h5trav_type_t type) { switch(type) { @@ -242,7 +242,7 @@ get_type(h5trav_type_t type) * Purpose: Returns the sign as a string *------------------------------------------------------------------------- */ -H5_ATTR_PURE const char* +H5_ATTR_CONST const char* get_sign(H5T_sign_t sign) { switch(sign) { @@ -270,7 +270,7 @@ get_sign(H5T_sign_t sign) * Purpose: Returns the class as a string *------------------------------------------------------------------------- */ -H5_ATTR_PURE const char* +H5_ATTR_CONST const char* get_class(H5T_class_t tclass) { switch(tclass) { diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 917d5f5..ecc1fae 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(udata->is_absolute) { size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; - size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1; + size_t new_name_len = base_len + add_slash + HDstrlen(path) + 4; if(NULL == (new_name = (char*)HDmalloc(new_name_len))) return(H5_ITER_ERROR); diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a275443..610c21c 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -22,7 +22,7 @@ */ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); -static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, +static int copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt); @@ -81,7 +81,7 @@ int do_copy_refobjs(hid_t fidin, if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) + if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) @@ -316,7 +316,7 @@ int do_copy_refobjs(hid_t fidin, * copy referenced objects in attributes *------------------------------------------------------------------------- */ - if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) + if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); /*------------------------------------------------------------------------- @@ -426,7 +426,6 @@ done: static int copy_refs_attr(hid_t loc_in, hid_t loc_out, - pack_opt_t *options, trav_table_t *travt, hid_t fidout) /* for saving references */ { @@ -450,7 +449,6 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = 0; void *refbuf = NULL; void *buf = NULL; - const char *refname = NULL; unsigned *ref_comp_index = NULL; size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; @@ -604,12 +602,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> reference created to <%s>\n", name, refname); - } /* i */ } /* H5T_STD_REF_OBJ */ /* handle region references */ else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { @@ -632,12 +627,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> region reference created to <%s>\n", name, refname); - } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { /* handle VLEN of references */ @@ -700,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in, size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt)<0) continue; HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); } /* if */ diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 88c8ea5..7f80c23 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -172,7 +172,7 @@ gen_enhance_files(hbool_t user) int data[NUM_ELMTS]; /* Buffer for data */ int fd = -1; /* The file descriptor ID */ int64_t eoa; /* The EOA value */ - int32_t chksum; /* The chksum value */ + uint32_t chksum; /* The chksum value */ int i = 0 , j = 0, u = 0; /* Local index variable */ /* Get a copy of the default file creation property */ diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 3962edd..1d2e791 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -70,9 +70,9 @@ const H5Z_class2_t H5Z_COUNTER[1] = {{ * track of the data of chunks being read from file into memory. */ static size_t -counter (unsigned flags, size_t cd_nelmts, - const unsigned *cd_values, size_t nbytes, - size_t *buf_size, void **buf) +counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes, + size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { nbytes_global += nbytes; return nbytes; diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index c6e62d5..1d52471 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -22,6 +22,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5test.h" #ifdef H5_HAVE_PARALLEL @@ -77,7 +78,7 @@ hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t block[RANK], stride[RANK], count[RANK]; -hssize_t start[RANK]; +hsize_t start[RANK]; hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ hid_t sid; /* Dataspace ID */ @@ -240,7 +241,7 @@ int main(int argc, char **argv) */ for(j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); stride[0] = block[0] = opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -293,7 +294,7 @@ int main(int argc, char **argv) /* we are going to repeat the read the same pattern the write used */ for (j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); stride[0] = block[0] = opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -320,13 +321,13 @@ int main(int argc, char **argv) VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", + if (ret < 0) HDfprintf(stderr, "node %d, read error, loc = %Ld: %s\n", mynod, mynod*opt_block, strerror(myerrno)); /* if the user wanted to check correctness, compare the write * buffer to the read buffer */ if (opt_correct && memcmp(buf, buf2, opt_block)) { - fprintf(stderr, "node %d, correctness test failed\n", mynod); + HDfprintf(stderr, "node %d, correctness test failed\n", mynod); my_correct = 0; MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD); @@ -435,10 +436,12 @@ parse_args(int argc, char **argv) * e.g., -a4096/512 allocate at 4096 bytes * boundary if request size >= 512. */ - {char *p; - opt_alignment = atoi(optarg); - if (p=(char*)strchr(optarg, '/')) - opt_threshold = atoi(p+1); + { + char *p; + + opt_alignment = HDatoi(optarg); + if(NULL != (p = (char*)HDstrchr(optarg, '/'))) + opt_threshold = HDatoi(p + 1); } HDfprintf(stdout, "alignment/threshold=%Hu/%Hu\n", -- cgit v0.12 From 7509c2c4fc304971b7eccf34aecc72304b9e4c8f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 2 Jul 2019 23:49:35 -0500 Subject: Added GCC9 flags to CMake build --- config/cmake/HDFCompilerFlags.cmake | 5 +++++ config/gnu-flags | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 106d6d7..d658c48 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -208,6 +208,11 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") endif () + # Append more extra warning flags that only gcc 9.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} Wattribute-alias=2 -Wmissing-profile") + endif () + endif () #----------------------------------------------------------------------------- diff --git a/config/gnu-flags b/config/gnu-flags index c5c70eb..f401d3d 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -241,7 +241,6 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" # Append warning flags that only gcc 9.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS " H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" ;; -- cgit v0.12 From ce92a647163db7929d04b333b26eebc8b81a089a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 3 Jul 2019 10:14:50 -0500 Subject: Add missing test --- tools/test/perform/CMakeLists.txt | 15 +++++++++++++++ tools/test/perform/CMakeTests.cmake | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 5a45d34..e6c4626 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -132,6 +132,21 @@ else () endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) +#-- Adding test for perf +set (perf_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c +) +add_executable (perf ${perf_SOURCES}) +target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (perf PROPERTIES FOLDER perform) + if (H5_HAVE_PARALLEL AND BUILD_TESTING) #-- Adding test for h5perf set (h5perf_SOURCES diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 36172d1..d079402 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -169,6 +169,22 @@ else () endif () set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_perf COMMAND $) +else () + add_test (NAME PERFORM_perf COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=perf.txt" + #-D "TEST_REFERENCE=perf.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (PERFORM_perf PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") + if (H5_HAVE_PARALLEL) add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) -- cgit v0.12 From 5e86326e0a731505095013aaf2a766bfa6cc1dda Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Wed, 3 Jul 2019 14:21:45 -0500 Subject: Fixed Build HDF Tests name in CMake's libhdf5 settings --- config/cmake/libhdf5.settings.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 97929e6..2117f3b 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -68,7 +68,7 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_BUILD_HL_LIB@ - Build HDF5 Tests: @BUILD_TESTS@ + Build HDF5 Tests: @BUILD_TESTING@ Build HDF5 Tools: @HDF5_BUILD_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ -- cgit v0.12 From 1c7420d1e3dfc7b6c957410925cae2ce726ead6f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 3 Jul 2019 15:30:41 -0500 Subject: perf test is parallel only --- tools/test/perform/CMakeLists.txt | 30 +++++++++++++++--------------- tools/test/perform/CMakeTests.cmake | 18 ++---------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index e6c4626..5995b60 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -132,22 +132,22 @@ else () endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) -#-- Adding test for perf -set (perf_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c -) -add_executable (perf ${perf_SOURCES}) -target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) -endif () -set_target_properties (perf PROPERTIES FOLDER perform) - if (H5_HAVE_PARALLEL AND BUILD_TESTING) + #-- Adding test for perf + set (perf_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c + ) + add_executable (perf ${perf_SOURCES}) + target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (perf PROPERTIES FOLDER perform) + #-- Adding test for h5perf set (h5perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index d079402..45f43b4 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -169,23 +169,9 @@ else () endif () set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_perf COMMAND $) -else () - add_test (NAME PERFORM_perf COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=perf.txt" - #-D "TEST_REFERENCE=perf.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (PERFORM_perf PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") - if (H5_HAVE_PARALLEL) + add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) if (HDF5_BUILD_PERFORM_STANDALONE) -- cgit v0.12 From 43aa32ff4f302a5aa389db1c2df9db7ae06ce730 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 5 Jul 2019 13:31:38 -0500 Subject: Cleaned up code that genericizes warning output, and add "-u" option to leave unique types in warnings (i.e. don't genericize output). Also fixed the '-S' option to work correctly. --- bin/warnhist | 334 ++++++++++++----------------------------------------------- 1 file changed, 65 insertions(+), 269 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 499886b..90f8601 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -50,10 +50,11 @@ my $warn_index; my $last_c_name; my $last_fort_name; my $last_fort_line; +my $genericize = 1; # Display usage sub do_help { - print "Usage: 'warnhist [-h, --help] [-t ] [-w ] [-W] [-f ] [-F] [-s ] [-S ] [file]'\n"; + print "Usage: 'warnhist [-h, --help] [-t ] [-w ] [-W] [-f ] [-F] [-s ] [-S ] [file]'\n"; print "\t-h, --help\tDisplay this usage\n"; print "\t-t \tTrim pathname prefix from filenames, \n"; print "\t-w \tDisplay files for a given warning index list, \n"; @@ -71,6 +72,7 @@ sub do_help { print "\t\t is a comma separated list, with no spaces\n"; print "\t\tFor example: 'H5Fint' or 'H5Fint,H5Gnode'\n"; print "\t-l\tDisplay line nunbers for file/warning\n"; + print "\t-u\tLeave 'unique' types in warnings, instead of genericizing them\n"; print "\t-i \tIgnore named files, \n"; print "\t\t is a comma separated list, with no spaces\n"; print "\t\tFor example: 'H5LTparse' or 'H5LTparse,H5LTanalyze'\n"; @@ -85,7 +87,7 @@ sub main::HELP_MESSAGE { # declare the Perl command line flags/options we want to allow my %options=(); -getopts("FWht:w:f:s:S:i:l", \%options); +getopts("FWhut:w:f:s:S:i:l", \%options); # Display usage, if requested if($options{h}) { @@ -176,6 +178,11 @@ if(exists $options{S}) { # print @file_match_strings; } +# Check if warnings should stay unique and not be "genericized" +if($options{u}) { + $genericize = 0; +} + PARSE_LINES: while (<>) { my $name; @@ -314,6 +321,9 @@ while (<>) { $warning =~ s/‘/'/g; $warning =~ s/’/'/g; +# +# These skipped messages & "genericizations" may be specific to GCC + # Skip supplemental warning message next if $warning =~ /near initialization for/; @@ -323,271 +333,54 @@ while (<>) { # Skip GCC warning that should be a note next if $_ =~ /\(this will be reported only once per input file\)/; - # Eliminate "{aka }" and "{aka ''}" info - if($warning =~ /\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))/) { - $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))//g; - } + if($genericize) { + # Eliminate C/C++ "{aka }" and "{aka ''}" info + if($warning =~ /\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))/) { + $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))//g; + } -# print "warning = $warning\n"; - # Genericize warnings - if($warning =~ /variable '[A-Za-z_0-9]*' set but not used.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /unused variable '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /unused function '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' when passing argument to function.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' to match other operand of binary expression.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may alter its value.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may change the sign of the result.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\s]*' discards '[A-Za-z_0-9\s]*'.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_0-9\s]*' defined but not used.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /cast discards '[A-Za-z_0-9\(\)\s]*'.*/) { - $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; - } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*\.]*' is [0-9]* bytes.*/) { - $warning =~ s/is [0-9]* bytes/is - bytes/g; - $warning =~ s/'[A-Za-z_0-9\(\)\s\*\.]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\(\)\s]*' from incompatible.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; - } elsif($warning =~ /stack usage is [0-9]* bytes.*/) { - $warning =~ s/stack usage is [0-9]*/stack usage is -/g; - } elsif($warning =~ /stack usage might be [0-9]* bytes.*/) { - $warning =~ s/stack usage might be [0-9]*/stack usage might be -/g; - } elsif($warning =~ /the frame size of [0-9]* bytes is larger than [0-9]* bytes.*/) { - $warning =~ s/the frame size of [0-9]* bytes is larger than [0-9]*/the frame size of - bytes is larger than -/g; - } elsif($warning =~ /enumeration value '[A-Za-z_0-9\s]*' not handled in switch.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /"[A-Za-z_0-9\s]*" is not defined.*/) { - $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g; - } elsif($warning =~ /macro "[A-Za-z_0-9\s]*" is not used.*/) { - $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g; - } elsif($warning =~ /unused parameter '[A-Za-z_0-9\s]*'.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /request for implicit conversion from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\<\>\[\]\(\)\*]*' not permitted in C\+\+.*/) { - $warning =~ s/'[A-Za-z_0-9\s\*\<\>\[\]\(\)]*'/'-'/g; - } elsif($warning =~ /no previous prototype for '[A-Za-z_0-9\s]*'.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a previous local.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /cast from function call of type '[A-Za-z_0-9\s\*]*' to non-matching type '[A-Za-z_0-9\s\*]*'.*/) { - $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_0-9\s]*' declared '[A-Za-z_0-9\s]*' but never defined.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a global declaration.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /typedef '[A-Za-z_0-9\s]*' locally defined but not used.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /format '%[a-z]*' expects argument of type '[A-Za-z_0-9\s\*]*', but argument [0-9]* has type '[A-Za-z_0-9\s\*\(\),]*'.*/) { - $warning =~ s/but argument [0-9]*/but argument -/g; - $warning =~ s/'[%A-Za-z_0-9\s\*\(\),]*'/'-'/g; - } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' alters '[A-Za-z_0-9\s]*' constant value.*/) { - $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; - } elsif($warning =~ /to be safe all intermediate pointers in cast from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\*]*' must be 'const' qualified.*/) { - $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g; - } elsif($warning =~ /identifier '[A-Za-z_0-9]*' conflicts with C\+\+ keyword.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /nested extern declaration of '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /Procedure '[A-Za-z_0-9]*' called with an implicit interface.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /Unused dummy argument '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/\([0-9]+\)/\(-\)/g; - } elsif($warning =~ /Unused parameter '[A-Za-z_0-9]*' declared at.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/\([0-9]+\)/\(-\)/g; - } elsif($warning =~ /Unused variable '[A-Za-z_0-9]*' declared at.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /Inequality comparison for REAL\([0-9]*\) at.*/) { - $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; - $warning =~ s/\([0-9]+\)/\(-\)/g; - } elsif($warning =~ /Possible change of value in conversion from INTEGER\([0-9]*\) to (INTEGER|REAL)\([0-9]*\) at.*/) { - $warning =~ s/INTEGER\([0-9]*\)/INTEGER\(-\)/g; - $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; - } elsif($warning =~ /Equality comparison for REAL\([0-9]*\) at.*/) { - $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g; - $warning =~ s/\([0-9]+\)/\(-\)/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' with different width due to prototype.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as unsigned due to prototype.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' discards qualifiers from pointer target type.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as floating rather than integer due to prototype.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as 'float' rather than 'double' due to prototype.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/; - } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as signed due to prototype.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /format '\%[A-Za-z0-9]*' expects type '[a-z][a-z\s\*]*', but argument [0-9]* has type '[a-z][a-z\(\)_,\s\*]*'.*/) { - $warning =~ s/but argument [0-9]*/but argument -/g; - $warning =~ s/'\%[A-Za-z0-9]*'/'\%-'/g; - $warning =~ s/'[a-z][a-z_,\s\*\(\)]*'/'-'/g; - } elsif($warning =~ /implicit declaration of function '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*' may be used uninitialized in this function.*/) { - $warning =~ s/'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*'/'-'/g; - } elsif($warning =~ /redundant redeclaration of '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /declaration of '[A-Za-z_0-9]*' shadows a parameter.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_scanf length modifier.*/) { - $warning =~ s/'[a-z]*'/'-'/g; - } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_printf length modifier.*/) { - $warning =~ s/'[a-z]*'/'-'/g; - } elsif($warning =~ /ISO C90 does not support the '%[a-z]*' gnu_printf format.*/) { - $warning =~ s/'%[a-z]*'/'%-'/g; - } elsif($warning =~ /string length '[0-9]*' is greater than the length.*/) { - $warning =~ s/string length '[0-9]*' is/string length '-' is/g; - } elsif($warning =~ /enum conversion when passing argument [0-9]* of '[A-Za-z_0-9]*' is invalid.*/) { - $warning =~ s/passing argument [0-9]*/passing argument -/g; - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /enum conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' in assignment is invalid in C\+\+.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /duplicate declaration of '[A-Za-z_0-9]*' is invalid in.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) is a dummy argument of the BIND\(C\) procedure '[A-Za-z_0-9]*' but may not be C interoperable.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/at \([0-9]*\)/at \(-\)/g; - } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) may not be a C interoperable kind but it is BIND\(C\).*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/at \([0-9]*\)/at \(-\)/g; - } elsif($warning =~ /Component '[A-Za-z_0-9]*' in derived type '[A-Za-z_0-9]*' at \([0-9]*\) may not be C interoperable, even though derived type '[A-Za-z_0-9]*' is BIND\(C\).*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/at \([0-9]*\)/at \(-\)/g; - } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' if it is known to return normally.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; - } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; - } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*L*[dfsu]' directive writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)) bytes into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*L*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'((%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+))' directive output may be truncated writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)|([0-9+)|(likely 1 or more)) byte(s)? into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/'[A-Za-z_0-9\/]+'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive argument is null.*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+'.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - $warning =~ s/'-?[0-9]+'/'-'/g; - } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+'.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - $warning =~ s/'-?[0-9]+'/'-'/g; - } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'/'-'/g; - } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'.*/) { - $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list.*/) { - $warning =~ s/'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*'/'-'/g; - } elsif($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) { - $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g; - } elsif($warning =~ /size of '[A-Za-z_\*0-9]*' [0-9]+ bytes exceeds maximum object size [0-9]+ .*/) { - $warning =~ s/'[A-Za-z_\*0-9]*'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'[A-Za-z_0-9]*' output truncated before terminating nul copying [0-9]+ bytes from a string of the same length.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes pointer from integer without a cast.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes integer from pointer without a cast.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from incompatible pointer type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /ignoring attribute '[a-z]*' because it conflicts with attribute '[a-z]*'.*/) { - $warning =~ s/'[a-z]*'/'-'/g; - } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /unknown warning group '[A-Za-z-=]*', ignored.*/) { - $warning =~ s/'[A-Za-z-=]*'/'-'/g; - } elsif($warning =~ /'[A-Za-z_0-9]*' macro redefined.*/) { - $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /"[A-Za-z_0-9]*" redefined.*/) { - $warning =~ s/"[A-Za-z_0-9]*"/"-"/g; - } elsif($warning =~ /incompatible (pointer|integer) to (pointer|integer) conversion assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /returning '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from a function with result type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /array index [0-9]+ is past the end of the array \(which contains [0-9]+ elements\).*/) { - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /array subscript [0-9]+ is above array bounds of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /expression which evaluates to zero treated as a null pointer constant of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /result of comparison of constant [0-9]+ with expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' is always (true|false).*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /initializing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' with an expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - } elsif($warning =~ /implicit conversion from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' changes value from -?[0-9]+ to -?[0-9]+.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g; - $warning =~ s/-?[0-9]+/-/g; - } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' converts between pointers to integer types with different sign.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*'/'-'/g; - } elsif($warning =~ /address of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' will always evaluate to 'true'.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g; - } elsif($warning =~ /length modifier '[A-Za-z]' results in undefined behavior or no effect with '[A-Za-z]' conversion specifier.*/) { - $warning =~ s/'[A-Za-z]'/'-'/g; - } elsif($warning =~ /'[A-Za-z_]+' specified bound depends on the length of the source argument.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - } elsif($warning =~ /'[A-Za-z_]+' specified bound [0-9]+ equals destination size.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'[A-Za-z_]+' output may be truncated copying between [0-9]+ and [0-9]+ bytes from a string of length [0-9]+.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'[A-Za-z_]+' output may be truncated before the last format character.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - } elsif($warning =~ /'[A-Za-z_]+' output truncated before terminating nul copying as many bytes from a string as its length.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - } elsif($warning =~ /'[A-Za-z_\:0-9]+' hides overloaded virtual function.*/) { - $warning =~ s/'[A-Za-z_\:0-9]+'/'-'/g; - } elsif($warning =~ /'[A-Za-z_]+' storage class specifier is deprecated and incompatible with C\+\+1z.*/) { - $warning =~ s/'[A-Za-z_]+'/'-'/g; - } elsif($warning =~ /explicitly assigning value of variable of type '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' to itself.*/) { - $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g; - } elsif($warning =~ /private field '[A-Za-z_0-9]+' is not used.*/) { - $warning =~ s/'[A-Za-z_0-9]+'/'-'/g; - } elsif($warning =~ /field '[A-Za-z_0-9]+' will be initialized after field '[A-Za-z_0-9]+'.*/) { - $warning =~ s/'[A-Za-z_0-9]+'/'-'/g; + # Genericize C/C++ '' and printf format '%' into '-' + if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/) { + $warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/'-'/g; + } + if($warning =~ /'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/) { + $warning =~ s/'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/'-'/g; + } + + # Genericize C/C++ "" warnings into "-" + if($warning =~ /"[A-Za-z_0-9]*"/) { + $warning =~ s/"[A-Za-z_0-9]*"/"-"/g; + } + + # Genericize [GCC?] C/C++ warning text about suggessted attribute + if($warning =~ /attribute=[A-Za-z_0-9]*\]/) { + $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; + } + + # Genericize FORTRAN "at ()" into "at (-)", "REAL()" into "REAL(-)", + # and "INTEGER()" into "INTEGER(-)" + if($warning =~ /.*at\s\([0-9]+\).*/) { + $warning =~ s/at\s\([0-9]+\)/at \(-\)/g; + } + if($warning =~ /.*REAL\([0-9]+\).*/) { + $warning =~ s/REAL\([0-9]+\)/REAL\(-\)/g; + } + if($warning =~ /.*INTEGER\([0-9]+\).*/) { + $warning =~ s/INTEGER\([0-9]+\)/INTEGER\(-\)/g; + } + + # Genericize standalone numbers in warnings + if($warning =~ /\s-?[0-9]+\s/) { + $warning =~ s/\s-?[0-9]+\s/\ -\ /g; + } + + # Genericize unusual GCC/G++/GFORTRAN warnings that aren't handled above + if($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) { + $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g; + } } # print "warning = $warning\n"; +# # Check if we've already seen this warning on this line in this file # (Can happen for warnings from inside header files) @@ -662,7 +455,7 @@ print "\n# of Warnings by filename (warning type)\n"; print "========================================\n"; for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) { printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn_line{$x}}), $x); - if((exists $options{F}) || (exists $options{f})) { + if((exists $options{F}) || (exists $options{f}) || (exists $options{S})) { my $curr_index = $current_file - 1; my $match = 0; @@ -696,9 +489,12 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) { } # Print names of files that were ignored -print "\nIgnored filenames\n"; -print "=================\n"; -for my $x (sort keys(%ignored_files)) { - print "$x\n"; +# Check for ignored file +if(exists $options{i}) { + print "\nIgnored filenames\n"; + print "=================\n"; + for my $x (sort keys(%ignored_files)) { + print "$x\n"; + } } -- cgit v0.12 From ae0c16d1f2025683ad7fa6d4da2cc290f9c633d9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 12:21:11 -0500 Subject: HDFFV-10581 fix locations for static pdb files --- config/cmake_ext_mod/HDFMacros.cmake | 34 ++++++++++++++++------------------ fortran/src/CMakeLists.txt | 4 ++-- hl/c++/src/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 ++-- hl/src/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- tools/lib/CMakeLists.txt | 2 +- 7 files changed, 24 insertions(+), 26 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 9da5006..52b96fc 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -78,7 +78,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (${libtype} MATCHES "SHARED") set (targetfilename $) else () - get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + get_property (target_name TARGET ${libtarget} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) set (targetfilename $/${target_name}.pdb) endif () install ( @@ -86,9 +86,10 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) ${targetfilename} DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS $ COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () @@ -100,9 +101,10 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) $ DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS $ COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () @@ -126,19 +128,6 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) endif () endif () - set_target_properties (${libtarget} - PROPERTIES - OUTPUT_NAME - ${LIB_RELEASE_NAME} - OUTPUT_NAME_DEBUG - ${LIB_DEBUG_NAME} - OUTPUT_NAME_RELEASE - ${LIB_RELEASE_NAME} - OUTPUT_NAME_MINSIZEREL - ${LIB_RELEASE_NAME} - OUTPUT_NAME_RELWITHDEBINFO - ${LIB_RELEASE_NAME} - ) if (${libtype} MATCHES "STATIC") if (WIN32) set_target_properties (${libtarget} @@ -378,6 +367,15 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) 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 () + endif () + SET_HDF_BUILD_TYPE() #----------------------------------------------------------------------------- diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index b01e4d4..774ed8c 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -439,8 +439,8 @@ if (HDF5_EXPORTED_TARGETS) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} fortlibraries) endif () install ( diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index eb83d8c..1911d62 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -59,7 +59,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlcpplibraries) endif () install ( diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a684088..b63b5c6 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -294,8 +294,8 @@ if (HDF5_EXPORTED_TARGETS) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) - #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) + #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) endif () install ( diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 7125403..3cce7e4 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -83,7 +83,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hllibraries) endif () install ( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4cf4965..a0a10a5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1192,7 +1192,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} libraries) endif () install ( diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index e9dfcaa..75ed627 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -85,7 +85,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} toolslibraries) endif () install ( -- cgit v0.12 From 3dd7137430c05153d5cc6a692ef66f9e5ceea91f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 13:46:25 -0500 Subject: HDFFV-10581 remove special name checking --- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index c327c86..1f46bbd 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -72,7 +72,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 0fef370..8d4b0af 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -57,7 +57,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index b31a186..bab2eff 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -56,7 +56,7 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 8c94a09..2504337 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -58,7 +58,7 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 937b129..eb1f715 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,7 +88,7 @@ else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif () -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -- cgit v0.12 From 1878e68558b83bb2d822c298aa7b8373a2bde273 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 13:52:05 -0500 Subject: Move before null check --- java/src/jni/h5lImp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 7413023..7eee3d4 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -508,11 +508,11 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx UNUSED(clss); + infobuf.type = H5L_TYPE_ERROR; + if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: group name is NULL"); - infobuf.type = H5L_TYPE_ERROR; - PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned"); /* Get the length of the link value */ -- cgit v0.12 From 8eadaf34081902f2080cdcac3a568ff5169b4ea7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 13:59:35 -0500 Subject: Change how name is retrieved --- java/examples/datasets/CMakeLists.txt | 3 ++- java/examples/datatypes/CMakeLists.txt | 3 ++- java/examples/groups/CMakeLists.txt | 3 ++- java/examples/intro/CMakeLists.txt | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 1f46bbd..9e5c45c 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -72,7 +72,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 8d4b0af..c939985 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -57,7 +57,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index bab2eff..489dab3 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -56,7 +56,8 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 2504337..1801749 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -58,7 +58,8 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" -- cgit v0.12 From 8583d608ef094237e5f484e0b4a7bb147fa9c6b5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 15:10:12 -0500 Subject: Correct test use of library name --- java/test/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index eb1f715..05bfd8d 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,7 +88,8 @@ else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif () -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") +get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -- cgit v0.12 From c88caec5aeaf4011e6577967d4f382e77b8a012f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 15:33:31 -0500 Subject: Declaration needed for parallel standalone --- tools/test/perform/pio_standalone.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index dd6a61a..022e390 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -162,4 +162,8 @@ print_version(const char *progname) H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE); } +#ifdef H5_HAVE_PARALLEL +MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ +#endif + -- cgit v0.12 From c424877351842145679f0b8194cc10a03a4e0e7c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 15:37:58 -0500 Subject: perf program can only be built on unix platforms --- tools/test/perform/CMakeLists.txt | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 5995b60..38dd605 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -133,20 +133,22 @@ endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) if (H5_HAVE_PARALLEL AND BUILD_TESTING) - #-- Adding test for perf - set (perf_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c - ) - add_executable (perf ${perf_SOURCES}) - target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + if (UNIX) + #-- Adding test for perf - only on unix systems + set (perf_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c + ) + add_executable (perf ${perf_SOURCES}) + target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (perf PROPERTIES FOLDER perform) endif () - set_target_properties (perf PROPERTIES FOLDER perform) #-- Adding test for h5perf set (h5perf_SOURCES -- cgit v0.12 From f241ff8ad95b9087b6606d0d1698c14538c582a6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 8 Jul 2019 15:50:14 -0500 Subject: Fix compile error with ifdef H5_HAVE_GETHOSTNAME --- testpar/t_mpi.c | 1543 +++++++++++++++++++++++++++---------------------------- 1 file changed, 757 insertions(+), 786 deletions(-) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 3d501c9..157a09f 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -28,149 +28,143 @@ #include "testpar.h" /* FILENAME and filenames must have the same number of names */ -const char *FILENAME[2]={ - "MPItest", - NULL}; -char filenames[2][200]; -int nerrors = 0; -hid_t fapl; /* file access property list */ +const char *FILENAME[2] = { "MPItest", NULL }; +char filenames[2][200]; +int nerrors = 0; +hid_t fapl; /* file access property list */ /* protocols */ static int errors_sum(int nerrs); #define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */ -static int -test_mpio_overlap_writes(char *filename) -{ +static int test_mpio_overlap_writes(char *filename) { int mpi_size, mpi_rank; MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; int color, mrc; - MPI_File fh; + MPI_File fh; int i; int vrfyerrs, nerrs; - unsigned char buf[4093]; /* use some prime number for size */ + unsigned char buf[4093]; /* use some prime number for size */ int bufsize = sizeof(buf); - MPI_Offset stride; - MPI_Offset mpi_off; - MPI_Status mpi_stat; - + MPI_Offset stride; + MPI_Offset mpi_off; + MPI_Status mpi_stat; if (VERBOSE_MED) - printf("MPIO independent overlapping writes test on file %s\n", - filename); + printf("MPIO independent overlapping writes test on file %s\n", + filename); nerrs = 0; /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* Need at least 2 processes */ if (mpi_size < 2) { - if (MAINPROCESS) - printf("Need at least 2 processes to run MPIO test.\n"); - printf(" -SKIP- \n"); - return 0; + if (MAINPROCESS) + printf("Need at least 2 processes to run MPIO test.\n"); + printf(" -SKIP- \n"); + return 0; } /* splits processes 0 to n-2 into one comm. and the last one into another */ color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1); - mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm); - VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded"); - - if (color==0){ - /* First n-1 processes (color==0) open a file and write it */ - mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = 1; - mpi_off = mpi_rank*stride; - while (mpi_off < MPIO_TEST_WRITE_SIZE){ - /* make sure the write does not exceed the TEST_WRITE_SIZE */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - - /* set data to some trivial pattern for easy verification */ - for (i=0; i bufsize) - stride = bufsize; - mpi_off += mpi_rank*stride; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - - /* sync with the other waiting processes */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - }else{ - /* last process waits till writes are done, - * then opens file to verify data. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - - mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = bufsize; - for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ - /* make sure it does not read beyond end of data */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, - &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); - vrfyerrs=0; - for (i=0; i MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm); + VRFY((mrc == MPI_SUCCESS), "Comm_split succeeded"); + + if (color == 0) { + /* First n-1 processes (color==0) open a file and write it */ + mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + info, &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + stride = 1; + mpi_off = mpi_rank * stride; + while (mpi_off < MPIO_TEST_WRITE_SIZE) { + /* make sure the write does not exceed the TEST_WRITE_SIZE */ + if (mpi_off + stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + + /* set data to some trivial pattern for easy verification */ + for (i = 0; i < stride; i++) + buf[i] = (unsigned char) (mpi_off + i); + mrc = MPI_File_write_at(fh, mpi_off, buf, (int) stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc == MPI_SUCCESS), ""); + + /* move the offset pointer to last byte written by all processes */ + mpi_off += (mpi_size - 1 - mpi_rank) * stride; + + /* Increase chunk size without exceeding buffer size. */ + /* Then move the starting offset for next write. */ + stride *= 2; + if (stride > bufsize) + stride = bufsize; + mpi_off += mpi_rank * stride; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + + /* sync with the other waiting processes */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + } else { + /* last process waits till writes are done, + * then opens file to verify data. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + + mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, info, &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + stride = bufsize; + for (mpi_off = 0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize) { + /* make sure it does not read beyond end of data */ + if (mpi_off + stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + mrc = MPI_File_read_at(fh, mpi_off, buf, (int) stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc == MPI_SUCCESS), ""); + vrfyerrs = 0; + for (i = 0; i < stride; i++) { + unsigned char expected; + expected = (unsigned char) (mpi_off + i); + if ((expected != buf[i]) + && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { + printf( + "proc %d: found data error at [%ld], expect %u, got %u\n", + mpi_rank, (long) (mpi_off + i), expected, buf[i]); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); } /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ + * one more sync to ensure all processes have done reading + * before ending this test. + */ mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); return (nerrs); } - #define MB 1048576 /* 1024*1024 == 2**20 */ #define GB 1073741824 /* 1024**3 == 2**30 */ #define TWO_GB_LESS1 2147483647 /* 2**31 - 1 */ @@ -186,30 +180,28 @@ test_mpio_overlap_writes(char *filename) * Then reads the file back in by reverse order, that is process 0 * reads the data of process n-1 and vice versa. */ -static int -test_mpio_gb_file(char *filename) -{ +static int test_mpio_gb_file(char *filename) { int mpi_size, mpi_rank; MPI_Info info = MPI_INFO_NULL; int mrc; - MPI_File fh; + MPI_File fh; int i, j, n; int vrfyerrs; - int writerrs; /* write errors */ + int writerrs; /* write errors */ int nerrs; - int ntimes; /* how many times */ - char *buf = NULL; - char expected; - MPI_Offset size; - MPI_Offset mpi_off; - MPI_Offset mpi_off_old; - MPI_Status mpi_stat; + int ntimes; /* how many times */ + char *buf = NULL; + char expected; + MPI_Offset size; + MPI_Offset mpi_off; + MPI_Offset mpi_off_old; + MPI_Status mpi_stat; int is_signed, sizeof_mpi_offset; nerrs = 0; /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (VERBOSE_MED) printf("MPI_Offset range test\n"); @@ -217,196 +209,207 @@ test_mpio_gb_file(char *filename) /* figure out the signness and sizeof MPI_Offset */ mpi_off = 0; is_signed = ((MPI_Offset)(mpi_off - 1)) < 0; - sizeof_mpi_offset = (int)(sizeof(MPI_Offset)); + sizeof_mpi_offset = (int) (sizeof(MPI_Offset)); /* - * Verify the sizeof MPI_Offset and correctness of handling multiple GB - * sizes. - */ - if (MAINPROCESS){ /* only process 0 needs to check it*/ - printf("MPI_Offset is %s %d bytes integeral type\n", - is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset)); - if (sizeof_mpi_offset <= 4 && is_signed){ - printf("Skipped 2GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 2GB sizes */ - mpi_off = 2 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "2GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 2 GB to above 2GB */ - mpi_off = TWO_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "2GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); - } - } - - if (sizeof_mpi_offset <= 4){ - printf("Skipped 4GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 4GB sizes */ - mpi_off = 4 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "4GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 4 GB to above 4 GB */ - mpi_off = FOUR_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "4GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); - } - } + * Verify the sizeof MPI_Offset and correctness of handling multiple GB + * sizes. + */ + if (MAINPROCESS) { /* only process 0 needs to check it*/ + printf("MPI_Offset is %s %d bytes integeral type\n", + is_signed ? "signed" : "unsigned", (int) sizeof(MPI_Offset)); + if (sizeof_mpi_offset <= 4 && is_signed) { + printf("Skipped 2GB range test " + "because MPI_Offset cannot support it\n"); + } else { + /* verify correctness of assigning 2GB sizes */ + mpi_off = 2 * 1024 * (MPI_Offset) MB; + INFO((mpi_off > 0), "2GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 2 GB to above 2GB */ + mpi_off = TWO_GB_LESS1; + for (i = 0; i < 3; i++) { + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off > 0), "2GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off - 1) == mpi_off_old, + "2GB OFFSET increment succeed"); + } + } + + if (sizeof_mpi_offset <= 4) { + printf("Skipped 4GB range test " + "because MPI_Offset cannot support it\n"); + } else { + /* verify correctness of assigning 4GB sizes */ + mpi_off = 4 * 1024 * (MPI_Offset) MB; + INFO((mpi_off > 0), "4GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 4 GB to above 4 GB */ + mpi_off = FOUR_GB_LESS1; + for (i = 0; i < 3; i++) { + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off > 0), "4GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off - 1) == mpi_off_old, + "4GB OFFSET increment succeed"); + } + } } /* - * Verify if we can write to a file of multiple GB sizes. - */ + * Verify if we can write to a file of multiple GB sizes. + */ if (VERBOSE_MED) - printf("MPIO GB file test %s\n", filename); - - if (sizeof_mpi_offset <= 4){ - printf("Skipped GB file range test " - "because MPI_Offset cannot support it\n"); - }else{ - buf = (char *)HDmalloc(MB); - VRFY((buf!=NULL), "malloc succeed"); - - /* open a new file. Remove it first in case it exists. */ - /* Must delete because MPI_File_open does not have a Truncate mode. */ - /* Don't care if it has error. */ - MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ - - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); - - printf("MPIO GB file write test %s\n", filename); - - /* instead of writing every bytes of the file, we will just write - * some data around the 2 and 4 GB boundaries. That should cover - * potential integer overflow and filesystem size limits. - */ - writerrs = 0; - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - /* set data to some trivial pattern for easy verification */ - for (j=0; j0){ - printf("proc %d: Skip read test due to previous write errors\n", - mpi_rank); - goto finish; - } - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - /* Only read back parts of the file that have been written. */ - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - INFO((mrc==MPI_SUCCESS), "GB size file read"); - expected = i*mpi_size + (mpi_size - mpi_rank - 1); - vrfyerrs=0; - for (j=0; j MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + printf("MPIO GB file test %s\n", filename); + + if (sizeof_mpi_offset <= 4) { + printf("Skipped GB file range test " + "because MPI_Offset cannot support it\n"); + } else { + buf = (char *) HDmalloc(MB); + VRFY((buf != NULL), "malloc succeed"); + + /* open a new file. Remove it first in case it exists. */ + /* Must delete because MPI_File_open does not have a Truncate mode. */ + /* Don't care if it has error. */ + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + + mrc = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_OPEN"); + + printf("MPIO GB file write test %s\n", filename); + + /* instead of writing every bytes of the file, we will just write + * some data around the 2 and 4 GB boundaries. That should cover + * potential integer overflow and filesystem size limits. + */ + writerrs = 0; + for (n = 2; n <= 4; n += 2) { + ntimes = GB / MB * n / mpi_size + 1; + for (i = ntimes - 2; i <= ntimes; i++) { + mpi_off = (i * mpi_size + mpi_rank) * (MPI_Offset) MB; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: write to mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + /* set data to some trivial pattern for easy verification */ + for (j = 0; j < MB; j++) + *(buf + j) = i * mpi_size + mpi_rank; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: writing %d bytes at offset %lld\n", + mpi_rank, MB, mpi_off); + mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, + &mpi_stat); + INFO((mrc == MPI_SUCCESS), "GB size file write"); + if (mrc != MPI_SUCCESS) + writerrs++; + } + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + + /* + * Verify if we can read the multiple GB file just created. + */ + /* open it again to verify the data written */ + /* but only if there was no write errors */ + printf("MPIO GB file read test %s\n", filename); + if (errors_sum(writerrs) > 0) { + printf("proc %d: Skip read test due to previous write errors\n", + mpi_rank); + goto finish; + } + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, + &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + /* Only read back parts of the file that have been written. */ + for (n = 2; n <= 4; n += 2) { + ntimes = GB / MB * n / mpi_size + 1; + for (i = ntimes - 2; i <= ntimes; i++) { + mpi_off = (i * mpi_size + (mpi_size - mpi_rank - 1)) + * (MPI_Offset) MB; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: read from mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, + &mpi_stat); + INFO((mrc == MPI_SUCCESS), "GB size file read"); + expected = i * mpi_size + (mpi_size - mpi_rank - 1); + vrfyerrs = 0; + for (j = 0; j < MB; j++) { + if ((*(buf + j) != expected) + && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { + printf( + "proc %d: found data error at [%ld+%d], expect %d, got %d\n", + mpi_rank, (long) mpi_off, j, expected, + *(buf + j)); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); printf("Test if MPI_File_get_size works correctly with %s\n", filename); - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, + &fh); + VRFY((mrc == MPI_SUCCESS), ""); - if (MAINPROCESS){ /* only process 0 needs to check it*/ + if (MAINPROCESS) { /* only process 0 needs to check it*/ mrc = MPI_File_get_size(fh, &size); - VRFY((mrc==MPI_SUCCESS), ""); - VRFY((size == mpi_off+MB), "MPI_File_get_size doesn't return correct file size."); + VRFY((mrc == MPI_SUCCESS), ""); + VRFY((size == mpi_off+MB), + "MPI_File_get_size doesn't return correct file size."); } - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); } -finish: - if (buf) - HDfree(buf); + finish: if (buf) + HDfree(buf); return (nerrs); } - /* * MPI-IO Test: One writes, Many reads. * Verify if only one process writes some data and then all other @@ -424,191 +427,190 @@ finish: * Each process writes something, then reads all data back. */ -#define DIMSIZE 32 /* Dimension size. */ +#define DIMSIZE 32 /* Dimension size. */ #define PRINTID printf("Proc %d: ", mpi_rank) #define USENONE 0 -#define USEATOM 1 /* request atomic I/O */ -#define USEFSYNC 2 /* request file_sync */ +#define USEATOM 1 /* request atomic I/O */ +#define USEFSYNC 2 /* request file_sync */ - -static int -test_mpio_1wMr(char *filename, int special_request) -{ +static int test_mpio_1wMr(char *filename, int special_request) { char hostname[128]; - int mpi_size, mpi_rank; + int mpi_size, mpi_rank; MPI_File fh; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; + int mpi_err_strlen; + int mpi_err; unsigned char writedata[DIMSIZE], readdata[DIMSIZE]; unsigned char expect_val; - int i, irank; - int nerrs = 0; /* number of errors */ - int atomicity; - MPI_Offset mpi_off; - MPI_Status mpi_stat; + int i, irank; + int nerrs = 0; /* number of errors */ + int atomicity; + MPI_Offset mpi_off; + MPI_Status mpi_stat; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - if (MAINPROCESS && VERBOSE_MED){ + if (MAINPROCESS && VERBOSE_MED) { printf("Testing one process writes, all processes read.\n"); - printf("Using %d processes accessing file %s\n", mpi_size, filename); + printf("Using %d processes accessing file %s\n", mpi_size, filename); printf(" (Filename can be specified via program argument)\n"); } /* show the hostname so that we can tell where the processes are running */ - if (VERBOSE_DEF){ - if (gethostname(hostname, 128) < 0){ - PRINTID; - printf("gethostname failed\n"); - return 1; - } - PRINTID; - printf("hostname=%s\n", hostname); + if (VERBOSE_DEF) { +#ifdef H5_HAVE_GETHOSTNAME + if(HDgethostname(hostname, sizeof(host_name)) < 0) { + printf("gethostname failed\n"); + hostname[0] = '\0'; + } + #else + printf("gethostname unavailable\n"); + hostname[0] = '\0'; +#endif + PRINTID; + printf("hostname=%s\n", hostname); } /* Delete any old file in order to start anew. */ /* Must delete because MPI_File_open does not have a Truncate mode. */ /* Don't care if it has error. */ MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE , - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } -if (special_request & USEATOM){ - /* ================================================== - * Set atomcity to true (1). A POSIX compliant filesystem - * should not need this. - * ==================================================*/ - if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); - } - if (VERBOSE_HI) - printf("Initial atomicity = %d\n", atomicity); - if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); - } - if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + if (special_request & USEATOM) { + /* ================================================== + * Set atomcity to true (1). A POSIX compliant filesystem + * should not need this. + * ==================================================*/ + if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + } + if (VERBOSE_HI) + printf("Initial atomicity = %d\n", atomicity); + if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); + } + if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + } + if (VERBOSE_HI) + printf("After set_atomicity atomicity = %d\n", atomicity); } - if (VERBOSE_HI) - printf("After set_atomicity atomicity = %d\n", atomicity); -} /* This barrier is not necessary but do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("between MPI_Barrier and MPI_File_write_at\n"); + if (VERBOSE_HI) { + PRINTID; + printf("between MPI_Barrier and MPI_File_write_at\n"); } /* ================================================== - * Each process calculates what to write but - * only process irank(0) writes. - * ==================================================*/ - irank=0; - for (i=0; i < DIMSIZE; i++) - writedata[i] = irank*DIMSIZE + i; - mpi_off = irank*DIMSIZE; + * Each process calculates what to write but + * only process irank(0) writes. + * ==================================================*/ + irank = 0; + for (i = 0; i < DIMSIZE; i++) + writedata[i] = irank * DIMSIZE + i; + mpi_off = irank * DIMSIZE; /* Only one process writes */ - if (mpi_rank==irank){ - if (VERBOSE_HI){ - PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); - } - if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, - MPI_BYTE, &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; - }; + if (mpi_rank == irank) { + if (VERBOSE_HI) { + PRINTID; + printf("wrote %d bytes at %ld\n", DIMSIZE, (long) mpi_off); + } + if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, + MPI_BYTE, &mpi_stat)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; + }; }; /* Bcast the return code and */ /* make sure all writing are done before reading. */ MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("MPI_Bcast: mpi_err = %d\n", mpi_err); + if (VERBOSE_HI) { + PRINTID; + printf("MPI_Bcast: mpi_err = %d\n", mpi_err); } -if (special_request & USEFSYNC){ - /* ================================================== - * Do a file sync. A POSIX compliant filesystem - * should not need this. - * ==================================================*/ - if (VERBOSE_HI) - printf("Apply MPI_File_sync\n"); - /* call file_sync to force the write out */ - if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); - } - MPI_Barrier(MPI_COMM_WORLD); - /* call file_sync to force the write out */ - if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + if (special_request & USEFSYNC) { + /* ================================================== + * Do a file sync. A POSIX compliant filesystem + * should not need this. + * ==================================================*/ + if (VERBOSE_HI) + printf("Apply MPI_File_sync\n"); + /* call file_sync to force the write out */ + if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); + } + MPI_Barrier(MPI_COMM_WORLD); + /* call file_sync to force the write out */ + if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); + } } -} /* This barrier is not necessary because the Bcase or File_sync above */ /* should take care of it. Do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("after MPI_Barrier\n"); + if (VERBOSE_HI) { + PRINTID; + printf("after MPI_Barrier\n"); } /* ================================================== - * Each process reads what process 0 wrote and verify. - * ==================================================*/ - irank=0; - mpi_off = irank*DIMSIZE; + * Each process reads what process 0 wrote and verify. + * ==================================================*/ + irank = 0; + mpi_off = irank * DIMSIZE; if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, - &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; + &mpi_stat)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; }; - for (i=0; i < DIMSIZE; i++){ - expect_val = irank*DIMSIZE + i; - if (readdata[i] != expect_val){ - PRINTID; - printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, - readdata[i], expect_val); - nerrs++; - } + for (i = 0; i < DIMSIZE; i++) { + expect_val = irank * DIMSIZE + i; + if (readdata[i] != expect_val) { + PRINTID; + printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, + readdata[i], expect_val); + nerrs++; + } } MPI_File_close(&fh); - if (VERBOSE_HI){ - PRINTID; - printf("%d data errors detected\n", nerrs); + if (VERBOSE_HI) { + PRINTID; + printf("%d data errors detected\n", nerrs); } mpi_err = MPI_Barrier(MPI_COMM_WORLD); @@ -617,272 +619,268 @@ if (special_request & USEFSYNC){ /* -Function: test_mpio_derived_dtype - -Test Whether the Displacement of MPI derived datatype -(+ File_set_view + MPI_write)works or not on this MPI-IO package -and this platform. - -1. Details for the test: -1) Create two derived datatypes with MPI_Type_create_hindexed: - datatype1: - count = 1, blocklens = 1, offsets = 0, - base type = MPI_BYTE(essentially a char) - datatype2: - count = 1, blocklens = 1, offsets = 1(byte), - base type = MPI_BYTE - -2) Using these two derived datatypes, - Build another derived datatype with MPI_Type_create_struct: - advtype: derived from datatype1 and datatype2 - advtype: - count = 2, blocklens[0] = 1, blocklens[1]=1, - offsets[0] = 0, offsets[1] = 1(byte), - bas_type[0]=datatype1, - bas_type[1] = datatype2; - -3) Setting MPI file view with advtype -4) Writing 2 bytes 1 to 2 using MPI_File_write to a file -5) File content: -Suppose the fill value of the file is 0(most machines indeed do so) -and Fill value is embraced with "() in the following output: -Expected output should be: -1,0,2 - - - -However, at some platforms, for example, IBM AIX(at March 23rd, 2005): -the following values were obtained: -1,2,0 - -The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived datatype(advtype) + Function: test_mpio_derived_dtype + + Test Whether the Displacement of MPI derived datatype + (+ File_set_view + MPI_write)works or not on this MPI-IO package + and this platform. + + 1. Details for the test: + 1) Create two derived datatypes with MPI_Type_create_hindexed: + datatype1: + count = 1, blocklens = 1, offsets = 0, + base type = MPI_BYTE(essentially a char) + datatype2: + count = 1, blocklens = 1, offsets = 1(byte), + base type = MPI_BYTE + + 2) Using these two derived datatypes, + Build another derived datatype with MPI_Type_create_struct: + advtype: derived from datatype1 and datatype2 + advtype: + count = 2, blocklens[0] = 1, blocklens[1]=1, + offsets[0] = 0, offsets[1] = 1(byte), + bas_type[0]=datatype1, + bas_type[1] = datatype2; + + 3) Setting MPI file view with advtype + 4) Writing 2 bytes 1 to 2 using MPI_File_write to a file + 5) File content: + Suppose the fill value of the file is 0(most machines indeed do so) + and Fill value is embraced with "() in the following output: + Expected output should be: + 1,0,2 + + + + However, at some platforms, for example, IBM AIX(at March 23rd, 2005): + the following values were obtained: + 1,2,0 + + The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived datatype(advtype) has been put after the basic datatype(MPI_BYTE) of datatype2. This is a bug. -2. This test will verify whether the complicated derived datatype is working on -the current platform. + 2. This test will verify whether the complicated derived datatype is working on + the current platform. -If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change -the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections. + If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections. -If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that -we can turn off collective IO support for irregular selections. -*/ + If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that + we can turn off collective IO support for irregular selections. + */ static int test_mpio_derived_dtype(char *filename) { MPI_File fh; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; - int i; - MPI_Datatype etype,filetype; - MPI_Datatype adv_filetype,bas_filetype[2]; - MPI_Datatype filetypenew; - MPI_Offset disp; - MPI_Status Status; - MPI_Aint adv_disp[2]; - MPI_Aint offsets[1]; - int blocklens[1],adv_blocklens[2]; - int count,outcount; - int retcode; - - int mpi_rank,mpi_size; - - char buf[3],outbuf[3] = {0}; + int mpi_err_strlen; + int mpi_err; + int i; + MPI_Datatype etype, filetype; + MPI_Datatype adv_filetype, bas_filetype[2]; + MPI_Datatype filetypenew; + MPI_Offset disp; + MPI_Status Status; + MPI_Aint adv_disp[2]; + MPI_Aint offsets[1]; + int blocklens[1], adv_blocklens[2]; + int count, outcount; + int retcode; + + int mpi_rank, mpi_size; + + char buf[3], outbuf[3] = { 0 }; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); retcode = 0; - for(i=0;i<3;i++) - buf[i] = i+1; - + for (i = 0; i < 3; i++) + buf[i] = i + 1; if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE, - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } - disp = 0; + disp = 0; etype = MPI_BYTE; count = 1; blocklens[0] = 1; - offsets[0] = 0; + offsets[0] = 0; - if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, + &filetype)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&filetype))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } count = 1; - blocklens[0]=1; + blocklens[0] = 1; offsets[0] = 1; - if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, + &filetypenew)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&filetypenew))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&filetypenew)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } - outcount = 2; + outcount = 2; adv_blocklens[0] = 1; adv_blocklens[1] = 1; - adv_disp[0] = 0; - adv_disp[1] = 1; - bas_filetype[0] = filetype; - bas_filetype[1] = filetypenew; - - if((mpi_err= MPI_Type_create_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); - return 1; + adv_disp[0] = 0; + adv_disp[1] = 1; + bas_filetype[0] = filetype; + bas_filetype[1] = filetypenew; + + if ((mpi_err = MPI_Type_create_struct(outcount, adv_blocklens, adv_disp, + bas_filetype, &adv_filetype)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&adv_filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_set_view(fh,disp,etype,adv_filetype,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_set_view(fh, disp, etype, adv_filetype, "native", + MPI_INFO_NULL)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_write(fh,buf,3,MPI_BYTE,&Status))!= MPI_SUCCESS){ + if ((mpi_err = MPI_File_write(fh, buf, 3, MPI_BYTE, &Status)) + != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write failed (%s)\n", mpi_err_str); - return 1; - ; + printf("MPI_File_write failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_open(MPI_COMM_WORLD,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, + MPI_INFO_NULL, &fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_set_view(fh,0,MPI_BYTE,MPI_BYTE,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ + if ((mpi_err = MPI_File_set_view(fh, 0, MPI_BYTE, MPI_BYTE, "native", + MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_read(fh,outbuf,3,MPI_BYTE,&Status))!=MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_read failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_read(fh, outbuf, 3, MPI_BYTE, &Status)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_read failed (%s)\n", mpi_err_str); + return 1; } - if(outbuf[2]==2) { - retcode = 0; - } - else { -/* if(mpi_rank == 0) { - printf("complicated derived datatype is NOT working at this platform\n"); - printf("go back to hdf5/config and find the corresponding\n"); - printf("configure-specific file and change ?????\n"); - } -*/ - retcode = -1; - } - - if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + if (outbuf[2] == 2) { + retcode = 0; + } else { + /* if(mpi_rank == 0) { + printf("complicated derived datatype is NOT working at this platform\n"); + printf("go back to hdf5/config and find the corresponding\n"); + printf("configure-specific file and change ?????\n"); + } + */ + retcode = -1; } + if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; + } mpi_err = MPI_Barrier(MPI_COMM_WORLD); - if(retcode == -1) { - if(mpi_rank == 0) { - printf("Complicated derived datatype is NOT working at this platform\n"); - printf(" Please report to help@hdfgroup.org about this problem.\n"); - } - retcode = 1; + if (retcode == -1) { + if (mpi_rank == 0) { + printf( + "Complicated derived datatype is NOT working at this platform\n"); + printf(" Please report to help@hdfgroup.org about this problem.\n"); + } + retcode = 1; } return retcode; } /* -Function: test_mpio_special_collective + Function: test_mpio_special_collective -Test Whether collective IO is still working when more than one process -has no contribution to IO. To properly test this case, at least FOUR -processes are needed. + Test Whether collective IO is still working when more than one process + has no contribution to IO. To properly test this case, at least FOUR + processes are needed. -1. Details for the test: -1) Create one derived datatype with MPI_Type_create_hindexed: + 1. Details for the test: + 1) Create one derived datatype with MPI_Type_create_hindexed: -2) Choosing at least two processes to contribute none for IO with - the buf size inside MPI_Write_at_all to 0. -3) Choosing at least two processes to have real contributions for IO. -4) Do collective IO. + 2) Choosing at least two processes to contribute none for IO with + the buf size inside MPI_Write_at_all to 0. + 3) Choosing at least two processes to have real contributions for IO. + 4) Do collective IO. -2. This test will fail with the MPI-IO package that doesn't support this. For example, -mpich 1.2.6. + 2. This test will fail with the MPI-IO package that doesn't support this. For example, + mpich 1.2.6. -If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change -the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO. + If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO. -If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that -we can turn off the support for special collective IO; currently only special collective IO. -*/ + If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that + we can turn off the support for special collective IO; currently only special collective IO. + */ -static int -test_mpio_special_collective(char *filename) -{ - int mpi_size, mpi_rank; +static int test_mpio_special_collective(char *filename) { + int mpi_size, mpi_rank; MPI_File fh; - MPI_Datatype etype,buftype,filetype; + MPI_Datatype etype, buftype, filetype; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; - char writedata[2*DIMSIZE]; + int mpi_err_strlen; + int mpi_err; + char writedata[2 * DIMSIZE]; char filerep[7] = "native"; - int i; - int count,bufcount; + int i; + int count, bufcount; int blocklens[2]; MPI_Aint offsets[2]; - MPI_Offset mpi_off = 0; - MPI_Status mpi_stat; - int retcode = 0; + MPI_Offset mpi_off = 0; + MPI_Status mpi_stat; + int retcode = 0; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* create MPI data type */ etype = MPI_BYTE; - if(mpi_rank == 0 || mpi_rank == 1) { + if (mpi_rank == 0 || mpi_rank == 1) { count = DIMSIZE; bufcount = 1; } /* end if */ @@ -892,38 +890,32 @@ test_mpio_special_collective(char *filename) } /* end else */ blocklens[0] = count; - offsets[0] = mpi_rank*count; + offsets[0] = mpi_rank * count; blocklens[1] = count; - offsets[1] = (mpi_size+mpi_rank)*count; - - if(count !=0) { - if((mpi_err = MPI_Type_create_hindexed(2, - blocklens, - offsets, - etype, - &filetype)) != MPI_SUCCESS) { + offsets[1] = (mpi_size + mpi_rank) * count; + + if (count != 0) { + if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, + &filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_create_hindexed(2, - blocklens, - offsets, - etype, - &buftype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, + &buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; @@ -931,46 +923,36 @@ test_mpio_special_collective(char *filename) } /* end if */ else { filetype = MPI_BYTE; - buftype = MPI_BYTE; + buftype = MPI_BYTE; } /* end else */ /* Open a file */ - if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, - filename, - MPI_MODE_RDWR | MPI_MODE_CREATE, - MPI_INFO_NULL, - &fh)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } /* end if */ /* each process writes some data */ - for (i=0; i < 2*DIMSIZE; i++) - writedata[i] = (char)(mpi_rank*DIMSIZE + i); + for (i = 0; i < 2 * DIMSIZE; i++) + writedata[i] = (char) (mpi_rank * DIMSIZE + i); /* Set the file view */ - if((mpi_err = MPI_File_set_view(fh, - mpi_off, - MPI_BYTE, - filetype, - filerep, - MPI_INFO_NULL)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_set_view(fh, mpi_off, MPI_BYTE, filetype, filerep, + MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_set_view failed (%s)\n", mpi_err_str); return 1; } /* end if */ /* Collectively write into the file */ - if ((mpi_err = MPI_File_write_at_all(fh, - mpi_off, - writedata, - bufcount, - buftype, - &mpi_stat)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_write_at_all(fh, mpi_off, writedata, bufcount, + buftype, &mpi_stat)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, bufcount, mpi_err_str); + (long) mpi_off, bufcount, mpi_err_str); return 1; } /* end if */ @@ -983,8 +965,8 @@ test_mpio_special_collective(char *filename) /* Perform a barrier */ mpi_err = MPI_Barrier(MPI_COMM_WORLD); - if(retcode != 0) { - if(mpi_rank == 0) { + if (retcode != 0) { + if (mpi_rank == 0) { printf("special collective IO is NOT working at this platform\n"); printf(" Please report to help@hdfgroup.org about this problem.\n"); } /* end if */ @@ -998,71 +980,69 @@ test_mpio_special_collective(char *filename) /* * parse the command line options */ -static int -parse_options(int argc, char **argv) -{ - while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'v': if (*((*argv+1)+1)) - ParseTestVerbosity((*argv+1)+1); - else - SetTestVerbosity(VERBO_MED); - break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: nerrors++; - return(1); - } - } +static int parse_options(int argc, char **argv) { + while (--argc) { + if (**(++argv) != '-') { + break; + } else { + switch (*(*argv + 1)) { + case 'v': + if (*((*argv + 1) + 1)) + ParseTestVerbosity((*argv + 1) + 1); + else + SetTestVerbosity(VERBO_MED); + break; + case 'f': + if (--argc < 1) { + nerrors++; + return (1); + } + if (**(++argv) == '-') { + nerrors++; + return (1); + } + paraprefix = *argv; + break; + case 'h': /* print help message--return with nerrors set */ + return (1); + default: + nerrors++; + return (1); + } + } } /*while*/ /* compose the test filenames */ { - int i, n; - hid_t plist; - - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - H5Pclose(plist); - if (VERBOSE_MED){ - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); - } + int i, n; + hid_t plist; + + plist = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i = 0; i < n; i++) + if (h5_fixname(FILENAME[i], plist, filenames[i], + sizeof(filenames[i])) == NULL) { + printf("h5_fixname failed\n"); + nerrors++; + return (1); + } + H5Pclose(plist); + if (VERBOSE_MED) { + printf("Test filenames are:\n"); + for (i = 0; i < n; i++) + printf(" %s\n", filenames[i]); + } } - return(0); + return (0); } - /* * Show command usage */ -static void -usage(void) -{ +static void usage(void) { printf("Usage: t_mpi [-v] [-f ]\n"); printf("\t-v\tset verbose level (0-9,l,m,h)\n"); printf("\t-f \tfilename prefix\n"); @@ -1072,19 +1052,14 @@ usage(void) /* * return the sum of all errors. */ -static int -errors_sum(int nerrs) -{ +static int errors_sum(int nerrs) { int temp; MPI_Allreduce(&nerrs, &temp, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - return(temp); + return (temp); } - -int -main(int argc, char **argv) -{ - int mpi_size, mpi_rank; /* mpi variables */ +int main(int argc, char **argv) { + int mpi_size, mpi_rank; /* mpi variables */ int ret_code; MPI_Init(&argc, &argv); @@ -1092,78 +1067,76 @@ main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* Attempt to turn off atexit post processing so that in case errors - * happen during the test and the process is aborted, it will not get - * hang in the atexit post processing in which it may try to make MPI - * calls. By then, MPI calls may not work. - */ - if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n"); + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0) { + printf("Failed to turn off atexit processing. Continue.\n"); }; H5open(); - if (parse_options(argc, argv) != 0){ - if (MAINPROCESS) - usage(); - goto finish; + if (parse_options(argc, argv) != 0) { + if (MAINPROCESS) + usage(); + goto finish; } - if (MAINPROCESS){ - printf("===================================\n"); - printf("MPI functionality tests\n"); - printf("===================================\n"); + if (MAINPROCESS) { + printf("===================================\n"); + printf("MPI functionality tests\n"); + printf("===================================\n"); } if (VERBOSE_MED) - h5_show_hostname(); + h5_show_hostname(); - fapl = H5Pcreate (H5P_FILE_ACCESS); + fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* set alarm. */ ALARM_ON; - /*======================================= - * MPIO 1 write Many read test - *=======================================*/ + * MPIO 1 write Many read test + *=======================================*/ MPI_BANNER("MPIO 1 write Many read test..."); ret_code = test_mpio_1wMr(filenames[0], USENONE); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /* test atomicity and file sync in high verbose mode only */ /* since they often hang when broken and PHDF5 does not use them. */ - if (VERBOSE_HI){ - MPI_BANNER("MPIO 1 write Many read test with atomicity..."); - ret_code = test_mpio_1wMr(filenames[0], USEATOM); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - - MPI_BANNER("MPIO 1 write Many read test with file sync..."); - ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - } + if (VERBOSE_HI) { + MPI_BANNER("MPIO 1 write Many read test with atomicity..."); + ret_code = test_mpio_1wMr(filenames[0], USEATOM); + ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + MPI_BANNER("MPIO 1 write Many read test with file sync..."); + ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); + ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + } /*======================================= - * MPIO MPIO File size range test - *=======================================*/ + * MPIO MPIO File size range test + *=======================================*/ MPI_BANNER("MPIO File size range test..."); #ifndef H5_HAVE_WIN32_API ret_code = test_mpio_gb_file(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } #else if (mpi_rank==0) @@ -1171,30 +1144,30 @@ main(int argc, char **argv) #endif /*======================================= - * MPIO independent overlapping writes - *=======================================*/ + * MPIO independent overlapping writes + *=======================================*/ MPI_BANNER("MPIO independent overlapping writes..."); ret_code = test_mpio_overlap_writes(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= - * MPIO complicated derived datatype test - *=======================================*/ + * MPIO complicated derived datatype test + *=======================================*/ MPI_BANNER("MPIO complicated derived datatype test..."); ret_code = test_mpio_derived_dtype(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= - * MPIO special collective IO test - *=======================================*/ + * MPIO special collective IO test + *=======================================*/ if (mpi_size < 4) { MPI_BANNER("MPIO special collective io test SKIPPED."); if (mpi_rank == 0) @@ -1206,28 +1179,26 @@ main(int argc, char **argv) MPI_BANNER("MPIO special collective io test..."); ret_code = test_mpio_special_collective(filenames[0]); -sc_finish: - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + sc_finish: ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } - -finish: + finish: /* make sure all processes are finished before final report, cleanup - * and exit. - */ + * and exit. + */ MPI_Barrier(MPI_COMM_WORLD); - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors){ - printf("***MPI tests detected %d errors***\n", nerrors); - } - else{ - printf("MPI tests finished with no errors\n"); - } - printf("===================================\n"); + if (MAINPROCESS) { /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) { + printf("***MPI tests detected %d errors***\n", nerrors); + } + else { + printf("MPI tests finished with no errors\n"); + } + printf("===================================\n"); } /* turn off alarm */ @@ -1240,6 +1211,6 @@ finish: MPI_Finalize(); /* cannot just return (nerrors) because exit code is limited to 1byte */ - return(nerrors!=0); + return (nerrors != 0); } -- cgit v0.12 From 88ab4b144bcf8454be9eff8800706c0abb404de1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jul 2019 12:07:41 -0500 Subject: fix var name --- testpar/t_mpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 157a09f..41acf7a 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -460,7 +460,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF) { #ifdef H5_HAVE_GETHOSTNAME - if(HDgethostname(hostname, sizeof(host_name)) < 0) { + if(HDgethostname(hostname, sizeof(hostname)) < 0) { printf("gethostname failed\n"); hostname[0] = '\0'; } -- cgit v0.12 From eb0d1e4e8eff2d401f593e7f01194f8f323cbfca Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jul 2019 16:30:27 -0500 Subject: HDFFV-10581 add missed change and release note. --- c++/src/CMakeLists.txt | 2 +- release_docs/RELEASE.txt | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 8e7f8be..b141a5e 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -139,7 +139,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries) endif () install ( diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7c9bbfa..72a3fb1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,15 @@ New Features Configuration: ------------- + - Windows PDB files are installed incorrectly + + For static builds, the PDB files for windows should be installed next + to the static libraries in the lib folder. Also the debug versions of + libraries and PDB files are now correctly built using the default + CMAKE_DEBUG_POSTFIX setting. + + (ADB - 2019/07/09, HDFFV-10581) + - Add option to build only shared libs A request was made to prevent building static libraries and only build @@ -286,13 +295,13 @@ Bug Fixes since HDF5-1.10.3 release together with library high bound setting to H5F_LIBVER_V18. When setting non-default file space info in fcpl via - H5Pset_file_space_strategy() and then creating a file with + H5Pset_file_space_strategy() and then creating a file with both high and low library bounds set to H5F_LIBVER_V18 in fapl, the library succeeds in creating the file. File creation should fail because the feature of setting non-default file space info does not exist in library release 1.8 or earlier. - This was fixed by setting and checking the proper version in the + This was fixed by setting and checking the proper version in the file space info message based on the library low and high bounds when creating and opening the HDF5 file. -- cgit v0.12 From db7c43d375f6997dfc44d6153e7b015da571a8c9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 9 Jul 2019 22:15:36 -0500 Subject: Updates to warnhist script, along with a few cleanups, and add some comments to warning cleanups that are a bit obscure. --- bin/warnhist | 25 ++++++++++++++++++------- src/H5FDfamily.c | 18 ++++++++++++++++++ src/H5FDmulti.c | 2 +- src/H5Fint.c | 4 ++-- src/H5PLpath.c | 2 +- src/H5Pint.c | 2 +- src/H5system.c | 4 ++-- test/big.c | 9 +++++++++ test/error_test.c | 9 +++++++++ test/fheap.c | 9 +++++++++ test/file_image.c | 9 +++++++++ test/h5test.c | 21 ++++++++++++++++++++- test/use_disable_mdc_flushes.c | 8 ++++---- test/vfd.c | 27 +++++++++++++++++++++++++++ tools/lib/h5diff_array.c | 2 +- tools/lib/h5trav.c | 2 +- tools/src/h5repack/h5repack_refs.c | 2 +- tools/test/perform/pio_engine.c | 1 - tools/test/perform/sio_engine.c | 37 +++++++++++++++++++++++-------------- 19 files changed, 156 insertions(+), 37 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 90f8601..7e56246 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -252,8 +252,18 @@ while (<>) { print "Line is a null string! Input line #$. is: '$_'"; next } + # Check for non-GCC warning (Solaris/Oracle?) + } elsif($_ =~ /^\".*, line [0-9]+: *[Ww]arning:.*/) { + ($name, $toss, $warning, $extra, $extra2) = split /\:/, $_; + ($name, $line) = split /\,/, $name; + $name =~ s/^\"//g; + $name =~ s/\"$//g; + $line =~ s/^\s*line\s*//g; +# print "name:'", $name, "'-'", $line, "'\n"; +# print "warning:'", $warning, "'\n"; } else { # Check for 'character offset' field appended to file & line # + # (This is probably specific to GCC) if($_ =~ /^.*[0-9]+\:[0-9]+\:/) { ($name, $line, $offset, $toss, $warning, $extra, $extra2) = split /\:/, $_; } else { @@ -339,9 +349,10 @@ while (<>) { $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))//g; } - # Genericize C/C++ '' and printf format '%' into '-' - if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/) { - $warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/'-'/g; + # Genericize C/C++ '', printf format '%', and + # "unknown warning group" into '-' + if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=\ ]*'/) { + $warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=\ ]*'/'-'/g; } if($warning =~ /'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/) { $warning =~ s/'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/'-'/g; @@ -370,8 +381,8 @@ while (<>) { } # Genericize standalone numbers in warnings - if($warning =~ /\s-?[0-9]+\s/) { - $warning =~ s/\s-?[0-9]+\s/\ -\ /g; + if($warning =~ /(\s|')-?[0-9]+(\s|')/) { + $warning =~ s/-?[0-9]+/-/g; } # Genericize unusual GCC/G++/GFORTRAN warnings that aren't handled above @@ -442,7 +453,7 @@ for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) { for my $y (sort {$warn_file{$x}{$b} <=> $warn_file{$x}{$a}} keys(%{$warn_file{$x}})) { printf ("\t%4d - %s\n", $warn_file{$x}{$y}, $y); if(exists $options{l}) { - my $lines = join ", ", sort {$a <=> $b} keys $warn_file_line{$x}{$y}; + my $lines = join ", ", sort {$a <=> $b} keys %{$warn_file_line{$x}{$y}}; printf("\t\tLines: $lines \n"); } } @@ -480,7 +491,7 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) { for my $y (sort {$file_warn{$x}{$b} <=> $file_warn{$x}{$a}} keys(%{$file_warn{$x}})) { printf ("\t%4d - %s\n", $file_warn{$x}{$y}, $y); if(exists $options{l}) { - my $lines = join ", ", sort {$a <=> $b} keys $file_warn_line{$x}{$y}; + my $lines = join ", ", sort {$a <=> $b} keys %{$file_warn_line{$x}{$y}}; printf("\t\tLines: $lines \n"); } } diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index c8893f9..bc00403 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -613,6 +613,14 @@ done: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * memb_name & temp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static H5FD_t * H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) @@ -763,6 +771,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_family_open() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -942,6 +951,14 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() call with + * memb_name in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) { @@ -1008,6 +1025,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b1d3430..acd128c 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -771,7 +771,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) buf += nseen*2*8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t*)((void *)x); + ap = (haddr_t*)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; diff --git a/src/H5Fint.c b/src/H5Fint.c index 6879d46..758900b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -572,11 +572,11 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out fname_len = HDstrlen(file_name); /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 4))) + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 4), "%s%s%s", prefix, + HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name); done: diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 5125839..44d9cb9 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -673,7 +673,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 5 /*\0*/; + len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ + 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") diff --git a/src/H5Pint.c b/src/H5Pint.c index 911a126..a9dc363 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5235,7 +5235,7 @@ H5P__get_class_path(H5P_genclass_t *pclass) /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 3 + 1; + ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") diff --git a/src/H5system.c b/src/H5system.c index bd5f9c5..1d47d13 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1301,11 +1301,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) * Allocate a buffer to hold path1 + path2 + possibly the delimiter * + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 4))) + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 4), "%s%s%s", path1, + HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ diff --git a/test/big.c b/test/big.c index b3105eb..46acc5e 100644 --- a/test/big.c +++ b/test/big.c @@ -275,6 +275,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int enough_room(hid_t fapl) { @@ -315,6 +323,7 @@ done: return ret_value; } +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/error_test.c b/test/error_test.c index 5356fa7..44f6210 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -320,6 +320,14 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'full_desc' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_long_desc(void) { @@ -374,6 +382,7 @@ error: return -1; } /* end test_long_desc() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/fheap.c b/test/fheap.c index 1ad5c11..ef47d94 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -539,6 +539,14 @@ get_fill_size(const fheap_test_param_t *tparam) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * test_desc in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *keep_ids, size_t *fill_size) @@ -567,6 +575,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, /* Success */ return(0); } /* end begin_test() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/file_image.c b/test/file_image.c index 86dd13e..ddbec80 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -672,6 +672,14 @@ error: * ****************************************************************************** */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'member_file_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int test_get_file_image(const char * test_banner, const int file_name_num, @@ -938,6 +946,7 @@ test_get_file_image(const char * test_banner, error: return 1; } /* end test_get_file_image() */ +#pragma GCC diagnostic pop /****************************************************************************** diff --git a/test/h5test.c b/test/h5test.c index 99b2010..d83c6e7 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -190,6 +190,14 @@ h5_clean_files(const char *base_name[], hid_t fapl) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * sub_filename in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" void h5_delete_test_file(const char *base_name, hid_t fapl) { @@ -239,6 +247,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl) return; } /* end h5_delete_test_file() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -1344,6 +1353,14 @@ h5_dump_info_object(MPI_Info info) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * temp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl) { @@ -1445,12 +1462,14 @@ h5_get_file_size(const char *filename, hid_t fapl) return(-1); } /* end get_file_size() */ +#pragma GCC diagnostic pop /* * This routine is designed to provide equivalent functionality to 'printf' * and allow easy replacement for environments which don't have stdin/stdout * available. (i.e. Windows & the Mac) */ +H5_ATTR_FORMAT(printf, 1, 2) int print_func(const char *format, ...) { @@ -2016,7 +2035,7 @@ error: * *------------------------------------------------------------------------- */ -const char * +H5_ATTR_PURE const char * h5_get_version_string(H5F_libver_t libver) { return(LIBVER_NAMES[libver]); diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 340f578..67e2226 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -108,28 +108,28 @@ parse_option(int argc, char * const argv[]) filename_g = optarg; break; case 'n': /* number of planes to write/read */ - if ((nplanes_g = atoi(optarg)) <= 0){ + if ((nplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 's': /* use swmr file open mode */ - if ((use_swmr_g = atoi(optarg)) < 0){ + if ((use_swmr_g = HDatoi(optarg)) < 0){ fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); usage(progname_g); Hgoto_error(-1); }; break; case 'y': /* Number of planes per chunk */ - if ((chunkplanes_g = atoi(optarg)) <= 0){ + if ((chunkplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'z': /* size of chunk=(z,z) */ - if ((chunksize_g = atoi(optarg)) <= 0){ + if ((chunksize_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); diff --git a/test/vfd.c b/test/vfd.c index 2305593..b196406 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -769,6 +769,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'first_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_family_opens(char *fname, hid_t fa_pl) { @@ -825,6 +833,7 @@ test_family_opens(char *fname, hid_t fa_pl) error: return -1; } /* end test_family_opens() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -1027,6 +1036,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'newname_individual', etc. in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_family_compat(void) { @@ -1110,6 +1127,7 @@ error: return -1; } /* end test_family_compat() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -1125,6 +1143,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'sf_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_multi_opens(char *fname) { @@ -1142,6 +1168,7 @@ test_multi_opens(char *fname) return(fid >= 0 ? FAIL : SUCCEED); } /* end test_multi_opens() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index a9a87c9..2a45913 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -831,7 +831,7 @@ static hsize_t diff_datum( nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index ecc1fae..5519437 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(udata->is_absolute) { size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; - size_t new_name_len = base_len + add_slash + HDstrlen(path) + 4; + size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if(NULL == (new_name = (char*)HDmalloc(new_name_len))) return(H5_ITER_ERROR); diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 610c21c..f5846ba 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -692,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in, size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt)<0) + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ continue; HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); } /* if */ diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 43a0f64..d47cd43 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -318,7 +318,6 @@ do_pio(parameters param) set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - hrc == SUCCESS; set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 11de229..ed15fa5 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -1262,7 +1262,15 @@ done: * Programmer: Albert Cheng 2001/12/12 * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ - static void +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'temp' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +static void do_cleanupfile(iotype iot, char *filename) { char temp[2048]; @@ -1275,12 +1283,12 @@ do_cleanupfile(iotype iot, char *filename) if (clean_file_g){ switch (iot) { - case POSIXIO: - HDremove(filename); - break; + case POSIXIO: + HDremove(filename); + break; - case HDF5: - driver = H5Pget_driver(fapl); + case HDF5: + driver = H5Pget_driver(fapl); if (driver == H5FD_FAMILY) { for (j = 0; /*void*/; j++) { @@ -1313,14 +1321,15 @@ do_cleanupfile(iotype iot, char *filename) HDremove(filename); } H5Pclose(fapl); - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - HDassert(0 && "Unknown IO type"); - break; - } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + HDassert(0 && "Unknown IO type"); + break; + } } } +#pragma GCC diagnostic pop -- cgit v0.12 From 097d6037af8dd8d8e5364ae0a731b9843cd4aef8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 04:50:57 -0700 Subject: Cleaned up test_dset_append and enabled the bug1/2 tests. --- hl/test/test_dset_append.c | 996 ++++++++++++++++++++++----------------------- 1 file changed, 496 insertions(+), 500 deletions(-) diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index d890481..9d466b5 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -11,38 +11,39 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #include #include + #include "h5hltest.h" #include "H5DOpublic.h" -#include #if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) # define H5_ZLIB_HEADER "zlib.h" #endif #if defined(H5_ZLIB_HEADER) -# include H5_ZLIB_HEADER /* "zlib.h" */ +#include H5_ZLIB_HEADER /* "zlib.h" */ #endif -#define FILE "test_append.h5" -#define DNAME_NOTSET "dataset_notset" -#define DNAME_UNLIM "dataset_unlim" -#define DNAME_LESS "dataset_less" -#define DNAME_VARY "dataset_vary" -#define DNAME_ROW "dataset_row" -#define DNAME_COLUMN "dataset_column" -#define DBUGNAME1 "dataset_bug1" -#define DBUGNAME2 "dataset_bug2" +#define FILENAME "test_append.h5" +#define DNAME_NOTSET "dataset_notset" +#define DNAME_UNLIM "dataset_unlim" +#define DNAME_LESS "dataset_less" +#define DNAME_VARY "dataset_vary" +#define DNAME_ROW "dataset_row" +#define DNAME_COLUMN "dataset_column" +#define DBUGNAME1 "dataset_bug1" +#define DBUGNAME2 "dataset_bug2" /*------------------------------------------------------------------------- - * Function: test_dataset_append_notset + * Function: test_dataset_append_notset * - * Purpose: Verify that H5DOappend works properly with default dapl. - * That is, H5Pset_append_flush() is not used to set boundary - * and callback in dapl. + * Purpose: Verify that H5DOappend works properly with default dapl. + * That is, H5Pset_append_flush() is not used to set boundary + * and callback in dapl. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Aug 2016 * @@ -51,68 +52,68 @@ static int test_dataset_append_notset(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10]; /* The data buffers */ - int i, j; /* Local index variables */ - h5_stat_t sb1, sb2; /* File info */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10]; /* The data buffers */ + int i, j; /* Local index variables */ + h5_stat_t sb1, sb2; /* File info */ TESTING("Append flush with H5DOappend()--append rows with default dapl"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = (i * 10) + (j + 1); - /* Append without boundary, callback and flush */ - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - FAIL_STACK_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = (i * 10) + (j + 1); + /* Append without boundary, callback and flush */ + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + FAIL_STACK_ERROR; } /* end for */ /* File size when not flushed */ - if(HDstat(FILE, &sb1) < 0) - TEST_ERROR; + if(HDstat(FILENAME, &sb1) < 0) + TEST_ERROR; /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* File size after flushing */ - if(HDstat(FILE, &sb2) < 0) - TEST_ERROR; + if(HDstat(FILENAME, &sb2) < 0) + TEST_ERROR; /* File size before flushing should be less */ if(sb1.st_size > sb2.st_size) - TEST_ERROR; + TEST_ERROR; /* Closing */ if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -120,10 +121,10 @@ test_dataset_append_notset(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; @@ -148,14 +149,14 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void } /*------------------------------------------------------------------------- - * Function: test_dataset_append_rows_columns + * Function: test_dataset_append_rows_columns * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to a dataset - * with 2 extendible dimensions. + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to a dataset + * with 2 extendible dimensions. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -164,91 +165,91 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void static int test_dataset_append_rows_columns(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* The data buffers */ - int buf[6][13], rbuf[6][13]; /* The data buffers */ + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* The data buffers */ + int buf[6][13], rbuf[6][13]; /* The data buffers */ - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ - int i, j; /* Local index variables */ + int i, j; /* Local index variables */ TESTING("Append flush with H5DOappend()--append rows & columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -257,33 +258,33 @@ test_dataset_append_rows_columns(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_UNLIM, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -291,25 +292,25 @@ test_dataset_append_rows_columns(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_rows_columns() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_rows + * Function: test_dataset_append_rows * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows to a dataset with - * one extendible dimension (row). + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows to a dataset with + * one extendible dimension (row). * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -318,71 +319,71 @@ error: static int test_dataset_append_rows(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10]; /* The data buffer */ - int buf[6][10], rbuf[6][10]; /* The data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 0}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10]; /* The data buffer */ + int buf[6][10], rbuf[6][10]; /* The data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 0}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 10; j++) + for(j = 0; j < 10; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -391,33 +392,33 @@ test_dataset_append_rows(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_ROW, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 10; j++) + for(j = 0; j < 10; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -425,25 +426,25 @@ test_dataset_append_rows(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_rows() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_columns + * Function: test_dataset_append_columns * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending columns to a dataset - * with one extendible dimension (column). + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending columns to a dataset + * with one extendible dimension (column). * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -452,72 +453,72 @@ error: static int test_dataset_append_columns(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {6, 0}; /* Current dimension sizes */ - hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int cbuf[6]; /* The data buffer */ - int buf[6][3], rbuf[6][3]; /* The data buffers */ - int i, j; /* Local index variable */ - - hsize_t boundary[2] = {0, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {6, 0}; /* Current dimension sizes */ + hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int cbuf[6]; /* The data buffer */ + int buf[6][3], rbuf[6][3]; /* The data buffers */ + int i, j; /* Local index variable */ + + hsize_t boundary[2] = {0, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 3) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 3) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 3; j++) + for(j = 0; j < 3; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -526,33 +527,33 @@ test_dataset_append_columns(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_COLUMN, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 3; j++) + for(j = 0; j < 3; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -560,33 +561,34 @@ test_dataset_append_columns(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_columns() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_BUG1 + * Function: test_dataset_append_BUG1 * - * Purpose: Verify that the object flush property and the append flush property + * Purpose: Verify that the object flush property and the append flush property * are working properly when appending rows and columns to an * extendible dataset. - * A BUG occurs: - * when the extendible dataset is set up as follows: - * hsize_t dims[2] = {0, 10}; - * hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; - * when append 6 rows and 3 columns to the dataset; - * The data is correct when the dataset is read at this point; - * The data is incorrect when the dataset is closed, opened again, and read at this point; - * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. * - * Return: Success: 0 - * Failure: 1 + * A BUG occurs: + * when the extendible dataset is set up as follows: + * hsize_t dims[2] = {0, 10}; + * hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; + * when append 6 rows and 3 columns to the dataset; + * The data is correct when the dataset is read at this point; + * The data is incorrect when the dataset is closed, opened again, and read at this point; + * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. + * + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -595,126 +597,124 @@ error: static int test_dataset_append_BUG1(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property */ - hid_t dapl = -1; /* Dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* The data buffers */ - int buf[6][13], rbuf[6][13]; /* The data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* Dataset creation property */ + hid_t dapl = -1; /* Dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* The data buffers */ + int buf[6][13], rbuf[6][13]; /* The data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows & columns--BUG1"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#ifdef BUG1 HDmemset(rbuf, 0, sizeof(rbuf)); /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen(fid, DBUGNAME1, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#endif /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -722,33 +722,34 @@ test_dataset_append_BUG1(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(dapl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(dapl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_BUG1() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_BUG2 + * Function: test_dataset_append_BUG2 * - * Purpose: Verify that the object flush property and the append flush property + * Purpose: Verify that the object flush property and the append flush property * are working properly when appending rows and columns to an * extendible dataset. - * A BUG occurs: - * when the extendible dataset is set up as follows: - * hsize_t dims[2] = {0, 10}; - * hsize_t maxdims[2] = {50, H5S_UNLIMITED}; - * when append 6 rows and 3 columns to the dataset; - * The data is correct when the dataset is read at this point; - * The data is incorrect when the dataset is closed, opened again, and read at this point; - * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. * - * Return: Success: 0 - * Failure: 1 + * A BUG occurs: + * when the extendible dataset is set up as follows: + * hsize_t dims[2] = {0, 10}; + * hsize_t maxdims[2] = {50, H5S_UNLIMITED}; + * when append 6 rows and 3 columns to the dataset; + * The data is correct when the dataset is read at this point; + * The data is incorrect when the dataset is closed, opened again, and read at this point; + * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. + * + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -757,127 +758,125 @@ error: static int test_dataset_append_BUG2(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property */ - hid_t dapl = -1; /* Dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* Dataset creation property */ + hid_t dapl = -1; /* Dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows & columns--BUG2"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#ifdef BUG2 HDmemset(rbuf, 0, sizeof(rbuf)); /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen(fid, DBUGNAME2, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#endif /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -885,11 +884,11 @@ test_dataset_append_BUG2(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(dapl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(dapl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; @@ -897,15 +896,15 @@ error: /*------------------------------------------------------------------------- - * Function: test_dataset_append_less + * Function: test_dataset_append_less * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to an - * extendible dataset where the append size is less than the boundary - * size. + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to an + * extendible dataset where the append size is less than the boundary + * size. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -914,93 +913,93 @@ error: static int test_dataset_append_less(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[20], cbuf[6][3]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j, k; /* Local index variables */ - - hsize_t boundary[2] = {3, 3}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[20], cbuf[6][3]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j, k; /* Local index variables */ + + hsize_t boundary[2] = {3, 3}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append size < boundary size"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append to the dataset 2 rows at a time for 3 times */ for(i = 0, k = 0; i < 6; i++) { - for(j = 0; j < 10; j++, k++) - buf[i][j] = lbuf[k] = (i * 10) + (j + 1); - - if((i + 1) % 2 == 0) { - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; - k = 0; - } /* end if */ + for(j = 0; j < 10; j++, k++) + buf[i][j] = lbuf[k] = (i * 10) + (j + 1); + + if((i + 1) % 2 == 0) { + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; + k = 0; + } /* end if */ } /* end for */ /* Verify the # of appends */ if(append_ct != 2) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 2) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset, once */ for(i = 0; i < 3; i++) - for(j = 0; j < 6; j++, k++) - cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + for(j = 0; j < 6; j++, k++) + cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 3) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 3) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -1009,33 +1008,33 @@ test_dataset_append_less(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_LESS, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -1043,29 +1042,29 @@ test_dataset_append_less(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_less() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_vary + * Function: test_dataset_append_vary * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to an - * extendible dataset where - * row: the append size is 3 times of the boundary size - * the append callback/flush is performed on the 1st boundary hit - * column: the boundary is greater than the append size - * the boundary is not hit at all + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to an + * extendible dataset where + * row: the append size is 3 times of the boundary size + * the append callback/flush is performed on the 1st boundary hit + * column: the boundary is greater than the append size + * the boundary is not hit at all * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -1074,88 +1073,88 @@ error: static int test_dataset_append_vary(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[60], cbuf[6][3]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j, k; /* Local index variables */ - - hsize_t boundary[2] = {3, 7}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[60], cbuf[6][3]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j, k; /* Local index variables */ + + hsize_t boundary[2] = {3, 7}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append & boundary size vary"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset, once */ for(i = 0, k = 0; i < 6; i++) - for(j = 0; j < 10; j++, k++) - buf[i][j] = lbuf[k] = (i * 10) + (j + 1); + for(j = 0; j < 10; j++, k++) + buf[i][j] = lbuf[k] = (i * 10) + (j + 1); if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)6, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 1) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 1) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset, once */ for(i = 0; i < 3; i++) - for(j = 0; j < 6; j++, k++) - cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + for(j = 0; j < 6; j++, k++) + cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 1) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 1) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -1164,33 +1163,33 @@ test_dataset_append_vary(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_VARY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -1198,24 +1197,23 @@ test_dataset_append_vary(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_vary() */ /*------------------------------------------------------------------------- - * Function: Main function + * Function: Main function * - * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush() - * along with H5DOappend(). + * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush() + * along with H5DOappend(). * - * Return: Success: 0 - * Failure: 1 + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Vailin Choi; Jan 2014 * @@ -1223,69 +1221,67 @@ error: */ int main(void) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - unsigned flush_ct = 0; /* The # of flushes */ - int nerrors = 0; /* The # of errors encountered */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + unsigned flush_ct = 0; /* The # of flushes */ + int nerrors = 0; /* The # of errors encountered */ /* Get a copy of file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to use the latest library format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set object flush property */ if(H5Pset_object_flush_cb(fapl, flush_func, &flush_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the test file */ - if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR; + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR; nerrors += test_dataset_append_notset(fid); nerrors += test_dataset_append_rows(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_columns(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_rows_columns(fid); -#ifdef BUG1_BUG2 /* * The following tests illustrate the scenarios when H5DOappend does not work with extensible array indexing: - * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible - * - the dataset expands along 1 dimension and then expands along the other dimension + * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible + * - the dataset expands along 1 dimension and then expands along the other dimension */ - flush_ct = 0; /* Reset flush counter */ - nerrors += test_dataset_append_BUG1(fid); + flush_ct = 0; /* Reset flush counter */ + nerrors += test_dataset_append_BUG1(fid); - flush_ct = 0; /* Reset flush counter */ - nerrors += test_dataset_append_BUG2(fid); -#endif + flush_ct = 0; /* Reset flush counter */ + nerrors += test_dataset_append_BUG2(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_less(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_vary(fid); /* Closing */ if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Check for errors */ if(nerrors) goto error; - return 0; + return EXIT_SUCCESS; error: - return 1; + return EXIT_FAILURE; } -- cgit v0.12 From 2015fa59fece3da35c27c7084ca9e0fd0dd6af8e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jul 2019 09:43:15 -0500 Subject: Remove tab characters --- src/H5FDmulti.c | 1210 +++++++++++++++++++++++++++---------------------------- 1 file changed, 605 insertions(+), 605 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index acd128c..19aa0df 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, November 10, 1997 - * - * Purpose: Implements a file driver which dispatches I/O requests to - * other file drivers depending on the purpose of the address - * region being accessed. For instance, all meta-data could be - * place in one file while all raw data goes to some other file. - * This also serves as an example of coding a complex file driver, - * therefore, it should not use any non-public definitions. + * Programmer: Robb Matzke + * Monday, November 10, 1997 + * + * Purpose: Implements a file driver which dispatches I/O requests to + * other file drivers depending on the purpose of the address + * region being accessed. For instance, all meta-data could be + * place in one file while all raw data goes to some other file. + * This also serves as an example of coding a complex file driver, + * therefore, it should not use any non-public definitions. */ #include #include @@ -30,23 +30,23 @@ #ifndef FALSE -#define FALSE 0 +#define FALSE 0 #endif #ifndef TRUE -#define TRUE 1 +#define TRUE 1 #endif /* Loop through all mapped files */ -#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \ - H5FD_mem_t ITER, LOOPVAR; \ - unsigned SEEN[H5FD_MEM_NTYPES]; \ - \ - memset(SEEN, 0, sizeof SEEN); \ +#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \ + H5FD_mem_t ITER, LOOPVAR; \ + unsigned SEEN[H5FD_MEM_NTYPES]; \ + \ + memset(SEEN, 0, sizeof SEEN); \ for (ITER=H5FD_MEM_SUPER; ITER0 && LOOPVAR0 && LOOPVARsizeof(meta_name) - QK & JK - 2013/01/17 */ - strncpy(meta_name, meta_ext, sizeof(meta_name)); + strncpy(meta_name, meta_ext, sizeof(meta_name)); meta_name[sizeof(meta_name) - 1] = '\0'; } - else - sprintf(meta_name, "%%s%s", meta_ext); + else + sprintf(meta_name, "%%s%s", meta_ext); } else { - strncpy(meta_name, "%s.meta", sizeof(meta_name)); + strncpy(meta_name, "%s.meta", sizeof(meta_name)); meta_name[sizeof(meta_name) - 1] = '\0'; } memb_name[H5FD_MEM_SUPER] = meta_name; /* process raw filename */ if(raw_ext) { - if(strstr(raw_ext, "%s")) { + if(strstr(raw_ext, "%s")) { /* Note: this doesn't accommodate for when the '%s' in the user's * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17 */ - strncpy(raw_name, raw_ext, sizeof(raw_name)); + strncpy(raw_name, raw_ext, sizeof(raw_name)); raw_name[sizeof(raw_name) - 1] = '\0'; } - else - sprintf(raw_name, "%%s%s", raw_ext); + else + sprintf(raw_name, "%%s%s", raw_ext); } else { - strncpy(raw_name, "%s.raw", sizeof(raw_name)); + strncpy(raw_name, "%s.raw", sizeof(raw_name)); raw_name[sizeof(raw_name) - 1] = '\0'; } memb_name[H5FD_MEM_DRAW] = raw_name; @@ -343,96 +343,96 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE); } - + /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_multi + * Function: H5Pset_fapl_multi * - * Purpose: Sets the file access property list FAPL_ID to use the multi - * driver. The MEMB_MAP array maps memory usage types to other - * memory usage types and is the mechanism which allows the - * caller to specify how many files are created. The array - * contains H5FD_MEM_NTYPES entries which are either the value - * H5FD_MEM_DEFAULT or a memory usage type and the number of - * unique values determines the number of files which are - * opened. For each memory usage type which will be associated - * with a file the MEMB_FAPL array should have a property list - * and the MEMB_NAME array should be a name generator (a - * printf-style format with a %s which will be replaced with the - * name passed to H5FDopen(), usually from H5Fcreate() or - * H5Fopen()). + * Purpose: Sets the file access property list FAPL_ID to use the multi + * driver. The MEMB_MAP array maps memory usage types to other + * memory usage types and is the mechanism which allows the + * caller to specify how many files are created. The array + * contains H5FD_MEM_NTYPES entries which are either the value + * H5FD_MEM_DEFAULT or a memory usage type and the number of + * unique values determines the number of files which are + * opened. For each memory usage type which will be associated + * with a file the MEMB_FAPL array should have a property list + * and the MEMB_NAME array should be a name generator (a + * printf-style format with a %s which will be replaced with the + * name passed to H5FDopen(), usually from H5Fcreate() or + * H5Fopen()). * - * If RELAX is set then opening an existing file for read-only - * access will not fail if some file members are missing. This - * allows a file to be accessed in a limited sense if just the - * meta data is available. + * If RELAX is set then opening an existing file for read-only + * access will not fail if some file members are missing. This + * allows a file to be accessed in a limited sense if just the + * meta data is available. * - * Defaults: Default values for each of the optional arguments are: + * Defaults: Default values for each of the optional arguments are: * - * memb_map: The default member map has the value - * H5FD_MEM_DEFAULT for each element. + * memb_map: The default member map has the value + * H5FD_MEM_DEFAULT for each element. * - * memb_fapl: The value H5P_DEFAULT for each element. + * memb_fapl: The value H5P_DEFAULT for each element. * - * memb_name: The string `%s-X.h5' where `X' is one of the - * letters `s' (H5FD_MEM_SUPER), - * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW), - * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), - * `o' (H5FD_MEM_OHDR). + * memb_name: The string `%s-X.h5' where `X' is one of the + * letters `s' (H5FD_MEM_SUPER), + * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW), + * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), + * `o' (H5FD_MEM_OHDR). * - * memb_addr: The value HADDR_UNDEF for each element. + * memb_addr: The value HADDR_UNDEF for each element. * * - * Example: To set up a multi file access property list which partitions - * data into meta and raw files each being 1/2 of the address - * space one would say: + * Example: To set up a multi file access property list which partitions + * data into meta and raw files each being 1/2 of the address + * space one would say: * - * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - * hid_t memb_fapl[H5FD_MEM_NTYPES]; - * const char *memb[H5FD_MEM_NTYPES]; - * haddr_t memb_addr[H5FD_MEM_NTYPES]; + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * hid_t memb_fapl[H5FD_MEM_NTYPES]; + * const char *memb[H5FD_MEM_NTYPES]; + * haddr_t memb_addr[H5FD_MEM_NTYPES]; * - * // The mapping... - * for (mt=0; mt=H5FD_MEM_NTYPES) + /* Map usage type */ + mmt = memb_map[mt]; + if (mmt<0 || mmt>=H5FD_MEM_NTYPES) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1) - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; + if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - /* - * All members of MEMB_FAPL must be either defaults or actual file - * access property lists. - */ - if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) + /* + * All members of MEMB_FAPL must be either defaults or actual file + * access property lists. + */ + if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1) - /* All names must be defined */ - if (!memb_name[mmt] || !memb_name[mmt][0]) + /* All names must be defined */ + if (!memb_name[mmt] || !memb_name[mmt][0]) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1) } @@ -506,30 +506,30 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, return H5Pset_driver(fapl_id, H5FD_MULTI, &fa); } - + /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_multi + * Function: H5Pget_fapl_multi * - * Purpose: Returns information about the multi file access property - * list though the function arguments which are the same as for - * H5Pset_fapl_multi() above. + * Purpose: Returns information about the multi file access property + * list though the function arguments which are the same as for + * H5Pset_fapl_multi() above. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, - hid_t *memb_fapl/*out*/, char **memb_name/*out*/, - haddr_t *memb_addr/*out*/, hbool_t *relax) + hid_t *memb_fapl/*out*/, char **memb_name/*out*/, + haddr_t *memb_addr/*out*/, hbool_t *relax) { const H5FD_multi_fapl_t *fa; - H5FD_mem_t mt; + H5FD_mem_t mt; static const char *func="H5FDget_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -548,41 +548,41 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t)); if (memb_fapl) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) - memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); - else - memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ - } + for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) + memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); + else + memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ + } } if(memb_name) { - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - if(fa->memb_name[mt]) - memb_name[mt] = my_strdup(fa->memb_name[mt]); - else - memb_name[mt] = NULL; - } + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + if(fa->memb_name[mt]) + memb_name[mt] = my_strdup(fa->memb_name[mt]); + else + memb_name[mt] = NULL; + } } if (memb_addr) - memcpy(memb_addr, fa->memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t)); + memcpy(memb_addr, fa->memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t)); if (relax) - *relax = fa->relax; + *relax = fa->relax; return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_size + * Function: H5FD_multi_sb_size * - * Purpose: Returns the size of the private information to be stored in - * the superblock. + * Purpose: Returns the size of the private information to be stored in + * the superblock. * - * Return: Success: The super block driver data size. + * Return: Success: The super block driver data size. * - * Failure: never fails + * Failure: never fails * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- @@ -590,16 +590,16 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, static hsize_t H5FD_multi_sb_size(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - unsigned nseen = 0; - hsize_t nbytes = 8; /*size of header*/ + H5FD_multi_t *file = (H5FD_multi_t*)_file; + unsigned nseen = 0; + hsize_t nbytes = 8; /*size of header*/ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* How many unique files? */ UNIQUE_MEMBERS(file->fa.memb_map, mt) { - nseen++; + nseen++; } END_MEMBERS; /* Addresses and EOA markers */ @@ -614,40 +614,40 @@ H5FD_multi_sb_size(H5FD_t *_file) return nbytes; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_encode + * Function: H5FD_multi_sb_encode * - * Purpose: Encode driver information for the superblock. The NAME - * argument is a nine-byte buffer which will be initialized with - * an eight-character name/version number and null termination. + * Purpose: Encode driver information for the superblock. The NAME + * argument is a nine-byte buffer which will be initialized with + * an eight-character name/version number and null termination. * - * The encoding is a six-byte member mapping followed two bytes - * which are unused. For each unique file in usage-type order - * encode all the starting addresses as unsigned 64-bit integers, - * then all the EOA values as unsigned 64-bit integers, then all - * the template names as null terminated strings which are - * multiples of 8 characters. + * The encoding is a six-byte member mapping followed two bytes + * which are unused. For each unique file in usage-type order + * encode all the starting addresses as unsigned 64-bit integers, + * then all the EOA values as unsigned 64-bit integers, then all + * the template names as null terminated strings which are + * multiples of 8 characters. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, - unsigned char *buf/*out*/) + unsigned char *buf/*out*/) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - haddr_t memb_eoa; - unsigned char *p; - size_t nseen; - size_t i; - H5FD_mem_t m; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + haddr_t memb_eoa; + unsigned char *p; + size_t nseen; + size_t i; + H5FD_mem_t m; static const char *func="H5FD_multi_sb_encode"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -698,23 +698,23 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, return 0; } /* end H5FD_multi_sb_encode() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_decode + * Function: H5FD_multi_sb_decode * - * Purpose: Decodes the superblock information for this driver. The NAME - * argument is the eight-character (plus null termination) name - * stored in the file. + * Purpose: Decodes the superblock information for this driver. The NAME + * argument is the eight-character (plus null termination) name + * stored in the file. * - * The FILE argument is updated according to the information in - * the superblock. This may mean that some member files are - * closed and others are opened. + * The FILE argument is updated according to the information in + * the superblock. This may mean that some member files are + * closed and others are opened. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- @@ -722,17 +722,17 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, static herr_t H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - char x[2*H5FD_MEM_NTYPES*8]; - H5FD_mem_t map[H5FD_MEM_NTYPES]; - int i; - size_t nseen=0; - hbool_t map_changed=FALSE; - hbool_t in_use[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - haddr_t memb_eoa[H5FD_MEM_NTYPES]; - haddr_t *ap; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + char x[2*H5FD_MEM_NTYPES*8]; + H5FD_mem_t map[H5FD_MEM_NTYPES]; + int i; + size_t nseen=0; + hbool_t map_changed=FALSE; + hbool_t in_use[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + haddr_t memb_eoa[H5FD_MEM_NTYPES]; + haddr_t *ap; static const char *func="H5FD_multi_sb_decode"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -831,28 +831,28 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) if (file->memb[mt]) if(H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt])<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1) - - /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) */ - file->memb_eoa[mt] = memb_eoa[mt]; + + /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) */ + file->memb_eoa[mt] = memb_eoa[mt]; } END_MEMBERS; return 0; } /* end H5FD_multi_sb_decode() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_get + * Function: H5FD_multi_fapl_get * - * Purpose: Returns a file access property list which indicates how the - * specified file is being accessed. The return list could be - * used to access another file the same way. + * Purpose: Returns a file access property list which indicates how the + * specified file is being accessed. The return list could be + * used to access another file the same way. * - * Return: Success: Ptr to new file access property list with all - * members copied from the file struct. + * Return: Success: Ptr to new file access property list with all + * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * *------------------------------------------------------------------------- @@ -860,7 +860,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) static void * H5FD_multi_fapl_get(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_multi_t *file = (H5FD_multi_t*)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -868,17 +868,17 @@ H5FD_multi_fapl_get(H5FD_t *_file) return H5FD_multi_fapl_copy(&(file->fa)); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_copy + * Function: H5FD_multi_fapl_copy * - * Purpose: Copies the multi-specific file access properties. + * Purpose: Copies the multi-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -898,20 +898,20 @@ H5FD_multi_fapl_copy(const void *_old_fa) memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t)); ALL_MEMBERS(mt) { - if (old_fa->memb_fapl[mt]>=0) { - if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) { + if (old_fa->memb_fapl[mt]>=0) { + if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) { nerrors++; break; } - new_fa->memb_fapl[mt] = old_fa->memb_fapl[mt]; - } - if (old_fa->memb_name[mt]) { - new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]); + new_fa->memb_fapl[mt] = old_fa->memb_fapl[mt]; + } + if (old_fa->memb_name[mt]) { + new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]); if (NULL == new_fa->memb_name[mt]) { nerrors++; break; } - } + } } END_MEMBERS; if (nerrors) { @@ -927,17 +927,17 @@ H5FD_multi_fapl_copy(const void *_old_fa) return new_fa; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_free + * Function: H5FD_multi_fapl_free * - * Purpose: Frees the multi-specific file access properties. + * Purpose: Frees the multi-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -945,17 +945,17 @@ H5FD_multi_fapl_copy(const void *_old_fa) static herr_t H5FD_multi_fapl_free(void *_fa) { - H5FD_multi_fapl_t *fa = (H5FD_multi_fapl_t*)_fa; + H5FD_multi_fapl_t *fa = (H5FD_multi_fapl_t*)_fa; static const char *func="H5FD_multi_fapl_free"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { - if (fa->memb_fapl[mt]>=0) + if (fa->memb_fapl[mt]>=0) if(H5Idec_ref(fa->memb_fapl[mt])<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1) - if (fa->memb_name[mt]) + if (fa->memb_name[mt]) free(fa->memb_name[mt]); } END_MEMBERS; free(fa); @@ -963,19 +963,19 @@ H5FD_multi_fapl_free(void *_fa) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_open + * Function: H5FD_multi_open * - * Purpose: Creates and/or opens a multi HDF5 file. + * Purpose: Creates and/or opens a multi HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -983,10 +983,10 @@ H5FD_multi_fapl_free(void *_fa) static H5FD_t * H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_multi_t *file=NULL; - hid_t close_fapl=-1; + H5FD_multi_t *file=NULL; + hid_t close_fapl=-1; const H5FD_multi_fapl_t *fa; - H5FD_mem_t m; + H5FD_mem_t m; static const char *func="H5FD_multi_open"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1001,7 +1001,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* * Initialize the file from the file access properties, using default * values if necessary. Make sure to use CALLOC here because the code - * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa + * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa * in H5FD_multi_t. */ if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) @@ -1060,19 +1060,19 @@ error: return NULL; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_close + * Function: H5FD_multi_close * - * Purpose: Closes a multi file. + * Purpose: Closes a multi file. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative with as many members closed as - * possible. The only subsequent operation - * permitted on the file is a close operation. + * Failure: Negative with as many members closed as + * possible. The only subsequent operation + * permitted on the file is a close operation. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1080,8 +1080,8 @@ error: static herr_t H5FD_multi_close(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors=0; static const char *func="H5FD_multi_close"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1089,21 +1089,21 @@ H5FD_multi_close(H5FD_t *_file) /* Close as many members as possible */ ALL_MEMBERS(mt) { - if (file->memb[mt]) { - if (H5FDclose(file->memb[mt])<0) { + if (file->memb[mt]) { + if (H5FDclose(file->memb[mt])<0) { nerrors++; - } else { + } else { file->memb[mt] = NULL; - } - } + } + } } END_MEMBERS; if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1) /* Clean up other stuff */ ALL_MEMBERS(mt) { - if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); - if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); + if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); + if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } END_MEMBERS; free(file->name); @@ -1111,22 +1111,22 @@ H5FD_multi_close(H5FD_t *_file) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_cmp + * Function: H5FD_multi_cmp * - * Purpose: Compares two file families to see if they are the same. It - * does this by comparing the first common member of the two - * families. If the families have no members in common then the - * file with the earliest member is smaller than the other file. - * We abort if neither file has any members. + * Purpose: Compares two file families to see if they are the same. It + * does this by comparing the first common member of the two + * families. If the families have no members in common then the + * file with the earliest member is smaller than the other file. + * We abort if neither file has any members. * - * Return: Success: like strcmp() + * Return: Success: like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1134,24 +1134,24 @@ H5FD_multi_close(H5FD_t *_file) static int H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_multi_t *f1 = (const H5FD_multi_t*)_f1; - const H5FD_multi_t *f2 = (const H5FD_multi_t*)_f2; - H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; - int cmp=0; + const H5FD_multi_t *f1 = (const H5FD_multi_t*)_f1; + const H5FD_multi_t *f2 = (const H5FD_multi_t*)_f2; + H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; + int cmp=0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { out_mt = mt; - if(f1->memb[mt] && f2->memb[mt]) + if(f1->memb[mt] && f2->memb[mt]) break; - if(!cmp) { - if(f1->memb[mt]) + if(!cmp) { + if(f1->memb[mt]) cmp = -1; - else if(f2->memb[mt]) + else if(f2->memb[mt]) cmp = 1; - } + } } END_MEMBERS; assert(cmp || out_mt=H5FD_MEM_NTYPES) @@ -1160,18 +1160,18 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_query + * Function: H5FD_multi_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, September 26, 2000 * *------------------------------------------------------------------------- @@ -1194,16 +1194,16 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) return(0); } /* end H5FD_multi_query() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_type_map + * Function: H5FD_multi_get_type_map * - * Purpose: Retrieve the memory type mapping for this file + * Purpose: Retrieve the memory type mapping for this file * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 9, 2008 * *------------------------------------------------------------------------- @@ -1211,7 +1211,7 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) static herr_t H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; /* Copy file's free space type mapping */ memcpy(type_map, file->fa.memb_map, sizeof(file->fa.memb_map)); @@ -1219,19 +1219,19 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) return(0); } /* end H5FD_multi_get_type_map() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_eoa + * Function: H5FD_multi_get_eoa * - * Purpose: Returns the end-of-address marker for the file. The EOA - * marker is the first address past the last byte allocated in - * the format address space. + * Purpose: Returns the end-of-address marker for the file. The EOA + * marker is the first address past the last byte allocated in + * the format address space. * - * Return: Success: The end-of-address-marker + * Return: Success: The end-of-address-marker * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * * Modifications: @@ -1247,7 +1247,7 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; haddr_t eoa = 0; static const char *func="H5FD_multi_get_eoa"; /* Function Name for error reporting */ @@ -1264,26 +1264,26 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) UNIQUE_MEMBERS(file->fa.memb_map, mt) { haddr_t memb_eoa; - if (file->memb[mt]) { + if (file->memb[mt]) { /* Retrieve EOA */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); - } H5E_END_TRY; + } H5E_END_TRY; - if(HADDR_UNDEF == memb_eoa) + if(HADDR_UNDEF == memb_eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) if(memb_eoa>0) memb_eoa += file->fa.memb_addr[mt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - memb_eoa = file->memb_next[mt]; - assert(HADDR_UNDEF != memb_eoa); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + memb_eoa = file->memb_next[mt]; + assert(HADDR_UNDEF != memb_eoa); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) - } + } if(memb_eoa > eoa) eoa = memb_eoa; @@ -1294,44 +1294,44 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) if(H5FD_MEM_DEFAULT == mmt) mmt = type; - if(file->memb[mmt]) { + if(file->memb[mmt]) { H5E_BEGIN_TRY { - eoa = H5FDget_eoa(file->memb[mmt], mmt); + eoa = H5FDget_eoa(file->memb[mmt], mmt); } H5E_END_TRY; - if(HADDR_UNDEF == eoa) + if(HADDR_UNDEF == eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) - if(eoa > 0) + if(eoa > 0) eoa += file->fa.memb_addr[mmt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - eoa = file->memb_next[mmt]; - assert(HADDR_UNDEF != eoa); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + eoa = file->memb_next[mmt]; + assert(HADDR_UNDEF != eoa); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) - } + } } return eoa; } /* end H5FD_multi_get_eoa() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_set_eoa + * Function: H5FD_multi_set_eoa * - * Purpose: Set the end-of-address marker for the file by savig the new - * EOA value in the file struct. Also set the EOA marker for the - * subfile in which the new EOA value falls. We don't set the - * EOA values of any other subfiles. + * Purpose: Set the end-of-address marker for the file by savig the new + * EOA value in the file struct. Also set the EOA marker for the + * subfile in which the new EOA value falls. We don't set the + * EOA values of any other subfiles. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * * Modifications: @@ -1350,9 +1350,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) static herr_t H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; - herr_t status; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; + herr_t status; static const char *func="H5FD_multi_set_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1383,7 +1383,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) assert(eoa < file->memb_next[mmt]); H5E_BEGIN_TRY { - status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); + status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); } H5E_END_TRY; if(status < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) @@ -1391,20 +1391,20 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) return 0; } /* end H5FD_multi_set_eoa() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_eof + * Function: H5FD_multi_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the total multi size or the current EOA marker. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the total multi size or the current EOA marker. * - * Return: Success: End of file address, the first address past - * the end of the multi of files or the current - * EOA, whichever is larger. + * Return: Success: End of file address, the first address past + * the end of the multi of files or the current + * EOA, whichever is larger. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1412,8 +1412,8 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) static haddr_t H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; - haddr_t eof = 0; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + haddr_t eof = 0; static const char *func="H5FD_multi_get_eof"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1452,31 +1452,31 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if(H5FD_MEM_DEFAULT == mmt) mmt = type; - if(file->memb[mmt]) { + if(file->memb[mmt]) { /* Retrieve EOF */ H5E_BEGIN_TRY { - eof = H5FDget_eof(file->memb[mmt], mmt); + eof = H5FDget_eof(file->memb[mmt], mmt); } H5E_END_TRY; - if(HADDR_UNDEF == eof) + if(HADDR_UNDEF == eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) - if(eof > 0) + if(eof > 0) eof += file->fa.memb_addr[mmt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - eof = file->memb_next[mmt]; - assert(HADDR_UNDEF != eof); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + eof = file->memb_next[mmt]; + assert(HADDR_UNDEF != eof); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) - } + } } return eof; } - + /*------------------------------------------------------------------------- * Function: H5FD_multi_get_handle * @@ -1507,17 +1507,17 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) return (H5FDget_vfd_handle(file->memb[mmt], fapl, file_handle)); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_alloc + * Function: H5FD_multi_alloc * - * Purpose: Allocate file memory. + * Purpose: Allocate file memory. * - * Return: Success: Address of new memory + * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 12, 1999 * *------------------------------------------------------------------------- @@ -1525,9 +1525,9 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; - haddr_t addr; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; + haddr_t addr; static const char *func="H5FD_multi_alloc"; /* Function Name for error reporting */ mmt = file->fa.memb_map[type]; @@ -1548,31 +1548,31 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /*#ifdef TMP if ( addr + size > file->eoa ) { - if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { + if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, \ - "can't set eoa", HADDR_UNDEF) - } + "can't set eoa", HADDR_UNDEF) + } } #else if ( addr + size > file->eoa ) - file->eoa = addr + size; + file->eoa = addr + size; #endif */ return addr; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_free + * Function: H5FD_multi_free * - * Purpose: Frees memory + * Purpose: Frees memory * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 12, 1999 * *------------------------------------------------------------------------- @@ -1580,8 +1580,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1594,20 +1594,20 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi return H5FDfree(file->memb[mmt], mmt, dxpl_id, addr-file->fa.memb_addr[mmt], size); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_read + * Function: H5FD_multi_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: Zero. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, contents of buffer BUF are undefined. + * Failure: -1, contents of buffer BUF are undefined. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1616,26 +1616,26 @@ static herr_t H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; - haddr_t start_addr = 0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; + haddr_t start_addr = 0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* Find the file to which this address belongs */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - mmt = file->fa.memb_map[mt]; - if(H5FD_MEM_DEFAULT == mmt) + mmt = file->fa.memb_map[mt]; + if(H5FD_MEM_DEFAULT == mmt) mmt = mt; - assert(mmt > 0 && mmt < H5FD_MEM_NTYPES); + assert(mmt > 0 && mmt < H5FD_MEM_NTYPES); - if(file->fa.memb_addr[mmt] > addr) + if(file->fa.memb_addr[mmt] > addr) continue; - if(file->fa.memb_addr[mmt] >= start_addr) { - start_addr = file->fa.memb_addr[mmt]; - hi = mmt; - } /* end if */ + if(file->fa.memb_addr[mmt] >= start_addr) { + start_addr = file->fa.memb_addr[mmt]; + hi = mmt; + } /* end if */ } /* end for */ assert(hi > 0); @@ -1643,19 +1643,19 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, return H5FDread(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_read() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_write + * Function: H5FD_multi_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero + * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1664,26 +1664,26 @@ static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; - haddr_t start_addr = 0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; + haddr_t start_addr = 0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* Find the file to which this address belongs */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - mmt = file->fa.memb_map[mt]; - if(H5FD_MEM_DEFAULT == mmt) + mmt = file->fa.memb_map[mt]; + if(H5FD_MEM_DEFAULT == mmt) mmt = mt; - assert(mmt > 0 && mmt 0 && mmtfa.memb_addr[mmt] > addr) + if(file->fa.memb_addr[mmt] > addr) continue; - if(file->fa.memb_addr[mmt] >= start_addr) { - start_addr = file->fa.memb_addr[mmt]; - hi = mmt; - } /* end if */ + if(file->fa.memb_addr[mmt] >= start_addr) { + start_addr = file->fa.memb_addr[mmt]; + hi = mmt; + } /* end if */ } /* end for */ assert(hi > 0); @@ -1691,17 +1691,17 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, return H5FDwrite(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_write() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_flush + * Function: H5FD_multi_flush * - * Purpose: Flushes all multi members. + * Purpose: Flushes all multi members. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1, as many files flushed as possible. + * Failure: -1, as many files flushed as possible. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1709,13 +1709,13 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt; + int nerrors=0; static const char *func="H5FD_multi_flush"; /* Function Name for error reporting */ #if 0 - H5FD_mem_t mmt; + H5FD_mem_t mmt; /* Debugging stuff... */ fprintf(stderr, "multifile access information:\n"); @@ -1723,9 +1723,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* print the map */ fprintf(stderr, " map="); for (mt=1; mtmemb_map[mt]; - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt); + mmt = file->memb_map[mt]; + if (H5FD_MEM_DEFAULT==mmt) mmt = mt; + fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt); } fprintf(stderr, "\n"); @@ -1735,14 +1735,14 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) fprintf(stderr, " ------ -------------------- -------------------- -------------------- ------------------------------\n"); for (mt=1; mtmemb_addr[mt]) { - haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); - fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", - (int)mt, (unsigned long long)(file->memb_addr[mt]), - (unsigned long long)eoa, - (unsigned long long)(file->memb_next[mt]), - file->memb_name[mt]); - } + if (HADDR_UNDEF!=file->memb_addr[mt]) { + haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); + fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", + (int)mt, (unsigned long long)(file->memb_addr[mt]), + (unsigned long long)eoa, + (unsigned long long)(file->memb_next[mt]), + file->memb_name[mt]); + } } #endif @@ -1751,11 +1751,11 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* Flush each file */ for (mt=H5FD_MEM_SUPER; mtmemb[mt]) { - H5E_BEGIN_TRY { - if (H5FDflush(file->memb[mt],dxpl_id,closing)<0) nerrors++; - } H5E_END_TRY; - } + if (file->memb[mt]) { + H5E_BEGIN_TRY { + if (H5FDflush(file->memb[mt],dxpl_id,closing)<0) nerrors++; + } H5E_END_TRY; + } } if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1) @@ -1763,16 +1763,16 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_truncate + * Function: H5FD_multi_truncate * - * Purpose: Truncates all multi members. + * Purpose: Truncates all multi members. * - * Return: Success: 0 - * Failure: -1, as many files truncated as possible. + * Return: Success: 0 + * Failure: -1, as many files truncated as possible. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 31, 2008 * *------------------------------------------------------------------------- @@ -1780,9 +1780,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt; + int nerrors=0; static const char *func="H5FD_multi_truncate"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1790,12 +1790,12 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* Truncate each file */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - if(file->memb[mt]) { - H5E_BEGIN_TRY { - if(H5FDtruncate(file->memb[mt], dxpl_id, closing) < 0) + if(file->memb[mt]) { + H5E_BEGIN_TRY { + if(H5FDtruncate(file->memb[mt], dxpl_id, closing) < 0) nerrors++; - } H5E_END_TRY; - } + } H5E_END_TRY; + } } if(nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1) @@ -1803,28 +1803,28 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) return 0; } /* end H5FD_multi_truncate() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_lock + * Function: H5FD_multi_lock * - * Purpose: Place a lock on all multi members. - * When there is error in locking a member file, it will not - * proceed further and will try to remove the locks of those - * member files that are locked before error is encountered. + * Purpose: Place a lock on all multi members. + * When there is error in locking a member file, it will not + * proceed further and will try to remove the locks of those + * member files that are locked before error is encountered. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Vailin Choi; March 2015 + * Programmer: Vailin Choi; March 2015 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors = 0; - H5FD_mem_t out_mt; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors = 0; + H5FD_mem_t out_mt; static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1861,26 +1861,26 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) } /* H5FD_multi_lock() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_unlock + * Function: H5FD_multi_unlock * - * Purpose: Remove the lock on all multi members. - * It will try to unlock all member files but will record error - * encountered. + * Purpose: Remove the lock on all multi members. + * It will try to unlock all member files but will record error + * encountered. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Vailin Choi; March 2015 + * Programmer: Vailin Choi; March 2015 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_unlock(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors=0; static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1889,7 +1889,7 @@ H5FD_multi_unlock(H5FD_t *_file) ALL_MEMBERS(mt) { if(file->memb[mt]) if(H5FDunlock(file->memb[mt]) < 0) - nerrors++; + nerrors++; } END_MEMBERS; if(nerrors) @@ -1898,18 +1898,18 @@ H5FD_multi_unlock(H5FD_t *_file) return 0; } /* H5FD_multi_unlock() */ - + /*------------------------------------------------------------------------- - * Function: compute_next + * Function: compute_next * - * Purpose: Compute the memb_next[] values of the file based on the - * file's member map and the member starting addresses. + * Purpose: Compute the memb_next[] values of the file based on the + * file's member map and the member starting addresses. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 23, 1999 * *------------------------------------------------------------------------- @@ -1921,36 +1921,36 @@ compute_next(H5FD_multi_t *file) H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { - file->memb_next[mt] = HADDR_UNDEF; + file->memb_next[mt] = HADDR_UNDEF; } END_MEMBERS; UNIQUE_MEMBERS(file->fa.memb_map, mt1) { - UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { - if (file->fa.memb_addr[mt1]fa.memb_addr[mt2] && - (HADDR_UNDEF==file->memb_next[mt1] || - file->memb_next[mt1]>file->fa.memb_addr[mt2])) { - file->memb_next[mt1] = file->fa.memb_addr[mt2]; - } - } END_MEMBERS; - if (HADDR_UNDEF==file->memb_next[mt1]) { - file->memb_next[mt1] = HADDR_MAX; /*last member*/ - } + UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { + if (file->fa.memb_addr[mt1]fa.memb_addr[mt2] && + (HADDR_UNDEF==file->memb_next[mt1] || + file->memb_next[mt1]>file->fa.memb_addr[mt2])) { + file->memb_next[mt1] = file->fa.memb_addr[mt2]; + } + } END_MEMBERS; + if (HADDR_UNDEF==file->memb_next[mt1]) { + file->memb_next[mt1] = HADDR_MAX; /*last member*/ + } } END_MEMBERS; return 0; } - + /*------------------------------------------------------------------------- - * Function: open_members + * Function: open_members * - * Purpose: Opens all members which are not opened yet. + * Purpose: Opens all members which are not opened yet. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 23, 1999 * *------------------------------------------------------------------------- @@ -1966,30 +1966,30 @@ compute_next(H5FD_multi_t *file) static int open_members(H5FD_multi_t *file) { - char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; - int nerrors=0; + char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; + int nerrors=0; static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); UNIQUE_MEMBERS(file->fa.memb_map, mt) { - if(file->memb[mt]) - continue; /*already open*/ - assert(file->fa.memb_name[mt]); - /* Note: This truncates the user's filename down to only sizeof(tmp) - * characters. -QK & JK, 2013/01/17 - */ - snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); - tmp[sizeof(tmp) - 1] = '\0'; - - H5E_BEGIN_TRY { - file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); - } H5E_END_TRY; - if(!file->memb[mt]) { - if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) - nerrors++; - } + if(file->memb[mt]) + continue; /*already open*/ + assert(file->fa.memb_name[mt]); + /* Note: This truncates the user's filename down to only sizeof(tmp) + * characters. -QK & JK, 2013/01/17 + */ + snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + tmp[sizeof(tmp) - 1] = '\0'; + + H5E_BEGIN_TRY { + file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); + } H5E_END_TRY; + if(!file->memb[mt]) { + if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) + nerrors++; + } } END_MEMBERS; if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1) @@ -1998,7 +1998,7 @@ open_members(H5FD_multi_t *file) } #pragma GCC diagnostic pop - + #ifdef _H5private_H /* * This is not related to the functionality of the driver code. -- cgit v0.12 From 2f88d439c647e9c8e9d9c670224936fc2941c787 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jul 2019 09:46:10 -0500 Subject: Undo commit --- src/H5FDmulti.c | 1210 +++++++++++++++++++++++++++---------------------------- 1 file changed, 605 insertions(+), 605 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 19aa0df..acd128c 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, November 10, 1997 - * - * Purpose: Implements a file driver which dispatches I/O requests to - * other file drivers depending on the purpose of the address - * region being accessed. For instance, all meta-data could be - * place in one file while all raw data goes to some other file. - * This also serves as an example of coding a complex file driver, - * therefore, it should not use any non-public definitions. + * Programmer: Robb Matzke + * Monday, November 10, 1997 + * + * Purpose: Implements a file driver which dispatches I/O requests to + * other file drivers depending on the purpose of the address + * region being accessed. For instance, all meta-data could be + * place in one file while all raw data goes to some other file. + * This also serves as an example of coding a complex file driver, + * therefore, it should not use any non-public definitions. */ #include #include @@ -30,23 +30,23 @@ #ifndef FALSE -#define FALSE 0 +#define FALSE 0 #endif #ifndef TRUE -#define TRUE 1 +#define TRUE 1 #endif /* Loop through all mapped files */ -#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \ - H5FD_mem_t ITER, LOOPVAR; \ - unsigned SEEN[H5FD_MEM_NTYPES]; \ - \ - memset(SEEN, 0, sizeof SEEN); \ +#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \ + H5FD_mem_t ITER, LOOPVAR; \ + unsigned SEEN[H5FD_MEM_NTYPES]; \ + \ + memset(SEEN, 0, sizeof SEEN); \ for (ITER=H5FD_MEM_SUPER; ITER0 && LOOPVAR0 && LOOPVARsizeof(meta_name) - QK & JK - 2013/01/17 */ - strncpy(meta_name, meta_ext, sizeof(meta_name)); + strncpy(meta_name, meta_ext, sizeof(meta_name)); meta_name[sizeof(meta_name) - 1] = '\0'; } - else - sprintf(meta_name, "%%s%s", meta_ext); + else + sprintf(meta_name, "%%s%s", meta_ext); } else { - strncpy(meta_name, "%s.meta", sizeof(meta_name)); + strncpy(meta_name, "%s.meta", sizeof(meta_name)); meta_name[sizeof(meta_name) - 1] = '\0'; } memb_name[H5FD_MEM_SUPER] = meta_name; /* process raw filename */ if(raw_ext) { - if(strstr(raw_ext, "%s")) { + if(strstr(raw_ext, "%s")) { /* Note: this doesn't accommodate for when the '%s' in the user's * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17 */ - strncpy(raw_name, raw_ext, sizeof(raw_name)); + strncpy(raw_name, raw_ext, sizeof(raw_name)); raw_name[sizeof(raw_name) - 1] = '\0'; } - else - sprintf(raw_name, "%%s%s", raw_ext); + else + sprintf(raw_name, "%%s%s", raw_ext); } else { - strncpy(raw_name, "%s.raw", sizeof(raw_name)); + strncpy(raw_name, "%s.raw", sizeof(raw_name)); raw_name[sizeof(raw_name) - 1] = '\0'; } memb_name[H5FD_MEM_DRAW] = raw_name; @@ -343,96 +343,96 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE); } - + /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_multi + * Function: H5Pset_fapl_multi * - * Purpose: Sets the file access property list FAPL_ID to use the multi - * driver. The MEMB_MAP array maps memory usage types to other - * memory usage types and is the mechanism which allows the - * caller to specify how many files are created. The array - * contains H5FD_MEM_NTYPES entries which are either the value - * H5FD_MEM_DEFAULT or a memory usage type and the number of - * unique values determines the number of files which are - * opened. For each memory usage type which will be associated - * with a file the MEMB_FAPL array should have a property list - * and the MEMB_NAME array should be a name generator (a - * printf-style format with a %s which will be replaced with the - * name passed to H5FDopen(), usually from H5Fcreate() or - * H5Fopen()). + * Purpose: Sets the file access property list FAPL_ID to use the multi + * driver. The MEMB_MAP array maps memory usage types to other + * memory usage types and is the mechanism which allows the + * caller to specify how many files are created. The array + * contains H5FD_MEM_NTYPES entries which are either the value + * H5FD_MEM_DEFAULT or a memory usage type and the number of + * unique values determines the number of files which are + * opened. For each memory usage type which will be associated + * with a file the MEMB_FAPL array should have a property list + * and the MEMB_NAME array should be a name generator (a + * printf-style format with a %s which will be replaced with the + * name passed to H5FDopen(), usually from H5Fcreate() or + * H5Fopen()). * - * If RELAX is set then opening an existing file for read-only - * access will not fail if some file members are missing. This - * allows a file to be accessed in a limited sense if just the - * meta data is available. + * If RELAX is set then opening an existing file for read-only + * access will not fail if some file members are missing. This + * allows a file to be accessed in a limited sense if just the + * meta data is available. * - * Defaults: Default values for each of the optional arguments are: + * Defaults: Default values for each of the optional arguments are: * - * memb_map: The default member map has the value - * H5FD_MEM_DEFAULT for each element. + * memb_map: The default member map has the value + * H5FD_MEM_DEFAULT for each element. * - * memb_fapl: The value H5P_DEFAULT for each element. + * memb_fapl: The value H5P_DEFAULT for each element. * - * memb_name: The string `%s-X.h5' where `X' is one of the - * letters `s' (H5FD_MEM_SUPER), - * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW), - * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), - * `o' (H5FD_MEM_OHDR). + * memb_name: The string `%s-X.h5' where `X' is one of the + * letters `s' (H5FD_MEM_SUPER), + * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW), + * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), + * `o' (H5FD_MEM_OHDR). * - * memb_addr: The value HADDR_UNDEF for each element. + * memb_addr: The value HADDR_UNDEF for each element. * * - * Example: To set up a multi file access property list which partitions - * data into meta and raw files each being 1/2 of the address - * space one would say: + * Example: To set up a multi file access property list which partitions + * data into meta and raw files each being 1/2 of the address + * space one would say: * - * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - * hid_t memb_fapl[H5FD_MEM_NTYPES]; - * const char *memb[H5FD_MEM_NTYPES]; - * haddr_t memb_addr[H5FD_MEM_NTYPES]; + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * hid_t memb_fapl[H5FD_MEM_NTYPES]; + * const char *memb[H5FD_MEM_NTYPES]; + * haddr_t memb_addr[H5FD_MEM_NTYPES]; * - * // The mapping... - * for (mt=0; mt=H5FD_MEM_NTYPES) + /* Map usage type */ + mmt = memb_map[mt]; + if (mmt<0 || mmt>=H5FD_MEM_NTYPES) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1) - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; + if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - /* - * All members of MEMB_FAPL must be either defaults or actual file - * access property lists. - */ - if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) + /* + * All members of MEMB_FAPL must be either defaults or actual file + * access property lists. + */ + if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1) - /* All names must be defined */ - if (!memb_name[mmt] || !memb_name[mmt][0]) + /* All names must be defined */ + if (!memb_name[mmt] || !memb_name[mmt][0]) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1) } @@ -506,30 +506,30 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, return H5Pset_driver(fapl_id, H5FD_MULTI, &fa); } - + /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_multi + * Function: H5Pget_fapl_multi * - * Purpose: Returns information about the multi file access property - * list though the function arguments which are the same as for - * H5Pset_fapl_multi() above. + * Purpose: Returns information about the multi file access property + * list though the function arguments which are the same as for + * H5Pset_fapl_multi() above. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, - hid_t *memb_fapl/*out*/, char **memb_name/*out*/, - haddr_t *memb_addr/*out*/, hbool_t *relax) + hid_t *memb_fapl/*out*/, char **memb_name/*out*/, + haddr_t *memb_addr/*out*/, hbool_t *relax) { const H5FD_multi_fapl_t *fa; - H5FD_mem_t mt; + H5FD_mem_t mt; static const char *func="H5FDget_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -548,41 +548,41 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t)); if (memb_fapl) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) - memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); - else - memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ - } + for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) + memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); + else + memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ + } } if(memb_name) { - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - if(fa->memb_name[mt]) - memb_name[mt] = my_strdup(fa->memb_name[mt]); - else - memb_name[mt] = NULL; - } + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + if(fa->memb_name[mt]) + memb_name[mt] = my_strdup(fa->memb_name[mt]); + else + memb_name[mt] = NULL; + } } if (memb_addr) - memcpy(memb_addr, fa->memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t)); + memcpy(memb_addr, fa->memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t)); if (relax) - *relax = fa->relax; + *relax = fa->relax; return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_size + * Function: H5FD_multi_sb_size * - * Purpose: Returns the size of the private information to be stored in - * the superblock. + * Purpose: Returns the size of the private information to be stored in + * the superblock. * - * Return: Success: The super block driver data size. + * Return: Success: The super block driver data size. * - * Failure: never fails + * Failure: never fails * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- @@ -590,16 +590,16 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, static hsize_t H5FD_multi_sb_size(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - unsigned nseen = 0; - hsize_t nbytes = 8; /*size of header*/ + H5FD_multi_t *file = (H5FD_multi_t*)_file; + unsigned nseen = 0; + hsize_t nbytes = 8; /*size of header*/ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* How many unique files? */ UNIQUE_MEMBERS(file->fa.memb_map, mt) { - nseen++; + nseen++; } END_MEMBERS; /* Addresses and EOA markers */ @@ -614,40 +614,40 @@ H5FD_multi_sb_size(H5FD_t *_file) return nbytes; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_encode + * Function: H5FD_multi_sb_encode * - * Purpose: Encode driver information for the superblock. The NAME - * argument is a nine-byte buffer which will be initialized with - * an eight-character name/version number and null termination. + * Purpose: Encode driver information for the superblock. The NAME + * argument is a nine-byte buffer which will be initialized with + * an eight-character name/version number and null termination. * - * The encoding is a six-byte member mapping followed two bytes - * which are unused. For each unique file in usage-type order - * encode all the starting addresses as unsigned 64-bit integers, - * then all the EOA values as unsigned 64-bit integers, then all - * the template names as null terminated strings which are - * multiples of 8 characters. + * The encoding is a six-byte member mapping followed two bytes + * which are unused. For each unique file in usage-type order + * encode all the starting addresses as unsigned 64-bit integers, + * then all the EOA values as unsigned 64-bit integers, then all + * the template names as null terminated strings which are + * multiples of 8 characters. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, - unsigned char *buf/*out*/) + unsigned char *buf/*out*/) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - haddr_t memb_eoa; - unsigned char *p; - size_t nseen; - size_t i; - H5FD_mem_t m; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + haddr_t memb_eoa; + unsigned char *p; + size_t nseen; + size_t i; + H5FD_mem_t m; static const char *func="H5FD_multi_sb_encode"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -698,23 +698,23 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, return 0; } /* end H5FD_multi_sb_encode() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_sb_decode + * Function: H5FD_multi_sb_decode * - * Purpose: Decodes the superblock information for this driver. The NAME - * argument is the eight-character (plus null termination) name - * stored in the file. + * Purpose: Decodes the superblock information for this driver. The NAME + * argument is the eight-character (plus null termination) name + * stored in the file. * - * The FILE argument is updated according to the information in - * the superblock. This may mean that some member files are - * closed and others are opened. + * The FILE argument is updated according to the information in + * the superblock. This may mean that some member files are + * closed and others are opened. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 16, 1999 * *------------------------------------------------------------------------- @@ -722,17 +722,17 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, static herr_t H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - char x[2*H5FD_MEM_NTYPES*8]; - H5FD_mem_t map[H5FD_MEM_NTYPES]; - int i; - size_t nseen=0; - hbool_t map_changed=FALSE; - hbool_t in_use[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - haddr_t memb_eoa[H5FD_MEM_NTYPES]; - haddr_t *ap; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + char x[2*H5FD_MEM_NTYPES*8]; + H5FD_mem_t map[H5FD_MEM_NTYPES]; + int i; + size_t nseen=0; + hbool_t map_changed=FALSE; + hbool_t in_use[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + haddr_t memb_eoa[H5FD_MEM_NTYPES]; + haddr_t *ap; static const char *func="H5FD_multi_sb_decode"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -831,28 +831,28 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) if (file->memb[mt]) if(H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt])<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1) - - /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) */ - file->memb_eoa[mt] = memb_eoa[mt]; + + /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) */ + file->memb_eoa[mt] = memb_eoa[mt]; } END_MEMBERS; return 0; } /* end H5FD_multi_sb_decode() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_get + * Function: H5FD_multi_fapl_get * - * Purpose: Returns a file access property list which indicates how the - * specified file is being accessed. The return list could be - * used to access another file the same way. + * Purpose: Returns a file access property list which indicates how the + * specified file is being accessed. The return list could be + * used to access another file the same way. * - * Return: Success: Ptr to new file access property list with all - * members copied from the file struct. + * Return: Success: Ptr to new file access property list with all + * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * *------------------------------------------------------------------------- @@ -860,7 +860,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) static void * H5FD_multi_fapl_get(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_multi_t *file = (H5FD_multi_t*)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -868,17 +868,17 @@ H5FD_multi_fapl_get(H5FD_t *_file) return H5FD_multi_fapl_copy(&(file->fa)); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_copy + * Function: H5FD_multi_fapl_copy * - * Purpose: Copies the multi-specific file access properties. + * Purpose: Copies the multi-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -898,20 +898,20 @@ H5FD_multi_fapl_copy(const void *_old_fa) memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t)); ALL_MEMBERS(mt) { - if (old_fa->memb_fapl[mt]>=0) { - if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) { + if (old_fa->memb_fapl[mt]>=0) { + if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) { nerrors++; break; } - new_fa->memb_fapl[mt] = old_fa->memb_fapl[mt]; - } - if (old_fa->memb_name[mt]) { - new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]); + new_fa->memb_fapl[mt] = old_fa->memb_fapl[mt]; + } + if (old_fa->memb_name[mt]) { + new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]); if (NULL == new_fa->memb_name[mt]) { nerrors++; break; } - } + } } END_MEMBERS; if (nerrors) { @@ -927,17 +927,17 @@ H5FD_multi_fapl_copy(const void *_old_fa) return new_fa; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_fapl_free + * Function: H5FD_multi_fapl_free * - * Purpose: Frees the multi-specific file access properties. + * Purpose: Frees the multi-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -945,17 +945,17 @@ H5FD_multi_fapl_copy(const void *_old_fa) static herr_t H5FD_multi_fapl_free(void *_fa) { - H5FD_multi_fapl_t *fa = (H5FD_multi_fapl_t*)_fa; + H5FD_multi_fapl_t *fa = (H5FD_multi_fapl_t*)_fa; static const char *func="H5FD_multi_fapl_free"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { - if (fa->memb_fapl[mt]>=0) + if (fa->memb_fapl[mt]>=0) if(H5Idec_ref(fa->memb_fapl[mt])<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1) - if (fa->memb_name[mt]) + if (fa->memb_name[mt]) free(fa->memb_name[mt]); } END_MEMBERS; free(fa); @@ -963,19 +963,19 @@ H5FD_multi_fapl_free(void *_fa) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_open + * Function: H5FD_multi_open * - * Purpose: Creates and/or opens a multi HDF5 file. + * Purpose: Creates and/or opens a multi HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -983,10 +983,10 @@ H5FD_multi_fapl_free(void *_fa) static H5FD_t * H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_multi_t *file=NULL; - hid_t close_fapl=-1; + H5FD_multi_t *file=NULL; + hid_t close_fapl=-1; const H5FD_multi_fapl_t *fa; - H5FD_mem_t m; + H5FD_mem_t m; static const char *func="H5FD_multi_open"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1001,7 +1001,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* * Initialize the file from the file access properties, using default * values if necessary. Make sure to use CALLOC here because the code - * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa + * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa * in H5FD_multi_t. */ if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) @@ -1060,19 +1060,19 @@ error: return NULL; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_close + * Function: H5FD_multi_close * - * Purpose: Closes a multi file. + * Purpose: Closes a multi file. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative with as many members closed as - * possible. The only subsequent operation - * permitted on the file is a close operation. + * Failure: Negative with as many members closed as + * possible. The only subsequent operation + * permitted on the file is a close operation. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1080,8 +1080,8 @@ error: static herr_t H5FD_multi_close(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors=0; static const char *func="H5FD_multi_close"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1089,21 +1089,21 @@ H5FD_multi_close(H5FD_t *_file) /* Close as many members as possible */ ALL_MEMBERS(mt) { - if (file->memb[mt]) { - if (H5FDclose(file->memb[mt])<0) { + if (file->memb[mt]) { + if (H5FDclose(file->memb[mt])<0) { nerrors++; - } else { + } else { file->memb[mt] = NULL; - } - } + } + } } END_MEMBERS; if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1) /* Clean up other stuff */ ALL_MEMBERS(mt) { - if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); - if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); + if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); + if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } END_MEMBERS; free(file->name); @@ -1111,22 +1111,22 @@ H5FD_multi_close(H5FD_t *_file) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_cmp + * Function: H5FD_multi_cmp * - * Purpose: Compares two file families to see if they are the same. It - * does this by comparing the first common member of the two - * families. If the families have no members in common then the - * file with the earliest member is smaller than the other file. - * We abort if neither file has any members. + * Purpose: Compares two file families to see if they are the same. It + * does this by comparing the first common member of the two + * families. If the families have no members in common then the + * file with the earliest member is smaller than the other file. + * We abort if neither file has any members. * - * Return: Success: like strcmp() + * Return: Success: like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1134,24 +1134,24 @@ H5FD_multi_close(H5FD_t *_file) static int H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_multi_t *f1 = (const H5FD_multi_t*)_f1; - const H5FD_multi_t *f2 = (const H5FD_multi_t*)_f2; - H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; - int cmp=0; + const H5FD_multi_t *f1 = (const H5FD_multi_t*)_f1; + const H5FD_multi_t *f2 = (const H5FD_multi_t*)_f2; + H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; + int cmp=0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { out_mt = mt; - if(f1->memb[mt] && f2->memb[mt]) + if(f1->memb[mt] && f2->memb[mt]) break; - if(!cmp) { - if(f1->memb[mt]) + if(!cmp) { + if(f1->memb[mt]) cmp = -1; - else if(f2->memb[mt]) + else if(f2->memb[mt]) cmp = 1; - } + } } END_MEMBERS; assert(cmp || out_mt=H5FD_MEM_NTYPES) @@ -1160,18 +1160,18 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_query + * Function: H5FD_multi_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, September 26, 2000 * *------------------------------------------------------------------------- @@ -1194,16 +1194,16 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) return(0); } /* end H5FD_multi_query() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_type_map + * Function: H5FD_multi_get_type_map * - * Purpose: Retrieve the memory type mapping for this file + * Purpose: Retrieve the memory type mapping for this file * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 9, 2008 * *------------------------------------------------------------------------- @@ -1211,7 +1211,7 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) static herr_t H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; /* Copy file's free space type mapping */ memcpy(type_map, file->fa.memb_map, sizeof(file->fa.memb_map)); @@ -1219,19 +1219,19 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) return(0); } /* end H5FD_multi_get_type_map() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_eoa + * Function: H5FD_multi_get_eoa * - * Purpose: Returns the end-of-address marker for the file. The EOA - * marker is the first address past the last byte allocated in - * the format address space. + * Purpose: Returns the end-of-address marker for the file. The EOA + * marker is the first address past the last byte allocated in + * the format address space. * - * Return: Success: The end-of-address-marker + * Return: Success: The end-of-address-marker * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * * Modifications: @@ -1247,7 +1247,7 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; haddr_t eoa = 0; static const char *func="H5FD_multi_get_eoa"; /* Function Name for error reporting */ @@ -1264,26 +1264,26 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) UNIQUE_MEMBERS(file->fa.memb_map, mt) { haddr_t memb_eoa; - if (file->memb[mt]) { + if (file->memb[mt]) { /* Retrieve EOA */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); - } H5E_END_TRY; + } H5E_END_TRY; - if(HADDR_UNDEF == memb_eoa) + if(HADDR_UNDEF == memb_eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) if(memb_eoa>0) memb_eoa += file->fa.memb_addr[mt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - memb_eoa = file->memb_next[mt]; - assert(HADDR_UNDEF != memb_eoa); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + memb_eoa = file->memb_next[mt]; + assert(HADDR_UNDEF != memb_eoa); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) - } + } if(memb_eoa > eoa) eoa = memb_eoa; @@ -1294,44 +1294,44 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) if(H5FD_MEM_DEFAULT == mmt) mmt = type; - if(file->memb[mmt]) { + if(file->memb[mmt]) { H5E_BEGIN_TRY { - eoa = H5FDget_eoa(file->memb[mmt], mmt); + eoa = H5FDget_eoa(file->memb[mmt], mmt); } H5E_END_TRY; - if(HADDR_UNDEF == eoa) + if(HADDR_UNDEF == eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) - if(eoa > 0) + if(eoa > 0) eoa += file->fa.memb_addr[mmt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - eoa = file->memb_next[mmt]; - assert(HADDR_UNDEF != eoa); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + eoa = file->memb_next[mmt]; + assert(HADDR_UNDEF != eoa); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) - } + } } return eoa; } /* end H5FD_multi_get_eoa() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_set_eoa + * Function: H5FD_multi_set_eoa * - * Purpose: Set the end-of-address marker for the file by savig the new - * EOA value in the file struct. Also set the EOA marker for the - * subfile in which the new EOA value falls. We don't set the - * EOA values of any other subfiles. + * Purpose: Set the end-of-address marker for the file by savig the new + * EOA value in the file struct. Also set the EOA marker for the + * subfile in which the new EOA value falls. We don't set the + * EOA values of any other subfiles. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * * Modifications: @@ -1350,9 +1350,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) static herr_t H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; - herr_t status; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; + herr_t status; static const char *func="H5FD_multi_set_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1383,7 +1383,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) assert(eoa < file->memb_next[mmt]); H5E_BEGIN_TRY { - status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); + status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); } H5E_END_TRY; if(status < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) @@ -1391,20 +1391,20 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) return 0; } /* end H5FD_multi_set_eoa() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_get_eof + * Function: H5FD_multi_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the total multi size or the current EOA marker. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the total multi size or the current EOA marker. * - * Return: Success: End of file address, the first address past - * the end of the multi of files or the current - * EOA, whichever is larger. + * Return: Success: End of file address, the first address past + * the end of the multi of files or the current + * EOA, whichever is larger. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1412,8 +1412,8 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) static haddr_t H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) { - const H5FD_multi_t *file = (const H5FD_multi_t*)_file; - haddr_t eof = 0; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + haddr_t eof = 0; static const char *func="H5FD_multi_get_eof"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1452,31 +1452,31 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if(H5FD_MEM_DEFAULT == mmt) mmt = type; - if(file->memb[mmt]) { + if(file->memb[mmt]) { /* Retrieve EOF */ H5E_BEGIN_TRY { - eof = H5FDget_eof(file->memb[mmt], mmt); + eof = H5FDget_eof(file->memb[mmt], mmt); } H5E_END_TRY; - if(HADDR_UNDEF == eof) + if(HADDR_UNDEF == eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) - if(eof > 0) + if(eof > 0) eof += file->fa.memb_addr[mmt]; - } else if(file->fa.relax) { - /* - * The member is not open yet (maybe it doesn't exist). Make the - * best guess about the end-of-file. - */ - eof = file->memb_next[mmt]; - assert(HADDR_UNDEF != eof); - } else { + } else if(file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + eof = file->memb_next[mmt]; + assert(HADDR_UNDEF != eof); + } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) - } + } } return eof; } - + /*------------------------------------------------------------------------- * Function: H5FD_multi_get_handle * @@ -1507,17 +1507,17 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) return (H5FDget_vfd_handle(file->memb[mmt], fapl, file_handle)); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_alloc + * Function: H5FD_multi_alloc * - * Purpose: Allocate file memory. + * Purpose: Allocate file memory. * - * Return: Success: Address of new memory + * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 12, 1999 * *------------------------------------------------------------------------- @@ -1525,9 +1525,9 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; - haddr_t addr; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; + haddr_t addr; static const char *func="H5FD_multi_alloc"; /* Function Name for error reporting */ mmt = file->fa.memb_map[type]; @@ -1548,31 +1548,31 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /*#ifdef TMP if ( addr + size > file->eoa ) { - if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { + if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, \ - "can't set eoa", HADDR_UNDEF) - } + "can't set eoa", HADDR_UNDEF) + } } #else if ( addr + size > file->eoa ) - file->eoa = addr + size; + file->eoa = addr + size; #endif */ return addr; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_free + * Function: H5FD_multi_free * - * Purpose: Frees memory + * Purpose: Frees memory * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 12, 1999 * *------------------------------------------------------------------------- @@ -1580,8 +1580,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mmt; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mmt; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1594,20 +1594,20 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi return H5FDfree(file->memb[mmt], mmt, dxpl_id, addr-file->fa.memb_addr[mmt], size); } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_read + * Function: H5FD_multi_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: Zero. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, contents of buffer BUF are undefined. + * Failure: -1, contents of buffer BUF are undefined. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1616,26 +1616,26 @@ static herr_t H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; - haddr_t start_addr = 0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; + haddr_t start_addr = 0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* Find the file to which this address belongs */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - mmt = file->fa.memb_map[mt]; - if(H5FD_MEM_DEFAULT == mmt) + mmt = file->fa.memb_map[mt]; + if(H5FD_MEM_DEFAULT == mmt) mmt = mt; - assert(mmt > 0 && mmt < H5FD_MEM_NTYPES); + assert(mmt > 0 && mmt < H5FD_MEM_NTYPES); - if(file->fa.memb_addr[mmt] > addr) + if(file->fa.memb_addr[mmt] > addr) continue; - if(file->fa.memb_addr[mmt] >= start_addr) { - start_addr = file->fa.memb_addr[mmt]; - hi = mmt; - } /* end if */ + if(file->fa.memb_addr[mmt] >= start_addr) { + start_addr = file->fa.memb_addr[mmt]; + hi = mmt; + } /* end if */ } /* end for */ assert(hi > 0); @@ -1643,19 +1643,19 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, return H5FDread(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_read() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_write + * Function: H5FD_multi_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero + * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1664,26 +1664,26 @@ static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; - haddr_t start_addr = 0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; + haddr_t start_addr = 0; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* Find the file to which this address belongs */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - mmt = file->fa.memb_map[mt]; - if(H5FD_MEM_DEFAULT == mmt) + mmt = file->fa.memb_map[mt]; + if(H5FD_MEM_DEFAULT == mmt) mmt = mt; - assert(mmt > 0 && mmt 0 && mmtfa.memb_addr[mmt] > addr) + if(file->fa.memb_addr[mmt] > addr) continue; - if(file->fa.memb_addr[mmt] >= start_addr) { - start_addr = file->fa.memb_addr[mmt]; - hi = mmt; - } /* end if */ + if(file->fa.memb_addr[mmt] >= start_addr) { + start_addr = file->fa.memb_addr[mmt]; + hi = mmt; + } /* end if */ } /* end for */ assert(hi > 0); @@ -1691,17 +1691,17 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, return H5FDwrite(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_write() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_flush + * Function: H5FD_multi_flush * - * Purpose: Flushes all multi members. + * Purpose: Flushes all multi members. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1, as many files flushed as possible. + * Failure: -1, as many files flushed as possible. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1709,13 +1709,13 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt; + int nerrors=0; static const char *func="H5FD_multi_flush"; /* Function Name for error reporting */ #if 0 - H5FD_mem_t mmt; + H5FD_mem_t mmt; /* Debugging stuff... */ fprintf(stderr, "multifile access information:\n"); @@ -1723,9 +1723,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* print the map */ fprintf(stderr, " map="); for (mt=1; mtmemb_map[mt]; - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt); + mmt = file->memb_map[mt]; + if (H5FD_MEM_DEFAULT==mmt) mmt = mt; + fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt); } fprintf(stderr, "\n"); @@ -1735,14 +1735,14 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) fprintf(stderr, " ------ -------------------- -------------------- -------------------- ------------------------------\n"); for (mt=1; mtmemb_addr[mt]) { - haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); - fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", - (int)mt, (unsigned long long)(file->memb_addr[mt]), - (unsigned long long)eoa, - (unsigned long long)(file->memb_next[mt]), - file->memb_name[mt]); - } + if (HADDR_UNDEF!=file->memb_addr[mt]) { + haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); + fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", + (int)mt, (unsigned long long)(file->memb_addr[mt]), + (unsigned long long)eoa, + (unsigned long long)(file->memb_next[mt]), + file->memb_name[mt]); + } } #endif @@ -1751,11 +1751,11 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* Flush each file */ for (mt=H5FD_MEM_SUPER; mtmemb[mt]) { - H5E_BEGIN_TRY { - if (H5FDflush(file->memb[mt],dxpl_id,closing)<0) nerrors++; - } H5E_END_TRY; - } + if (file->memb[mt]) { + H5E_BEGIN_TRY { + if (H5FDflush(file->memb[mt],dxpl_id,closing)<0) nerrors++; + } H5E_END_TRY; + } } if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1) @@ -1763,16 +1763,16 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) return 0; } - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_truncate + * Function: H5FD_multi_truncate * - * Purpose: Truncates all multi members. + * Purpose: Truncates all multi members. * - * Return: Success: 0 - * Failure: -1, as many files truncated as possible. + * Return: Success: 0 + * Failure: -1, as many files truncated as possible. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 31, 2008 * *------------------------------------------------------------------------- @@ -1780,9 +1780,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + H5FD_mem_t mt; + int nerrors=0; static const char *func="H5FD_multi_truncate"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1790,12 +1790,12 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) /* Truncate each file */ for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - if(file->memb[mt]) { - H5E_BEGIN_TRY { - if(H5FDtruncate(file->memb[mt], dxpl_id, closing) < 0) + if(file->memb[mt]) { + H5E_BEGIN_TRY { + if(H5FDtruncate(file->memb[mt], dxpl_id, closing) < 0) nerrors++; - } H5E_END_TRY; - } + } H5E_END_TRY; + } } if(nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1) @@ -1803,28 +1803,28 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) return 0; } /* end H5FD_multi_truncate() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_lock + * Function: H5FD_multi_lock * - * Purpose: Place a lock on all multi members. - * When there is error in locking a member file, it will not - * proceed further and will try to remove the locks of those - * member files that are locked before error is encountered. + * Purpose: Place a lock on all multi members. + * When there is error in locking a member file, it will not + * proceed further and will try to remove the locks of those + * member files that are locked before error is encountered. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Vailin Choi; March 2015 + * Programmer: Vailin Choi; March 2015 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors = 0; - H5FD_mem_t out_mt; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors = 0; + H5FD_mem_t out_mt; static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1861,26 +1861,26 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) } /* H5FD_multi_lock() */ - + /*------------------------------------------------------------------------- - * Function: H5FD_multi_unlock + * Function: H5FD_multi_unlock * - * Purpose: Remove the lock on all multi members. - * It will try to unlock all member files but will record error - * encountered. + * Purpose: Remove the lock on all multi members. + * It will try to unlock all member files but will record error + * encountered. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Vailin Choi; March 2015 + * Programmer: Vailin Choi; March 2015 * *------------------------------------------------------------------------- */ static herr_t H5FD_multi_unlock(H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; - int nerrors=0; + H5FD_multi_t *file = (H5FD_multi_t*)_file; + int nerrors=0; static const char *func="H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1889,7 +1889,7 @@ H5FD_multi_unlock(H5FD_t *_file) ALL_MEMBERS(mt) { if(file->memb[mt]) if(H5FDunlock(file->memb[mt]) < 0) - nerrors++; + nerrors++; } END_MEMBERS; if(nerrors) @@ -1898,18 +1898,18 @@ H5FD_multi_unlock(H5FD_t *_file) return 0; } /* H5FD_multi_unlock() */ - + /*------------------------------------------------------------------------- - * Function: compute_next + * Function: compute_next * - * Purpose: Compute the memb_next[] values of the file based on the - * file's member map and the member starting addresses. + * Purpose: Compute the memb_next[] values of the file based on the + * file's member map and the member starting addresses. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 23, 1999 * *------------------------------------------------------------------------- @@ -1921,36 +1921,36 @@ compute_next(H5FD_multi_t *file) H5Eclear2(H5E_DEFAULT); ALL_MEMBERS(mt) { - file->memb_next[mt] = HADDR_UNDEF; + file->memb_next[mt] = HADDR_UNDEF; } END_MEMBERS; UNIQUE_MEMBERS(file->fa.memb_map, mt1) { - UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { - if (file->fa.memb_addr[mt1]fa.memb_addr[mt2] && - (HADDR_UNDEF==file->memb_next[mt1] || - file->memb_next[mt1]>file->fa.memb_addr[mt2])) { - file->memb_next[mt1] = file->fa.memb_addr[mt2]; - } - } END_MEMBERS; - if (HADDR_UNDEF==file->memb_next[mt1]) { - file->memb_next[mt1] = HADDR_MAX; /*last member*/ - } + UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { + if (file->fa.memb_addr[mt1]fa.memb_addr[mt2] && + (HADDR_UNDEF==file->memb_next[mt1] || + file->memb_next[mt1]>file->fa.memb_addr[mt2])) { + file->memb_next[mt1] = file->fa.memb_addr[mt2]; + } + } END_MEMBERS; + if (HADDR_UNDEF==file->memb_next[mt1]) { + file->memb_next[mt1] = HADDR_MAX; /*last member*/ + } } END_MEMBERS; return 0; } - + /*------------------------------------------------------------------------- - * Function: open_members + * Function: open_members * - * Purpose: Opens all members which are not opened yet. + * Purpose: Opens all members which are not opened yet. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 23, 1999 * *------------------------------------------------------------------------- @@ -1966,30 +1966,30 @@ compute_next(H5FD_multi_t *file) static int open_members(H5FD_multi_t *file) { - char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; - int nerrors=0; + char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; + int nerrors=0; static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); UNIQUE_MEMBERS(file->fa.memb_map, mt) { - if(file->memb[mt]) - continue; /*already open*/ - assert(file->fa.memb_name[mt]); - /* Note: This truncates the user's filename down to only sizeof(tmp) - * characters. -QK & JK, 2013/01/17 - */ - snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); - tmp[sizeof(tmp) - 1] = '\0'; - - H5E_BEGIN_TRY { - file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); - } H5E_END_TRY; - if(!file->memb[mt]) { - if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) - nerrors++; - } + if(file->memb[mt]) + continue; /*already open*/ + assert(file->fa.memb_name[mt]); + /* Note: This truncates the user's filename down to only sizeof(tmp) + * characters. -QK & JK, 2013/01/17 + */ + snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + tmp[sizeof(tmp) - 1] = '\0'; + + H5E_BEGIN_TRY { + file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); + } H5E_END_TRY; + if(!file->memb[mt]) { + if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) + nerrors++; + } } END_MEMBERS; if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1) @@ -1998,7 +1998,7 @@ open_members(H5FD_multi_t *file) } #pragma GCC diagnostic pop - + #ifdef _H5private_H /* * This is not related to the functionality of the driver code. -- cgit v0.12 From ede618741953c9ff70f9a0f3a0d22e7c92043437 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jul 2019 10:32:43 -0500 Subject: Fix note text and cmake module include --- config/cmake_ext_mod/FindSZIP.cmake | 2 +- release_docs/RELEASE.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 152f8ac..b84d768 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -57,7 +57,7 @@ endforeach() if(NOT SZIP_LIBRARY) find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) - include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + include(SelectLibraryConfigurations) select_library_configurations(SZIP) mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) endif() diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 72a3fb1..01d8658 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -63,7 +63,7 @@ New Features shared. A new option was added to CMake, ONLY_SHARED_LIBS, which will skip building static libraries. Certain utility functions will build with static libs but are not published. Tests are adjusted to use the correct - libraries. + libraries depending on SHARED/STATIC settings. (ADB - 2019/06/12, HDFFV-10805) @@ -82,8 +82,8 @@ New Features - Change tools test that test the error stack There are some use cases which can cause the error stack of tools to be - different then the expected. These tests now use grepTest.cmake, this was - changed to allow the error file to be searched for an expected string. + different then the expected output. These tests now use grepTest.cmake, + this was changed to allow the error file to be searched for an expected string. (ADB - 2019/04/15, HDFFV-10741) -- cgit v0.12 From 52f0622bfed19a56d2f57b25b07b5a7996915507 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 09:09:59 -0700 Subject: Converted duplicated flags code to a set of if statements. --- config/gnu-flags | 552 ++++++++++++------------------------------------------- 1 file changed, 117 insertions(+), 435 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index f401d3d..585c2b4 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -37,10 +37,10 @@ if test X = "X$cc_flags_set"; then cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` if test X = "X$cc_vendor" -a X != "X$cc_version"; then - cc_vendor=gcc + cc_vendor=gcc fi if test "-" != "$cc_vendor-$cc_version"; then - echo "compiler '$CC' is GNU $cc_vendor-$cc_version" + echo "compiler '$CC' is GNU $cc_vendor-$cc_version" fi # Some version numbers @@ -127,29 +127,29 @@ case "$cc_vendor-$cc_version" in # Production # NDEBUG is handled explicitly by the configure script case "$cc_vendor-$cc_version" in - gcc-4.*) - PROD_CFLAGS= - ;; - gcc-[56789].*) - PROD_CFLAGS="-fstdarg-opt" - ;; - *) - # gcc automatically inlines based on the optimization level - # this is just a failsafe - PROD_CFLAGS="-finline-functions" - ;; + gcc-4.*) + PROD_CFLAGS= + ;; + gcc-[56789].*) + PROD_CFLAGS="-fstdarg-opt" + ;; + *) + # gcc automatically inlines based on the optimization level + # this is just a failsafe + PROD_CFLAGS="-finline-functions" + ;; esac # Debug # NDEBUG is handled explicitly by the configure script # -g is handled by the symbols flags case "$cc_vendor-$cc_version" in - gcc-[56789].*) - DEBUG_CFLAGS="-ftrapv -fno-common" - ;; - *) - DEBUG_CFLAGS= - ;; + gcc-[56789].*) + DEBUG_CFLAGS="-ftrapv -fno-common" + ;; + *) + DEBUG_CFLAGS= + ;; esac # Developer warnings (suggestions from gcc, not code problems) @@ -166,18 +166,18 @@ case "$cc_vendor-$cc_version" in # Optimization case "$cc_vendor-$cc_version" in - gcc-4.*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS= - ;; - gcc-[56789].*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-Og" - ;; - *) - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS= - ;; + gcc-4.*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + ;; + gcc-[56789].*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + ;; + *) + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + ;; esac NO_OPT_CFLAGS="-O0" @@ -186,434 +186,116 @@ case "$cc_vendor-$cc_version" in ;; esac -# Version specific GCC flags -# -# Please follow the pattern below by adding new versions at the top, copying -# the information from the previous version and adding modifications to that. -case "$cc_vendor-$cc_version" in - -# When the gcc 10.x release is out, we should check for additional flags to -# include and break it out into it's own section, like the other versions -# below. -QAK - gcc-9*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - - # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" - - # Append warning flags that only gcc 7.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" - - # Append warning flags that only gcc 8.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" - - # Append warning flags that only gcc 9.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" - ;; - - gcc-8*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" +# Version-specific GCC flags +if test "X-gcc" = "X-$cc_vendor"; then - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - - # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" - - # Append warning flags that only gcc 7.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" - - # Append warning flags that only gcc 8.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" - ;; - - gcc-7*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - - # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" - - # Append warning flags that only gcc 7.x+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" - ;; - - gcc-6*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about + # Special cases # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - - # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" - ;; - - gcc-5*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - ;; - - gcc-4.9*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - ;; - - gcc-4.8*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init" + # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 6; then + H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + fi - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + # -Wvolatile-register-var was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.2-4.3 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 3; then + H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + fi - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + # -Wstrict-aliasing was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.5-4.6 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 6; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing" + fi - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - ;; + # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 4; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + fi - gcc-4.7*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) + # -Wvla was later incorporated into -Wpedantic and + # only needs to be specified explicitly for gcc 4 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then + H5_CFLAGS="$H5_CFLAGS -Wvla" + fi - # Append warning flags that only gcc 4.3+ knows about # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - ;; - - gcc-4.6*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" - - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about + # Main version-specific flags # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - ;; - - gcc-4.5*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" - - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - ;; - - gcc-4.4*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" - - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + # gcc 4.3 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" + fi - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - ;; + # gcc 4.4 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + fi - gcc-4.3*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 4.5 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + # gcc 4.6 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + fi - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + # gcc 4.7 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + fi - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wvla" - ;; + # gcc 4.8 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + fi - gcc-4.2*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 4.9 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + # gcc 5 + if test $cc_vers_major -ge 5; then + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + fi - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" - ;; + # gcc 6 + if test $cc_vers_major -ge 6; then + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + fi - gcc-4.1*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 7 + if test $cc_vers_major -ge 7; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" - ;; + # gcc 8 + if test $cc_vers_major -ge 8; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" + fi -esac + # gcc 9 + if test $cc_vers_major -ge 9; then + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" + fi +fi # Clear cc info if no flags set if test "X$cc_flags_set" = "X"; then - cc_vendor= - cc_version= + cc_vendor= + cc_version= fi -- cgit v0.12 From c582df7538e71fd80915ef922b3edb530a66f70f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 09:22:32 -0700 Subject: Revert path processing to fix daily test errors. --- src/H5PLpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 44d9cb9..e270c73 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -678,7 +678,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") - HDsnprintf(path, len, "%s%s%s", dir, H5PL_PATH_SEPARATOR, dp->d_name); + HDsnprintf(path, len, "%s/%s", dir, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) -- cgit v0.12 From 924d4c01a8b32d1a1c2496ca68a066b5bd9343e9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 10:49:55 -0700 Subject: Reworked the config/gnu-flags file to be more organized and robust. --- config/gnu-flags | 164 +++++++++++++++++++++++++++---------------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 585c2b4..3d7331b 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -14,7 +14,7 @@ # This file should be sourced into configure if the compiler is the # GNU gcc compiler or a derivative. It is careful not to do anything -# if the compiler is not GNU; otherwise `cc_flags_set' is set to `yes' +# if the compiler is not GNU; otherwise 'cc_flags_set' is set to 'yes' # # Get the compiler version in a way that works for gcc @@ -43,20 +43,21 @@ if test X = "X$cc_flags_set"; then echo "compiler '$CC' is GNU $cc_vendor-$cc_version" fi - # Some version numbers + # Get the compiler version numbers cc_vers_major=`echo $cc_version | cut -f1 -d.` cc_vers_minor=`echo $cc_version | cut -f2 -d.` cc_vers_patch=`echo $cc_version | cut -f3 -d.` test -n "$cc_vers_major" || cc_vers_major=0 test -n "$cc_vers_minor" || cc_vers_minor=0 test -n "$cc_vers_patch" || cc_vers_patch=0 - cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` fi -# Common GCC flags for various situations -case "$cc_vendor-$cc_version" in - gcc*) - # Architecture-specific flags +if test "X-gcc" = "X-$cc_vendor"; then + + ############################### + # Architecture-specific flags # + ############################### + arch= case "$host_os-$host_cpu" in # FreeBSD sets the information from "uname -m" to the general machine @@ -96,15 +97,65 @@ case "$cc_vendor-$cc_version" in ;; esac - # Host-specific flags - case "`hostname`" in - sleipnir.ncsa.uiuc.edu) - arch="$arch -pipe" - ;; - esac + H5_CFLAGS="$H5_CFLAGS $arch" + + ############## + # Production # + ############## + + # NDEBUG is handled explicitly by the configure script + if test $cc_vers_major -eq 4; then + PROD_CFLAGS= + else + PROD_CFLAGS="-fstdarg-opt" + fi + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags + if test $cc_vers_major -eq 4; then + DEBUG_CFLAGS= + else + DEBUG_CFLAGS="-ftrapv -fno-common" + fi + + ########### + # Symbols # + ########### + + NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer" + + ############# + # Profiling # + ############# + + PROFILE_CFLAGS="-pg" + + ################ + # Optimization # + ################ + + if test $cc_vers_major -eq 4; then + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + else + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + fi + NO_OPT_CFLAGS="-O0" + + ############ + # Warnings # + ############ + + ########### + # General # + ########### - # General flags - # # Note that some of the flags listed here really should be developer # flags (listed in a separate variable, below) but we put them here # because they are not raised by the current code and we'd like to @@ -117,81 +168,25 @@ case "$cc_vendor-$cc_version" in # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add # it to the developer flags. # - H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" - # Production - # NDEBUG is handled explicitly by the configure script - case "$cc_vendor-$cc_version" in - gcc-4.*) - PROD_CFLAGS= - ;; - gcc-[56789].*) - PROD_CFLAGS="-fstdarg-opt" - ;; - *) - # gcc automatically inlines based on the optimization level - # this is just a failsafe - PROD_CFLAGS="-finline-functions" - ;; - esac - - # Debug - # NDEBUG is handled explicitly by the configure script - # -g is handled by the symbols flags - case "$cc_vendor-$cc_version" in - gcc-[56789].*) - DEBUG_CFLAGS="-ftrapv -fno-common" - ;; - *) - DEBUG_CFLAGS= - ;; - esac + ###################### + # Developer warnings # + ###################### - # Developer warnings (suggestions from gcc, not code problems) + # (suggestions from gcc, not code problems) # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn -Wformat-nonliteral" NO_DEVELOPER_WARNING_CFLAGS="-Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn" - # Symbols - NO_SYMBOLS_CFLAGS="-s" - SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer" - - # Profile - PROFILE_CFLAGS="-pg" - - # Optimization - case "$cc_vendor-$cc_version" in - gcc-4.*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS= - ;; - gcc-[56789].*) - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-Og" - ;; - *) - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS= - ;; - esac - NO_OPT_CFLAGS="-O0" - - # Flags are set - cc_flags_set=yes - ;; -esac - -# Version-specific GCC flags -if test "X-gcc" = "X-$cc_vendor"; then - - # - # Special cases - # + ####################### + # gcc 4 special cases # + ####################### # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 6; then @@ -221,9 +216,9 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wvla" fi - # - # Main version-specific flags - # + ############################# + # Version-specific warnings # + ############################# # gcc 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then @@ -292,6 +287,11 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 9; then H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" fi + + ################# + # Flags are set # + ################# + cc_flags_set=yes fi # Clear cc info if no flags set -- cgit v0.12 From 40b63bffb7268f363ed7172916350d1b9a73fca8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 13:05:50 -0700 Subject: * Fixed a bug in the gcc warning parsing * Changed version parsing from == gcc 4.x to < to handle ancient compilers. --- config/gnu-flags | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 3d7331b..4407865 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -23,7 +23,7 @@ # cc_vendor: The compiler name: gcc # cc_version: Version number: 2.91.60, 2.7.2.1 # -if test X = "X$cc_flags_set"; then +if test "X-" = "X-$cc_flags_set"; then # PathScale compiler spits out gcc version string too. Need to # filter it out. # icc beginning with version 12 includes a "gcc version compatiblilty" @@ -104,7 +104,7 @@ if test "X-gcc" = "X-$cc_vendor"; then ############## # NDEBUG is handled explicitly by the configure script - if test $cc_vers_major -eq 4; then + if test $cc_vers_major -le 4; then PROD_CFLAGS= else PROD_CFLAGS="-fstdarg-opt" @@ -116,7 +116,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # NDEBUG is handled explicitly by the configure script # -g is handled by the symbols flags - if test $cc_vers_major -eq 4; then + if test $cc_vers_major -le 4; then DEBUG_CFLAGS= else DEBUG_CFLAGS="-ftrapv -fno-common" @@ -139,7 +139,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # Optimization # ################ - if test $cc_vers_major -eq 4; then + if test "$cc_vers_major" -le 4; then HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS= else @@ -189,24 +189,24 @@ if test "X-gcc" = "X-$cc_vendor"; then ####################### # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 6; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then H5_CFLAGS="$H5_CFLAGS -Wno-long-long" fi # -Wvolatile-register-var was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.2-4.3 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 3; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" fi # -Wstrict-aliasing was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.5-4.6 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 6; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing" fi # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 4; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" fi -- cgit v0.12 From 3fa1cc47008998f2b6d69276724cdb67b4103596 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Jul 2019 13:40:09 -0700 Subject: Fix errant quotes --- config/gnu-flags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gnu-flags b/config/gnu-flags index 4407865..c8fd724 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -139,7 +139,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # Optimization # ################ - if test "$cc_vers_major" -le 4; then + if test $cc_vers_major -le 4; then HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS= else -- cgit v0.12 From 33e9b4526ec7b5d910bda879ac92dc992672057b Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 11 Jul 2019 08:31:02 -0500 Subject: Use H5DOpen2 in hl/test/test_dset_append.c. --- hl/test/test_dset_append.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 9d466b5..8bb4f84 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -691,7 +691,7 @@ test_dataset_append_BUG1(hid_t fid) FAIL_STACK_ERROR; /* Open the dataset again */ - if((did = H5Dopen(fid, DBUGNAME1, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, DBUGNAME1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Read the dataset */ @@ -853,7 +853,7 @@ test_dataset_append_BUG2(hid_t fid) FAIL_STACK_ERROR; /* Open the dataset again */ - if((did = H5Dopen(fid, DBUGNAME2, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, DBUGNAME2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Read the dataset */ -- cgit v0.12 From 9655485f6af87e8ee221c824f649fa013fad4542 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Jul 2019 10:19:24 -0500 Subject: non-windows test must be skipped on windows --- tools/test/perform/CMakeTests.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 45f43b4..20e7f59 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -170,7 +170,9 @@ endif () set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") if (H5_HAVE_PARALLEL) - add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + if (UNIX) + add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + endif () add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) -- cgit v0.12 From 6333fb8711adc3af930e186dad3b8b756e41a863 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Jul 2019 16:24:47 -0500 Subject: Fix packaging issue --- fortran/src/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 774ed8c..315dc85 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -356,8 +356,13 @@ install ( ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h - ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + if (NOT ONLY_SHARED_LIBS) + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + else () + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + endif () DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT -- cgit v0.12 From 3566fff6261d0bb8e360d3842e99919d2eb4ba73 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 11 Jul 2019 16:08:35 -0700 Subject: Reverted snprintf to sprintf in the multi VFD since the former causes problems on Windows. --- src/H5FDmulti.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index acd128c..800869d 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1966,30 +1966,30 @@ compute_next(H5FD_multi_t *file) static int open_members(H5FD_multi_t *file) { - char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; - int nerrors=0; + char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; + int nerrors = 0; static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); UNIQUE_MEMBERS(file->fa.memb_map, mt) { - if(file->memb[mt]) + if(file->memb[mt]) continue; /*already open*/ - assert(file->fa.memb_name[mt]); + assert(file->fa.memb_name[mt]); /* Note: This truncates the user's filename down to only sizeof(tmp) * characters. -QK & JK, 2013/01/17 */ - snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + sprintf(tmp, file->fa.memb_name[mt], file->name); tmp[sizeof(tmp) - 1] = '\0'; - H5E_BEGIN_TRY { - file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); - } H5E_END_TRY; - if(!file->memb[mt]) { - if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) - nerrors++; - } + H5E_BEGIN_TRY { + file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); + } H5E_END_TRY; + if(!file->memb[mt]) { + if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) + nerrors++; + } } END_MEMBERS; if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1) -- cgit v0.12 From d5031a55192ac6b8ca81a0e5315cb4739af98896 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 14 Jul 2019 10:46:03 -0700 Subject: Removed support for gcc 4.3 and earlier. --- config/gnu-flags | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index c8fd724..9b61907 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -174,6 +174,7 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" ###################### # Developer warnings # @@ -193,12 +194,6 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wno-long-long" fi - # -Wvolatile-register-var was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.2-4.3 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" - fi - # -Wstrict-aliasing was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.5-4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then @@ -220,11 +215,6 @@ if test "X-gcc" = "X-$cc_vendor"; then # Version-specific warnings # ############################# - # gcc 4.3 - if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - fi - # gcc 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" -- cgit v0.12 From d7144b2fa40b1be59e6250313c5e5f1a2bd8fb25 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 16 Jul 2019 03:49:50 -0500 Subject: Restored warnings for older gcc so jam can continue to creak along. --- config/gnu-flags | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 9b61907..ae8ddb0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -174,7 +174,6 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" ###################### # Developer warnings # @@ -194,6 +193,12 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS -Wno-long-long" fi + # -Wvolatile-register-var was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.2-4.3 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 3; then + H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + fi + # -Wstrict-aliasing was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.5-4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then @@ -201,7 +206,7 @@ if test "X-gcc" = "X-$cc_vendor"; then fi # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" fi @@ -215,6 +220,11 @@ if test "X-gcc" = "X-$cc_vendor"; then # Version-specific warnings # ############################# + # gcc 4.3 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" + fi + # gcc 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" -- cgit v0.12 From 6c84a83eeaa187c92d445f8ef8565a4337498cd6 Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Tue, 16 Jul 2019 14:22:31 -0500 Subject: H5P: Fix wrong value comparison in assert Move compile assert of H5P_plist_type to H5P__init_package() --- src/H5Pint.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/H5Pint.c b/src/H5Pint.c index a9dc363..5683403 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -430,6 +430,9 @@ H5P__init_package(void) FUNC_ENTER_PACKAGE + /* Sanity check */ + HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1)); + /* * Initialize the Generic Property class & object groups. */ @@ -5434,9 +5437,8 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1)); - HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); + /* Sanity check */ + HDassert(type >= H5P_TYPE_USER && type < H5P_TYPE_MAX_TYPE); /* Check arguments */ if(type == H5P_TYPE_USER) -- cgit v0.12 From 6e4f2798e883a88de7126739307722f6da39dd98 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 17 Jul 2019 10:42:58 -0500 Subject: HDFFV-10424 add optional variable to avoid PDB installs --- config/cmake_ext_mod/HDFMacros.cmake | 2 +- release_docs/RELEASE.txt | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 52b96fc..0a4598d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -73,7 +73,7 @@ endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) + if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) get_target_property (target_type ${libtarget} TYPE) if (${libtype} MATCHES "SHARED") set (targetfilename $) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 01d8658..6be1d7f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,15 @@ New Features Configuration: ------------- + - Windows PDB files are always installed + + There are configuration settings for Windows, that may not generate + PDB files. As such the install utility will break because those files + are not found. Add an optional variable that can be set to not install + PDB files. + + (ADB - 2019/07/17, HDFFV-100424) + - Windows PDB files are installed incorrectly For static builds, the PDB files for windows should be installed next -- cgit v0.12