diff options
51 files changed, 1134 insertions, 1170 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 922ada8..3c7bb38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,51 +199,6 @@ set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.j set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar) set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar) -if (APPLE) - option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) -endif () - -if (NOT HDF5_INSTALL_BIN_DIR) - set (HDF5_INSTALL_BIN_DIR bin) -endif () -if (NOT HDF5_INSTALL_LIB_DIR) - if (APPLE) - if (HDF5_BUILD_FRAMEWORKS) - set (HDF5_INSTALL_JAR_DIR ../Java) - else () - set (HDF5_INSTALL_JAR_DIR lib) - endif () - set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - else () - set (HDF5_INSTALL_JAR_DIR lib) - endif () - set (HDF5_INSTALL_LIB_DIR lib) -endif () -if (NOT HDF5_INSTALL_INCLUDE_DIR) - set (HDF5_INSTALL_INCLUDE_DIR include) -endif () -if (NOT HDF5_INSTALL_DATA_DIR) - if (NOT WIN32) - if (APPLE) - if (HDF5_BUILD_FRAMEWORKS) - set (HDF5_INSTALL_EXTRA_DIR ../SharedSupport) - else () - set (HDF5_INSTALL_EXTRA_DIR share) - endif () - set (HDF5_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - endif () - set (HDF5_INSTALL_DATA_DIR share) - set (HDF5_INSTALL_CMAKE_DIR share/cmake) - else () - set (HDF5_INSTALL_DATA_DIR ".") - set (HDF5_INSTALL_CMAKE_DIR cmake) - endif () -endif () - -if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") - set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) -endif () - #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO #----------------------------------------------------------------------------- @@ -406,46 +361,15 @@ set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") # Include some macros for reusable code #----------------------------------------------------------------------------- include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake) -include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) -include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) -SET_HDF_BUILD_TYPE() +HDF_DIR_PATHS(${HDF5_PACKAGE_NAME}) -#----------------------------------------------------------------------------- -# Setup output Directories -#----------------------------------------------------------------------------- -if (NOT HDF5_EXTERNALLY_CONFIGURED) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables." - ) - set (CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries" - ) - set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries." - ) - set (CMAKE_Fortran_MODULE_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." - ) - if (WIN32) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) - set (CMAKE_PDB_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." - ) - else () - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) - endif () -else () - # if we are externally configured, but the project uses old cmake scripts - # this may not be set and utilities like H5detect will fail - if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) - endif () -endif () +include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) +include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use -# by other projects using FindHDF5. +# by other projects. #----------------------------------------------------------------------------- if (NOT HDF5_EXPORTED_TARGETS) set (HDF5_EXPORTED_TARGETS "hdf5-targets") @@ -604,9 +528,13 @@ endif () #----------------------------------------------------------------------------- # Option to embed library info into executables #----------------------------------------------------------------------------- -option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON) -if (HDF5_ENABLE_EMBEDDED_LIBINFO) - set (H5_HAVE_EMBEDDED_LIBINFO 1) +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set (H5_HAVE_EMBEDDED_LIBINFO 0) +else () + option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON) + if (HDF5_ENABLE_EMBEDDED_LIBINFO) + set (H5_HAVE_EMBEDDED_LIBINFO 1) + endif () endif () include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) @@ -752,17 +680,17 @@ endif () #----------------------------------------------------------------------------- # Add the HDF5 Library Target to the build #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src) +add_subdirectory (src) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB) + add_dependencies (${HDF5_LIB_TARGET} ZLIB) if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} ZLIB) endif () endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) - ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP) + add_dependencies (${HDF5_LIB_TARGET} SZIP) if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} SZIP) endif () @@ -797,12 +725,11 @@ if (BUILD_TESTING) if (NOT HDF5_EXTERNALLY_CONFIGURED) if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") - add_subdirectory (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib) - add_subdirectory (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test) + add_subdirectory (test) endif () if (H5_HAVE_PARALLEL) if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") - add_subdirectory (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar) + add_subdirectory (testpar) endif () endif () endif () @@ -814,7 +741,7 @@ endif () if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") option (HDF5_BUILD_TOOLS "Build HDF5 Tools" ON) if (HDF5_BUILD_TOOLS) - add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) + add_subdirectory (tools) endif () endif () @@ -824,7 +751,7 @@ endif () if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON) if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples) + add_subdirectory (examples) endif () endif () @@ -835,7 +762,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") option (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON) if (HDF5_BUILD_HL_LIB) set (H5_INCLUDE_HL 1) - add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl) + add_subdirectory (hl) endif () endif () @@ -884,11 +811,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for # # set (FCFLAGS "${Fortran_DEFINES}") - add_subdirectory (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) + add_subdirectory (fortran) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes - add_subdirectory (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran) + add_subdirectory (hl/fortran) endif () endif () endif () @@ -911,11 +838,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") if (CMAKE_NO_STD_NAMESPACE) set (H5_NO_STD 1) endif () - add_subdirectory (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) + add_subdirectory (c++) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++") #-- Build the High Level Fortran source codes - add_subdirectory (${HDF5_SOURCE_DIR}/hl/c++ ${PROJECT_BINARY_DIR}/hl/c++) + add_subdirectory (hl/c++) endif () endif () endif () @@ -937,7 +864,7 @@ endif () if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF) if (HDF5_BUILD_JAVA) - add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java) + add_subdirectory (java) endif () endif () @@ -99,7 +99,7 @@ and/or accompanying materials: HDF5 is available with the SZIP compression library but SZIP is not part of HDF5 and has separate copyright and license terms. See “Szip Compression -in HDF Products” (www.hdfgroup.org/doc_resource/SZIP/) for further details. +in HDF Products” (https://support.hdfgroup.org/doc_resource/SZIP/) for further details. ----------------------------------------------------------------------------- @@ -3094,7 +3094,6 @@ ./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake -./config/cmake_ext_mod/CheckTypeSize.cmake ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake ./config/cmake_ext_mod/FindMPI.cmake diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index c9c4815..adbf1a4 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -27,18 +27,18 @@ if (H5_HAVE_PARALLEL) add_definitions ("-DMPICH_IGNORE_CXX_SEEK") endif () -add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src) +add_subdirectory (src) #----------------------------------------------------------------------------- # Build the CPP Examples #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples) + add_subdirectory (examples) endif () #----------------------------------------------------------------------------- # Build the CPP unit tests #----------------------------------------------------------------------------- if (BUILD_TESTING) - add_subdirectory (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test) + add_subdirectory (test) endif () diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake index c59b10c..a8b7bbc 100755 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/CTestScript.cmake @@ -63,13 +63,6 @@ if (APPLE) set (ENV{CC} "${XCODE_CC}") set (ENV{CXX} "${XCODE_CXX}") - if (NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - endif () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") endif () diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 0848e66..7d73c09 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -179,7 +179,7 @@ endif () # Macro to determine the various conversion capabilities #----------------------------------------------------------------------------- macro (H5ConversionTests TEST msg) - if ("${TEST}" MATCHES "^${TEST}$") + if (NOT DEFINED ${TEST}) # message (STATUS "===> ${TEST}") TRY_RUN (${TEST}_RUN ${TEST}_COMPILE ${CMAKE_BINARY_DIR} @@ -210,21 +210,6 @@ macro (H5ConversionTests TEST msg) endmacro () #----------------------------------------------------------------------------- -# Macro to make some of the conversion tests easier to write/read -#----------------------------------------------------------------------------- -macro (H5MiscConversionTest VAR TEST msg) - if ("${TEST}" MATCHES "^${TEST}$") - if (${VAR}) - set (${TEST} 1 CACHE INTERNAL ${msg}) - message (STATUS "${msg}... yes") - else () - set (${TEST} "" CACHE INTERNAL ${msg}) - message (STATUS "${msg}... no") - endif () - endif () -endmacro () - -#----------------------------------------------------------------------------- # Check various conversion capabilities #----------------------------------------------------------------------------- diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index 082dbd4..002bc88 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -9,12 +9,23 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ++ +#if defined(__has_attribute) +#if __has_attribute(no_sanitize) +#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) +#else +#define HDF_NO_UBSAN +#endif +#else +#define HDF_NO_UBSAN +#endif + #ifdef H5_LDOUBLE_TO_LONG_SPECIAL_TEST #include <string.h> #include <stdlib.h> -int main(void) +int main(void) HDF_NO_UBSAN { long double ld = 20041683600089727.779961L; long ll; @@ -24,44 +35,44 @@ int main(void) int ret = 1; if(sizeof(long double) == 16 && sizeof(long) == 8) { - /*make sure the long double type has 16 bytes in size and - * 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ - memcpy(s, &ld, 16); - if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && - s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && - s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { - - /* Assign the hexadecimal value of long double type. */ - s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; - s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; - s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; - s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; - - memcpy(&ld, s, 16); - - ll = (long)ld; - memcpy(s2, &ll, 8); - - /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82 - * and gets wrong value 20041683600089730 on the IBM Power6 Linux. - * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f - * and gets the correct value 20041683600089727. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && - s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) - ret = 0; - - ull = (unsigned long)ld; - memcpy(s2, &ull, 8); - - /* The unsigned long is the same as signed long. */ - if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && - s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) - ret = 0; - } + /*make sure the long double type has 16 bytes in size and + * 11 bits of exponent. If it is, + *the bit sequence should be like below. It's not + *a decent way to check but this info isn't available. */ + memcpy(s, &ld, 16); + if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && + s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { + + /* Assign the hexadecimal value of long double type. */ + s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; + s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; + s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + + ll = (long)ld; + memcpy(s2, &ll, 8); + + /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82 + * and gets wrong value 20041683600089730 on the IBM Power6 Linux. + * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f + * and gets the correct value 20041683600089727. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + + ull = (unsigned long)ld; + memcpy(s2, &ull, 8); + + /* The unsigned long is the same as signed long. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + } } done: @@ -75,7 +86,7 @@ done: #include <string.h> #include <stdlib.h> -int main(void) +int main(void) HDF_NO_UBSAN { long double ld; long ll; @@ -86,46 +97,46 @@ int main(void) /*Determine if long double has 16 byte in size, 11 bit exponent, and *the bias is 0x3ff */ if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; + ld = 1.0L; + memcpy(s, &ld, 16); + if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; } if(flag==1 && sizeof(long)==8) { - ll = 0x003fffffffffffffL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /* The library converts the value to 0x434fffffffffffff8000000000000000. - * In decimal it is 18014398509481982.000000, one value short of the original. - * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000. - * The value is correct in decimal. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && - s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && - s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) - ret = 0; + ll = 0x003fffffffffffffL; + ld = (long double)ll; + memcpy(s, &ld, 16); + /* The library converts the value to 0x434fffffffffffff8000000000000000. + * In decimal it is 18014398509481982.000000, one value short of the original. + * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; } if(flag==1 && sizeof(unsigned long)==8) { - ull = 0xffffffffffffffffUL; - ld = (long double)ull; - memcpy(s, &ld, 16); - /* Use a different value from signed long to test. The problem is the same - * for both long and unsigned long. The value is 18446744073709551615. - * The library converts the value to 0x43effffffffffffffe000000000000000. - * In decimal it's 18446744073709548544.000000, very different from the original. - * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000. - * The value is correct in decimal. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && - s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && - s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) - ret = 0; + ull = 0xffffffffffffffffUL; + ld = (long double)ull; + memcpy(s, &ld, 16); + /* Use a different value from signed long to test. The problem is the same + * for both long and unsigned long. The value is 18446744073709551615. + * The library converts the value to 0x43effffffffffffffe000000000000000. + * In decimal it's 18446744073709548544.000000, very different from the original. + * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; } done: exit(ret); @@ -138,7 +149,7 @@ done: #include <string.h> #include <stdlib.h> -int main(void) +int main(void) HDF_NO_UBSAN { long double ld = 20041683600089727.779961L; long long ll; @@ -181,7 +192,7 @@ done: #include <string.h> #include <stdlib.h> -int main(void) +int main(void) HDF_NO_UBSAN { long double ld; long long ll; @@ -243,7 +254,7 @@ int FC_DUMMY_MAIN() #endif #endif int -main () +main () HDF_NO_UBSAN { char *chp = "beefs"; diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index f08349e..c3dea9a 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -17,12 +17,12 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) if (ARGN) set (PACKAGE_SOVERSION ${ARGN}) else () - set (PACKAGE_SOVERSION ${HDF5_PACKAGE_SOVERSION}) + set (PACKAGE_SOVERSION ${H5_SOVERS_MAJOR}) endif () if (WIN32) set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) else () - set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION}) + set (LIBHDF_VERSION ${HDF5_PACKAGE_SOVERSION}) endif () set_target_properties (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) if (WIN32) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index a414cea..56277fa 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -49,9 +49,9 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) if (MSVC) set (HDF5_WARNINGS_BLOCKED 1) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0") endif () if (WIN32) add_definitions (-D_CRT_SECURE_NO_WARNINGS) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 7bb426f..891e3a7 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -13,7 +13,7 @@ General Information: Compiling Options: ------------------ - Build Mode: @HDF_BUILD_TYPE@ + Build Mode: @CMAKE_BUILD_TYPE@ Debugging Symbols: @SYMBOLS@ Asserts: @ASSERTS@ Profiling: @PROFILING@ diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 3cb9a5e..f826e31 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -64,13 +64,6 @@ if (APPLE) set (ENV{CC} "${XCODE_CC}")
set (ENV{CXX} "${XCODE_CXX}")
- if (NOT NO_MAC_FORTRAN)
- # Shared fortran is not supported, build static
- set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
- else ()
- set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
- endif ()
-
set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
endif ()
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index d32a6bdb..33d7868 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -32,10 +32,6 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed
# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
# CTEST_SOURCE_NAME - source folder
-# STATIC_ONLY - Build/use static libraries
-# FORTRAN_LIBRARIES - Build/use fortran libraries
-# JAVA_LIBRARIES - Build/use java libraries
-# NO_MAC_FORTRAN - Yes to be SHARED on a Mac
##############################################################################
set (CTEST_SOURCE_VERSION "1.11.2")
@@ -47,10 +43,6 @@ set (CTEST_SOURCE_VERSEXT "") #INSTALLDIR - HDF5-1.10.0 root folder
#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
-#STATIC_ONLY - Default is YES
-#FORTRAN_LIBRARIES - Default is NO
-#JAVA_LIBRARIES - Default is NO
-#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac
if (DEFINED CTEST_SCRIPT_ARG)
# transform ctest script arguments of the form
# script.ctest,var1=value1,var2=value2
@@ -70,6 +62,7 @@ endif () ###################################################################
### Following Line is one of [Release, RelWithDebInfo, Debug] #####
+### (default use command line -C value) set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
###################################################################
@@ -86,21 +79,6 @@ endif () if (NOT DEFINED CTEST_SOURCE_NAME)
set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
endif ()
-if (NOT DEFINED STATIC_ONLY)
- set (STATICONLYLIBRARIES "YES")
-else ()
- set (STATICONLYLIBRARIES "NO")
-endif ()
-if (NOT DEFINED FORTRAN_LIBRARIES)
- set (FORTRANLIBRARIES "NO")
-else ()
- set(FORTRANLIBRARIES "YES")
-endif ()
-if (NOT DEFINED JAVA_LIBRARIES)
- set (JAVALIBRARIES "NO")
-else ()
- set (JAVALIBRARIES "YES")
-endif ()
set (CTEST_BINARY_NAME "build")
set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
@@ -212,34 +190,6 @@ set (REPOSITORY_BRANCH "develop") #set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
###################################################################
-###################################################################
-if (${STATICONLYLIBRARIES})
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
- ######### Following describes computer ############
- ## following is optional to describe build ##
- set (SITE_BUILDNAME_SUFFIX "STATIC")
-endif ()
-###################################################################
-#### fortran ####
-if (${FORTRANLIBRARIES})
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON")
- ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON")
-else ()
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
- ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF")
-endif ()
-#### java ####
-if (${JAVALIBRARIES})
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON")
-else ()
- set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
-endif ()
-
-### change install prefix
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}")
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}")
###################################################################
diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index b090434..82ab04a 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -21,6 +21,32 @@ #set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") ############################################################################################# +#### Only build static libraries #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") +#### Add PICC option on linux/mac #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + +############################################################################################# +#### fortran enabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") +#### fortran disabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") + +############################################################################################# +#### java enabled #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") +#### java disabled #### +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + +############################################################################################# +### change install prefix (default use INSTALLDIR value) +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") + +############################################################################################# #### ext libraries #### ### ext libs from tgz diff --git a/config/cmake_ext_mod/CheckTypeSize.cmake b/config/cmake_ext_mod/CheckTypeSize.cmake deleted file mode 100644 index c14c2f2..0000000 --- a/config/cmake_ext_mod/CheckTypeSize.cmake +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# -# Check if the type exists and determine size of type. if the type -# exists, the size will be stored to the variable. -# -# CHECK_TYPE_SIZE - macro which checks the size of type -# VARIABLE - variable to store size if the type exists. -# HAVE_${VARIABLE} - does the variable exists or not -# - -macro (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) - set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) - if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - set (MACRO_CHECK_TYPE_SIZE_FLAGS - "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}" - ) - foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H) - if ("${def}") - set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") - endif () - endforeach () - - message (STATUS "Check size of ${TYPE}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_TYPE_SIZE_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" - ) - endif () - try_run (${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/CheckTypeSize.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} - "${CHECK_TYPE_SIZE_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (HAVE_${VARIABLE}) - message (STATUS "Check size of ${TYPE} - done") - file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log - "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n" - ) - else () - message (STATUS "Check size of ${TYPE} - failed") - file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n" - ) - endif () - endif () - set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS) -endmacro () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 56d45f9..3797768 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -12,18 +12,18 @@ #----------------------------------------------------------------------------- # Include all the necessary files for macros #----------------------------------------------------------------------------- -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake) -include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) -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 (CheckFunctionExists) +include (CheckIncludeFile) +include (CheckIncludeFileCXX) +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) +include (CheckTypeSize) +include (CheckVariableExists) +include (CheckFortranFunctionExists) +include (TestBigEndian) if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED) - include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) + include (TestForSTDNamespace) endif () #----------------------------------------------------------------------------- @@ -145,7 +145,7 @@ endif () # For other specific tests, use this MACRO. macro (HDF_FUNCTION_TEST OTHER_TEST) - if ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$") + if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) @@ -587,7 +587,7 @@ endif () # For other CXX specific tests, use this MACRO. macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) - if ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") + if (NOT DEFINED ${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) @@ -656,7 +656,7 @@ endif () if (WINDOWS) if (NOT HDF_NO_IOEO_TEST) message (STATUS "Checking for InitOnceExecuteOnce:") - if ("${${HDF_PREFIX}_HAVE_IOEO}" MATCHES "^${${HDF_PREFIX}_HAVE_IOEO}$") + if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO}) if (LARGEFILE) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 1326420..4097ca9 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -166,7 +166,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) @@ -331,3 +331,85 @@ macro (HDFTEST_COPY_FILE src dest target) ) list (APPEND ${target}_list "${dest}") endmacro () + +macro (HDF_DIR_PATHS package_prefix) + if (APPLE) + option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + endif () + + if (NOT ${package_prefix}_INSTALL_BIN_DIR) + set (${package_prefix}_INSTALL_BIN_DIR bin) + endif () + if (NOT ${package_prefix}_INSTALL_LIB_DIR) + if (APPLE) + if (${package_prefix}_BUILD_FRAMEWORKS) + set (${package_prefix}_INSTALL_JAR_DIR ../Java) + else () + set (${package_prefix}_INSTALL_JAR_DIR lib) + endif () + set (${package_prefix}_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + else () + set (${package_prefix}_INSTALL_JAR_DIR lib) + endif () + set (${package_prefix}_INSTALL_LIB_DIR lib) + endif () + if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR) + set (${package_prefix}_INSTALL_INCLUDE_DIR include) + endif () + if (NOT ${package_prefix}_INSTALL_DATA_DIR) + if (NOT WIN32) + if (APPLE) + if (${package_prefix}_BUILD_FRAMEWORKS) + set (${package_prefix}_INSTALL_EXTRA_DIR ../SharedSupport) + else () + set (${package_prefix}_INSTALL_EXTRA_DIR share) + endif () + set (${package_prefix}_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + endif () + set (${package_prefix}_INSTALL_DATA_DIR share) + set (${package_prefix}_INSTALL_CMAKE_DIR share/cmake) + else () + set (${package_prefix}_INSTALL_DATA_DIR ".") + set (${package_prefix}_INSTALL_CMAKE_DIR cmake) + endif () + endif () + + if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") + set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) + endif () + + SET_HDF_BUILD_TYPE() + +#----------------------------------------------------------------------------- +# Setup output Directories +#----------------------------------------------------------------------------- + if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables." + ) + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries" + ) + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries." + ) + set (CMAKE_Fortran_MODULE_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." + ) + if (WIN32) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + set (CMAKE_PDB_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." + ) + else () + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + endif () + else () + # if we are externally configured, but the project uses old cmake scripts + # this may not be set and utilities like H5detect will fail + if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) + endif () + endif () +endmacro () + diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 60ac744..320fd5b 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -222,12 +222,26 @@ SIMPLE_TEST(struct stat sb; sb.st_blocks=0); #include <stdlib.h> #include <string.h> +#if defined(_MSC_VER) && defined(_DEBUG) +# include <crtdbg.h> +int DebugReport(int reportType, char* message, int* returnValue) +{ + (void)reportType; + (void)message; + (void)returnValue; + return 1; /* no further handling required */ +} +#endif + int main(void) { char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL }; char *s = malloc(128); char **currentArg = NULL; LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; + #if defined(_MSC_VER) && defined(_DEBUG) + _CrtSetReportHook(DebugReport); + #endif for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) { char formatString[64]; diff --git a/configure.ac b/configure.ac index 6bd650f..98c97cc 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where a ## ## By default, it is enabled. Users can configure with ## --disable-maintainer-mode to prevent running the autotools. -AM_MAINTAINER_MODE([disable]) +AM_MAINTAINER_MODE([enable]) ## ---------------------------------------------------------------------- ## Set prefix default (install directory) to a directory in the build area. diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index 075e1da..a0f92d3 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -10,21 +10,21 @@ endif () #----------------------------------------------------------------------------- # Traverse source subdirectory #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_F90_SOURCE_DIR}/src ${HDF5_F90_BINARY_DIR}/src) +add_subdirectory (src) #----------------------------------------------------------------------------- # Build the Fortran Examples #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_F90_SOURCE_DIR}/examples ${HDF5_F90_BINARY_DIR}/examples) + add_subdirectory (examples) endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if (BUILD_TESTING) - add_subdirectory (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test) + add_subdirectory (test) if (MPI_Fortran_FOUND) - add_subdirectory (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar) + add_subdirectory (testpar) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index b664c50..5446616 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -78,22 +78,20 @@ add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -set (CMD $<TARGET_FILE:H5match_types>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5match_types> WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS H5match_types ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - set (CMDSH $<TARGET_FILE:H5match_types>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - COMMAND ${CMDSH} + COMMAND $<TARGET_FILE:H5match_types> WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS H5match_types ) @@ -171,10 +169,9 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -set (CMD $<TARGET_FILE:H5_buildiface>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5_buildiface> WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" @@ -185,10 +182,9 @@ add_custom_target (H5gen ALL set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - set (CMDSH $<TARGET_FILE:H5_buildiface>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 - COMMAND ${CMDSH} + COMMAND $<TARGET_FILE:H5_buildiface> WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 shared file" diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 588ea9f..14fac6b 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -567,7 +567,7 @@ DONE: * dims - one-demnsional array of size 2 * dims[0] = MAXLENGTH * dims[1] = number of elements of VL type - * len - array element lenghts + * len - array element lengths * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -641,7 +641,7 @@ DONE: * dims[1] = number of elements of VL type * OUTPUTS * buf - data buffer - * len - array element lenghts + * len - array element lengths * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -882,7 +882,7 @@ h5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac * dims - one-demnsional array of size 2 * dims[0] = MAXLENGTH * dims[1] = number of elements of VL type - * len - array element lenghts + * len - array element lengths * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -956,7 +956,7 @@ DONE: * dims[1] = number of elements of VL type * OUTPUTS * buf - data buffer - * len - array element lenghts + * len - array element lengths * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -1209,7 +1209,7 @@ h5dwrite_f_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, * dims[1] = number of elements of VL type * OUTPUTS * buf - data buffer - * len - array element lenghts + * len - array element lengths * RETURNS * 0 on success, -1 on failure * AUTHOR diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 720bd49..b829b20 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -47,7 +47,7 @@ */ int_f h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, - hid_t_f *grp_id, hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id ) + hid_t_f *grp_id, hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id ) /******/ { hid_t c_gcpl_id = -1; /* Group creation property list */ @@ -69,11 +69,11 @@ h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, else { /* Create the group creation property list */ if((c_gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto DONE; + goto DONE; /* Set the local heap size hint */ if(H5Pset_local_heap_size_hint(c_gcpl_id, (size_t)*size_hint) < 0) - goto DONE; + goto DONE; /* Create the group */ c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, H5P_DEFAULT, c_gcpl_id, H5P_DEFAULT); @@ -308,9 +308,9 @@ h5gclose_c(hid_t_f *grp_id) * link_type - link type * current_name - name of the existing object for hard link, * anything for the soft link - * current_namelen - current name lenghth + * current_namelen - current name length * new_name - new name for the object - * new_namelen - new_name lenghth + * new_namelen - new_name length * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -365,7 +365,7 @@ h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, goto DONE; break; /* End of the warnings fix */ - + default: /* Unknown/unhandled link type */ goto DONE; } /* end switch */ @@ -390,12 +390,12 @@ DONE: * cur_name - name of the existing object for hard link releative * to cur_loc_id location, * anything for the soft link - * current_namelen - current name lenghth + * current_namelen - current name length * link_type - link type * new_loc_id - location identifier * new_name - new name for the object releative to the new_loc_id * location - * new_namelen - new_name lenghth + * new_namelen - new_name length * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -515,9 +515,9 @@ DONE: * INPUTS * loc_id - identifier of file or group * src_name - name of the original object - * src_namelen - original name lenghth + * src_namelen - original name length * dst_name - new name for the object - * dst_namelen - new name lenghth + * dst_namelen - new name length * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -565,10 +565,10 @@ DONE: * INPUTS * src_loc_id - identifier of file or group * src_name - name of the original object relative to src_loc_id - * src_namelen - original name lenghth + * src_namelen - original name length * dst_loc_id - new location identifier * dst_name - new name for the object relative to dst_loc_id - * dst_namelen - new name lenghth + * dst_namelen - new name length * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -617,8 +617,8 @@ DONE: * INPUTS * loc_id - identifier of file or group * name - name of the object that symbolic link points to - * namelen - the name lenghth - * size - lenghth of retrurned value + * namelen - the name length + * size - length of retrurned value * OUTPUTS * value - name to be returned * RETURNS @@ -681,9 +681,9 @@ DONE: * INPUTS * loc_id - identifier of file or group * name - name of object whose comment is to be set or reset - * namelen - the name lenghth + * namelen - the name length * comment - the new comment - * commentlen - new comment lenghth + * commentlen - new comment length * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -732,7 +732,7 @@ DONE: * INPUTS * loc_id - identifier of file or group * name - name of object whose comment is to be set or reset - * namelen - the name lenghth + * namelen - the name length * bufsize - at most bufsize characters * comment - the new comment * RETURNS @@ -948,8 +948,8 @@ done: */ int_f h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, - int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, - int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted ) + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, + int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted ) /******/ { char *c_group_name = NULL; /* Buffer to hold group name C string */ @@ -965,7 +965,7 @@ h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, * Call H5Gget_info_by_idx function. */ if(H5Gget_info_by_idx((hid_t)*loc_id,c_group_name, (H5_index_t)*index_type,(H5_iter_order_t)*order,(hsize_t)*n, - &ginfo, (hid_t)*lapl_id) < 0) + &ginfo, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); /* Unpack the structure */ @@ -1018,7 +1018,7 @@ h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, */ int_f h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, hid_t_f *lapl_id, - int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted) + int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted) /******/ { char *c_group_name = NULL; /* Buffer to hold group name C string */ diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index a114e8b..9fdd19b 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2638,7 +2638,7 @@ h5pget_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size) * INPUTS * parent - property list class identifier * name - name of the new class - * name_len - lenght of the "name" buffer + * name_len - length of the "name" buffer * OUTPUTS * class - new class identifier * RETURNS @@ -3415,8 +3415,8 @@ h5pset_family_offset_c ( hid_t_f *prp_id , hsize_t_f *offset) * mem_map - memory mapping array * memb_fapl - property list for each memory usage type * memb_name - array with members names - * len - array with the lenght of each name - * lenmax - lenght of the name a sdeclared in Fortran + * len - array with the length of each name + * lenmax - length of the name a sdeclared in Fortran * flag - flag allowing partila access when one of the files is missing * RETURNS * 0 on success, -1 on failure @@ -3537,12 +3537,12 @@ h5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag) * Call H5Pget_fapl_multi to set multi file dirver * INPUTS * prp_id - file_creation property list identifier - * lenmax - lenght of the name a sdeclared in Fortran + * lenmax - length of the name a sdeclared in Fortran * OUTPUTS * memb_map - memory mapping array * memb_fapl - property list for each memory usage type * memb_name - array with members names - * len - array with the lenght of each name + * len - array with the length of each name * flag - flag allowing partila access when one of the files is missing * RETURNS * 0 on success, -1 on failure diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index b69d4d0..178aa80 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -5313,7 +5313,7 @@ CONTAINS ! ! expression - buffer to hold transform expression ! hdferr - Error code -! Success: Actual lenght of the expression +! Success: Actual length of the expression ! If provided buffer "expression" is ! smaller, than expression will be ! truncated to fit into diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index 6d6371b..f5a9c6e 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -38,7 +38,7 @@ ! !***** -MODULE H5R +MODULE H5R USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_SIGNED_CHAR USE H5GLOBAL @@ -62,7 +62,7 @@ MODULE H5R END INTERFACE - TYPE :: hdset_reg_ref_t_f03 + TYPE :: hdset_reg_ref_t_f03 INTEGER(C_SIGNED_CHAR), DIMENSION(1:H5R_DSET_REG_REF_BUF_SIZE_F) :: ref END TYPE hdset_reg_ref_t_f03 @@ -165,16 +165,16 @@ CONTAINS ! Retrieves the type of object that an object reference points to. ! ! INPUTS -! dset_id - identifier of the dataset containing +! dset_id - identifier of the dataset containing ! reference to the objects -! ref - reference to open +! ref - reference to open ! OUTPUTS -! obj_type - object_type, possible values: +! obj_type - object_type, possible values: ! H5G_UNKNOWN_F -! H5G_GROUP_F +! H5G_GROUP_F ! H5G_DATASET_F ! H5G_TYPE_F -! hdferr - Returns 0 if successful and -1 if fails +! hdferr - Returns 0 if successful and -1 if fails ! ! AUTHOR ! Elena Pourmal @@ -227,17 +227,17 @@ CONTAINS ! Retrieves a dataspace with the specified region selected ! ! INPUTS -! dset_id - identifier of the dataset containing +! dset_id - identifier of the dataset containing ! reference to the regions -! ref - reference to open +! ref - reference to open ! OUTPUTS -! space_id - dataspace identifier -! hdferr - Returns 0 if successful and -1 if fails +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 ! -! HISTORY +! HISTORY ! Explicit Fortran interfaces were added for ! called C functions (it is needed for Windows ! port). February 28, 2001 @@ -276,16 +276,16 @@ CONTAINS ! h5rget_region_ptr_f ! ! PURPOSE -! Retrieves a dataspace with the specified region +! Retrieves a dataspace with the specified region ! selected using pointer ! ! INPUTS -! dset_id - identifier of the dataset containing +! dset_id - identifier of the dataset containing ! reference to the regions -! ref - reference to open +! ref - reference to open ! OUTPUTS -! space_id - dataspace identifier -! hdferr - Returns 0 if successful and -1 if fails +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails ! AUTHOR ! M. Scot Breitenfeld ! August 4, 2012 @@ -319,7 +319,7 @@ CONTAINS ! loc_id - location identifier ! name - name of the object at the specified location ! Outputs: -! ref - reference to the specified object +! ref - reference to the specified object ! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal @@ -363,11 +363,11 @@ CONTAINS ! Creates reference to the dataset region ! ! INPUTS -! loc_id - location identifier -! name - name of the dataset at the specified location -! space_id - dataspace identifier that describes selected region +! loc_id - location identifier +! name - name of the dataset at the specified location +! space_id - dataspace identifier that describes selected region ! OUTPUTS -! ref - reference to the dataset region +! ref - reference to the dataset region ! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal @@ -424,12 +424,12 @@ CONTAINS ! ! Inputs: ! loc_id - location identifier -! name - name of the dataset at the specified location +! name - name of the dataset at the specified location ! ref_type - type of reference: ! H5R_OBJECT ! H5T_STD_REF_DSETREG ! Outputs: -! ref - reference created by the function call. +! ref - reference created by the function call. ! hdferr - returns 0 if successful and -1 if fails. ! OPTIONAL ! space_id - dataspace identifier that describes selected region @@ -474,7 +474,7 @@ CONTAINS ! Inputs: ! dset_id - identifier of the dataset containing ! reference -! ref - reference to open +! ref - reference to open ! Outputs: ! obj_id - object_identifier ! hdferr - returns 0 if successful and -1 if fails @@ -515,8 +515,8 @@ CONTAINS ! ! Inputs: ! dset_id - identifier of the dataset containing -! reference to teh regions -! ref - reference to open +! reference to the regions +! ref - reference to open ! Outputs: ! obj_id - dataspace identifier ! hdferr - returns 0 if successful and -1 if fails @@ -585,7 +585,7 @@ CONTAINS INTEGER(HID_T), INTENT(OUT) :: ref_obj_id ! Identifier of referenced object INTEGER, INTENT(OUT) :: hdferr ! Error code -!***** +!***** hdferr = h5rdereference_ptr_c(obj_id, ref_type, ref, ref_obj_id) END SUBROUTINE h5rdereference_ptr_f @@ -600,14 +600,14 @@ CONTAINS ! ! Inputs: ! loc_id - Identifier for the file containing the reference or for any object in that file. -! ref - An object or dataset region reference. +! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. ! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! size - The size of the name buffer, returning 0 (zero) if no name is associated +! size - The size of the name buffer, returning 0 (zero) if no name is associated ! with the identifier. ! ! AUTHOR @@ -648,7 +648,7 @@ CONTAINS ! ! Inputs: ! loc_id - Identifier for the file containing the reference or for any object in that file. -! ref - An object or dataset region reference. +! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. @@ -747,12 +747,12 @@ CONTAINS ! ref - Reference to query. ! ! Outputs: - ! obj_type - Type of referenced object. + ! obj_type - Type of referenced object. ! H5G_UNKNOWN_F ! H5G_GROUP_F ! H5G_DATASET_F ! H5G_TYPE_F - ! + ! ! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 2990bcc..86f7a12 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -74,10 +74,9 @@ if (BUILD_SHARED_LIBS) ) endif () -set (CMD $<TARGET_FILE:H5_test_buildiface>) add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5_test_buildiface> WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 file" @@ -88,10 +87,9 @@ add_custom_target (H5testgen ALL set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - set (CMDSH $<TARGET_FILE:H5_test_buildiface>) add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 - COMMAND ${CMDSH} + COMMAND $<TARGET_FILE:H5_test_buildiface> WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index a47e023..d80b4f9 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -12,21 +12,21 @@ add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src ) -add_subdirectory (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src) +add_subdirectory (src) #-- Build the High level Tools if (HDF5_BUILD_TOOLS) - add_subdirectory (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools) + add_subdirectory (tools) endif () #-- Add High Level Examples if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples) + add_subdirectory (examples) endif () #-- Build the Unit testing if requested if (NOT HDF5_EXTERNALLY_CONFIGURED) if (BUILD_TESTING) - add_subdirectory (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test) + add_subdirectory (test) endif () endif () diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt index 91bfa14..9a1d059 100644 --- a/hl/c++/CMakeLists.txt +++ b/hl/c++/CMakeLists.txt @@ -4,13 +4,13 @@ PROJECT (HDF5_HL_CPP) #----------------------------------------------------------------------------- # Main HL lib is in /src #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/src) +add_subdirectory (src) # -------------------------------------------------------------------- # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/examples ${HDF5_HL_CPP_BINARY_DIR}/examples) + add_subdirectory (examples) endif () # -------------------------------------------------------------------- @@ -18,5 +18,5 @@ endif () # -------------------------------------------------------------------- if (BUILD_TESTING) - add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test) + add_subdirectory (test) endif () diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index c651ce9..00d7517 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -4,18 +4,18 @@ PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- # List Source files #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src) +add_subdirectory (src) #----------------------------------------------------------------------------- # Build the HL Fortran Examples #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples) + add_subdirectory (examples) endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if (BUILD_TESTING) - add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test) + add_subdirectory (test) endif () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index b1a639a..5ad441c 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -109,10 +109,9 @@ set (HDF5_HL_F90_F_BASE_SOURCES ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90 ) -set (CMD $<TARGET_FILE:H5HL_buildiface>) add_custom_command ( OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5HL_buildiface> WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" @@ -126,10 +125,9 @@ set_source_files_properties ( PROPERTIES GENERATED TRUE ) if (BUILD_SHARED_LIBS) - set (CMDSH $<TARGET_FILE:H5HL_buildiface>) add_custom_command ( OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5HL_buildiface> WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 35b08a1..031db2c 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -303,7 +303,7 @@ h5tbmake_table_c(size_t_f *namelen1, hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *char_len_field_names, /* field_names lengths */ size_t_f *max_char_size_field_names, /* char len of fields */ _fcd buf); /* field_names */ @@ -334,7 +334,7 @@ h5tbmake_table_ptr_c(size_t_f *namelen1, hsize_t_f *chunk_size, void *fill_data, int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *char_len_field_names, /* field_names lengths */ size_t_f *max_char_size_field_names, /* char len of fields */ char *field_names, /* field_names */ void *data); diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index c0d053f..331f0bc 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -38,7 +38,7 @@ int_f h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *char_len_field_names, /* field_names lengths */ size_t_f *max_char_size_field_names, /* char len of fields */ char *field_names) /* field_names */ { @@ -143,7 +143,7 @@ h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f * _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, void *fill_data, int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *char_len_field_names, /* field_names lengths */ size_t_f *max_char_size_field_names, /* char len of fields */ char *field_names, void *data) /* field_names */ @@ -638,7 +638,7 @@ done: int_f h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, - size_t_f *namelen2, /* field_names lenghts */ + size_t_f *namelen2, /* field_names lengths */ size_t_f *lenmax, /* character len max */ _fcd field_names, /* field_names */ size_t_f *maxlen_out) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 91f1505..49dc72f 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -3080,7 +3080,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- - * get the label using a static buffer smaller than the string lenght + * get the label using a static buffer smaller than the string length *------------------------------------------------------------------------- */ @@ -3118,7 +3118,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - /* get the lenght of the scale name (pass NULL in name) */ + /* get the length of the scale name (pass NULL in name) */ if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) < 0) goto out; @@ -3151,7 +3151,7 @@ static int test_simple(void) goto out; /*------------------------------------------------------------------------- - * get the scale name using a static buffer smaller than the string lenght + * get the scale name using a static buffer smaller than the string length *------------------------------------------------------------------------- */ @@ -4925,7 +4925,7 @@ static int test_errors2(void) hsize_t dimd[2] = {3,3}; /* size of data dataset */ hsize_t dims[1] = {3}; /* size of scale dataset */ char lbuf[255]; /* label buffer */ - ssize_t label_len; /* label lenght */ + ssize_t label_len; /* label length */ int scale_idx; /* scale index */ int nscales; /* number of scales in DIM */ int count; /* visitor data */ diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 9536517..43229e8 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_TOOLS C CXX) -add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5 ${HDF5_HL_TOOLS_BINARY_DIR}/gif2h5) +add_subdirectory (gif2h5) -add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/h5watch ${HDF5_HL_TOOLS_BINARY_DIR}/h5watch) +add_subdirectory (h5watch) diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index 7514281..3f8f5ae 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -44,7 +44,7 @@ GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests -TRY_MAX=20 # Try running the test again +TRY_MAX=30 # Try running the test again # # These 3 defines should be the same as the defines in ./extend_dset.c WRITER_MESSAGE=writer_message # The message file created by the "extend" process diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 68860be..9a5692f 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -36,20 +36,20 @@ set (CMAKE_JAVA_INCLUDE_PATH "") #----------------------------------------------------------------------------- # Traverse source subdirectory #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src) +add_subdirectory (src) #----------------------------------------------------------------------------- # Build the Java Examples #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) - add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples) + add_subdirectory (examples) endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if (BUILD_TESTING) - add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test) + add_subdirectory (test) endif () #----------------------------------------------------------------------------- diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt index a1a7483..3073918 100644 --- a/java/examples/CMakeLists.txt +++ b/java/examples/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES) -add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets) -add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datatypes datatypes) -add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/groups groups) -add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/intro intro) +add_subdirectory (datasets) +add_subdirectory (datatypes) +add_subdirectory (groups) +add_subdirectory (intro) diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt index 3f93f39..9bdab4b 100644 --- a/java/src/CMakeLists.txt +++ b/java/src/CMakeLists.txt @@ -4,5 +4,5 @@ PROJECT ( HDF5_JAVA_SRC C Java ) #----------------------------------------------------------------------------- # Traverse source subdirectory #----------------------------------------------------------------------------- -add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/jni ${HDF5_JAVA_SRC_BINARY_DIR}/jni) -add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/hdf ${HDF5_JAVA_SRC_BINARY_DIR}/hdf) +add_subdirectory (jni) +add_subdirectory (hdf) diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt index 84bda53..649f7d0 100644 --- a/java/src/hdf/CMakeLists.txt +++ b/java/src/hdf/CMakeLists.txt @@ -1,4 +1,4 @@ cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_JAVA_HDF) -add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib) +add_subdirectory (hdf5lib) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index f20ca43..8c72685 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -664,10 +664,6 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_CONFIGURATION_TYPE - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATIC_ONLY - Build/use static libraries -# FORTRAN_LIBRARIES - Build/use fortran libraries -# JAVA_LIBRARIES - Build/use java libraries -# NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## set (CTEST_SOURCE_VERSION "1.11.0") @@ -679,10 +675,6 @@ set (CTEST_SOURCE_VERSEXT "") #INSTALLDIR - HDF5-1.10.0 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 -#STATIC_ONLY - Default is YES -#FORTRAN_LIBRARIES - Default is NO -#JAVA_LIBRARIES - Default is NO -#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 74b73a4..c13b247 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -236,7 +236,17 @@ Bug Fixes since HDF5-1.10.1 release ------------- - CMake - Correct usuage of CMAKE_BUILD_TYPE variable. + Update CMake commands configuration. + + A number of improvements were made to the CMake commands. Most + changes simplify usage or eliminate unused constructs. Also, + some changes support better cross-platform support. + + (ADB - 2018/02/01, HDFFV-10398) + + - CMake + + Correct usage of CMAKE_BUILD_TYPE variable. The use of the CMAKE_BUILD_TYPE is incorrect for multi-config generators (Visual Studio and XCode) and is optional for single diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 5993a0f..fc62b75 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -219,129 +219,113 @@ NOTE: this file is available at the HDF web site: http://www.hdfgroup.org/HDF5/release/cmakebuild.html HDF5_Examples.cmake + HDF5_Examples_options.cmake Also available at the HDF web site is a CMake application framework template. You can quickly add files to the framework and execute the script to compile your application with an installed HDF5 binary. ======================================================================== -ctest +ctest use of HDF5_Examples.cmake and HDF5_Examples_options.cmake ======================================================================== cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: -# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -V -O test.log +# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log ############################################################################################################### -set (CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +if("@CMAKE_GENERATOR_TOOLSET@") + set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +endif() +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) # handle input parameters to script. #INSTALLDIR - HDF5 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATIC_ONLY - Default is YES -#FORTRAN_LIBRARIES - Default is NO -#JAVA_LIBRARIES - Default is NO -##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) -if (DEFINED CTEST_SCRIPT_ARG) - # transform ctest script arguments of the form - # script.ctest,var1=value1,var2=value2 - # to variables with the respective names set to the respective values - string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach (current_var ${script_args}) - if ("${current_var}" MATCHES "^([^=]+)=(.+)$") - set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif () - endforeach () -endif () -if (NOT DEFINED INSTALLDIR) - set (INSTALLDIR "@CMAKE_INSTALL_PREFIX@") -endif () -if (NOT DEFINED CTEST_CONFIGURATION_TYPE) - set (CTEST_CONFIGURATION_TYPE "Release") -endif () -if (NOT DEFINED CTEST_SOURCE_NAME) - set (CTEST_SOURCE_NAME "HDF5Examples") -endif () -if (NOT DEFINED STATIC_ONLY) - set (STATICONLYLIBRARIES "YES") -else () - set (STATICONLYLIBRARIES "NO") -endif () -if (NOT DEFINED FORTRAN_LIBRARIES) - set (FORTRANLIBRARIES "NO") -else () - set (FORTRANLIBRARIES "YES") -endif () -if (NOT DEFINED JAVA_LIBRARIES) - set (JAVALIBRARIES "NO") -else () - set (JAVALIBRARIES "YES") -endif () +#CTEST_SOURCE_NAME - name of source folder; HDF5Examples +if(DEFINED CTEST_SCRIPT_ARG) + # transform ctest script arguments of the form + # script.ctest,var1=value1,var2=value2 + # to variables with the respective names set to the respective values + string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach(current_var ${script_args}) + if("${current_var}" MATCHES "^([^=]+)=(.+)$") + set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif() + endforeach() +endif() + +################################################################### +### Following Line is one of [Release, RelWithDebInfo, Debug] ##### +set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") +if(NOT DEFINED CTEST_CONFIGURATION_TYPE) + set(CTEST_CONFIGURATION_TYPE "Release") +endif() +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}") +################################################################## + +if(NOT DEFINED INSTALLDIR) + set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") +endif() + +if(NOT DEFINED CTEST_SOURCE_NAME) + set(CTEST_SOURCE_NAME "HDF5Examples") +endif() + +if(NOT DEFINED HDF_LOCAL) + set(CDASH_LOCAL "NO") +else() + set(CDASH_LOCAL "YES") +endif() +if(NOT DEFINED CTEST_SITE) + set(CTEST_SITE "local") +endif() +if(NOT DEFINED CTEST_BUILD_NAME) + set(CTEST_BUILD_NAME "examples") +endif() +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") #TAR_SOURCE - name of tarfile -#if (NOT DEFINED TAR_SOURCE) -# set (CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") -#endif () +#if(NOT DEFINED TAR_SOURCE) +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.5-Source") +#endif() ############################################################################################################### -# Adjust the following SET Commands as needed -############################################################################################################### -if (WIN32) - if (${STATICONLYLIBRARIES}) - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif () - set (ENV{HDF5_DIR} "${INSTALLDIR}/cmake") - set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) - set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else (WIN32) - if (${STATICONLYLIBRARIES}) - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif () - set (ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") - set (ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") - set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) - set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif(WIN32) -if (${FORTRANLIBRARIES}) - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -else () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") -endif () -if (${JAVALIBRARIES}) - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") -else () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") -endif () -set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") +if(WIN32) + set(SITE_OS_NAME "Windows") + set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else() + set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") + set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif() +if(${CDASH_LOCAL}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") +endif() +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org # ############################################################################################################### -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if (APPLE) - # Compiler choice - execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set (ENV{CC} "${XCODE_CC}") - set (ENV{CXX} "${XCODE_CXX}") - if (NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif () - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif () +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format for file: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +############################################################################################# +if(WIN32) + include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake) +else() + include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake) +endif() #----------------------------------------------------------------------------- set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") @@ -415,6 +399,57 @@ endif () #----------------------------------------------------------------------------- ############################################################################################################## +############################################################################################################## +#### HDF5_Examples_options.cmake ### +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +############################################################################################################## +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +#### DEFAULT: ### +#### BUILD_SHARED_LIBS:BOOL=OFF ### +#### HDF_BUILD_C:BOOL=ON ### +#### HDF_BUILD_CXX:BOOL=OFF ### +#### HDF_BUILD_FORTRAN:BOOL=OFF ### +#### HDF_BUILD_JAVA:BOOL=OFF ### +#### BUILD_TESTING:BOOL=OFF ### +#### HDF_ENABLE_PARALLEL:BOOL=OFF ### +#### HDF_ENABLE_THREADSAFE:BOOL=OFF ### +############################################################################################# + +### uncomment/comment and change the following lines for other configuration options +### build with shared libraries +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON") + +############################################################################################# +#### languages #### +### disable C builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_C:BOOL=OFF") + +### enable C++ builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_CXX:BOOL=ON") + +### enable Fortran builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") + +### enable JAVA builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") + +############################################################################################# +### enable parallel program builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_ENABLE_PARALLEL:BOOL=ON") + +############################################################################################# +### enable threadsafe program builds +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_ENABLE_THREADSAFE:BOOL=ON") + +############################################################################################# +### enable test program builds, requires reference files in testfiles subdirectory +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=ON") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCOMPARE_TESTING:BOOL=ON") + +############################################################################################# + ======================================================================== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0552244..aaedfda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -852,11 +852,13 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif () +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set_property(TARGET H5detect PROPERTY LINK_FLAGS "-O0") +endif () -set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5detect> ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c DEPENDS H5detect ) @@ -866,11 +868,13 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif () +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set_property(TARGET H5make_libsettings PROPERTY LINK_FLAGS "-O0") +endif () -set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5make_libsettings> ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} @@ -905,18 +909,16 @@ set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5detect> ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared ) - set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5make_libsettings> ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index b86d785..58bcf8b 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -13,16 +13,16 @@ #include "H5Zmodule.h" /* This source code file is part of the H5Z module */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5Zpkg.h" /* Data filters */ /* Struct of parameters needed for compressing/decompressing one atomic datatype */ typedef struct { @@ -78,13 +78,13 @@ static void H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, uns /* This message derives from H5Z */ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_SCALEOFFSET, /* Filter id number */ + H5Z_FILTER_SCALEOFFSET, /* Filter id number */ 1, /* Assume encoder present: check before registering */ 1, /* decoder_present flag (set to true) */ - "scaleoffset", /* Filter name for debugging */ - H5Z_can_apply_scaleoffset, /* The "can apply" callback */ + "scaleoffset", /* Filter name for debugging */ + H5Z_can_apply_scaleoffset, /* The "can apply" callback */ H5Z_set_local_scaleoffset, /* The "set local" callback */ - H5Z_filter_scaleoffset, /* The actual filter function */ + H5Z_filter_scaleoffset, /* The actual filter function */ }}; /* Local macros */ @@ -665,15 +665,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ } - + /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_scaleoffset + * Function: H5Z_can_apply_scaleoffset * - * Purpose: Check the parameters for scaleoffset compression for + * Purpose: Check the parameters for scaleoffset compression for * validity and whether they fit a particular dataset. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Xiaowen Wu * Friday, February 4, 2005 @@ -685,7 +685,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ static htri_t H5Z_can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { - const H5T_t *type; /* Datatype */ + const H5T_t *type; /* Datatype */ H5T_class_t dtype_class; /* Datatype's class */ H5T_order_t dtype_order; /* Datatype's endianness order */ htri_t ret_value = TRUE; /* Return value */ @@ -694,20 +694,20 @@ H5Z_can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get datatype's class, for checking the "datatype class" */ if((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") /* Get datatype's size, for checking the "datatype size" */ if(H5T_get_size(type) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") if(dtype_class == H5T_INTEGER || dtype_class == H5T_FLOAT) { /* Get datatype's endianness order */ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order") /* Range check datatype's endianness order */ if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE) @@ -719,17 +719,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_can_apply_scaleoffset() */ - + /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_get_type + * Function: H5Z_scaleoffset_get_type * - * Purpose: Get the specific integer type based on datatype size and sign + * Purpose: Get the specific integer type based on datatype size and sign * or floating-point type based on size * - * Return: Success: id number of integer type - * Failure: 0 + * Return: Success: id number of integer type + * Failure: 0 * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Wednesday, April 13, 2005 * * Modifications: @@ -784,14 +784,14 @@ done: FUNC_LEAVE_NOAPI(ret_value) } - + /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_set_parms_fillval + * Function: H5Z_scaleoffset_set_parms_fillval * - * Purpose: Get the fill value of the dataset and store in cd_values[] + * Purpose: Get the fill value of the dataset and store in cd_values[] * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Xiaowen Wu * Monday, March 7, 2005 @@ -836,17 +836,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_scaleoffset_set_parms_fillval() */ - + /*------------------------------------------------------------------------- - * Function: H5Z_set_local_scaleoffset + * Function: H5Z_set_local_scaleoffset * - * Purpose: Set the "local" dataset parameters for scaleoffset + * Purpose: Set the "local" dataset parameters for scaleoffset * compression. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Friday, February 4, 2005 * * Modifications: @@ -857,8 +857,8 @@ static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) { H5P_genplist_t *dcpl_plist; /* Property list pointer */ - H5T_t *type; /* Datatype */ - const H5S_t *ds; /* Dataspace */ + H5T_t *type; /* Datatype */ + const H5S_t *ds; /* Dataspace */ unsigned flags; /* Filter flags */ size_t cd_nelmts = H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */ unsigned cd_values[H5Z_SCALEOFFSET_TOTAL_NPARMS]; /* Filter parameters */ @@ -879,14 +879,14 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Initialize the parameters to a known state */ HDmemset(cd_values, 0, sizeof(cd_values)); /* Get the filter's current parameters */ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters") /* Get dataspace */ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -930,7 +930,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -1008,23 +1008,23 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Modify the filter's parameters for this dataset */ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_set_local_scaleoffset() */ - + /*------------------------------------------------------------------------- - * Function: H5Z_filter_scaleoffset + * Function: H5Z_filter_scaleoffset * - * Purpose: Implement an I/O filter for storing packed integer + * Purpose: Implement an I/O filter for storing packed integer * data using scale and offset method. * - * Return: Success: Size of buffer filtered - * Failure: 0 + * Return: Success: Size of buffer filtered + * Failure: 0 * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Monday, February 7, 2005 * * Modifications: @@ -1051,13 +1051,13 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value unsigned char *outbuf = NULL; /* pointer to new output buffer */ unsigned buf_offset = 21; /* buffer offset because of parameters stored in file */ unsigned i; /* index */ - parms_atomic p; /* paramters needed for compress/decompress functions */ + parms_atomic p; /* parameters needed for compress/decompress functions */ FUNC_ENTER_NOAPI_NOINIT /* check arguments */ if(cd_nelmts != H5Z_SCALEOFFSET_TOTAL_NPARMS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of paramters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of parameters") /* Check if memory byte order matches dataset datatype byte order */ switch(H5T_native_order_g) { @@ -1107,7 +1107,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* if scale_factor is less than 0 for integer, library will reset it to 0 * in this case, library will calculate the minimum-bits */ - if(scale_factor < 0) scale_factor = 0; + if(scale_factor < 0) scale_factor = 0; } /* fixed-minimum-bits method is not implemented and is forbidden */ @@ -1128,7 +1128,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value minbits = (uint32_t)scale_factor; } - /* prepare paramters to pass to compress/decompress functions */ + /* prepare parameters to pass to compress/decompress functions */ p.size = cd_values[H5Z_SCALEOFFSET_PARM_SIZE]; p.mem_order = H5T_native_order_g; @@ -1310,7 +1310,7 @@ done: * atomic datatype is treated on byte basis */ - + /* change byte order of input buffer either from little-endian to big-endian * or from big-endian to little-endian 2/21/2005 */ diff --git a/src/H5detect.c b/src/H5detect.c index 75a1dba..ff163cf 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -27,23 +27,23 @@ static const char *FileHeader = "\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* * - * Created: H5detect.c - * 10 Aug 1997 - * Robb Matzke + * Created: H5detect.c + * 10 Aug 1997 + * Robb Matzke * - * Purpose: This code was borrowed heavily from the `detect.c' - * program in the AIO distribution from Lawrence - * Livermore National Laboratory. + * Purpose: This code was borrowed heavily from the `detect.c' + * program in the AIO distribution from Lawrence + * Livermore National Laboratory. * - * Detects machine byte order and floating point - * format and generates a C source file (H5Tinit.c) - * to describe those paramters. + * Detects machine byte order and floating point + * format and generates a C source file (H5Tinit.c) + * to describe those parameters. * * Assumptions: We have an ANSI compiler. We're on a Unix like - * system or configure has detected those Unix - * features which aren't available. We're not - * running on a Vax or other machine with mixed - * endianess. + * system or configure has detected those Unix + * features which aren't available. We're not + * running on a Vax or other machine with mixed + * endianess. * * Modifications: * @@ -54,9 +54,19 @@ static const char *FileHeader = "\n\ #include "H5Tpublic.h" #include "H5Rpublic.h" +#if defined(__has_attribute) +#if __has_attribute(no_sanitize) +#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) +#else +#define HDF_NO_UBSAN +#endif +#else +#define HDF_NO_UBSAN +#endif + #define MAXDETECT 64 -/* The ALIGNMENT test code may generate the SIGBUS, SIGSEGV, or SIGILL signals. +/* The ALIGNMENT test code may generate the SIGBUS, SIGSEGV, or SIGILL signals. * We use setjmp/longjmp in the signal handlers for recovery. But setjmp/longjmp * do not necessary restore the signal blocking status while sigsetjmp/siglongjmp * do. If sigsetjmp/siglongjmp are not supported, need to use sigprocmask to @@ -65,20 +75,20 @@ static const char *FileHeader = "\n\ /* Define H5SETJMP/H5LONGJMP depending on if sigsetjmp/siglongjmp are */ /* supported. */ #if defined(H5_HAVE_SIGSETJMP) && defined(H5_HAVE_SIGLONGJMP) -/* Always save blocked signals to be restore by siglongjmp. */ -#define H5JMP_BUF sigjmp_buf -#define H5SETJMP(buf) HDsigsetjmp(buf, 1) -#define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) -#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ +/* Always save blocked signals to be restored by siglongjmp. */ +#define H5JMP_BUF sigjmp_buf +#define H5SETJMP(buf) HDsigsetjmp(buf, 1) +#define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) +#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ #elif defined(H5_HAVE_LONGJMP) -#define H5JMP_BUF jmp_buf -#define H5SETJMP(buf) HDsetjmp(buf) -#define H5LONGJMP(buf, val) HDlongjmp(buf, val) +#define H5JMP_BUF jmp_buf +#define H5SETJMP(buf) HDsetjmp(buf) +#define H5LONGJMP(buf, val) HDlongjmp(buf, val) #endif /* ALIGNMENT and signal-handling status codes */ -#define STA_NoALIGNMENT 0x0001 /* No ALIGNMENT Test */ -#define STA_NoHandlerVerify 0x0002 /* No signal handler Tests */ +#define STA_NoALIGNMENT 0x0001 /* No ALIGNMENT Test */ +#define STA_NoHandlerVerify 0x0002 /* No signal handler Tests */ /* @@ -133,11 +143,11 @@ static void detect_C99_integers32(void); static void detect_C99_integers64(void); static void detect_alignments(void); static unsigned int align_g[] = {1, 2, 4, 8, 16}; -static int align_status_g = 0; /* ALIGNMENT Signal Status */ -static int sigbus_handler_called_g = 0; /* how many times called */ +static int align_status_g = 0; /* ALIGNMENT Signal Status */ +static int sigbus_handler_called_g = 0; /* how many times called */ static int sigsegv_handler_called_g = 0;/* how many times called */ -static int sigill_handler_called_g = 0; /* how many times called */ -static int signal_handler_tested_g = 0; /* how many times tested */ +static int sigill_handler_called_g = 0; /* how many times called */ +static int signal_handler_tested_g = 0; /* how many times tested */ #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) static int verify_signal_handlers(int signum, void (*handler)(int)); #endif @@ -145,16 +155,16 @@ static int verify_signal_handlers(int signum, void (*handler)(int)); static H5JMP_BUF jbuf_g; #endif - + /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. + * Purpose: Determine the precision and offset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * Thursday, June 18, 1998 + * Programmer: Robb Matzke + * Thursday, June 18, 1998 * * Modifications: * @@ -167,7 +177,7 @@ precision (detected_t *d) if (0 == d->msize) { /* - * An integer. The permutation can have negative values at the + * An integer. The permutation can have negative values at the * beginning or end which represent padding of bytes. We must adjust * the precision and offset accordingly. */ @@ -201,36 +211,36 @@ precision (detected_t *d) } } - + /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * * DETECT_I is used for types that are larger than one byte, * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 12 1996 * * Modifications: * - * Robb Matzke, 4 Nov 1996 - * The INFO.perm now contains `-1' for bytes that aren't used and - * are always zero. This happens on the Cray for `short' where - * sizeof(short) is 8, but only the low-order 4 bytes are ever used. + * Robb Matzke, 4 Nov 1996 + * The INFO.perm now contains `-1' for bytes that aren't used and + * are always zero. This happens on the Cray for `short' where + * sizeof(short) is 8, but only the low-order 4 bytes are ever used. * - * Robb Matzke, 4 Nov 1996 - * Added a `padding' field to indicate how many zero bytes appear to - * the left (N) or right (-N) of the value. + * Robb Matzke, 4 Nov 1996 + * Added a `padding' field to indicate how many zero bytes appear to + * the left (N) or right (-N) of the value. * - * Robb Matzke, 5 Nov 1996 - * Removed HFILE and CFILE arguments. + * Robb Matzke, 5 Nov 1996 + * Removed HFILE and CFILE arguments. * * Neil Fortner, 6 Sep 2013 * Split macro into DETECT_I and DETECT_BYTE macros, extracted @@ -273,27 +283,27 @@ precision (detected_t *d) DETECT_I_BYTE_CORE(TYPE,VAR,INFO,int) \ } -#define DETECT_I(TYPE,VAR,INFO) { \ +#define DETECT_I(TYPE,VAR,INFO) { \ HDcompile_assert(sizeof(TYPE) > 1); \ \ DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_F + * Function: DETECT_F * - * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 12 1996 * *------------------------------------------------------------------------- */ @@ -383,31 +393,31 @@ precision (detected_t *d) } \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * - * Purpose: This macro takes only miscellaneous structures or pointer + * Purpose: This macro takes only miscellaneous structures or pointer * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * constructs the names and decides the alignment in structure. * - * Return: void + * Return: void * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Dec 9, 2002 + * Programmer: Raymond Lu + * slu@ncsa.uiuc.edu + * Dec 9, 2002 * * Modifications: * *------------------------------------------------------------------------- */ -#define DETECT_M(TYPE,VAR,INFO) { \ - INFO.name = #VAR; \ - COMP_ALIGNMENT(TYPE, INFO.comp_align); \ +#define DETECT_M(TYPE,VAR,INFO) { \ + INFO.name = #VAR; \ + COMP_ALIGNMENT(TYPE, INFO.comp_align); \ } /* Detect alignment for C structure */ -#define COMP_ALIGNMENT(TYPE,COMP_ALIGN) { \ +#define COMP_ALIGNMENT(TYPE,COMP_ALIGN) { \ struct { \ char c; \ TYPE x; \ @@ -417,67 +427,67 @@ precision (detected_t *d) } #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) -#define ALIGNMENT(TYPE,INFO) { \ - char *volatile _buf = NULL; \ - TYPE _val = 1, _val2; \ - volatile size_t _ano = 0; \ - void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \ - void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler);\ - void (*_handler3)(int) = HDsignal(SIGILL, sigill_handler); \ - \ - _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ - if(H5SETJMP(jbuf_g)) _ano++; \ - if(_ano < NELMTS(align_g)) { \ - *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ - /* Cray Check: This section helps detect alignment on Cray's */ \ +#define ALIGNMENT(TYPE,INFO) { \ + char *volatile _buf = NULL; \ + TYPE _val = 1, _val2; \ + volatile size_t _ano = 0; \ + void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \ + void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler);\ + void (*_handler3)(int) = HDsignal(SIGILL, sigill_handler); \ + \ + _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ + if(H5SETJMP(jbuf_g)) _ano++; \ + if(_ano < NELMTS(align_g)) { \ + *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ + /* Cray Check: This section helps detect alignment on Cray's */ \ /* vector machines (like the SV1) which mask off */ \ - /* pointer values when pointing to non-word aligned */ \ - /* locations with pointers that are supposed to be */ \ - /* word aligned. -QAK */ \ - HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ + /* pointer values when pointing to non-word aligned */ \ + /* locations with pointers that are supposed to be */ \ + /* word aligned. -QAK */ \ + HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ /*How to handle VAX types?*/ \ - if(INFO.perm[0]) /* Big-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ - else /* Little-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); \ - H5_GCC_DIAG_OFF(float-equal) \ - if(_val!=_val2) \ - H5LONGJMP(jbuf_g, 1); \ - H5_GCC_DIAG_ON(float-equal) \ - /* End Cray Check */ \ - (INFO.align)=align_g[_ano]; \ - } else { \ - (INFO.align)=0; \ - fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ - } \ - HDfree(_buf); \ - HDsignal(SIGBUS, _handler); /*restore original handler*/ \ - HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ - HDsignal(SIGILL, _handler3); /*restore original handler*/ \ + if(INFO.perm[0]) /* Big-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ + else /* Little-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); \ + H5_GCC_DIAG_OFF(float-equal) \ + if(_val!=_val2) \ + H5LONGJMP(jbuf_g, 1); \ + H5_GCC_DIAG_ON(float-equal) \ + /* End Cray Check */ \ + (INFO.align)=align_g[_ano]; \ + } else { \ + (INFO.align)=0; \ + fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ + } \ + HDfree(_buf); \ + HDsignal(SIGBUS, _handler); /*restore original handler*/ \ + HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ + HDsignal(SIGILL, _handler3); /*restore original handler*/ \ } #else -#define ALIGNMENT(TYPE,INFO) { \ - align_status_g |= STA_NoALIGNMENT; \ - (INFO.align)=0; \ +#define ALIGNMENT(TYPE,INFO) { \ + align_status_g |= STA_NoALIGNMENT; \ + (INFO.align)=0; \ } #endif - + #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 + * Programmer: Robb Matzke + * Thursday, March 18, 1999 * * Modifications: * @@ -502,20 +512,20 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) } #endif - + #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 + * Programmer: Robb Matzke + * Thursday, March 18, 1999 * * Modifications: * @@ -540,20 +550,20 @@ sigbus_handler(int H5_ATTR_UNUSED signo) } #endif - + #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. * - * Programmer: Raymond Lu - * 28 October 2013 + * Programmer: Raymond Lu + * 28 October 2013 * *------------------------------------------------------------------------- */ @@ -576,17 +586,17 @@ sigill_handler(int H5_ATTR_UNUSED signo) } #endif - + /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. + * Purpose: Prints information about the detected data types. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 14, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 14, 1996 * * Modifications: * @@ -596,7 +606,7 @@ static void print_results(int nd, detected_t *d, int na, malign_t *misc_align) { int byte_order=0; /*byte order of data types*/ - int i, j; + int i, j; /* Include files */ printf("\ @@ -610,11 +620,11 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /***********/\n\ /* Headers */\n\ /***********/\n\ -#include \"H5private.h\" /* Generic Functions */\n\ -#include \"H5Eprivate.h\" /* Error handling */\n\ -#include \"H5FLprivate.h\" /* Free Lists */\n\ -#include \"H5Iprivate.h\" /* IDs */\n\ -#include \"H5Tpkg.h\" /* Datatypes */\n\ +#include \"H5private.h\" /* Generic Functions */\n\ +#include \"H5Eprivate.h\" /* Error handling */\n\ +#include \"H5FLprivate.h\" /* Free Lists */\n\ +#include \"H5Iprivate.h\" /* IDs */\n\ +#include \"H5Tpkg.h\" /* Datatypes */\n\ \n\ \n\ /****************/\n\ @@ -663,15 +673,15 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) printf("\n\ \n\ /*-------------------------------------------------------------------------\n\ - * Function: H5T__init_native\n\ + * Function: H5T__init_native\n\ *\n\ - * Purpose: Initialize pre-defined native datatypes from code generated\n\ + * Purpose: Initialize pre-defined native datatypes from code generated\n\ * during the library configuration by H5detect.\n\ *\n\ - * Return: Success: non-negative\n\ - * Failure: negative\n\ + * Return: Success: non-negative\n\ + * Failure: negative\n\ *\n\ - * Programmer: Robb Matzke\n\ + * Programmer: Robb Matzke\n\ * Wednesday, December 16, 1998\n\ *\n\ *-------------------------------------------------------------------------\n\ @@ -679,8 +689,8 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) herr_t\n\ H5T__init_native(void)\n\ {\n\ - H5T_t *dt = NULL;\n\ - herr_t ret_value = SUCCEED;\n\ + H5T_t *dt = NULL;\n\ + herr_t ret_value = SUCCEED;\n\ \n\ FUNC_ENTER_PACKAGE\n"); @@ -702,20 +712,20 @@ H5T__init_native(void)\n\ } } - /* Print a comment to describe this section of definitions. */ - printf("\n /*\n"); - iprint(d+i); - printf(" */\n"); + /* Print a comment to describe this section of definitions. */ + printf("\n /*\n"); + iprint(d+i); + printf(" */\n"); - /* The part common to fixed and floating types */ - printf("\ + /* The part common to fixed and floating types */ + printf("\ if(NULL == (dt = H5T__alloc()))\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\ dt->shared->state = H5T_STATE_IMMUTABLE;\n\ dt->shared->type = H5T_%s;\n\ dt->shared->size = %d;\n", - d[i].msize ? "FLOAT" : "INTEGER",/*class */ - d[i].size); /*size */ + d[i].msize ? "FLOAT" : "INTEGER",/*class */ + d[i].size); /*size */ if(byte_order==-1) printf("\ @@ -732,18 +742,18 @@ H5T__init_native(void)\n\ dt->shared->u.atomic.prec = %d;\n\ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\ dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;\n", - d[i].offset, /*offset */ - d[i].precision); /*precision */ + d[i].offset, /*offset */ + d[i].precision); /*precision */ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ - if (0 == d[i].msize) { - /* The part unique to fixed point types */ - printf("\ + if (0 == d[i].msize) { + /* The part unique to fixed point types */ + printf("\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", - d[i].sign ? "2" : "NONE"); - } else { - /* The part unique to floating point types */ - printf("\ + d[i].sign ? "2" : "NONE"); + } else { + /* The part unique to floating point types */ + printf("\ dt->shared->u.atomic.u.f.sign = %d;\n\ dt->shared->u.atomic.u.f.epos = %d;\n\ dt->shared->u.atomic.u.f.esize = %d;\n\ @@ -752,22 +762,22 @@ H5T__init_native(void)\n\ dt->shared->u.atomic.u.f.msize = %d;\n\ dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\ dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n", - d[i].sign, /*sign location */ - d[i].epos, /*exponent loc */ - d[i].esize, /*exponent size */ - (unsigned long)(d[i].bias), /*exponent bias */ - d[i].mpos, /*mantissa loc */ - d[i].msize, /*mantissa size */ - d[i].imp ? "IMPLIED" : "NONE"); /*normalization */ - } - - /* Atomize the type */ - printf("\ + d[i].sign, /*sign location */ + d[i].epos, /*exponent loc */ + d[i].esize, /*exponent size */ + (unsigned long)(d[i].bias), /*exponent bias */ + d[i].mpos, /*mantissa loc */ + d[i].msize, /*mantissa size */ + d[i].imp ? "IMPLIED" : "NONE"); /*normalization */ + } + + /* Atomize the type */ + printf("\ if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n", - d[i].varname); - printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", - d[i].varname, (unsigned long)(d[i].align)); + d[i].varname); + printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", + d[i].varname, (unsigned long)(d[i].align)); /* Variables for alignment of compound datatype */ if(!HDstrcmp(d[i].varname, "SCHAR") || !HDstrcmp(d[i].varname, "SHORT") || @@ -809,69 +819,69 @@ done:\n\ /* Print the ALIGNMENT and signal-handling status as comments */ printf("\n" - "/****************************************/\n" - "/* ALIGNMENT and signal-handling status */\n" - "/****************************************/\n"); + "/****************************************/\n" + "/* ALIGNMENT and signal-handling status */\n" + "/****************************************/\n"); if (align_status_g & STA_NoALIGNMENT) - printf("/* ALIGNAMENT test is not available */\n"); + printf("/* ALIGNAMENT test is not available */\n"); if (align_status_g & STA_NoHandlerVerify) - printf("/* Signal handlers verify test is not available */\n"); + printf("/* Signal handlers verify test is not available */\n"); /* The following is available in H5pubconf.h. Printing them here for */ /* convenience. */ #ifdef H5_HAVE_SIGNAL - printf("/* Signal() support: yes */\n"); + printf("/* Signal() support: yes */\n"); #else - printf("/* Signal() support: no */\n"); + printf("/* Signal() support: no */\n"); #endif #ifdef H5_HAVE_SETJMP - printf("/* setjmp() support: yes */\n"); + printf("/* setjmp() support: yes */\n"); #else - printf("/* setjmp() support: no */\n"); + printf("/* setjmp() support: no */\n"); #endif #ifdef H5_HAVE_LONGJMP - printf("/* longjmp() support: yes */\n"); + printf("/* longjmp() support: yes */\n"); #else - printf("/* longjmp() support: no */\n"); + printf("/* longjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGSETJMP - printf("/* sigsetjmp() support: yes */\n"); + printf("/* sigsetjmp() support: yes */\n"); #else - printf("/* sigsetjmp() support: no */\n"); + printf("/* sigsetjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGLONGJMP - printf("/* siglongjmp() support: yes */\n"); + printf("/* siglongjmp() support: yes */\n"); #else - printf("/* siglongjmp() support: no */\n"); + printf("/* siglongjmp() support: no */\n"); #endif #ifdef H5_HAVE_SIGPROCMASK - printf("/* sigprocmask() support: yes */\n"); + printf("/* sigprocmask() support: yes */\n"); #else - printf("/* sigprocmask() support: no */\n"); + printf("/* sigprocmask() support: no */\n"); #endif /* Print the statics of signal handlers called for debugging */ printf("\n" - "/******************************/\n" - "/* signal handlers statistics */\n" - "/******************************/\n"); + "/******************************/\n" + "/* signal handlers statistics */\n" + "/******************************/\n"); printf("/* signal_handlers tested: %d times */\n", signal_handler_tested_g); printf("/* sigbus_handler called: %d times */\n", sigbus_handler_called_g); printf("/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g); printf("/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ - + /*------------------------------------------------------------------------- - * Function: iprint + * Function: iprint * - * Purpose: Prints information about the fields of a floating point - * format. + * Purpose: Prints information about the fields of a floating point + * format. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 13, 1996 * * Modifications: * @@ -945,22 +955,22 @@ iprint(detected_t *d) } - + /*------------------------------------------------------------------------- - * Function: byte_cmp + * Function: byte_cmp * - * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the * corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of differing byte. + * Return: Success: Index of differing byte. * - * Failure: -1 if all bytes are the same. + * Failure: -1 if all bytes are the same. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 12, 1996 * * Modifications: * @@ -980,17 +990,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) return -1; } - + /*------------------------------------------------------------------------- - * Function: bit_cmp + * Function: bit_cmp * - * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1021,23 +1031,23 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, return 0; } - + /*------------------------------------------------------------------------- - * Function: fix_order + * Function: fix_order * - * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 13, 1996 * * Modifications: * @@ -1046,81 +1056,81 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, static void fix_order(int n, int last, int *perm, const char **mesg) { - int i; + int i; if (last > 1) { - /* - * We have at least three points to consider. - */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { - /* - * Little endian. - */ - if (mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) perm[i] = i; - - } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) { - /* - * Big endian. - */ - if (mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) perm[i] = (n - 1) - i; - - } else { - /* - * Bi-endian machines like VAX. + /* + * We have at least three points to consider. + */ + if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + /* + * Little endian. + */ + if (mesg) *mesg = "Little-endian"; + for (i = 0; i < n; i++) perm[i] = i; + + } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) { + /* + * Big endian. + */ + if (mesg) *mesg = "Big-endian"; + for (i = 0; i < n; i++) perm[i] = (n - 1) - i; + + } else { + /* + * Bi-endian machines like VAX. * (NOTE: This is not an actual determination of the VAX-endianess. * It could have some other endianess and fall into this * case - JKM & QAK) - */ - HDassert(0 == n % 2); - if (mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { - perm[i] = (n - 2) - i; - perm[i + 1] = (n - 1) - i; - } - } + */ + HDassert(0 == n % 2); + if (mesg) *mesg = "VAX"; + for (i = 0; i < n; i += 2) { + perm[i] = (n - 2) - i; + perm[i + 1] = (n - 1) - i; + } + } } else { - fprintf(stderr, - "Failed to detect byte order of %d-byte floating point.\n", n); - HDexit(1); + fprintf(stderr, + "Failed to detect byte order of %d-byte floating point.\n", n); + HDexit(1); } } - + /*------------------------------------------------------------------------- - * Function: imp_bit + * Function: imp_bit * - * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least signficant bit - * of the exponent. + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least signficant bit + * of the exponent. * * - * Return: Success: Non-zero if the most significant bit - * of the mantissa is discarded (ie, the - * mantissa has an implicit `one' as the - * most significant bit). Otherwise, - * returns zero. + * Return: Success: Non-zero if the most significant bit + * of the mantissa is discarded (ie, the + * mantissa has an implicit `one' as the + * most significant bit). Otherwise, + * returns zero. * - * Failure: exit(1) + * Failure: exit(1) * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 13, 1996 * * Modifications: * - * Robb Matzke, 6 Nov 1996 - * Fixed a bug that occurs with non-implicit architectures. + * Robb Matzke, 6 Nov 1996 + * Fixed a bug that occurs with non-implicit architectures. * *------------------------------------------------------------------------- */ @@ -1150,26 +1160,26 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; } - + /*------------------------------------------------------------------------- - * Function: find_bias + * Function: find_bias * - * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * Purpose: Determines the bias of the exponent. This function should + * be called with _A having a value of `1'. * - * Return: Success: The exponent bias. + * Return: Success: The exponent bias. * - * Failure: + * Failure: * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 13, 1996 * * Modifications: * - * Robb Matzke, 6 Nov 1996 - * Fixed a bug with non-implicit architectures returning the - * wrong exponent bias. + * Robb Matzke, 6 Nov 1996 + * Fixed a bug with non-implicit architectures returning the + * wrong exponent bias. * *------------------------------------------------------------------------- */ @@ -1193,17 +1203,17 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) return bias; } - + /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. + * Purpose: Prints the C file header for the generated file. * - * Return: void + * Return: void * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Mar 12 1997 * * Modifications: * @@ -1213,22 +1223,22 @@ static void print_header(void) { - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; - int i; - const char *s; + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; #ifdef H5_HAVE_GETPWUID - struct passwd *pwd = NULL; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif - static const char *month_name[] = + static const char *month_name[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - static const char *purpose = "\ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static const char *purpose = "\ This machine-generated source code contains\n\ information about the various integer and\n\ floating point numeric formats found on this\n\ @@ -1240,7 +1250,7 @@ Each of the numeric formats listed below are\n\ printed from most significant bit to least\n\ significant bit even though the actual bytes\n\ might be stored in a different order in\n\ -memory. The integers above each binary byte\n\ +memory. The integers above each binary byte\n\ indicate the relative order of the bytes in\n\ memory; little-endian machines have\n\ decreasing numbers while big-endian machines\n\ @@ -1251,8 +1261,8 @@ letters with `S' for the mantissa sign bit,\n\ `M' for the mantissa magnitude, and `E' for\n\ the exponent. The exponent has an associated\n\ bias which can be subtracted to find the\n\ -true exponent. The radix point is assumed\n\ -to be before the first `M' bit. Any bit\n\ +true exponent. The radix point is assumed\n\ +to be before the first `M' bit. Any bit\n\ of a floating-point value not falling into one\n\ of these categories is printed as a question\n\ mark. Bits of integer types are printed as\n\ @@ -1271,20 +1281,20 @@ bit.\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; - } - } else { - real_name[0] = '\0'; - } + size_t n; + char *comma; + if ((pwd = HDgetpwuid(HDgetuid()))) { + if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } else { + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } + } else { + real_name[0] = '\0'; + } } #else real_name[0] = '\0'; @@ -1295,7 +1305,7 @@ bit.\n"; */ #ifdef H5_HAVE_GETHOSTNAME if (HDgethostname(host_name, sizeof(host_name)) < 0) { - host_name[0] = '\0'; + host_name[0] = '\0'; } #else host_name[0] = '\0'; @@ -1305,24 +1315,24 @@ bit.\n"; * The file header: warning, copyright notice, build information. */ printf("/* Generated automatically by H5detect -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + HDputs(FileHeader); /*the copyright notice--see top of this file */ printf(" *\n * Created:\t\t%s %2d, %4d\n", - month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); + month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); if (pwd || real_name[0] || host_name[0]) { - printf(" *\t\t\t"); - if (real_name[0]) printf("%s <", real_name); + printf(" *\t\t\t"); + if (real_name[0]) printf("%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, stdout); + if (pwd) HDfputs(pwd->pw_name, stdout); #endif - if (host_name[0]) printf("@%s", host_name); - if (real_name[0]) printf(">"); - HDputchar('\n'); + if (host_name[0]) printf("@%s", host_name); + if (real_name[0]) printf(">"); + HDputchar('\n'); } printf(" *\n * Purpose:\t\t"); for (s = purpose; *s; s++) { - HDputchar(*s); - if ('\n' == *s && s[1]) printf(" *\t\t\t"); + HDputchar(*s); + if ('\n' == *s && s[1]) printf(" *\t\t\t"); } printf(" *\n * Modifications:\n *\n"); @@ -1335,84 +1345,84 @@ bit.\n"; } - + /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * - * Purpose: Detect C89 integer types + * Purpose: Detect C89 integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C89_integers(void) +detect_C89_integers(void) HDF_NO_UBSAN { - DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; - DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; - DETECT_I(int, INT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; - DETECT_I(long, LONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; + DETECT_I(int, INT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; + DETECT_I(long, LONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types + * Purpose: Detect C89 floating point types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C89_floats(void) +detect_C89_floats(void) HDF_NO_UBSAN { DETECT_F(float, FLOAT, d_g[nd_g]); nd_g++; DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * - * Purpose: Detect C99 8 bit integer types + * Purpose: Detect C99 8 bit integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_integers8(void) +detect_C99_integers8(void) HDF_NO_UBSAN { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; #else - DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT8_T>0 #if H5_SIZEOF_UINT8_T==1 - DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; #else DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; #endif @@ -1421,147 +1431,147 @@ detect_C99_integers8(void) #if H5_SIZEOF_INT_LEAST8_T==1 DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 #if H5_SIZEOF_UINT_LEAST8_T==1 DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 #if H5_SIZEOF_INT_FAST8_T==1 DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 #if H5_SIZEOF_UINT_FAST8_T==1 - DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #else DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #endif #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * - * Purpose: Detect C99 16 bit integer types + * Purpose: Detect C99 16 bit integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_integers16(void) +detect_C99_integers16(void) HDF_NO_UBSAN { #if H5_SIZEOF_INT16_T>0 - DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; + DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT16_T>0 - DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; + DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST16_T>0 - DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST16_T>0 - DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST16_T>0 - DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST16_T>0 - DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types + * Purpose: Detect C99 32 bit integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_integers32(void) +detect_C99_integers32(void) HDF_NO_UBSAN { #if H5_SIZEOF_INT32_T>0 - DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; + DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT32_T>0 - DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; + DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST32_T>0 - DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST32_T>0 - DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST32_T>0 - DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST32_T>0 - DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_integers64(void) +detect_C99_integers64(void) HDF_NO_UBSAN { #if H5_SIZEOF_INT64_T>0 - DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; + DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT64_T>0 - DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; + DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST64_T>0 - DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST64_T>0 - DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST64_T>0 - DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST64_T>0 - DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_LONG_LONG>0 - DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; + DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; #else /* @@ -1569,28 +1579,28 @@ detect_C99_integers64(void) * so we'll just make H5T_NATIVE_LLONG the same as H5T_NATIVE_LONG since * `long long' is probably equivalent to `long' here anyway. */ - DETECT_I(long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(long, LLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * - * Purpose: Detect C99 integer types + * Purpose: Detect C99 integer types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_integers(void) +detect_C99_integers(void) HDF_NO_UBSAN { /* break it down to more subroutines so that each module subroutine */ /* is smaller and takes less time to compile with optimization on. */ @@ -1600,23 +1610,23 @@ detect_C99_integers(void) detect_C99_integers64(); } - + /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types + * Purpose: Detect C99 floating point types * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_C99_floats(void) +detect_C99_floats(void) HDF_NO_UBSAN { #if H5_SIZEOF_DOUBLE == H5_SIZEOF_LONG_DOUBLE /* @@ -1625,29 +1635,29 @@ detect_C99_floats(void) * some systems and `long double' is probably the same as `double' here * anyway. */ - DETECT_F(double, LDOUBLE, d_g[nd_g]); nd_g++; + DETECT_F(double, LDOUBLE, d_g[nd_g]); nd_g++; #elif H5_SIZEOF_LONG_DOUBLE !=0 - DETECT_F(long double, LDOUBLE, d_g[nd_g]); nd_g++; + DETECT_F(long double, LDOUBLE, d_g[nd_g]); nd_g++; #endif } - + /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * - * Purpose: Detect structure alignments + * Purpose: Detect structure alignments * - * Return: void + * Return: void * - * Programmer: Albert Cheng - * 2004/05/20 + * Programmer: Albert Cheng + * 2004/05/20 * * Modifications: * *------------------------------------------------------------------------- */ static void -detect_alignments(void) +detect_alignments(void) HDF_NO_UBSAN { /* Detect structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ DETECT_M(void *, POINTER, m_g[na_g]); na_g++; @@ -1656,7 +1666,7 @@ detect_alignments(void) DETECT_M(hdset_reg_ref_t, HDSETREGREF, m_g[na_g]); na_g++; } - + #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* Verify the signal handler for signal signum works correctly multiple times. * One possible cause of failure is that the signal handling is blocked or @@ -1664,64 +1674,70 @@ detect_alignments(void) * Return 0 for success, -1 for failure. */ static int verify_signal_handlers(int signum, void (*handler)(int)) -{ - void (*save_handler)(int) = HDsignal(signum, handler); +{ +#if defined(__has_feature) +#if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer) + /* Under the address and thread sanitizers, don't raise any signals. */ + return 0; +#endif +#endif + void (*save_handler)(int) = HDsignal(signum, handler); volatile int i, val; int ntries=5; volatile int nfailures=0; volatile int nsuccesses=0; - - for (i=0;i<ntries; i++){ - val=H5SETJMP(jbuf_g); - if (val==0) - { - /* send self the signal to trigger the handler */ - signal_handler_tested_g++; - HDraise(signum); - /* Should not reach here. Record error. */ - nfailures++; - }else{ - if (val==signum){ - /* return from signum handler. Record a sucess. */ - nsuccesses++; - }else{ - fprintf(stderr, "Unknown return value (%d) from H5SETJMP", - val); - nfailures++; - } - } - } + + for (i=0;i<ntries; i++){ + val=H5SETJMP(jbuf_g); + if (val==0) + { + /* send self the signal to trigger the handler */ + signal_handler_tested_g++; + HDraise(signum); + /* Should not reach here. Record error. */ + nfailures++; + }else{ + if (val==signum){ + /* return from signum handler. Record a sucess. */ + nsuccesses++; + }else{ + fprintf(stderr, "Unknown return value (%d) from H5SETJMP", + val); + nfailures++; + } + } + } /* restore save handler, check results and report failures */ HDsignal(signum, save_handler); if (nfailures>0 || nsuccesses != ntries){ - fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); + fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return(-1); }else{ - /* all succeeded */ - return(0); + /* all succeeded */ + return(0); } -} +} #endif - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: exit(0) + * Return: Success: exit(0) * - * Failure: exit(1) + * Failure: exit(1) * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jun 12, 1996 * * Modifications: - * Albert Cheng, 2004/05/20 - * Some compilers, e.g., Intel C v7.0, took a long time to compile + * Albert Cheng, 2004/05/20 + * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both * to avoid the compiler optimization error and cleaner codes. @@ -1729,7 +1745,7 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) *------------------------------------------------------------------------- */ int -main(void) +main(void) HDF_NO_UBSAN { #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) @@ -1738,12 +1754,12 @@ main(void) * Make sure unaligned access generates SIGBUS and doesn't print warning * messages so that we can detect alignment constraints on the DEC Alpha. */ - int nvpairs[2]; + int nvpairs[2]; nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", - HDstrerror(errno)); + fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", + HDstrerror(errno)); } #endif #endif diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4b3b3d5..41a9fdc 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -9,9 +9,7 @@ add_definitions (${HDF_EXTRA_C_FLAGS}) # -------------------------------------------------------------------- # If testing was NOT enabled, then we need to build the tools library # -------------------------------------------------------------------- -if (NOT BUILD_TESTING) - add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/lib) -endif () +add_subdirectory (lib) #----------------------------------------------------------------------------- # Setup include Directories @@ -19,9 +17,9 @@ endif () INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) #-- Add the test sources -add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/src) +add_subdirectory (src) #-- Add the tests if (BUILD_TESTING) - add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/test) + add_subdirectory (test) endif () diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt index 37680dd..24e682a 100644 --- a/tools/src/CMakeLists.txt +++ b/tools/src/CMakeLists.txt @@ -7,31 +7,31 @@ PROJECT (HDF5_TOOLS_SRC) add_definitions (${HDF_EXTRA_C_FLAGS}) #-- Add the h5diff and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5diff) +add_subdirectory (h5diff) #-- Add the h5ls executable -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5ls) +add_subdirectory (h5ls) #-- Misc Executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/misc) +add_subdirectory (misc) #-- Add the h5import and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5import) +add_subdirectory (h5import) #-- h5Repack executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5repack) +add_subdirectory (h5repack) #-- Add the h5dump and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5jam) +add_subdirectory (h5jam) #-- Add the h5copy and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5copy) +add_subdirectory (h5copy) #-- Add the h5stat and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5stat) +add_subdirectory (h5stat) #-- Add the h5dump and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5dump) +add_subdirectory (h5dump) #-- Add the h5format_convert and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5format_convert) +add_subdirectory (h5format_convert) diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 36a8c21..76e78af 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1405,7 +1405,7 @@ static int processConfigurationFile(char *infile, struct Input *in) const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; const char *err14b = "Error in retrieving the compression parameter from %s.\n"; const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; - const char *err15b = "Error in retrieving the external storage paramters from %s.\n"; + const char *err15b = "Error in retrieving the external storage parameters from %s.\n"; const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n"; const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n"; @@ -3690,7 +3690,7 @@ static int getCompressionParameter(struct Input *in, FILE *strm) { /* currently supports only GZIP */ /* can be extended by adding more values to COMPRESSION-TYPE and */ - /* handling the paramters here by adding more cases */ + /* handling the parameters here by adding more cases */ int ival; const char *err1 = "Unable to get integer value.\n"; diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt index a7dd11f..6877bfc 100644 --- a/tools/test/CMakeLists.txt +++ b/tools/test/CMakeLists.txt @@ -7,34 +7,34 @@ PROJECT (HDF5_TOOLS_TEST) add_definitions (${HDF_EXTRA_C_FLAGS}) #-- Add the h5diff tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5diff) +add_subdirectory (h5diff) #-- Add the h5ls tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5ls) +add_subdirectory (h5ls) #-- Misc tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/misc) +add_subdirectory (misc) #-- Add the h5import tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5import) +add_subdirectory (h5import) #-- h5Repack tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5repack) +add_subdirectory (h5repack) #-- Add the h5jam tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5jam) +add_subdirectory (h5jam) #-- Add the h5copy tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5copy) +add_subdirectory (h5copy) #-- Add the h5stat tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5stat) +add_subdirectory (h5stat) #-- Add the h5dump tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5dump) +add_subdirectory (h5dump) #-- Add the h5format_convert and test executables -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5format_convert) +add_subdirectory (h5format_convert) #-- Add the perform tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/perform) +add_subdirectory (perform) diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 35f9132..9f5d916 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -225,7 +225,7 @@ static void gent_compressed(hid_t loc_id) /*------------------------------------------------------------------------- * Function: gent_named_vl * - * Purpose: Generate a variable lenght named datatype for a dataset in + * Purpose: Generate a variable length named datatype for a dataset in LOC_ID * *------------------------------------------------------------------------- diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 48bc8ab..c014fad 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>) - add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds) + add_subdirectory (vds) endif () |