diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-08 13:49:24 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-08 13:49:24 (GMT) |
commit | 217c553b95358bfb0c41bf54df4f7596055cc9af (patch) | |
tree | 0d0480c6a94572f27b7ac151501eb7c973f37255 | |
parent | 6d5505282c353aeeae1c5bd4420607cd7489c996 (diff) | |
parent | 0820bef83e258c42294583e140e59f0637a77694 (diff) | |
download | hdf5-217c553b95358bfb0c41bf54df4f7596055cc9af.zip hdf5-217c553b95358bfb0c41bf54df4f7596055cc9af.tar.gz hdf5-217c553b95358bfb0c41bf54df4f7596055cc9af.tar.bz2 |
[svn-r22446] merge fron trunk pre-code review
-rw-r--r-- | CMakeLists.txt | 25 | ||||
-rw-r--r-- | MANIFEST | 3 | ||||
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 568 | ||||
-rw-r--r-- | config/cmake/HDF5CXXTests.cpp | 56 | ||||
-rw-r--r-- | config/cmake/HDF5Tests.c | 133 | ||||
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 5 | ||||
-rwxr-xr-x | config/cmake/cacheinit.cmake | 8 | ||||
-rwxr-xr-x | config/cmake/mccacheinit.cmake | 18 | ||||
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | perform/CMakeLists.txt | 48 | ||||
-rw-r--r-- | src/H5F.c | 1 | ||||
-rw-r--r-- | src/H5FDlog.c | 19 | ||||
-rw-r--r-- | src/H5FDmulti.c | 3 | ||||
-rw-r--r-- | src/H5FDpublic.h | 2 | ||||
-rw-r--r-- | src/H5Faccum.c | 27 | ||||
-rw-r--r-- | src/H5MF.c | 20 | ||||
-rw-r--r-- | src/H5MFaggr.c | 115 | ||||
-rw-r--r-- | src/H5config.h.in | 4 | ||||
-rw-r--r-- | test/mf.c | 50 | ||||
-rw-r--r-- | tools/h5copy/testfiles/h5copy_ref.out.ls | 2 | ||||
-rw-r--r-- | tools/h5copy/testfiles/h5copytst.out.ls | 174 | ||||
-rw-r--r-- | tools/h5stat/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tools/h5stat/h5stat.c | 39 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_notexist.ddl | 5 | ||||
-rw-r--r-- | tools/h5stat/testh5stat.sh.in | 3 |
26 files changed, 935 insertions, 437 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fbb8e98..9ac6f37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,6 +301,15 @@ IF (HDF5_ENABLE_COVERAGE) ENDIF (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- +# Option to indicate using dmalloc +#----------------------------------------------------------------------------- +# OPTION (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF) +# IF (HDF5_ENABLE_USING_DMALLOC) +# FIND_PACKAGE (DMALLOC) +# SET (H5_HAVE_DMALLOC DMALLOC_FOUND) +# ENDIF (HDF5_ENABLE_USING_DMALLOC) + +#----------------------------------------------------------------------------- # Option to indicate using a memory checker #----------------------------------------------------------------------------- OPTION (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) @@ -359,10 +368,17 @@ IF (CMAKE_BUILD_TYPE MATCHES Debug) -DH5I_DEBUG -DH5HL_DEBUG -DH5HG_DEBUG -DH5G_DEBUG -DH5F_DEBUG -DH5E_DEBUG -DH5D_DEBUG -DH5B_DEBUG -DH5AC_DEBUG -UNDEBUG ) + # Enable tracing of the API OPTION (HDF5_ENABLE_TRACE "Enable API tracing capability" ON) IF (HDF5_ENABLE_TRACE) ADD_DEFINITIONS (-DH5_DEBUG_API ) ENDIF (HDF5_ENABLE_TRACE) + # Enable instrumenting of the library's internal operations + OPTION (HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF) + IF (HDF5_ENABLE_INSTRUMENT) + SET (H5_HAVE_INSTRUMENTED_LIBRARY 1) + ENDIF (HDF5_ENABLE_INSTRUMENT) + MARK_AS_ADVANCED (HDF5_Enable_Instrument) #-- NMake Makefiles will overwhelm the console with warnings if -Wall is used. IF (NOT WIN32) ADD_DEFINITIONS (-Wall) @@ -407,7 +423,7 @@ ENDIF (HDF5_ENABLE_EMBEDDED_LIBINFO) OPTION (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) IF (HDF5_DISABLE_COMPILER_WARNINGS) # MSVC uses /w to suppress warnings. It also complains if another - # warning level is given, so remove it. + # warning level is given, so remove it.CMAKE_NO_STD_NAMESPACE IF (MSVC) SET (HDF5_WARNINGS_BLOCKED 1) STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -461,6 +477,7 @@ IF (HDF5_ENABLE_PARALLEL) # and once set, they are cached as false and not regenerated SET (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" ) CHECK_FUNCTION_EXISTS (MPI_File_get_size H5_HAVE_MPI_GET_SIZE) + SET (H5_MPI_FILE_SET_SIZE_BIG 1) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) @@ -475,6 +492,7 @@ IF (H5_HAVE_PARALLEL) ENDIF (MPI_C_LINK_FLAGS) ENDIF (H5_HAVE_PARALLEL) +SET (DEFAULT_API_VERSION "v110") #----------------------------------------------------------------------------- # Option to use 1.6.x API #----------------------------------------------------------------------------- @@ -482,6 +500,7 @@ OPTION (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF) SET (H5_USE_16_API_DEFAULT 0) IF (HDF5_USE_16_API_DEFAULT) SET (H5_USE_16_API_DEFAULT 1) + SET (DEFAULT_API_VERSION "v16") ENDIF (HDF5_USE_16_API_DEFAULT) #----------------------------------------------------------------------------- @@ -491,6 +510,7 @@ OPTION (HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF) SET (H5_USE_18_API_DEFAULT 0) IF (HDF5_USE_18_API_DEFAULT) SET (H5_USE_18_API_DEFAULT 1) + SET (DEFAULT_API_VERSION "v18") ENDIF (HDF5_USE_18_API_DEFAULT) #----------------------------------------------------------------------------- @@ -749,6 +769,9 @@ IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") IF (HDF5_ENABLE_PARALLEL) MESSAGE (FATAL " **** Parallel and C++ options are mutually exclusive **** ") ENDIF (HDF5_ENABLE_PARALLEL) + IF (CMAKE_NO_STD_NAMESPACE) + SET (H5_NO_STD 1) + ENDIF (CMAKE_NO_STD_NAMESPACE) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") @@ -1276,6 +1276,7 @@ ./tools/h5stat/testfiles/h5stat_newgrat-UA.ddl ./tools/h5stat/testfiles/h5stat_newgrat-UG.ddl ./tools/h5stat/testfiles/h5stat_newgrat.h5 +./tools/h5stat/testfiles/h5stat_notexist.ddl ./tools/h5stat/testfiles/h5stat_tsohm.ddl ./tools/h5stat/testfiles/h5stat_tsohm.h5 @@ -2219,6 +2220,7 @@ ./config/cmake/FindSZIP.cmake ./config/cmake/ConversionTests.c ./config/cmake/GetTimeOfDayTest.cpp +./config/cmake/HDF5CXXTests.cpp ./config/cmake/HDF5Tests.c ./config/cmake/xlatefile.c ./config/cmake/CheckTypeSize.cmake @@ -2246,6 +2248,7 @@ ./config/cmake/CPack.cmake ./config/cmake/NSIS.template.in ./config/cmake/NSIS.InstallOptions.ini.in + ./CMakeLists.txt ./CTestConfig.cmake ./c++/CMakeLists.txt diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 24fa7f7..c8d7f04 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -11,6 +11,7 @@ INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- # Always SET this for now IF we are on an OS X box @@ -37,18 +38,6 @@ ENDIF (HDF5_Enable_Clear_File_Buffers) MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) #----------------------------------------------------------------------------- -# Option for --enable-instrument -#----------------------------------------------------------------------------- -IF (CMAKE_BUILD_TYPE MATCHES Debug) - SET (HDF5_Enable_Instrument ON) -ENDIF (CMAKE_BUILD_TYPE MATCHES Debug) -OPTION (HDF5_Enable_Instrument "Instrument The library" HDF5_Enable_Instrument) -IF (HDF5_Enable_Instrument) - SET (H5_HAVE_INSTRUMENTED_LIBRARY 1) -ENDIF (HDF5_Enable_Instrument) -MARK_AS_ADVANCED (HDF5_Enable_Instrument) - -#----------------------------------------------------------------------------- # Option for --enable-strict-format-checks #----------------------------------------------------------------------------- OPTION (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) @@ -134,6 +123,8 @@ IF (WIN32) SET (WINDOWS 1) # MinGW tries to imitate Windows ENDIF (MINGW) SET (H5_HAVE_WIN32_API 1) + SET (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + SET (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) SET (WINDOWS 1) IF (MSVC) @@ -153,6 +144,8 @@ ENDIF (WIN32) # Should the Default Virtual File Driver be compiled? # This is hard-coded now but option should added to match configure # +SET (H5_DEFAULT_VFD H5FD_SEC2) + IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) # ---------------------------------------------------------------------- @@ -160,9 +153,8 @@ IF (WINDOWS) # that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). # (This flag should be _unset_ for all machines, except for Windows) SET (H5_HAVE_WINDOW_PATH 1) - SET (LINK_LIBS ${LINK_LIBS} "kernel32") +# SET (LINK_LIBS ${LINK_LIBS} "kernel32") ENDIF (WINDOWS) -SET (H5_DEFAULT_VFD H5FD_SEC2) SET (H5_DEFAULT_VOL H5VL_NATIVE) IF (WINDOWS) @@ -188,6 +180,9 @@ IF (WINDOWS) SET (H5_HAVE_TIMEZONE 1) SET (H5_HAVE_GETTIMEOFDAY 1) SET (H5_LONE_COLON 0) + + SET (H5_HAVE_LIBWS2_32 1) + SET (H5_HAVE_LIBWSOCK32 1) ENDIF (WINDOWS) #----------------------------------------------------------------------------- @@ -211,11 +206,11 @@ ENDIF (CYGWIN) # Check for the math library "m" #----------------------------------------------------------------------------- IF (NOT WINDOWS) - CHECK_LIBRARY_EXISTS_CONCAT ("m" random H5_HAVE_LIBM) + CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil H5_HAVE_LIBM) + CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32) + CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32) ENDIF (NOT WINDOWS) -CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32) -CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32) CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname H5_HAVE_LIBUCB) CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect H5_HAVE_LIBSOCKET) CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL) @@ -224,6 +219,8 @@ IF (NOT NOT_NEED_LIBNSL) CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname H5_HAVE_LIBNSL) ENDIF (NOT NOT_NEED_LIBNSL) +# For other tests to use the same libraries +SET (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) SET (USE_INCLUDES "") IF (WINDOWS) @@ -232,6 +229,123 @@ ENDIF (WINDOWS) TEST_BIG_ENDIAN(H5_WORDS_BIGENDIAN) +# For other specific tests, use this MACRO. +MACRO (HDF5_FUNCTION_TEST OTHER_TEST) + IF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") + SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") + SET (OTHER_TEST_ADD_LIBRARIES) + IF (CMAKE_REQUIRED_LIBRARIES) + SET (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ENDIF (CMAKE_REQUIRED_LIBRARIES) + + FOREACH (def ${HDF5_EXTRA_TEST_DEFINITIONS}) + SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") + ENDFOREACH (def) + + FOREACH (def + HAVE_SYS_TIME_H + HAVE_UNISTD_H + HAVE_SYS_TYPES_H + HAVE_SYS_SOCKET_H + ) + IF ("${H5_${def}}") + SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") + ENDIF ("${H5_${def}}") + ENDFOREACH (def) + + IF (LARGEFILE) + SET (MACRO_CHECK_FUNCTION_DEFINITIONS + "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" + ) + ENDIF (LARGEFILE) + + #MESSAGE (STATUS "Performing ${OTHER_TEST}") + TRY_COMPILE (${OTHER_TEST} + ${CMAKE_BINARY_DIR} + ${HDF5_RESOURCES_DIR}/HDF5Tests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${OTHER_TEST_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT + ) + IF (${OTHER_TEST}) + SET (H5_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") + MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Success") + ELSE (${OTHER_TEST}) + MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Failed") + SET (H5_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") + FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Performing Other Test ${OTHER_TEST} failed with the following output:\n" + "${OUTPUT}\n" + ) + ENDIF (${OTHER_TEST}) + ENDIF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") +ENDMACRO (HDF5_FUNCTION_TEST) + +#----------------------------------------------------------------------------- +# Check for these functions before the time headers are checked +#----------------------------------------------------------------------------- +IF (NOT WINDOWS) + HDF5_FUNCTION_TEST (STDC_HEADERS) +ENDIF (NOT WINDOWS) + +CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME) +#CHECK_FUNCTION_EXISTS (gettimeofday H5_HAVE_GETTIMEOFDAY) +# Since gettimeofday is not defined any where standard, lets look in all the +# usual places. On MSVC we are just going to use ::clock() +IF (NOT MSVC) + IF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") + TRY_COMPILE (HAVE_TIME_GETTIMEOFDAY + ${CMAKE_BINARY_DIR} + ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp + COMPILE_DEFINITIONS -DTRY_TIME_H + OUTPUT_VARIABLE OUTPUT + ) + IF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") + SET (H5_HAVE_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_TIME_GETTIMEOFDAY") + SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") + ENDIF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") + ENDIF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") + + IF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") + TRY_COMPILE (HAVE_SYS_TIME_GETTIMEOFDAY + ${CMAKE_BINARY_DIR} + ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp + COMPILE_DEFINITIONS -DTRY_SYS_TIME_H + OUTPUT_VARIABLE OUTPUT + ) + IF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") + SET (H5_HAVE_SYS_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_SYS_TIME_GETTIMEOFDAY") + SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") + ENDIF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") + ENDIF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") + + IF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) + MESSAGE (STATUS "---------------------------------------------------------------") + MESSAGE (STATUS "Function 'gettimeofday()' was not found. HDF5 will use its") + MESSAGE (STATUS " own implementation.. This can happen on older versions of") + MESSAGE (STATUS " MinGW on Windows. Consider upgrading your MinGW installation") + MESSAGE (STATUS " to a newer version such as MinGW 3.12") + MESSAGE (STATUS "---------------------------------------------------------------") + ENDIF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) +ENDIF (NOT MSVC) + +# Find the library containing clock_gettime() +IF (NOT WINDOWS) + CHECK_FUNCTION_EXISTS(clock_gettime CLOCK_GETTIME_IN_LIBC) + CHECK_LIBRARY_EXISTS(rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) + CHECK_LIBRARY_EXISTS(posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) + IF(CLOCK_GETTIME_IN_LIBC) + SET(H5_HAVE_CLOCK_GETTIME 1) + ELSEIF(CLOCK_GETTIME_IN_LIBRT) + SET(H5_HAVE_CLOCK_GETTIME 1) + LIST(APPEND LINK_LIBS rt) + ELSEIF(CLOCK_GETTIME_IN_LIBPOSIX4) + SET(H5_HAVE_CLOCK_GETTIME 1) + LIST(APPEND LINK_LIBS posix4) + ENDIF(CLOCK_GETTIME_IN_LIBC) +ENDIF (NOT WINDOWS) +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # Check IF header file exists and add it to the list. #----------------------------------------------------------------------------- @@ -245,43 +359,17 @@ ENDMACRO (CHECK_INCLUDE_FILE_CONCAT) #----------------------------------------------------------------------------- # Check for the existence of certain header files #----------------------------------------------------------------------------- -CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" H5_HAVE_GLOBUS_COMMON_H) -CHECK_INCLUDE_FILE_CONCAT ("io.h" H5_HAVE_IO_H) -CHECK_INCLUDE_FILE_CONCAT ("mfhdf.h" H5_HAVE_MFHDF_H) -CHECK_INCLUDE_FILE_CONCAT ("pdb.h" H5_HAVE_PDB_H) -CHECK_INCLUDE_FILE_CONCAT ("pthread.h" H5_HAVE_PTHREAD_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" H5_HAVE_SETJMP_H) -CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" H5_HAVE_SRBCLIENT_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" H5_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("stdint.h" H5_HAVE_STDINT_H) -CHECK_INCLUDE_FILE_CONCAT ("string.h" H5_HAVE_STRING_H) -CHECK_INCLUDE_FILE_CONCAT ("strings.h" H5_HAVE_STRINGS_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" H5_HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" H5_HAVE_SYS_PROC_H) CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" H5_HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" H5_HAVE_SYS_SOCKET_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" H5_HAVE_SYS_STAT_H) -IF (CMAKE_SYSTEM_NAME MATCHES "OSF") - CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" H5_HAVE_SYS_SYSINFO_H) -ELSE (CMAKE_SYSTEM_NAME MATCHES "OSF") - SET (H5_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) -ENDIF (CMAKE_SYSTEM_NAME MATCHES "OSF") CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" H5_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("time.h" H5_HAVE_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" H5_HAVE_MACH_MACH_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" H5_HAVE_SYS_TIMEB_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" H5_HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" H5_HAVE_UNISTD_H) -CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" H5_HAVE_STDLIB_H) -CHECK_INCLUDE_FILE_CONCAT ("memory.h" H5_HAVE_MEMORY_H) -CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" H5_HAVE_DLFCN_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" H5_HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" H5_HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" H5_HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" H5_HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("stddef.h" H5_HAVE_STDDEF_H) +CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" H5_HAVE_SETJMP_H) CHECK_INCLUDE_FILE_CONCAT ("features.h" H5_HAVE_FEATURES_H) -CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" H5_HAVE_INTTYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" H5_HAVE_NETINET_IN_H) - -IF (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" H5_HAVE_WINSOCK_H) -ENDIF (NOT CYGWIN) +CHECK_INCLUDE_FILE_CONCAT ("stdint.h" H5_HAVE_STDINT_H) # IF the c compiler found stdint, check the C++ as well. On some systems this # file will be found by C but not C++, only do this test IF the C++ compiler @@ -294,6 +382,37 @@ IF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) ENDIF (NOT H5_HAVE_STDINT_H_CXX) ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) +# Darwin +CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" H5_HAVE_MACH_MACH_TIME_H) + +# Windows +CHECK_INCLUDE_FILE_CONCAT ("io.h" H5_HAVE_IO_H) +IF (NOT CYGWIN) + CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" H5_HAVE_WINSOCK_H) +ENDIF (NOT CYGWIN) +CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" H5_HAVE_SYS_TIMEB_H) + +IF (CMAKE_SYSTEM_NAME MATCHES "OSF") + CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" H5_HAVE_SYS_SYSINFO_H) + CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" H5_HAVE_SYS_PROC_H) +ELSE (CMAKE_SYSTEM_NAME MATCHES "OSF") + SET (H5_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) + SET (H5_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) +ENDIF (CMAKE_SYSTEM_NAME MATCHES "OSF") + +CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" H5_HAVE_GLOBUS_COMMON_H) +CHECK_INCLUDE_FILE_CONCAT ("pdb.h" H5_HAVE_PDB_H) +CHECK_INCLUDE_FILE_CONCAT ("pthread.h" H5_HAVE_PTHREAD_H) +CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" H5_HAVE_SRBCLIENT_H) +CHECK_INCLUDE_FILE_CONCAT ("string.h" H5_HAVE_STRING_H) +CHECK_INCLUDE_FILE_CONCAT ("strings.h" H5_HAVE_STRINGS_H) +CHECK_INCLUDE_FILE_CONCAT ("time.h" H5_HAVE_TIME_H) +CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" H5_HAVE_STDLIB_H) +CHECK_INCLUDE_FILE_CONCAT ("memory.h" H5_HAVE_MEMORY_H) +CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" H5_HAVE_DLFCN_H) +CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" H5_HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" H5_HAVE_NETINET_IN_H) + #----------------------------------------------------------------------------- # Check for large file support #----------------------------------------------------------------------------- @@ -304,7 +423,7 @@ SET (LINUX_LFS 0) SET (HDF5_EXTRA_FLAGS) IF (NOT WINDOWS) # Linux Specific flags - SET (HDF5_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE) + SET (HDF5_EXTRA_FLAGS -D_POSIX_SOURCE=199506L -D_BSD_SOURCE) OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) IF (HDF5_ENABLE_LARGE_FILE) SET (msg "Performing TEST_LFS_WORKS") @@ -341,6 +460,28 @@ ENDIF (NOT WINDOWS) ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS}) #----------------------------------------------------------------------------- +# Check for HAVE_OFF64_T functionality +#----------------------------------------------------------------------------- +IF (NOT WINDOWS) + HDF5_FUNCTION_TEST (HAVE_OFF64_T) + IF (H5_HAVE_OFF64_T) + CHECK_FUNCTION_EXISTS (lseek64 H5_HAVE_LSEEK64) + CHECK_FUNCTION_EXISTS (fseeko64 H5_HAVE_FSEEKO64) + CHECK_FUNCTION_EXISTS (ftello64 H5_HAVE_FTELLO64) + CHECK_FUNCTION_EXISTS (ftruncate64 H5_HAVE_FTRUNCATE64) + ENDIF (H5_HAVE_OFF64_T) + + CHECK_FUNCTION_EXISTS (fseeko H5_HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS (ftello H5_HAVE_FTELLO) + + HDF5_FUNCTION_TEST (HAVE_STAT64_STRUCT) + IF (HAVE_STAT64_STRUCT) + CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64) + CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64) + ENDIF (HAVE_STAT64_STRUCT) +ENDIF (NOT WINDOWS) + +#----------------------------------------------------------------------------- # Check the size in bytes of all the int and float types #----------------------------------------------------------------------------- MACRO (H5_CHECK_TYPE_SIZE type var) @@ -354,7 +495,6 @@ MACRO (H5_CHECK_TYPE_SIZE type var) ENDIF (NOT ${aVar}) ENDMACRO (H5_CHECK_TYPE_SIZE) - H5_CHECK_TYPE_SIZE (char H5_SIZEOF_CHAR) H5_CHECK_TYPE_SIZE (short H5_SIZEOF_SHORT) H5_CHECK_TYPE_SIZE (int H5_SIZEOF_INT) @@ -371,66 +511,109 @@ ENDIF (NOT H5_SIZEOF___INT64) H5_CHECK_TYPE_SIZE (float H5_SIZEOF_FLOAT) H5_CHECK_TYPE_SIZE (double H5_SIZEOF_DOUBLE) H5_CHECK_TYPE_SIZE ("long double" H5_SIZEOF_LONG_DOUBLE) + H5_CHECK_TYPE_SIZE (int8_t H5_SIZEOF_INT8_T) H5_CHECK_TYPE_SIZE (uint8_t H5_SIZEOF_UINT8_T) H5_CHECK_TYPE_SIZE (int_least8_t H5_SIZEOF_INT_LEAST8_T) H5_CHECK_TYPE_SIZE (uint_least8_t H5_SIZEOF_UINT_LEAST8_T) H5_CHECK_TYPE_SIZE (int_fast8_t H5_SIZEOF_INT_FAST8_T) H5_CHECK_TYPE_SIZE (uint_fast8_t H5_SIZEOF_UINT_FAST8_T) + H5_CHECK_TYPE_SIZE (int16_t H5_SIZEOF_INT16_T) H5_CHECK_TYPE_SIZE (uint16_t H5_SIZEOF_UINT16_T) H5_CHECK_TYPE_SIZE (int_least16_t H5_SIZEOF_INT_LEAST16_T) H5_CHECK_TYPE_SIZE (uint_least16_t H5_SIZEOF_UINT_LEAST16_T) H5_CHECK_TYPE_SIZE (int_fast16_t H5_SIZEOF_INT_FAST16_T) H5_CHECK_TYPE_SIZE (uint_fast16_t H5_SIZEOF_UINT_FAST16_T) + H5_CHECK_TYPE_SIZE (int32_t H5_SIZEOF_INT32_T) H5_CHECK_TYPE_SIZE (uint32_t H5_SIZEOF_UINT32_T) H5_CHECK_TYPE_SIZE (int_least32_t H5_SIZEOF_INT_LEAST32_T) H5_CHECK_TYPE_SIZE (uint_least32_t H5_SIZEOF_UINT_LEAST32_T) H5_CHECK_TYPE_SIZE (int_fast32_t H5_SIZEOF_INT_FAST32_T) H5_CHECK_TYPE_SIZE (uint_fast32_t H5_SIZEOF_UINT_FAST32_T) + H5_CHECK_TYPE_SIZE (int64_t H5_SIZEOF_INT64_T) H5_CHECK_TYPE_SIZE (uint64_t H5_SIZEOF_UINT64_T) H5_CHECK_TYPE_SIZE (int_least64_t H5_SIZEOF_INT_LEAST64_T) H5_CHECK_TYPE_SIZE (uint_least64_t H5_SIZEOF_UINT_LEAST64_T) H5_CHECK_TYPE_SIZE (int_fast64_t H5_SIZEOF_INT_FAST64_T) H5_CHECK_TYPE_SIZE (uint_fast64_t H5_SIZEOF_UINT_FAST64_T) + IF (NOT APPLE) H5_CHECK_TYPE_SIZE (size_t H5_SIZEOF_SIZE_T) H5_CHECK_TYPE_SIZE (ssize_t H5_SIZEOF_SSIZE_T) IF (NOT H5_SIZEOF_SSIZE_T) SET (H5_SIZEOF_SSIZE_T 0) ENDIF (NOT H5_SIZEOF_SSIZE_T) + H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) ENDIF (NOT APPLE) + H5_CHECK_TYPE_SIZE (off_t H5_SIZEOF_OFF_T) H5_CHECK_TYPE_SIZE (off64_t H5_SIZEOF_OFF64_T) IF (NOT H5_SIZEOF_OFF64_T) SET (H5_SIZEOF_OFF64_T 0) ENDIF (NOT H5_SIZEOF_OFF64_T) -# Find the library containing clock_gettime() IF (NOT WINDOWS) - CHECK_FUNCTION_EXISTS(clock_gettime CLOCK_GETTIME_IN_LIBC) - CHECK_LIBRARY_EXISTS(rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) - CHECK_LIBRARY_EXISTS(posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) - IF(CLOCK_GETTIME_IN_LIBC) - SET(H5_HAVE_CLOCK_GETTIME 1) - ELSEIF(CLOCK_GETTIME_IN_LIBRT) - SET(H5_HAVE_CLOCK_GETTIME 1) - LIST(APPEND LINK_LIBS rt) - ELSEIF(CLOCK_GETTIME_IN_LIBPOSIX4) - SET(H5_HAVE_CLOCK_GETTIME 1) - LIST(APPEND LINK_LIBS posix4) - ENDIF(CLOCK_GETTIME_IN_LIBC) + #----------------------------------------------------------------------------- + # Check if the dev_t type is a scalar type + #----------------------------------------------------------------------------- + HDF5_FUNCTION_TEST (DEV_T_IS_SCALAR) + + # ---------------------------------------------------------------------- + # Check for MONOTONIC_TIMER support (used in clock_gettime). This has + # to be done after any POSIX/BSD defines to ensure that the test gets + # the correct POSIX level on linux. + CHECK_VARIABLE_EXISTS (CLOCK_MONOTONIC HAVE_CLOCK_MONOTONIC) + + #----------------------------------------------------------------------------- + # Check a bunch of time functions + #----------------------------------------------------------------------------- + FOREACH (test + HAVE_TM_GMTOFF + HAVE___TM_GMTOFF +# HAVE_TIMEZONE + HAVE_STRUCT_TIMEZONE + GETTIMEOFDAY_GIVES_TZ + TIME_WITH_SYS_TIME + HAVE_TM_ZONE + HAVE_STRUCT_TM_TM_ZONE + ) + HDF5_FUNCTION_TEST (${test}) + ENDFOREACH (test) + IF (NOT CYGWIN AND NOT MINGW) + HDF5_FUNCTION_TEST (HAVE_TIMEZONE) +# HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) + ENDIF (NOT CYGWIN AND NOT MINGW) + + # ---------------------------------------------------------------------- + # Does the struct stat have the st_blocks field? This field is not Posix. + # + HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) + ENDIF (NOT WINDOWS) -# For other tests to use the same libraries -SET (CMAKE_REQUIRED_LIBRARIES ${LINK_LIBS}) +# ---------------------------------------------------------------------- +# How do we figure out the width of a tty in characters? +# +CHECK_FUNCTION_EXISTS (ioctl H5_HAVE_IOCTL) +HDF5_FUNCTION_TEST (HAVE_STRUCT_VIDEOCONFIG) +HDF5_FUNCTION_TEST (HAVE_STRUCT_TEXT_INFO) +IF (NOT WINDOWS) + CHECK_FUNCTION_EXISTS (_getvideoconfig H5_HAVE__GETVIDEOCONFIG) + CHECK_FUNCTION_EXISTS (gettextinfo H5_HAVE_GETTEXTINFO) + CHECK_FUNCTION_EXISTS (_scrsize H5_HAVE__SCRSIZE) + CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo H5_HAVE_GETCONSOLESCREENBUFFERINFO) + CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" H5_HAVE_TIOCGWINSZ) + CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" H5_HAVE_TIOCGETD) +ENDIF (NOT WINDOWS) #----------------------------------------------------------------------------- # Check for some functions that are used # CHECK_FUNCTION_EXISTS (alarm H5_HAVE_ALARM) +#CHECK_FUNCTION_EXISTS (BSDgettimeofday H5_HAVE_BSDGETTIMEOFDAY) CHECK_FUNCTION_EXISTS (fork H5_HAVE_FORK) CHECK_FUNCTION_EXISTS (frexpf H5_HAVE_FREXPF) CHECK_FUNCTION_EXISTS (frexpl H5_HAVE_FREXPL) @@ -463,18 +646,13 @@ CHECK_FUNCTION_EXISTS (vasprintf H5_HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (waitpid H5_HAVE_WAITPID) CHECK_FUNCTION_EXISTS (vsnprintf H5_HAVE_VSNPRINTF) -CHECK_FUNCTION_EXISTS (ioctl H5_HAVE_IOCTL) -#CHECK_FUNCTION_EXISTS (gettimeofday H5_HAVE_GETTIMEOFDAY) -CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME) -CHECK_FUNCTION_EXISTS (fseeko H5_HAVE_FSEEKO) -CHECK_FUNCTION_EXISTS (ftello H5_HAVE_FTELLO) -CHECK_FUNCTION_EXISTS (fseeko64 H5_HAVE_FSEEKO64) -CHECK_FUNCTION_EXISTS (ftello64 H5_HAVE_FTELLO64) -CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64) -CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64) +IF (H5_HAVE_VSNPRINTF) + HDF5_FUNCTION_TEST (VSNPRINTF_WORKS) +ENDIF (H5_HAVE_VSNPRINTF) #----------------------------------------------------------------------------- # sigsetjmp is special; may actually be a macro +#----------------------------------------------------------------------------- IF (NOT H5_HAVE_SIGSETJMP) IF (H5_HAVE_SETJMP_H) CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" H5_HAVE_MACRO_SIGSETJMP) @@ -485,71 +663,30 @@ IF (NOT H5_HAVE_SIGSETJMP) ENDIF (NOT H5_HAVE_SIGSETJMP) #----------------------------------------------------------------------------- -# Since gettimeofday is not defined any where standard, lets look in all the -# usual places. On MSVC we are just going to use ::clock() -#----------------------------------------------------------------------------- -IF (NOT MSVC) - IF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") - TRY_COMPILE (HAVE_TIME_GETTIMEOFDAY - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp - COMPILE_DEFINITIONS -DTRY_TIME_H - OUTPUT_VARIABLE OUTPUT - ) - IF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") - SET (H5_HAVE_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_TIME_GETTIMEOFDAY") - SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") - ENDIF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") - ENDIF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") - - IF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") - TRY_COMPILE (HAVE_SYS_TIME_GETTIMEOFDAY - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp - COMPILE_DEFINITIONS -DTRY_SYS_TIME_H - OUTPUT_VARIABLE OUTPUT - ) - IF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") - SET (H5_HAVE_SYS_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_SYS_TIME_GETTIMEOFDAY") - SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") - ENDIF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") - ENDIF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") - - IF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) - MESSAGE (STATUS "---------------------------------------------------------------") - MESSAGE (STATUS "Function 'gettimeofday()' was not found. HDF5 will use its") - MESSAGE (STATUS " own implementation.. This can happen on older versions of") - MESSAGE (STATUS " MinGW on Windows. Consider upgrading your MinGW installation") - MESSAGE (STATUS " to a newer version such as MinGW 3.12") - MESSAGE (STATUS "---------------------------------------------------------------") - ENDIF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) -ENDIF (NOT MSVC) - # Check for Symbols CHECK_SYMBOL_EXISTS (tzname "time.h" H5_HAVE_DECL_TZNAME) #----------------------------------------------------------------------------- -# +# Check a bunch of other functions #----------------------------------------------------------------------------- IF (NOT WINDOWS) - CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" H5_HAVE_TIOCGWINSZ) - CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" H5_HAVE_TIOCGETD) + FOREACH (test + LONE_COLON + HAVE_ATTRIBUTE + HAVE_C99_FUNC + HAVE_FUNCTION + HAVE_C99_DESIGNATED_INITIALIZER + SYSTEM_SCOPE_THREADS + HAVE_SOCKLEN_T + CXX_HAVE_OFFSETOF + ) + HDF5_FUNCTION_TEST (${test}) + ENDFOREACH (test) ENDIF (NOT WINDOWS) -#----------------------------------------------------------------------------- -# Check for the Stream VFD driver -#----------------------------------------------------------------------------- -IF (HDF5_STREAM_VFD) - CHECK_INCLUDE_FILE_CONCAT ("netdb.h" H5_HAVE_NETDB_H) - CHECK_INCLUDE_FILE_CONCAT ("netinet/tcp.h" H5_HAVE_NETINET_TCP_H) - CHECK_INCLUDE_FILE_CONCAT ("sys/filio.h" H5_HAVE_SYS_FILIO_H) - SET (H5_HAVE_STREAM 1) -ENDIF (HDF5_STREAM_VFD) - - -# For other other specific tests, use this MACRO. -MACRO (HDF5_FUNCTION_TEST OTHER_TEST) - IF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") +# For other CXX specific tests, use this MACRO. +MACRO (HDF5_CXX_FUNCTION_TEST OTHER_TEST) + IF ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") SET (OTHER_TEST_ADD_LIBRARIES) IF (CMAKE_REQUIRED_LIBRARIES) @@ -580,61 +717,87 @@ MACRO (HDF5_FUNCTION_TEST OTHER_TEST) #MESSAGE (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/HDF5Tests.c + ${HDF5_RESOURCES_DIR}/HDF5CXXTests.cpp CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} "${OTHER_TEST_ADD_LIBRARIES}" OUTPUT_VARIABLE OUTPUT ) - IF (${OTHER_TEST}) - SET (H5_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") - MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Success") - ELSE (${OTHER_TEST}) - MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Failed") - SET (H5_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") + IF ("${OTHER_TEST}" EQUAL 0) + SET (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") + MESSAGE (STATUS "Performing CXX Test ${OTHER_TEST} - Success") + ELSE ("${OTHER_TEST}" EQUAL 0) + MESSAGE (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") + SET (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing Other Test ${OTHER_TEST} failed with the following output:\n" + "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" "${OUTPUT}\n" ) - ENDIF (${OTHER_TEST}) - ENDIF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") -ENDMACRO (HDF5_FUNCTION_TEST) + ENDIF ("${OTHER_TEST}" EQUAL 0) + ENDIF ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") +ENDMACRO (HDF5_CXX_FUNCTION_TEST) #----------------------------------------------------------------------------- -# Check a bunch of other functions +# Check a bunch of cxx functions #----------------------------------------------------------------------------- -IF (NOT WINDOWS) +IF (CMAKE_CXX_COMPILER_LOADED) FOREACH (test - TIME_WITH_SYS_TIME - STDC_HEADERS - HAVE_TM_ZONE - HAVE_STRUCT_TM_TM_ZONE - HAVE_ATTRIBUTE - HAVE_FUNCTION - HAVE_TM_GMTOFF -# HAVE_TIMEZONE - HAVE_STRUCT_TIMEZONE - HAVE_STAT_ST_BLOCKS - HAVE_FUNCTION - SYSTEM_SCOPE_THREADS - HAVE_SOCKLEN_T - DEV_T_IS_SCALAR - HAVE_OFF64_T - GETTIMEOFDAY_GIVES_TZ - VSNPRINTF_WORKS - HAVE_C99_FUNC - HAVE_C99_DESIGNATED_INITIALIZER - CXX_HAVE_OFFSETOF - LONE_COLON + OLD_HEADER_FILENAME + H5_NO_NAMESPACE + H5_NO_STD + BOOL_NOTDEFINED + NO_STATIC_CAST ) - HDF5_FUNCTION_TEST (${test}) + HDF5_CXX_FUNCTION_TEST (${test}) ENDFOREACH (test) - IF (NOT CYGWIN AND NOT MINGW) - HDF5_FUNCTION_TEST (HAVE_TIMEZONE) -# HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - ENDIF (NOT CYGWIN AND NOT MINGW) +ENDIF (CMAKE_CXX_COMPILER_LOADED) + +#----------------------------------------------------------------------------- +# Check if Direct I/O driver works +#----------------------------------------------------------------------------- +IF (NOT WINDOWS) + OPTION (HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" ON) + IF (HDF5_ENABLE_DIRECT_VFD) + SET (msg "Performing TEST_DIRECT_VFD_WORKS") + SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-DTEST_DIRECT_VFD_WORKS -D_GNU_SOURCE ${CMAKE_REQUIRED_FLAGS}") + TRY_RUN (TEST_DIRECT_VFD_WORKS_RUN TEST_DIRECT_VFD_WORKS_COMPILE + ${HDF5_BINARY_DIR}/CMake + ${HDF5_RESOURCES_DIR}/HDF5Tests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + OUTPUT_VARIABLE OUTPUT + ) + IF (TEST_DIRECT_VFD_WORKS_COMPILE) + IF (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + HDF5_FUNCTION_TEST (HAVE_DIRECT) + SET (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") + ADD_DEFINITIONS ("-D_GNU_SOURCE") + ELSE (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + SET (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) + MESSAGE (STATUS "${msg}... no") + FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test TEST_DIRECT_VFD_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" + ) + ENDIF (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + ELSE (TEST_DIRECT_VFD_WORKS_COMPILE ) + SET (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) + MESSAGE (STATUS "${msg}... no") + FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test TEST_DIRECT_VFD_WORKS Compile failed with the following output:\n ${OUTPUT}\n" + ) + ENDIF (TEST_DIRECT_VFD_WORKS_COMPILE) + ENDIF (HDF5_ENABLE_DIRECT_VFD) ENDIF (NOT WINDOWS) #----------------------------------------------------------------------------- +# Check for the Stream VFD driver +#----------------------------------------------------------------------------- +IF (HDF5_STREAM_VFD) + CHECK_INCLUDE_FILE_CONCAT ("netdb.h" H5_HAVE_NETDB_H) + CHECK_INCLUDE_FILE_CONCAT ("netinet/tcp.h" H5_HAVE_NETINET_TCP_H) + CHECK_INCLUDE_FILE_CONCAT ("sys/filio.h" H5_HAVE_SYS_FILIO_H) + SET (H5_HAVE_STREAM 1) +ENDIF (HDF5_STREAM_VFD) + +#----------------------------------------------------------------------------- # Check if InitOnceExecuteOnce is available #----------------------------------------------------------------------------- IF (WINDOWS) @@ -698,7 +861,6 @@ IF (WINDOWS) ENDIF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") ENDIF (NOT HDF5_NO_IOEO_TEST) ENDIF (WINDOWS) - #----------------------------------------------------------------------------- # Option to see if GPFS is available on this filesystem --enable-gpfs @@ -713,13 +875,6 @@ ENDIF (HDF5_ENABLE_GPFS) MARK_AS_ADVANCED (HDF5_ENABLE_GPFS) #----------------------------------------------------------------------------- -# Look for 64 bit file stream capability -#----------------------------------------------------------------------------- -IF (HAVE_OFF64_T) - CHECK_FUNCTION_EXISTS (lseek64 H5_HAVE_LSEEK64) -ENDIF (HAVE_OFF64_T) - -#----------------------------------------------------------------------------- # Determine how 'inline' is used #----------------------------------------------------------------------------- SET (HDF5_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE) @@ -950,6 +1105,31 @@ H5ConversionTests (H5_ULLONG_TO_LDOUBLE_PRECISION "Checking IF converting unsign # H5ConversionTests (H5_FP_TO_INTEGER_OVERFLOW_WORKS "Checking IF overflows normally converting floating-point to integer values") # ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm to convert +# 'long double' to '(unsigned) long' values. (This flag should only be set for +# the IBM Power6 Linux. When the bit sequence of long double is +# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +# is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. +# The machine's conversion gets the correct value. We define the macro and disable +# this kind of test until we figure out what algorithm they use. +# +IF (H5_LDOUBLE_TO_LONG_SPECIAL MATCHES ^H5_LDOUBLE_TO_LONG_SPECIAL$) + SET (H5_LDOUBLE_TO_LONG_SPECIAL 0 CACHE INTERNAL "Define if your system converts long double to (unsigned) long values with special algorithm") + MESSAGE (STATUS "Checking IF your system converts long double to (unsigned) long values with special algorithm... no") +ENDIF (H5_LDOUBLE_TO_LONG_SPECIAL MATCHES ^H5_LDOUBLE_TO_LONG_SPECIAL$) +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm +# to convert some values of '(unsigned) long' to 'long double' values. +# (This flag should be off for all machines, except for IBM Power6 Linux, +# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +# ..., 7fffff..., the compiler uses a unknown algorithm. We define a +# macro and skip the test for now until we know about the algorithm. +# +IF (H5_LONG_TO_LDOUBLE_SPECIAL MATCHES ^H5_LONG_TO_LDOUBLE_SPECIAL$) + SET (H5_LONG_TO_LDOUBLE_SPECIAL 0 CACHE INTERNAL "Define if your system can convert (unsigned) long to long double values with special algorithm") + MESSAGE (STATUS "Checking IF your system can convert (unsigned) long to long double values with special algorithm... no") +ENDIF (H5_LONG_TO_LDOUBLE_SPECIAL MATCHES ^H5_LONG_TO_LDOUBLE_SPECIAL$) +# ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert # 'long double' to '(unsigned) long long' values. (This flag should be set for # all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence @@ -967,6 +1147,19 @@ H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly convertin # as big as they should be. # H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine generates bad code +# for the H5V_log2_gen() routine in src/H5Vprivate.h +# (This flag should be set to no for all machines, except for SGI IRIX64, +# where the cache value is set to yes in it's config file) +# +IF (H5_BAD_LOG2_CODE_GENERATED MATCHES ^H5_BAD_LOG2_CODE_GENERATED$) + SET (H5_BAD_LOG2_CODE_GENERATED 0 CACHE INTERNAL "Define if your system generates wrong code for log2 routine") + MESSAGE (STATUS "Checking IF your system generates wrong code for log2 routine... no") +ENDIF (H5_BAD_LOG2_CODE_GENERATED MATCHES ^H5_BAD_LOG2_CODE_GENERATED$) +# ---------------------------------------------------------------------- +# Check if pointer alignments are enforced +# H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") # Define a macro for Cygwin (on XP only) where the compiler has rounding @@ -974,3 +1167,18 @@ H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restricti IF (CYGWIN) SET (H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM 1) ENDIF (CYGWIN) + +# ----------------------------------------------------------------------- +# wrapper script variables +# +SET (prefix ${CMAKE_INSTALL_PREFIX}) +SET (exec_prefix "\${prefix}") +SET (libdir "${exec_prefix}/lib") +SET (includedir "\${prefix}/include") +SET (host_os ${CMAKE_HOST_SYSTEM_NAME}) +SET (CC ${CMAKE_C_COMPILER}) +SET (CXX ${CMAKE_CXX_COMPILER}) +SET (FC ${CMAKE_Fortran_COMPILER}) +FOREACH (LINK_LIB ${LINK_LIBS}) + SET (LIBS "${LIBS} -l${LINK_LIB}") +ENDFOREACH (LINK_LIB ${LINK_LIBS}) diff --git a/config/cmake/HDF5CXXTests.cpp b/config/cmake/HDF5CXXTests.cpp new file mode 100644 index 0000000..7003cc8 --- /dev/null +++ b/config/cmake/HDF5CXXTests.cpp @@ -0,0 +1,56 @@ + +#ifdef OLD_HEADER_FILENAME + +#include <iostream> + +int main(void) { return 0; } + +#endif + + +#ifdef H5_NO_NAMESPACE + +namespace H5 { +int fnord; +} + +int main(void) { + using namespace H5; + fnord = 37; + return 0; +} + +#endif + +#ifdef H5_NO_STD + +#include <string> + +using namespace std; + +int main(void) { + string myString("testing namespace std"); + return 0; +} + +#endif + +#ifdef BOOL_NOTDEFINED +int main(void) { + bool flag; + return 0; +} + +#endif + +#ifdef NO_STATIC_CAST + +int main(void) { + float test_float; + int test_int; + test_float = 37.0; + test_int = static_cast <int> (test_float); + return 0; +} + +#endif diff --git a/config/cmake/HDF5Tests.c b/config/cmake/HDF5Tests.c index 9c21415..2f69ec8 100644 --- a/config/cmake/HDF5Tests.c +++ b/config/cmake/HDF5Tests.c @@ -1,38 +1,5 @@ #define SIMPLE_TEST(x) int main(){ x; return 0; } -#ifdef CXX_HAVE_OFFSETOF - #include <stdio.h> -#include <stddef.h> - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - struct index_st - { - unsigned char type; - unsigned char num; - unsigned int len; - }; - typedef struct index_st index_t; - int x,y; - x = offsetof(struct index_st, len); - y = offsetof(index_t, num) - - ; - return 0; -} -#endif - #ifdef HAVE_C99_DESIGNATED_INITIALIZER #ifdef FC_DUMMY_MAIN @@ -106,7 +73,7 @@ int test_vsnprintf(const char *fmt,...) int main(void) { - exit(test_vsnprintf("%s","A string that is longer than 16 characters")); + return(test_vsnprintf("%s","A string that is longer than 16 characters")); } #endif @@ -215,6 +182,16 @@ SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); #endif /* HAVE_TM_GMTOFF */ +#ifdef HAVE___TM_GMTOFF + +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#include <time.h> +SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0); + +#endif /* HAVE_TM_GMTOFF */ + #ifdef HAVE_TIMEZONE #ifdef HAVE_SYS_TIME_H @@ -269,10 +246,10 @@ int main(void) if (strcmp(s, "1099511627776") == 0) { printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); - exit(0); + return 0; } } - exit(1); + return 1; } #endif /* PRINTF_LL_WIDTH */ @@ -288,7 +265,9 @@ int main(void) pthread_attr_init(&attribute); ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); - exit(ret==0 ? 0 : 1); + if (ret==0) + return 0; + return 1; } #endif /* SYSTEM_SCOPE_THREADS */ @@ -336,6 +315,35 @@ int main() } #endif +#ifdef HAVE_STAT64_STRUCT +#include <sys/types.h> +#include <sys/stat.h>], +struct stat64 sb; +int main() +{ + return 0; +} +#endif + +#ifdef TEST_DIRECT_VFD_WORKS +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +int main(void) +{ + int fid; + if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0) + return 1; + close(fid); + remove("tst_file"); + return 0; +} +#endif + +#ifdef HAVE_DIRECT + SIMPLE_TEST(posix_memalign()); +#endif + #ifdef TEST_LFS_WORKS /* Return 0 when LFS is available and 1 otherwise. */ #define _LARGEFILE_SOURCE @@ -382,8 +390,8 @@ int main(void) gettimeofday(&tv, &tz); /* Check whether the function returned any value at all */ if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - exit(1); - else exit (0); + return 1; + else return 0; } #endif @@ -394,6 +402,41 @@ int main(int argc, char * argv) } #endif +#ifdef CXX_HAVE_OFFSETOF + +#include <stdio.h> +#include <stddef.h> + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus +extern "C" +# endif +int FC_DUMMY_MAIN() +{ return 1;} +#endif +#endif +int +main () +{ + + struct index_st + { + unsigned char type; + unsigned char num; + unsigned int len; + }; + typedef struct index_st index_t; + int x,y; + x = offsetof(struct index_st, len); + y = offsetof(index_t, num) + + ; + return 0; +} + +#endif + #ifdef HAVE_GPFS #include <gpfs.h> @@ -423,6 +466,18 @@ int main () #endif /* HAVE_IOEO */ +#ifdef HAVE_STRUCT_VIDEOCONFIG + +SIMPLE_TEST(struct videoconfig w; w.numtextcols=0); + +#endif /* HAVE_TM_GMTOFF */ + +#ifdef HAVE_STRUCT_TEXT_INFO + +SIMPLE_TEST(struct text_info w; w.screenwidth=0); + +#endif /* HAVE_TM_GMTOFF */ + #if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline ) #ifndef __cplusplus diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index c1c5acb..323c9ef 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -114,6 +114,11 @@ CHECK_FORTRAN_FEATURE(iso_c_binding " PROGRAM main USE iso_c_binding + IMPLICIT NONE + TYPE(C_PTR) :: ptr + TYPE(C_FUNPTR) :: funptr + CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr + ptr = C_LOC(ichr(1:1)) END PROGRAM " FORTRAN_HAVE_ISO_C_BINDING diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 1ab3432..e7dd19f 100755 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -20,6 +20,8 @@ SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE)
+SET (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE)
+
SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
@@ -28,12 +30,18 @@ SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
+SET (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
+
SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+SET (HDF5_ENABLE_DIRECT_VFD OFF CACHE BOOL "Build the Direct I/O Virtual File Driver" FORCE)
+
SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+SET (HDF5_BUILD_PARALLEL_ALL OFF CACHE BOOL "Build Parallel Programs" FORCE)
+
SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
SET (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE)
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 10b2824..b472acf 100755 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -14,10 +14,14 @@ SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) SET (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+SET (HDF5_ENABLE_F2003 OFF CACHE BOOL "Enable FORTRAN 2003 Standard" FORCE)
+
SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE)
SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE)
+SET (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE)
+
SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
@@ -26,22 +30,36 @@ SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
+SET (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE)
+
SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+SET (HDF5_ENABLE_DIRECT_VFD OFF CACHE BOOL "Build the Direct I/O Virtual File Driver" FORCE)
+
SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+
+SET (HDF5_BUILD_PARALLEL_ALL OFF CACHE BOOL "Build Parallel Programs" FORCE)
+
SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
SET (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE)
SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+SET (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE)
+
SET (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE)
+SET (HDF5_USE_18_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.8.x API by default" FORCE)
+
SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE)
SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+SET (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
+
SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 22413 2012-05-27 14:34:59Z hdftest . +# From configure.in Id: configure.in 22427 2012-06-03 14:29:20Z hdftest . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for HDF5 1.9.121. # @@ -3903,6 +3903,7 @@ elif test $hdf5_cv_host != $host; then as_fn_error $? "config.cache file is invalid" "$LINENO" 5 fi + case $host_os in aix*) host_os_novers=aix @@ -7260,6 +7261,7 @@ done fi + if test -z "$AR"; then for ac_prog in ar xar do @@ -7452,6 +7454,7 @@ $as_echo "none" >&6; } ;; esac + if test "X$HDF_FORTRAN" = "Xyes" ; then ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' @@ -7506,6 +7509,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi + if test "X${enable_shared}" = "X" -a "X${enable_parallel}" = "Xyes"; then echo ' shared libraries disabled in parallel' enable_shared="no" @@ -7525,14 +7529,16 @@ if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then $as_echo_n "checking if shared Fortran libraries are supported... " >&6; } H5_FORTRAN_SHARED="yes" - case "`uname`" in + + case "`uname`" in Darwin*) H5_FORTRAN_SHARED="no" CHECK_WARN="Shared Fortran libraries not currently supported on Mac." ;; esac - if test "X${H5_FORTRAN_SHARED}" = "Xno"; then + + if test "X${H5_FORTRAN_SHARED}" = "Xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CHECK_WARN" >&5 @@ -7572,12 +7578,14 @@ if test "X${HDF_CXX}" = "Xyes" && test "X${enable_shared}" != "Xno"; then $as_echo_n "checking if shared C++ libraries are supported... " >&6; } H5_CXX_SHARED="yes" - if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'DD64') > /dev/null; then + + if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'DD64') > /dev/null; then H5_CXX_SHARED="no" CHECK_WARN="Shared C++ libraries not currently supported with +DD64 flag." fi - if test "X${H5_CXX_SHARED}" = "Xno"; then + + if test "X${H5_CXX_SHARED}" = "Xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CHECK_WARN" >&5 @@ -7609,11 +7617,13 @@ else fi + if (${CC-cc} -V 2>&1 | grep '^pgcc 6.0') > /dev/null && test "X$enable_production" = "Xyes"; then echo 'adding compiler flag to avoid optimization problem in pgcc' CC="${CC-cc} -Mx,28,0x8" fi + if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then case "`uname`" in CYGWIN*) @@ -22265,7 +22275,7 @@ done ;; *) - for ac_header in io.h winsock.h sys/timeb.h + for ac_header in io.h winsock2.h sys/timeb.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.in b/configure.in index 0f0fbcf..db456d4 100644 --- a/configure.in +++ b/configure.in @@ -251,6 +251,7 @@ dnl CPU dnl dnl If the `OS' ends with a version number then remove it. For instance, dnl `freebsd3.1' would become `freebsd' + case $host_os in aix*) host_os_novers=aix @@ -710,6 +711,7 @@ dnl ---------------------------------------------------------------------- dnl Check which archiving tool to use. This needs to be done before dnl the AM_PROG_LIBTOOL macro. dnl + if test -z "$AR"; then AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH]) fi @@ -850,6 +852,7 @@ dnl Furthermore, the name of the compiler might tell us how to run the dnl resulting executable. For `mpif90' the executable should be run with dnl `mpiexec' from the same directory as mpif90 if it exists. dnl + if test "X$HDF_FORTRAN" = "Xyes" ; then dnl Change to the Fortran 90 language AC_LANG_PUSH(Fortran) @@ -904,6 +907,7 @@ fi dnl ----------------------------------------------------------------------------- dnl If shared libraries are being used with parallel, disable them, unless the dnl user explicity enables them via the '--enable-shared' option. + if test "X${enable_shared}" = "X" -a "X${enable_parallel}" = "Xyes"; then echo ' shared libraries disabled in parallel' enable_shared="no" @@ -918,7 +922,7 @@ fi dnl ---------------------------------------------------------------------- dnl Fortran libraries are not currently supported on Mac. Disable them. -dnl (this is overridable with --enable-unsupported). +dnl this is overridable with '--enable-unsupported'. dnl AC_SUBST([H5_FORTRAN_SHARED]) H5_FORTRAN_SHARED="no" @@ -927,6 +931,7 @@ if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then H5_FORTRAN_SHARED="yes" dnl Disable fortran shared libraries on Mac. (MAM - 03/30/11) + case "`uname`" in Darwin*) H5_FORTRAN_SHARED="no" @@ -935,6 +940,7 @@ if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then esac dnl Report results of check(s) + if test "X${H5_FORTRAN_SHARED}" = "Xno"; then AC_MSG_RESULT([no]) AC_MSG_WARN([$CHECK_WARN]) @@ -965,12 +971,14 @@ if test "X${HDF_CXX}" = "Xyes" && test "X${enable_shared}" != "Xno"; then H5_CXX_SHARED="yes" dnl Disable C++ shared libraries if DD64 flag is being used. + if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'DD64') > /dev/null; then H5_CXX_SHARED="no" CHECK_WARN="Shared C++ libraries not currently supported with +DD64 flag." fi dnl Report results of check(s) + if test "X${H5_CXX_SHARED}" = "Xno"; then AC_MSG_RESULT([no]) AC_MSG_WARN([$CHECK_WARN]) @@ -995,6 +1003,7 @@ dnl pgcc version 6.0x have optimization (-O, -O2 or -O3) problem. Detect dnl these versions and add option "-Mx,28,0x8" to the compiler to avoid dnl the problem if optimization is enabled. dnl + if (${CC-cc} -V 2>&1 | grep '^pgcc 6.0') > /dev/null && test "X$enable_production" = "Xyes"; then echo 'adding compiler flag to avoid optimization problem in pgcc' CC="${CC-cc} -Mx,28,0x8" @@ -1003,6 +1012,7 @@ fi dnl ---------------------------------------------------------------------- dnl Shared libraries are not currently supported under Cygwin, so configure dnl disables them unless --enable-unsupported has been supplied by the user. + if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then case "`uname`" in CYGWIN*) @@ -1063,7 +1073,7 @@ esac dnl ---------------------------------------------------------------------- dnl Some users have reported problems with libtool's use of '-Wl,-rpath' to -dnl link shared libraries in nondefulat directories. Allow users to +dnl link shared libraries in nondefault directories. Allow users to dnl disable embedding the rpath information in the executables and to dnl instead solely rely on the information in LD_LIBRARY_PATH. AC_MSG_CHECKING([if -Wl,-rpath should be used to link shared libs in nondefault directories]) @@ -1277,7 +1287,7 @@ case "`uname`" in AC_CHECK_HEADERS([io.h sys/timeb.h]) ;; *) - AC_CHECK_HEADERS([io.h winsock.h sys/timeb.h]) + AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h]) ;; esac diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index 1bcf628..421caba 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -110,25 +110,27 @@ IF (H5_HAVE_PARALLEL) SET_TARGET_PROPERTIES (h5perf_alone PROPERTIES FOLDER perform) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) - #-- Adding test for benchpar - SET (benchpar_SRCS - ${HDF5_PERFORM_SOURCE_DIR}/benchpar.c - ) - ADD_EXECUTABLE (benchpar ${benchpar_SRCS}) - TARGET_NAMING (benchpar ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - SET_TARGET_PROPERTIES (benchpar PROPERTIES FOLDER perform) - - #-- Adding test for mpi-perf - IF (NOT WIN32) - SET (mpi-perf_SRCS - ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c + IF (HDF5_BUILD_PARALLEL_ALL) + #-- Adding test for benchpar + SET (benchpar_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/benchpar.c ) - ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) - TARGET_NAMING (mpi-perf ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - SET_TARGET_PROPERTIES (mpi-perf PROPERTIES FOLDER perform) - ENDIF (NOT WIN32) + ADD_EXECUTABLE (benchpar ${benchpar_SRCS}) + TARGET_NAMING (benchpar ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (benchpar PROPERTIES FOLDER perform) + + #-- Adding test for mpi-perf + IF (NOT WIN32) + SET (mpi-perf_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c + ) + ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) + TARGET_NAMING (mpi-perf ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (mpi-perf PROPERTIES FOLDER perform) + ENDIF (NOT WIN32) + ENDIF (HDF5_BUILD_PARALLEL_ALL) ENDIF (H5_HAVE_PARALLEL) @@ -188,9 +190,11 @@ IF (H5_HAVE_PARALLEL) ADD_TEST (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) -# ADD_TEST (NAME PERFORM_benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) + IF (HDF5_BUILD_PARALLEL_ALL) + ADD_TEST (NAME PERFORM_benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) - IF (NOT WIN32) - ADD_TEST (NAME PERFORM_mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) - ENDIF (NOT WIN32) + IF (NOT WIN32) + ADD_TEST (NAME PERFORM_mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) + ENDIF (NOT WIN32) + ENDIF (HDF5_BUILD_PARALLEL_ALL) ENDIF (H5_HAVE_PARALLEL) @@ -610,7 +610,6 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_ { size_t obj_id_count=0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ - htri_t type_exists; /* Whether objects of a type are open */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 0b5c677..b2c6398 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1022,12 +1022,29 @@ H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) +H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { H5FD_log_t *file = (H5FD_log_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR + if(file->fa.flags != 0) { + if(H5F_addr_gt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { + hsize_t size = addr - file->eoa; + + /* Retain the flavor of the space allocated by the extension */ + if(file->fa.flags & H5FD_LOG_FLAVOR) { + HDassert(addr < file->iosize); + H5_CHECK_OVERFLOW(size, hsize_t, size_t); + HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size); + } /* end if */ + + /* Log the extension like an allocation */ + if(file->fa.flags & H5FD_LOG_ALLOC) + HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); + } /* end if */ + } /* end if */ + file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 5751596..b1d312f 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -309,7 +309,8 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, /* Initialize */ ALL_MEMBERS(mt) { - memb_map[mt] = (H5FD_MEM_DRAW==mt?mt:H5FD_MEM_SUPER); + /* Treat global heap as raw data, not metadata */ + memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER); memb_fapl[mt] = -1; memb_name[mt] = NULL; memb_addr[mt] = HADDR_UNDEF; diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index ab19c68..5f70f71 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -133,7 +133,7 @@ typedef enum H5F_mem_t H5FD_mem_t; H5FD_MEM_SUPER, /*super*/ \ H5FD_MEM_SUPER, /*btree*/ \ H5FD_MEM_DRAW, /*draw*/ \ - H5FD_MEM_SUPER, /*gheap*/ \ + H5FD_MEM_DRAW, /*gheap*/ \ H5FD_MEM_SUPER, /*lheap*/ \ H5FD_MEM_SUPER /*ohdr*/ \ } diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 3c72c5d..0e549fa 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -115,6 +115,7 @@ herr_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { + H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -123,8 +124,11 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(f->shared); HDassert(buf); + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + /* Check if this information is in the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); @@ -173,7 +177,7 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, f->shared->accum.dirty_off += amount_before; /* Dispatch to driver */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_before, f->shared->accum.buf) < 0) + if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, amount_before, f->shared->accum.buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") } /* end if */ else @@ -187,7 +191,7 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (f->shared->accum.loc + f->shared->accum.size)), hsize_t, size_t); /* Dispatch to driver */ - if(H5FD_read(f->shared->lf, dxpl_id, type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0) + if(H5FD_read(f->shared->lf, dxpl_id, map_type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") } /* end if */ @@ -201,13 +205,13 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, /* Current read doesn't overlap with metadata accumulator, read it from file */ else { /* Dispatch to driver */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") } /* end else */ } /* end if */ else { /* Read the data */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") /* Check for overlap w/dirty accumulator */ @@ -250,7 +254,7 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, } /* end if */ else { /* Read the data */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + if(H5FD_read(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") } /* end else */ @@ -415,6 +419,7 @@ herr_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { + H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -424,8 +429,11 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(f->intent & H5F_ACC_RDWR); HDassert(buf); + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + /* Check for accumulating metadata */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); @@ -719,7 +727,7 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); } /* end if */ else { /* Write the data */ - if(H5FD_write(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + if(H5FD_write(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") /* Check for overlap w/accumulator */ @@ -804,7 +812,7 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); } /* end if */ else { /* Write the data */ - if(H5FD_write(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + if(H5FD_write(f->shared->lf, dxpl_id, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") } /* end else */ @@ -846,6 +854,7 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr, /* Sanity check */ /* (The metadata accumulator should not intersect w/raw data */ HDassert(H5FD_MEM_DRAW != type); + HDassert(H5FD_MEM_GHEAP != type); /* (global heap data is being treated as raw data currently) */ /* Check for overlapping the beginning of the accumulator */ if(H5F_addr_le(addr, f->shared->accum.loc)) { @@ -160,7 +160,8 @@ H5MF_init_merge_flags(H5F_t *f) all_metadata_same = TRUE; for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) /* Skip checking raw data free list mapping */ - if(type != H5FD_MEM_DRAW) { + /* (global heap is treated as raw data) */ + if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { /* Check for any different type mappings */ if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_SUPER]) { all_metadata_same = FALSE; @@ -183,9 +184,12 @@ H5MF_init_merge_flags(H5F_t *f) HDmemset(f->shared->fs_aggr_merge, 0, sizeof(f->shared->fs_aggr_merge)); /* Check if merging raw data should be allowed */ + /* (treat global heaps as raw data) */ if(H5FD_MEM_DRAW == f->shared->fs_type_map[H5FD_MEM_DRAW] || - H5FD_MEM_DEFAULT == f->shared->fs_type_map[H5FD_MEM_DRAW]) + H5FD_MEM_DEFAULT == f->shared->fs_type_map[H5FD_MEM_DRAW]) { f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + } /* end if */ break; case H5MF_AGGR_MERGE_DICHOTOMY: @@ -193,7 +197,9 @@ H5MF_init_merge_flags(H5F_t *f) HDmemset(f->shared->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f->shared->fs_aggr_merge)); /* Allow merging raw data allocations together */ + /* (treat global heaps as raw data) */ f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; break; case H5MF_AGGR_MERGE_TOGETHER: @@ -744,6 +750,7 @@ H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsize_t extra_requested) { haddr_t end; /* End of block to extend */ + H5FD_mem_t map_type; /* Mapped type */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -755,18 +762,21 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r HDassert(f); HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + /* Set mapped type, treating global heap as raw data */ + map_type = (alloc_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : alloc_type; + /* Compute end of block to extend */ end = addr + size; /* Check if the block is exactly at the end of the file */ - if((ret_value = H5FD_try_extend(f->shared->lf, alloc_type, f, end, extra_requested)) < 0) + if((ret_value = H5FD_try_extend(f->shared->lf, map_type, f, end, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") else if(ret_value == FALSE) { H5F_blk_aggr_t *aggr; /* Aggregator to use */ /* Check for test block able to extend aggregation block */ - aggr = (alloc_type == H5FD_MEM_DRAW) ? &(f->shared->sdata_aggr) : &(f->shared->meta_aggr); - if((ret_value = H5MF_aggr_try_extend(f, aggr, alloc_type, end, extra_requested)) < 0) + aggr = (map_type == H5FD_MEM_DRAW) ? &(f->shared->sdata_aggr) : &(f->shared->meta_aggr); + if((ret_value = H5MF_aggr_try_extend(f, aggr, map_type, end, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block") else if(ret_value == FALSE) { H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 05a9241..6f68fd7 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -46,6 +46,7 @@ /******************/ /* Local Typedefs */ /******************/ +#define EXTEND_THRESHOLD .10 /********************/ @@ -108,14 +109,14 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HDassert(size > 0); /* Couldn't find anything from the free space manager, go allocate some */ - if(alloc_type != H5FD_MEM_DRAW) { + if(alloc_type != H5FD_MEM_DRAW && alloc_type != H5FD_MEM_GHEAP) { /* Handle metadata differently from "raw" data */ if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") } /* end if */ else { - /* Allocate "raw" data */ - if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), alloc_type, size))) + /* Allocate "raw" data: H5FD_MEM_DRAW and H5FD_MEM_GHEAP */ + if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") } /* end else */ @@ -242,7 +243,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ - if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, f, size, &eoa_frag_addr, &eoa_frag_size))) + if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") } /* end else */ } /* end if */ @@ -307,12 +308,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* Freeing any possible fragment due to file allocation */ if(eoa_frag_size) - if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) + if(H5MF_xfree(f, alloc_type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") /* Freeing any possible fragment due to alignment in the block after extension */ if(extended && aggr_frag_size) - if(H5MF_xfree(f, type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0) + if(H5MF_xfree(f, alloc_type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end if */ else { @@ -323,7 +324,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* free any possible fragment */ if(aggr_frag_size) - if(H5MF_xfree(f, type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0) + if(H5MF_xfree(f, alloc_type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end else */ } /* end if */ @@ -364,6 +365,16 @@ HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); * Purpose: Check if a block is inside an aggregator block and extend it * if possible. * + * Note: + * When the block to be extended adjoins the aggregator-- + * 1) When the aggregator is at end of file: + * A) If the request is below the threshold, extend the block into the aggregator + * B) If the request is above the threshold, + * a) extend the aggregator by aggr->alloc_size or the extended amount + * b) extend the block into the aggregator + * 2) When the aggregator is not at end of file: + * Extended the block into the aggregator if it has enough space to satisfy the request + * * Return: Success: TRUE(1) - Block was extended * FALSE(0) - Block could not be extended * Failure: FAIL @@ -388,26 +399,56 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, /* Check if this aggregator is active */ if(f->shared->feature_flags & aggr->feature_flag) { - /* If the block being tested adjoins the beginning of the aggregator + /* + * If the block being tested adjoins the beginning of the aggregator * block, check if the aggregator can accomodate the extension. */ if(H5F_addr_eq(blk_end, aggr->addr)) { - /* If the aggregator block is at the end of the file, extend the - * file and "bubble" the aggregator up - */ - if((ret_value = H5FD_try_extend(f->shared->lf, type, f, (aggr->addr + aggr->size), extra_requested)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") - else if(ret_value == TRUE) { - /* Shift the aggregator block by the extra requested */ - aggr->addr += extra_requested; - - /* Add extra requested to the aggregator block's total amount allocated */ - aggr->tot_size += extra_requested; - } /* end if */ - else { - /* Check if the aggregator block has enough internal space to satisfy - * extending the block. - */ + haddr_t eoa; /* EOA for the file */ + + /* Get the EOA for the file */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + + /* If the aggregator is at the end of file: */ + if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) { + /* If extra_requested is below percentage threshold, extend block into the aggregator. */ + if(extra_requested <= (EXTEND_THRESHOLD * aggr->size)) { + aggr->size -= extra_requested; + aggr->addr += extra_requested; + + /* Indicate success */ + HGOTO_DONE(TRUE); + } + /* + * If extra_requested is above percentage threshold: + * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested + * 2) extend the block into the aggregator + */ + else { + hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; + + if((ret_value = H5FD_try_extend(f->shared->lf, type, f, (aggr->addr + aggr->size), extra)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") + else if(ret_value == TRUE) { + /* Shift the aggregator block by the extra requested */ + /* (allocates the space for the extra_requested) */ + aggr->addr += extra_requested; + + /* Add extra to the aggregator's total allocated amount */ + aggr->tot_size += extra; + + /* Account for any space added to the aggregator */ + /* (either 0 (if extra_requested > aggr->alloc_size) or + * (aggr->alloc_size - extra_requested) -QAK + */ + aggr->size += extra; + aggr->size -= extra_requested; + } /* end if */ + } /* end if */ + } /* end if */ + else { /* The aggreator is not at end of file */ + /* Check if aggregator has enough internal space to satisfy the extension. */ if(aggr->size >= extra_requested) { /* Extend block into aggregator */ aggr->size -= extra_requested; @@ -416,8 +457,8 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, /* Indicate success */ HGOTO_DONE(TRUE); } /* end if */ - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ } /* end if */ done: @@ -462,7 +503,7 @@ H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, || H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) { #ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Check if aggregator would get too large and should be absorbed into section */ if((aggr->size + sect->sect_info.size) >= aggr->alloc_size) *shrink = H5MF_SHRINK_SECT_ABSORB_AGGR; @@ -510,9 +551,9 @@ H5MF_aggr_absorb(const H5F_t UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_ if((aggr->size + sect->sect_info.size) >= aggr->alloc_size && allow_sect_absorb) { /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { -#ifdef H5MF_AGGR_DBEUG +#ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto end of section */ sect->sect_info.size += aggr->size; } /* end if */ @@ -520,9 +561,9 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", " /* Sanity check */ HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); -#ifdef H5MF_AGGR_DBEUG +#ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto beginning of section */ sect->sect_info.addr -= aggr->size; sect->sect_info.size += aggr->size; @@ -536,9 +577,9 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5 else { /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { -#ifdef H5MF_AGGR_DBEUG +#ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto front of aggregator */ aggr->addr -= sect->sect_info.size; aggr->size += sect->sect_info.size; @@ -552,9 +593,9 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", " /* Sanity check */ HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); -#ifdef H5MF_AGGR_DBEUG +#ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto end of aggregator */ aggr->size += sect->sect_info.size; } /* end if */ @@ -637,9 +678,9 @@ H5MF_aggr_reset(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr) /* Retain aggregator info */ tmp_addr = aggr->addr; tmp_size = aggr->size; -#ifdef H5MF_AGGR_DBEUG +#ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", FUNC, tmp_addr, tmp_size); -#endif /* H5MF_AGGR_DBEUG */ +#endif /* H5MF_AGGR_DEBUG */ /* Reset aggregator block information */ aggr->tot_size = 0; diff --git a/src/H5config.h.in b/src/H5config.h.in index 27d317c..b35d68e 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -408,8 +408,8 @@ /* Define if your system has window style path name. */ #undef HAVE_WINDOW_PATH -/* Define to 1 if you have the <winsock.h> header file. */ -#undef HAVE_WINSOCK_H +/* Define to 1 if you have the <winsock2.h> header file. */ +#undef HAVE_WINSOCK2_H /* Define to 1 if you have the <zlib.h> header file. */ #undef HAVE_ZLIB_H @@ -3184,8 +3184,13 @@ error: * To verify that a block can be extended from the aggregator * * Test 1: Allocate block A from meta_aggr which is at end of file - * Try to extend a block which adjoins the aggregator - * H5MF_try_extend() succeeds: meta_aggr is extended by extended-request and meta_aggr's info is updated + * Try to extend the block which adjoins the aggregator that is at end of file + * a. block size < (% * aggr->alloc_size) + * The block is allocated from the aggregator + * b. block size > (% * aggr->alloc_size) but block size < aggr->alloc_size + * The block is extended by aggr->alloc_size and the block is allocated from the aggregator + * c. block size > (% * aggr->alloc_size) but block size > aggr->alloc_size + * The block is extended by extended-request and the block is allocated from the aggregator * * Test 2: Allocate block A from meta_aggr * Allocate block B from sdata_aggr so that meta_aggr is not at end of file @@ -3252,7 +3257,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) new_addr = addr - 10; - /* Try to extend the block */ + /* Try to extend the block by an amount < (% * aggr->alloc_size) */ extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); /* should succeed */ @@ -3263,15 +3268,42 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if (new_ma_addr != (addr+TEST_BLOCK_SIZE50)) TEST_ERROR - if (new_ma_size != f->shared->meta_aggr.alloc_size) TEST_ERROR + if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50)) TEST_ERROR - /* Restore info for meta_aggr */ - f->shared->meta_aggr.addr = ma_addr; - f->shared->meta_aggr.size = ma_size; + /* Free the allocated blocks */ + H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE50); + + /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount < aggr->alloc_size */ + extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700)); + + /* should succeed */ + if(!extended) + TEST_ERROR + + H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + + if (new_ma_addr != (addr + TEST_BLOCK_SIZE700)) + TEST_ERROR + if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TEST_BLOCK_SIZE700)) TEST_ERROR /* Free the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, (ma_addr+ma_size), (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE700); + + /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount > aggr->alloc_size */ + extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058)); + + /* should succeed */ + if(!extended) + TEST_ERROR + + H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + + if (new_ma_addr != (addr + TEST_BLOCK_SIZE2058)) + TEST_ERROR + if (new_ma_size != f->shared->meta_aggr.size) TEST_ERROR + + /* Free the allocated blocks */ + H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE2058); if(H5Fclose(file) < 0) FAIL_STACK_ERROR diff --git a/tools/h5copy/testfiles/h5copy_ref.out.ls b/tools/h5copy/testfiles/h5copy_ref.out.ls index 0769dc8..d685af2 100644 --- a/tools/h5copy/testfiles/h5copy_ref.out.ls +++ b/tools/h5copy/testfiles/h5copy_ref.out.ls @@ -21,7 +21,7 @@ Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver. Storage: <details removed for portability> Type: object reference /COPY/Dset_REGREF Dataset {2/2} - Location: 1:9400 + Location: 1:5304 Links: 1 Storage: <details removed for portability> Type: dataset region reference diff --git a/tools/h5copy/testfiles/h5copytst.out.ls b/tools/h5copy/testfiles/h5copytst.out.ls index 62c860b..4044aaf 100644 --- a/tools/h5copy/testfiles/h5copytst.out.ls +++ b/tools/h5copy/testfiles/h5copytst.out.ls @@ -3,57 +3,57 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Location: 1:96 Links: 1 /A Group - Location: 1:88336 + Location: 1:84304 Links: 1 /A/B1 Group - Location: 1:89040 + Location: 1:85008 Links: 1 /A/B1/simple Dataset {6/6} - Location: 1:88208 + Location: 1:84176 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /A/B2 Group - Location: 1:92576 + Location: 1:88544 Links: 1 /A/B2/simple2 Dataset {6/6} - Location: 1:92448 + Location: 1:88416 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /C Group - Location: 1:95784 + Location: 1:91752 Links: 1 /C/D Group - Location: 1:96488 + Location: 1:92456 Links: 1 /C/D/simple Dataset {6/6} - Location: 1:95656 + Location: 1:91624 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E Group - Location: 1:110400 + Location: 1:106368 Links: 1 /E/F Group - Location: 1:111104 + Location: 1:107072 Links: 1 /E/F/grp_dsets Group - Location: 1:98600 + Location: 1:94568 Links: 1 /E/F/grp_dsets/chunk Dataset {6/6} - Location: 1:102784 + Location: 1:98752 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/compact Dataset {6/6} - Location: 1:103240 + Location: 1:99208 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/compound Dataset {2/2} - Location: 1:103376 + Location: 1:99344 Links: 1 Storage: <details removed for portability> Type: struct { @@ -61,60 +61,60 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /E/F/grp_dsets/compressed Dataset {6/6} - Location: 1:105688 + Location: 1:101656 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /E/F/grp_dsets/named_vl Dataset {2/2} - Location: 1:109952 + Location: 1:105920 Links: 1 Storage: <details removed for portability> - Type: shared-1:110080 variable length of + Type: shared-1:106048 variable length of 32-bit little-endian integer /E/F/grp_dsets/nested_vl Dataset {2/2} - Location: 1:110128 + Location: 1:106096 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /E/F/grp_dsets/simple Dataset {6/6} - Location: 1:110272 + Location: 1:106240 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/vl Type - Location: 1:110080 + Location: 1:106048 Links: 2 - Type: shared-1:110080 variable length of + Type: shared-1:106048 variable length of 32-bit little-endian integer /G Group - Location: 1:126048 + Location: 1:122016 Links: 1 /G/H Group - Location: 1:126752 + Location: 1:122720 Links: 1 /G/H/grp_nested Group - Location: 1:113128 + Location: 1:109096 Links: 1 /G/H/grp_nested/grp_dsets Group - Location: 1:113920 + Location: 1:109888 Links: 1 /G/H/grp_nested/grp_dsets/chunk Dataset {6/6} - Location: 1:118104 + Location: 1:114072 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/compact Dataset {6/6} - Location: 1:118560 + Location: 1:114528 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/compound Dataset {2/2} - Location: 1:118696 + Location: 1:114664 Links: 1 Storage: <details removed for portability> Type: struct { @@ -122,34 +122,34 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /G/H/grp_nested/grp_dsets/compressed Dataset {6/6} - Location: 1:121008 + Location: 1:116976 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/named_vl Dataset {2/2} - Location: 1:125272 + Location: 1:121240 Links: 1 Storage: <details removed for portability> - Type: shared-1:125400 variable length of + Type: shared-1:121368 variable length of 32-bit little-endian integer /G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2} - Location: 1:125448 + Location: 1:121416 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /G/H/grp_nested/grp_dsets/simple Dataset {6/6} - Location: 1:125592 + Location: 1:121560 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/vl Type - Location: 1:125400 + Location: 1:121368 Links: 2 - Type: shared-1:125400 variable length of + Type: shared-1:121368 variable length of 32-bit little-endian integer /chunk Dataset {6/6} Location: 1:6312 @@ -178,21 +178,21 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_dsets Group - Location: 1:32160 + Location: 1:28128 Links: 1 /grp_dsets/chunk Dataset {6/6} - Location: 1:36344 + Location: 1:32312 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/compact Dataset {6/6} - Location: 1:36800 + Location: 1:32768 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/compound Dataset {2/2} - Location: 1:36936 + Location: 1:32904 Links: 1 Storage: <details removed for portability> Type: struct { @@ -200,62 +200,62 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_dsets/compressed Dataset {6/6} - Location: 1:39248 + Location: 1:35216 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_dsets/named_vl Dataset {2/2} - Location: 1:43512 + Location: 1:39480 Links: 1 Storage: <details removed for portability> - Type: shared-1:43640 variable length of + Type: shared-1:39608 variable length of 32-bit little-endian integer /grp_dsets/nested_vl Dataset {2/2} - Location: 1:43688 + Location: 1:39656 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_dsets/simple Dataset {6/6} - Location: 1:43832 + Location: 1:39800 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/simple_group Dataset {6/6} - Location: 1:59944 + Location: 1:55912 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/vl Type - Location: 1:43640 + Location: 1:39608 Links: 2 - Type: shared-1:43640 variable length of + Type: shared-1:39608 variable length of 32-bit little-endian integer /grp_empty Group - Location: 1:31368 + Location: 1:27336 Links: 1 /grp_nested Group - Location: 1:44624 + Location: 1:40592 Links: 1 /grp_nested/grp_dsets Group - Location: 1:45416 + Location: 1:41384 Links: 1 /grp_nested/grp_dsets/chunk Dataset {6/6} - Location: 1:49600 + Location: 1:45568 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/compact Dataset {6/6} - Location: 1:50056 + Location: 1:46024 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/compound Dataset {2/2} - Location: 1:50192 + Location: 1:46160 Links: 1 Storage: <details removed for portability> Type: struct { @@ -263,51 +263,51 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_nested/grp_dsets/compressed Dataset {6/6} - Location: 1:52504 + Location: 1:48472 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_nested/grp_dsets/named_vl Dataset {2/2} - Location: 1:56768 + Location: 1:52736 Links: 1 Storage: <details removed for portability> - Type: shared-1:56896 variable length of + Type: shared-1:52864 variable length of 32-bit little-endian integer /grp_nested/grp_dsets/nested_vl Dataset {2/2} - Location: 1:56944 + Location: 1:52912 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_nested/grp_dsets/simple Dataset {6/6} - Location: 1:57088 + Location: 1:53056 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/vl Type - Location: 1:56896 + Location: 1:52864 Links: 2 - Type: shared-1:56896 variable length of + Type: shared-1:52864 variable length of 32-bit little-endian integer /grp_rename Group - Location: 1:61152 + Location: 1:57120 Links: 1 /grp_rename/chunk Dataset {6/6} - Location: 1:65336 + Location: 1:61304 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/compact Dataset {6/6} - Location: 1:65792 + Location: 1:61760 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/compound Dataset {2/2} - Location: 1:65928 + Location: 1:61896 Links: 1 Storage: <details removed for portability> Type: struct { @@ -315,28 +315,28 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_rename/compressed Dataset {6/6} - Location: 1:68240 + Location: 1:64208 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_rename/grp_dsets Group - Location: 1:74032 + Location: 1:70000 Links: 1 /grp_rename/grp_dsets/chunk Dataset {6/6} - Location: 1:78216 + Location: 1:74184 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/compact Dataset {6/6} - Location: 1:78672 + Location: 1:74640 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/compound Dataset {2/2} - Location: 1:78808 + Location: 1:74776 Links: 1 Storage: <details removed for portability> Type: struct { @@ -344,73 +344,73 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_rename/grp_dsets/compressed Dataset {6/6} - Location: 1:81120 + Location: 1:77088 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_rename/grp_dsets/named_vl Dataset {2/2} - Location: 1:85384 + Location: 1:81352 Links: 1 Storage: <details removed for portability> - Type: shared-1:85512 variable length of + Type: shared-1:81480 variable length of 32-bit little-endian integer /grp_rename/grp_dsets/nested_vl Dataset {2/2} - Location: 1:85560 + Location: 1:81528 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_rename/grp_dsets/simple Dataset {6/6} - Location: 1:85704 + Location: 1:81672 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/vl Type - Location: 1:85512 + Location: 1:81480 Links: 2 - Type: shared-1:85512 variable length of + Type: shared-1:81480 variable length of 32-bit little-endian integer /grp_rename/named_vl Dataset {2/2} - Location: 1:72504 + Location: 1:68472 Links: 1 Storage: <details removed for portability> - Type: shared-1:72632 variable length of + Type: shared-1:68600 variable length of 32-bit little-endian integer /grp_rename/nested_vl Dataset {2/2} - Location: 1:72680 + Location: 1:68648 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_rename/simple Dataset {6/6} - Location: 1:72824 + Location: 1:68792 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/vl Type - Location: 1:72632 + Location: 1:68600 Links: 2 - Type: shared-1:72632 variable length of + Type: shared-1:68600 variable length of 32-bit little-endian integer /named_vl Dataset {2/2} - Location: 1:19296 + Location: 1:17280 Links: 1 Storage: <details removed for portability> - Type: shared-1:19424 variable length of + Type: shared-1:17408 variable length of 32-bit little-endian integer /nested_vl Dataset {2/2} - Location: 1:25792 + Location: 1:21760 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /rename Dataset {2/2} - Location: 1:30160 + Location: 1:26128 Links: 1 Storage: <details removed for portability> Type: struct { @@ -423,7 +423,7 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Storage: <details removed for portability> Type: 32-bit little-endian integer /simple_top Dataset {6/6} - Location: 1:27984 + Location: 1:23952 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index a9c5d11..091da9a 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -41,6 +41,7 @@ IF (BUILD_TESTING) SET (HDF5_REFERENCE_FILES h5stat_help1.ddl h5stat_help2.ddl + h5stat_notexist.ddl h5stat_filters.ddl h5stat_filters-file.ddl h5stat_filters-F.ddl @@ -133,6 +134,8 @@ IF (BUILD_TESTING) h5stat_help1.out.err h5stat_help2.out h5stat_help2.out.err + h5stat_notexist.out + h5stat_notexist.out.err h5stat_filters.out h5stat_filters.out.err h5stat_filters-file.out @@ -168,6 +171,9 @@ IF (BUILD_TESTING) ADD_H5_TEST (h5stat_help1 0 -h) ADD_H5_TEST (h5stat_help2 0 --help) +# Test when h5stat a file that does not exist + ADD_H5_TEST (h5stat_notexist 1 notexist.h5) + # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5) diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 99ea688..a68760d 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -937,36 +937,9 @@ error: /*------------------------------------------------------------------------- - * Function: init_iter + * Function: iter_free * - * Purpose: Initialize iter structure - * - * Return: Success: 0 - * - * Failure: Never fails - * - * Programmer: Elena Pourmal - * Saturday, August 12, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -iter_init(iter_t *iter, hid_t fid) -{ - /* Clear everything to zeros */ - HDmemset(iter, 0, sizeof(*iter)); - - /* Set the file ID for later use in callbacks */ - iter->fid = fid; - - return 0; -} /* iter_init() */ - - -/*------------------------------------------------------------------------- - * Function: free_iter - * - * Purpose: Freee iter structure + * Purpose: Free iter structure * * Return: Success: 0 * @@ -1610,7 +1583,7 @@ main(int argc, const char *argv[]) { iter_t iter; const char *fname = NULL; - hid_t fid; + hid_t fid = -1; hid_t fcpl; struct handler_t *hand = NULL; H5F_info2_t finfo; @@ -1633,6 +1606,8 @@ main(int argc, const char *argv[]) printf("Filename: %s\n", fname); + HDmemset(&iter, 0, sizeof(iter)); + fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if(fid < 0) { error_msg("unable to open file \"%s\"\n", fname); @@ -1641,7 +1616,7 @@ main(int argc, const char *argv[]) } /* end if */ /* Initialize iter structure */ - iter_init(&iter, fid); + iter.fid = fid; if(H5Fget_filesize(fid, &iter.filesize) < 0) warn_msg("Unable to retrieve file size\n"); @@ -1708,7 +1683,7 @@ done: /* Free iter structure */ iter_free(&iter); - if(H5Fclose(fid) < 0) { + if(fid >= 0 && H5Fclose(fid) < 0) { error_msg("unable to close file \"%s\"\n", fname); h5tools_setstatus(EXIT_FAILURE); } diff --git a/tools/h5stat/testfiles/h5stat_notexist.ddl b/tools/h5stat/testfiles/h5stat_notexist.ddl new file mode 100644 index 0000000..ac0fce4 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_notexist.ddl @@ -0,0 +1,5 @@ +############################# +Expected output for 'h5stat notexist.h5' +############################# +Filename: notexist.h5 +h5stat error: unable to open file "notexist.h5" diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index c5cb3e8..c594a97 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -77,6 +77,7 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.h5 LIST_OTHER_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_help1.ddl $SRC_H5STAT_TESTFILES/h5stat_help2.ddl +$SRC_H5STAT_TESTFILES/h5stat_notexist.ddl $SRC_H5STAT_TESTFILES/h5stat_filters.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl @@ -189,6 +190,8 @@ COPY_TESTFILES_TO_TESTDIR # Test for help flag TOOLTEST h5stat_help1.ddl -h TOOLTEST h5stat_help2.ddl --help +# Test when h5stat a file that does not exist +TOOLTEST h5stat_notexist.ddl notexist.h5 # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 |