From b24cd0261b2ae256d09f4afc5f07314f28137dc8 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Thu, 17 Oct 2024 11:11:24 -0500 Subject: [PATCH 01/10] Fix h5py GitHub Action (#4962) --- .github/workflows/h5py.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/h5py.yml b/.github/workflows/h5py.yml index a0c39d67f59..c6c6aa7505b 100644 --- a/.github/workflows/h5py.yml +++ b/.github/workflows/h5py.yml @@ -28,8 +28,9 @@ jobs: ./spack/bin/spack install py-h5py@master+mpi ^hdf5@develop-1.17 ./spack/bin/spack install py-pytest ./spack/bin/spack install py-ipython + ./spack/bin/spack install py-pytest-mpi spack load py-h5py spack load py-pytest spack load py-ipython - pip install pytest-mpi + spack load py-pytest-mpi python -c "import h5py; h5py.run_tests(); print(h5py.version.info);" From 7f619c9b13f846bcecaf70569a8a4992b1fa491d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:11:52 -0500 Subject: [PATCH 02/10] Do not package debug builds (#4963) * Do not package debug builds * Do not try to upload with debug builds --- .github/workflows/main-cmake.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 3c953409740..d633bb77ebb 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -241,6 +241,7 @@ jobs: - name: CMake Run Package run: cpack -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build + if: ${{ inputs.build_mode != 'Debug' }} - name: List files in the space run: | @@ -253,7 +254,7 @@ jobs: name: zip-vs2022_cl-${{ inputs.build_mode }}-binary path: ${{ runner.workspace }}/build/HDF5-*-win64.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - if: ${{ (matrix.os == 'windows-latest') && (inputs.thread_safety != 'TS') }} + if: ${{ (matrix.os == 'windows-latest') && (inputs.thread_safety != 'TS') && ( inputs.build_mode != 'Debug') }} - name: Save published binary (linux) uses: actions/upload-artifact@v4 @@ -261,7 +262,7 @@ jobs: name: tgz-ubuntu-2204_gcc-${{ inputs.build_mode }}-binary path: ${{ runner.workspace }}/build/HDF5-*-Linux.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - if: ${{ (matrix.os == 'ubuntu-latest') && (inputs.thread_safety != 'TS') }} + if: ${{ (matrix.os == 'ubuntu-latest') && (inputs.thread_safety != 'TS') && ( inputs.build_mode != 'Debug') }} - name: Save published binary (Mac_latest) uses: actions/upload-artifact@v4 @@ -269,4 +270,4 @@ jobs: name: tgz-macos14_clang-${{ inputs.build_mode }}-binary path: ${{ runner.workspace }}/build/HDF5-*-Darwin.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - if: ${{ (matrix.os == 'macos-latest') && (inputs.thread_safety != 'TS') }} + if: ${{ (matrix.os == 'macos-latest') && (inputs.thread_safety != 'TS') && ( inputs.build_mode != 'Debug') }} From ad307bf61f7dcd234204c1256b4954d9493e956a Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 17 Oct 2024 11:17:20 -0500 Subject: [PATCH 03/10] Updated hyperslab documentation (#4965) * corrected Fortran docs for hyperslab selection * updated hyperslab op doc --- fortran/src/H5Sff.F90 | 6 ++++-- src/H5Spublic.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index 3c301c2f462..db709ddc10f 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -893,6 +893,10 @@ END SUBROUTINE h5sset_extent_none_f !! \param operator Flag, valid values are: !! \li H5S_SELECT_SET_F !! \li H5S_SELECT_OR_F +!! \li H5S_SELECT_AND_F +!! \li H5S_SELECT_XOR_F +!! \li H5S_SELECT_NOTB_F +!! \li H5S_SELECT_NOTA_F !! \param start Array with hyperslab offsets, \Bold{0-based indices}. !! \param count Number of blocks included in the hyperslab. !! \param hdferr \fortran_error @@ -1000,8 +1004,6 @@ END SUBROUTINE h5sselect_hyperslab_f ! H5S_SELECT_XOR_F ! H5S_SELECT_NOTB_F ! H5S_SELECT_NOTA_F -! H5S_SELECT_APPEND_F -! H5S_SELECT_PREPEND_F ! start - array with hyperslab offsets ! count - number of blocks included in the ! hyperslab diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 3697374d49c..a5264099b0f 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -190,6 +190,8 @@ H5_DLL herr_t H5Sclose(hid_t space_id); * composing the entire current extent). If either \p stride or * \p block is NULL, then it will be set to \p 1. * + * See H5Sselect_hyperslab() for valid operators (\p op). + * * \since 1.10.6 * */ @@ -213,6 +215,8 @@ H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_ * from \p space1_id is copied for the dataspace extent of the * newly created dataspace. * + * See H5Sselect_hyperslab() for valid operators (\p op). + * * \since 1.10.6 * */ @@ -816,6 +820,8 @@ H5_DLL htri_t H5Sis_simple(hid_t space_id); * \p space2_id. The first selection is modified to contain the * result of \p space1_id operated on by \p space2_id. * + * See H5Sselect_hyperslab() for valid operators (\p op). + * * \since 1.10.6 * */ From e64e1ea881c431a9561b83607d722994af641026 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 17 Oct 2024 12:20:47 -0400 Subject: [PATCH 04/10] Fix linker flag in pkg-config file for system zlib (#4957) Previously was hardcoding `-lzlib-static` which will result in the wrong linker flags when built with system zlib. It looks like there was logic to figure out the library name but the resulting `libname` was never used. --- CMakeFilters.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 52d65e59e47..57c51edceaf 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -108,7 +108,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) # on the target. The target returned is: ZLIB::ZLIB get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE) string (REGEX REPLACE "^lib" "" libname ${libname}) - set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME zlib-static) + set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME ${libname}) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ZLIB::ZLIB) endif () else () From 29c84e0d597553a988cd71f455edf53e010fa319 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:10:24 -0500 Subject: [PATCH 05/10] Incorporate remaining parts of the filters.html file (#4966) --- doxygen/dox/ExamplesAPI.dox | 10 ---- src/H5Dmodule.h | 3 +- src/H5PLmodule.h | 95 +++++++++++++++++++++++++++++++++---- src/H5Zmodule.h | 38 +++++++++++++++ 4 files changed, 125 insertions(+), 21 deletions(-) diff --git a/doxygen/dox/ExamplesAPI.dox b/doxygen/dox/ExamplesAPI.dox index e2ee26ee28e..f3903cec1d2 100644 --- a/doxygen/dox/ExamplesAPI.dox +++ b/doxygen/dox/ExamplesAPI.dox @@ -800,16 +800,6 @@ FORTRAN h5ex_d_lzf.ddl -Read / Write Dataset using MAFISC Compression - -C - FORTRAN Java JavaObj MATLAB PyHigh PyLow - -h5ex_d_mafisc.h5 -h5ex_d_mafisc.tst -h5ex_d_mafisc.ddl - - Read / Write Dataset using ZFP Compression C diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h index 96c5b1a704e..5829e80fc9a 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -1612,7 +1612,8 @@ allocated if necessary. * care must be taken to assure that all the external files are accessible in the new location. * * \subsection subsec_dataset_filters Using HDF5 Filters - * This section describes in detail how to use the n-bit, scale-offset filters and szip filters. + * This section describes in detail how to use the n-bit, scale-offset filters and szip filters. For + * details on the how filters are used in the read / write of data, see /def subsubsec_dataset_transfer_pipe. * * \subsubsection subsubsec_dataset_filters_nbit Using the N‐bit Filter * N-bit data has n significant bits, where n may not correspond to a precise number of bytes. On diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h index 1aedc2783fe..9f867ee5fff 100644 --- a/src/H5PLmodule.h +++ b/src/H5PLmodule.h @@ -48,16 +48,23 @@ * available to the application. For example, if the application intends to apply the HDF5 bzip2 compression * filter that was registered with The HDF Group and has an identification number 307 * (Registered - * Filters) then the application would follow the steps as outlined below: \code dcpl = H5Pcreate - * (H5P_DATASET_CREATE); status = H5Pset_filter (dcpl, (H5Z_filter_t)307, H5Z_FLAG_MANDATORY, (size_t)6, - * cd_values); dset = H5Dcreate (file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, status = H5Dwrite - * (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]); \endcode + * Filters) then the application would follow the steps as outlined below: + * \code + * dcpl = H5Pcreate (H5P_DATASET_CREATE); + * status = H5Pset_filter (dcpl, (H5Z_filter_t)307, H5Z_FLAG_MANDATORY, (size_t)6, cd_values); + * dset = H5Dcreate (file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + * status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]); + * \endcode * * \subsubsection subsubsec_filter_plugins_model_read Reading Data with an Applied Third-party Filter * An application does not need to do anything special to read the data with a third-party filter applied. For * example, if one wants to read data written in the previous example, the following regular steps should be - * taken: \code file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); dset = H5Dopen (file, DATASET, - * H5P_DEFAULT); H5Dread (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]); \endcode + * taken: + * \code + * file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + * dset = H5Dopen (file, DATASET, H5P_DEFAULT); + * H5Dread (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]); + * \endcode * * The command-line utility h5dump, for example, will read and display the data as shown: * \code @@ -161,10 +168,78 @@ * plugin on the system. * * \subsubsection subsubsec_filter_plugins_prog_write Writing a Filter Function - * The HDF5 filter function for the dynamically loaded filter feature should be written as any custom filter - * described in Custom Filters. See the - * “Example” section, section 5, of that document to get an idea of the simple filter function, and see the - * example of the more sophisticated HDF5 bzip2 filter function in the “Building an HDF5 bzip2 Plugin Example” + * The HDF5 filter function for the dynamically loaded filter feature should be written as a custom filter. + * This example shows how to define and register a simple filter + * that adds a checksum capability to the data stream. + * + * The function that acts as the filter always returns zero (failure) if the md5() function was + * not detected at configuration time (left as an exercise for the reader). Otherwise the function is broken + * down to an input and output half. The output half calculates a checksum, increases the size of the output + * buffer if necessary, and appends the checksum to the end of the buffer. The input half calculates the + * checksum on the first part of the buffer and compares it to the checksum already stored at the end of the + * buffer. If the two differ then zero (failure) is returned, otherwise the buffer size is reduced to exclude + * the checksum. /code size_t md5_filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], + * size_t nbytes, size_t *buf_size, void **buf) + * { + * \c \#ifdef HAVE_MD5 + * unsigned char cksum[16]; + * + * if (flags & H5Z_REVERSE) { + * // Input + * assert(nbytes >= 16); + * md5(nbytes-16, *buf, cksum); + * // Compare + * if (memcmp(cksum, (char*)(*buf)+ nbytes- 16, 16)) { + * return 0; // fail + * } + * // Strip off checksum + * return nbytes - 16; + * } + * else { + * // Output + * md5(nbytes, *buf, cksum); + * // Increase buffer size if necessary + * if (nbytes + 16 > *buf_size) { + * *buf_size = nbytes + 16; + * *buf = realloc(*buf, *buf_size); + * } + * // Append checksum + * memcpy((char*)(*buf)+nbytes, cksum, 16); + * return nbytes+16; + * } + * \c \#else + * return 0; // fail + * \c \#endif + * } + * /endcode + * + * Once the filter function is defined it must be registered so + * the HDF5 library knows about it. Since we're testing this + * filter we choose one of the #H5Z_filter_t numbers + * from the reserved range. We'll randomly choose 305. + * + * /code + * \c \#define FILTER_MD5 305 + * herr_t status = H5Zregister(FILTER_MD5, "md5 checksum", md5_filter); + * /endcode + * + * Now we can use the filter in a pipeline. We could have added + * the filter to the pipeline before defining or registering the + * filter as long as the filter was defined and registered by time + * we tried to use it (if the filter is marked as optional then we + * could have used it without defining it and the library would + * have automatically removed it from the pipeline for each chunk + * written before the filter was defined and registered). + * + * /code + * hid_t dcpl = H5Pcreate(H5P_DATASET_CREATE); + * hsize_t chunk_size[3] = {10,10,10}; + * H5Pset_chunk(dcpl, 3, chunk_size); + * H5Pset_filter(dcpl, FILTER_MD5, 0, 0, NULL); + * hid_t dset = H5Dcreate(file, "dset", H5T_NATIVE_DOUBLE, space, dcpl); + * /endcode + * + * See the example of a more sophisticated HDF5 bzip2 filter function in the /ref subsec_filter_plugins_build * section. The HDF5 bzip2 filter function is also available for download from Filter Plugin Repository. * diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h index d1087b8bcd5..e02be5c2677 100644 --- a/src/H5Zmodule.h +++ b/src/H5Zmodule.h @@ -71,6 +71,7 @@ * shuffling algorithm) and error checking (Fletcher32 checksum). For further * flexibility, the library allows a user application to extend the pipeline * through the creation and registration of customized filters. + * See \ref sec_filter_plugins * * The flexibility of the filter pipeline implementation enables the definition * of additional filters by a user application. A filter @@ -83,6 +84,43 @@ * the difficulty of implementing random access for partial I/O. Compact dataset * filters are not supported because they would not produce significant results. * + * HDF5 allows chunked data to pass through user-defined filters + * on the way to or from disk. The filters operate on chunks of an + * #H5D_CHUNKED dataset can be arranged in a pipeline + * so output of one filter becomes the input of the next filter. + * + * Each filter has a two-byte identification number (type + * #H5Z_filter_t) allocated by The HDF Group and can also be + * passed application-defined integer resources to control its + * behavior. Each filter also has an optional ASCII comment + * string. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Values for #H5Z_filter_tDescription
0-255These values are reserved for filters predefined and + * registered by the HDF5 library and of use to the general + * public.
256-511Filter numbers in this range are used for testing only + * and can be used temporarily by any organization. No + * attempt is made to resolve numbering conflicts since all + * definitions are by nature temporary.
512-65535Reserved for future assignment. Please contact the + * HDF5 development team + * to reserve a value or range of values for + * use by your filters.
+ * * Filter identifiers for the filters distributed with the HDF5 * Library are as follows: * From 1c23395bd6195bfbb205357a53cb8519f9ae3a86 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 18 Oct 2024 07:57:34 -0700 Subject: [PATCH 06/10] Remove TRUE and FALSE from H5private.h (#4969) * Remove TRUE and FALSE from H5private.h * Replace hbool_t with bool in test code --- c++/test/tattr.cpp | 2 +- c++/test/tfile.cpp | 6 ++-- c++/test/tlinks.cpp | 14 ++++---- c++/test/tobject.cpp | 32 +++++++++--------- hl/test/test_lite.c | 72 ++++++++++++++++++++-------------------- src/H5Eint.c | 4 +-- src/H5TSmutex.c | 6 ++-- src/H5TSwin.c | 2 +- src/H5VLint.c | 4 +-- src/H5VLtest.c | 2 +- src/H5private.h | 10 ------ test/cmpd_dset.c | 14 ++++---- test/error_test.c | 38 ++++++++++----------- test/h5test.c | 16 ++++----- test/select_io_dset.c | 2 +- test/trefer.c | 4 +-- test/ttsafe_rec_rwlock.c | 16 ++++----- test/vol.c | 4 +-- 18 files changed, 119 insertions(+), 129 deletions(-) diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 07ab0a6d777..a01833802a4 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1983,7 +1983,7 @@ test_attr(const void *params) // Loop over using new group format unsigned new_format; - for (new_format = FALSE; new_format <= TRUE; new_format++) { + for (new_format = false; new_format <= true; new_format++) { FileAccPropList curr_fapl; // Set the file access proplist for the type of format diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 7f3406a60b8..94742f3c447 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -842,7 +842,7 @@ test_file_info() SUBTEST("File general information"); hsize_t out_threshold = 0; // Free space section threshold to get - hbool_t out_persist = FALSE; // Persist free-space read + hbool_t out_persist = false; // Persist free-space read // File space handling strategy H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; @@ -869,7 +869,7 @@ test_file_info() // Verify file space information. verify_val(static_cast(out_strategy), static_cast(H5F_FSPACE_STRATEGY_FSM_AGGR), "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(out_persist, false, "H5File::getFileInfo", __LINE__, __FILE__); verify_val(static_cast(out_threshold), 1, "H5File::getFileInfo", __LINE__, __FILE__); /* Retrieve file space page size */ @@ -884,7 +884,7 @@ test_file_info() fcpl.setIstorek(F2_ISTORE); hsize_t threshold = 5; // Free space section threshold to set - hbool_t persist = TRUE; // Persist free-space to set + hbool_t persist = true; // Persist free-space to set H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE; fcpl.setFileSpaceStrategy(strategy, persist, threshold); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index a6d68631fc4..355a4282651 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -129,14 +129,14 @@ test_basic_links(hid_t fapl_id, hbool_t new_format) H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Verify link existence - if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE) + if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != true) throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist"); - if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != true) throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist"); // Deprecated - if (file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE) + if (file.exists("dset1", LinkAccPropList::DEFAULT) != true) throw InvalidActionException("H5File::exists", "dset1 doesn't exist"); - if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != true) throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist"); // Verify link values @@ -290,7 +290,7 @@ test_move(hid_t fapl_id, hbool_t new_format) // Move a soft link across files, should succeed grp_2.moveLink("soft", file_b, "soft_new_name"); - if (file_b.exists("soft_new_name") != TRUE) + if (file_b.exists("soft_new_name") != true) throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist"); // Move a group across groups in the same file while renaming it @@ -429,7 +429,7 @@ test_copy(hid_t fapl_id, hbool_t new_format) // Copy a soft link across files, should succeed grp_2.copyLink("soft", file_b, "soft_new_name"); - if (file_b.exists("soft_new_name") != TRUE) + if (file_b.exists("soft_new_name") != true) throw InvalidActionException("H5File::exists", "soft_new_name doesn't exist"); // Move a group across groups in the same file while renaming it @@ -730,7 +730,7 @@ test_links(const void *params) throw Exception("test_links", "H5Pset_libver_bounds failed"); /* Loop over using new group format */ - for (new_format = FALSE; new_format <= TRUE; new_format++) { + for (new_format = false; new_format <= true; new_format++) { hid_t my_fapl_id; /* Check for FAPL to use */ diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index cec13323544..a7ac635de07 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -169,54 +169,54 @@ test_existance() // Check if GROUP1 exists in the file bool exists = file.nameExists(GROUP1); - verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists GROUP1_1", __LINE__, __FILE__); // Deprecated exists = file.exists(GROUP1); - verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists GROUP1_1", __LINE__, __FILE__); // Open GROUP1 Group grp1 = file.openGroup(GROUP1); // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 exists = grp1.nameExists(GROUP1_1); - verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists GROUP1_1", __LINE__, __FILE__); exists = grp1.nameExists(GROUP1_2); - verify_val(exists, TRUE, "Group::nameExists GROUP1_2", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists GROUP1_2", __LINE__, __FILE__); // Deprecated exists = grp1.exists(GROUP1_1); - verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists GROUP1_1", __LINE__, __FILE__); exists = grp1.exists(GROUP1_2); - verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists GROUP1_2", __LINE__, __FILE__); // Check if DSET_IN_GRP1 exists in GROUP1 exists = grp1.nameExists(DSET_IN_GRP1); - verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); // Deprecated exists = grp1.exists(DSET_IN_GRP1); - verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); // Open GROUP1_2 Group grp1_2 = grp1.openGroup(GROUP1_2); // Check if DSET_IN_GRP1_2 exists in GROUP1_2 exists = grp1_2.nameExists(DSET_IN_GRP1_2); - verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__); // Deprecated exists = grp1_2.exists(DSET_IN_GRP1_2); - verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); // Check if a dataset exists given dataset as location with full path name DataSet dset1 = file.openDataSet(DSET_IN_FILE); exists = dset1.nameExists("/Top Group/Dataset_in_Group_1"); - verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__); + verify_val(exists, true, "Group::nameExists given dataset with full path name", __LINE__, __FILE__); exists = grp1_2.nameExists(DSET_IN_GRP1); - verify_val(exists, FALSE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + verify_val(exists, false, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); // Deprecated exists = dset1.exists("/Top Group/Dataset_in_Group_1"); - verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); + verify_val(exists, true, "Group::exists given dataset with full path name", __LINE__, __FILE__); exists = grp1_2.exists(DSET_IN_GRP1); - verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); + verify_val(exists, false, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); // Everything will be closed as they go out of scope @@ -647,7 +647,7 @@ test_intermediate_groups() } // Failure is ignored // Create GROUP14NAME with the flag to create missing groups set - // to FALSE, should fail because group GROUP13NAME is missing + // to false, should fail because group GROUP13NAME is missing // Reset flag to not create missing groups lcpl.setCreateIntermediateGroup(false); @@ -662,7 +662,7 @@ test_intermediate_groups() catch (FileIException &expected2) { } // Failure is ignored - // Set the flag to create missing groups set to TRUE + // Set the flag to create missing groups set to true lcpl.setCreateIntermediateGroup(true); crt_int_grps = lcpl.getCreateIntermediateGroup(); verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 23508b79990..1ec81238a9d 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -2134,54 +2134,54 @@ test_valid_path(void) * CHECK ABSOLUTE PATHS **************************************/ - if ((path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/", true)) != true) { goto out; } - if ((path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/", false)) != true) { goto out; } - if ((path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(file_id, "/G1", true)) != true) { goto out; } - if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/DS3", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/DS3", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", false)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G2", true)) != true) goto out; /* check soft link points to a valid object*/ - if ((path_valid = H5LTpath_valid(file_id, "/G2/DS4", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G2/DS4", true)) != true) goto out; /* check if path exist, but not the object */ - if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", false)) != true) goto out; /* check if path exist and if the object exists. It should fail * since it is a dangling soft link */ - if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", TRUE)) == TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", true)) == true) goto out; /* check soft links */ - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", true)) != true) goto out; /************************************** @@ -2191,11 +2191,11 @@ test_valid_path(void) if ((group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) goto out; - if ((path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { + if ((path_valid = H5LTpath_valid(group, "/", true)) != true) { goto out; } - if ((path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) { + if ((path_valid = H5LTpath_valid(group, "/", false)) != true) { goto out; } @@ -2207,39 +2207,39 @@ test_valid_path(void) /* The identifier (file id) is the object itself, i.e. "." */ - if ((path_valid = H5LTpath_valid(file_id, ".", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, ".", false)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, ".", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, ".", true)) != true) goto out; /* The identifier (group id) is the object itself, i.e. "." */ - if ((path_valid = H5LTpath_valid(group, ".", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, ".", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(group, "DS3", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, "DS3", false)) != true) goto out; - if ((path_valid = H5LTpath_valid(group, "DS3", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, "DS3", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, "G2/G5", true)) != true) goto out; /* Check the "./" case */ - if ((path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, "./DS3", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(group, "./G2/G5", true)) != true) goto out; /* Should fail, does not exist */ - if ((path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE) + if ((path_valid = H5LTpath_valid(group, "./G2/G20", false)) == true) goto out; /* Should fail, does not exist */ - if ((path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE) + if ((path_valid = H5LTpath_valid(group, "./G2/G20", true)) == true) goto out; if (H5Gclose(group) < 0) @@ -2250,36 +2250,36 @@ test_valid_path(void) *****************************/ /* The dangled external link path is valid */ - if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", false)) != true) goto out; /* The file however does not exists, so the link dangles -> should return false */ - if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", TRUE)) == TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", true)) == true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", false)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", false)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", true)) != true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", false)) != true) goto out; /* Should fail, does not exist */ - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", TRUE)) == TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", true)) == true) goto out; - if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", TRUE)) == TRUE) + if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", true)) == true) goto out; if (H5Fclose(file_id) < 0) diff --git a/src/H5Eint.c b/src/H5Eint.c index 333bc202c0b..2ceb96b31a5 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -160,10 +160,10 @@ static const H5E_stack_t H5E_err_stack_def = { /* H5E_auto_op_t */ #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT - {1, TRUE, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1, + {1, true, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2}, #else /* H5_USE_16_API */ - {2, TRUE, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1, + {2, true, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2, (H5E_auto1_t)H5Eprint1, (H5E_auto2_t)H5E__print2}, #endif /* H5_USE_16_API_DEFAULT */ #else /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5TSmutex.c b/src/H5TSmutex.c index 5cc66efff89..710f37e74e7 100644 --- a/src/H5TSmutex.c +++ b/src/H5TSmutex.c @@ -86,7 +86,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int type) /*------------------------------------------------------------------------- * Function: H5TS_mutex_trylock * - * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so + * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so * * Return: Non-negative on success / Negative on failure * @@ -157,7 +157,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int H5_ATTR_UNUSED type) /*------------------------------------------------------------------------- * Function: H5TS_mutex_trylock * - * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so + * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so * * Return: Non-negative on success / Negative on failure * @@ -242,7 +242,7 @@ H5TS_mutex_init(H5TS_mutex_t *mutex, int type) /*------------------------------------------------------------------------- * Function: H5TS_mutex_trylock * - * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to TRUE if so + * Purpose: Attempt to lock a H5TS_mutex_t, sets *acquired to true if so * * Return: Non-negative on success / Negative on failure * diff --git a/src/H5TSwin.c b/src/H5TSwin.c index 913dbff0099..48efe009da8 100644 --- a/src/H5TSwin.c +++ b/src/H5TSwin.c @@ -70,7 +70,7 @@ static herr_t H5TS__win32_thread_exit(void); * * Purpose: Per-process setup on Windows when using Win32 threads. * - * Returns: TRUE on success, FALSE on failure + * Returns: true on success, FALSE on failure * *-------------------------------------------------------------------------- */ diff --git a/src/H5VLint.c b/src/H5VLint.c index e3e2b28e1a9..81d8fe07b22 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1012,7 +1012,7 @@ H5VL_conn_dec_rc(H5VL_connector_t *connector) * * Purpose: Determine if two connectors point to the same VOL class * - * Return: TRUE/FALSE/FAIL + * Return: true/false/FAIL * *------------------------------------------------------------------------- */ @@ -1029,7 +1029,7 @@ H5VL_conn_same_class(const H5VL_connector_t *conn1, const H5VL_connector_t *conn /* Fast check */ if (conn1 == conn2) - HGOTO_DONE(TRUE); + HGOTO_DONE(true); else { int cmp_value; /* Comparison result */ diff --git a/src/H5VLtest.c b/src/H5VLtest.c index 2c50a579e3e..c15f8295d51 100644 --- a/src/H5VLtest.c +++ b/src/H5VLtest.c @@ -99,7 +99,7 @@ H5VL__reparse_def_vol_conn_variable_test(void) * * Purpose: Check if connector is the native connector * - * Return: TRUE/FALSE/FAIL + * Return: true/false/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5private.h b/src/H5private.h index 86799d362b6..0d2d7ed9f9e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -376,16 +376,6 @@ #define H5_IS_KNOWN_BUFFER_OVERFLOW(skip, ptr, size, buffer_end) \ (skip ? false : H5_IS_BUFFER_OVERFLOW(ptr, size, buffer_end)) -/* - * HDF Boolean type. - */ -#ifndef FALSE -#define FALSE false -#endif -#ifndef TRUE -#define TRUE true -#endif - /* * The max value for ssize_t. * diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 06ae2ff0799..61592165137 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -128,7 +128,7 @@ static hid_t create_stype1(void); static hid_t create_stype2(void); static hid_t create_stype3(void); static hid_t create_stype4(void); -static int compare_data(void *src_data, void *dst_data, hbool_t src_subset); +static int compare_data(void *src_data, void *dst_data, bool src_subset); static int compare_stype4_data(void *expect_buf, void *rbuf); static int compare_s1_data(void *expect_buf, void *rbuf); static int compare_s1_s3_data(void *expect_buf, void *rbuf); @@ -1211,11 +1211,11 @@ test_compounds_selection_io(void) fapl = h5_fileaccess(); h5_fixname(FILENAME[3], fapl, fname, sizeof(fname)); - for (set_cache = FALSE; set_cache <= TRUE; set_cache++) { - for (set_fillvalue = FALSE; set_fillvalue <= TRUE; set_fillvalue++) { - for (select_io = FALSE; select_io <= TRUE; select_io++) { - for (mwbuf = FALSE; mwbuf <= TRUE; mwbuf++) { - for (set_buf = FALSE; set_buf <= TRUE; set_buf++) { + for (set_cache = false; set_cache <= true; set_cache++) { + for (set_fillvalue = false; set_fillvalue <= true; set_fillvalue++) { + for (select_io = false; select_io <= true; select_io++) { + for (mwbuf = false; mwbuf <= true; mwbuf++) { + for (set_buf = false; set_buf <= true; set_buf++) { if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; @@ -1243,7 +1243,7 @@ test_compounds_selection_io(void) if (mwbuf) { printf("with modify write buf, "); - if (H5Pset_modify_write_buf(dxpl, TRUE) < 0) + if (H5Pset_modify_write_buf(dxpl, true) < 0) goto error; } else diff --git a/test/error_test.c b/test/error_test.c index 204055097b8..b08acf63fdb 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -659,7 +659,7 @@ test_append(void) TEST_ERROR; /* Append error stack #2 to error stack #1, and close stack #2 */ - if (H5Eappend_stack(estack_id1, estack_id2, TRUE) < 0) + if (H5Eappend_stack(estack_id1, estack_id2, true) < 0) TEST_ERROR; /* Try to close error stack #2. Should fail because H5Eappend_stack @@ -700,7 +700,7 @@ test_pause(void) const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */ ssize_t err_num; /* Number of errors on stack */ hid_t estack_id1 = H5I_INVALID_HID; /* Error stack ID */ - hbool_t is_paused; /* Whether error stack is paused */ + bool is_paused; /* Whether error stack is paused */ herr_t ret; /* Generic return value */ /* Push an error */ @@ -718,7 +718,7 @@ test_pause(void) TEST_ERROR; /* Check for bad arguments */ - is_paused = TRUE; + is_paused = true; H5E_BEGIN_TRY { ret = H5Eis_paused(H5I_INVALID_HID, &is_paused); @@ -728,17 +728,17 @@ test_pause(void) TEST_ERROR; /* Verify that default stack is not paused */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; /* Verify that application stack is not paused */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(estack_id1, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; /* Check for bad arguments */ @@ -763,10 +763,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused */ - is_paused = FALSE; + is_paused = false; if (H5Eis_paused(estack_id1, &is_paused) < 0) TEST_ERROR; - if (TRUE != is_paused) + if (true != is_paused) TEST_ERROR; /* Resume error stack */ @@ -774,10 +774,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(estack_id1, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; /* Check for resuming too many times */ @@ -790,10 +790,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused, after trying to resume too many times */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(estack_id1, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; /* Close error stack */ @@ -805,10 +805,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused */ - is_paused = FALSE; + is_paused = false; if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) TEST_ERROR; - if (TRUE != is_paused) + if (true != is_paused) TEST_ERROR; /* Resume error stack */ @@ -816,10 +816,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; /* Check for resuming too many times */ @@ -832,10 +832,10 @@ test_pause(void) TEST_ERROR; /* Check if stack is paused, after trying to resume too many times */ - is_paused = TRUE; + is_paused = true; if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) TEST_ERROR; - if (FALSE != is_paused) + if (false != is_paused) TEST_ERROR; return 0; diff --git a/test/h5test.c b/test/h5test.c index 828d83f40f4..92e3c65c1d9 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -770,14 +770,14 @@ h5_get_vfd_fapl(hid_t fapl) } else if (!strcmp(tok, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, true) < 0) goto error; } else if (!strcmp(tok, "core_paged")) { /* In-memory driver with write tracking and paging on */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, true) < 0) goto error; - if (H5Pset_core_write_tracking(fapl, TRUE, 4096) < 0) + if (H5Pset_core_write_tracking(fapl, true, 4096) < 0) goto error; } else if (!strcmp(tok, "split")) { @@ -810,7 +810,7 @@ h5_get_vfd_fapl(hid_t fapl) memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } /* end for */ - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) + if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, false) < 0) goto error; for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) @@ -2394,10 +2394,10 @@ h5_check_file_locking_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks) herr_t h5_using_native_vol(hid_t fapl_id, hid_t obj_id, bool *is_native_vol) { - hbool_t is_native = false; - hid_t native_id = H5I_INVALID_HID; - hid_t vol_id = H5I_INVALID_HID; - herr_t ret_value = SUCCEED; + bool is_native = false; + hid_t native_id = H5I_INVALID_HID; + hid_t vol_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; assert((fapl_id >= 0) || (obj_id >= 0)); assert(is_native_vol); diff --git a/test/select_io_dset.c b/test/select_io_dset.c index c17d3b03a21..9ce1c636061 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -3214,7 +3214,7 @@ main(void) if ((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR; - for (set_cache = FALSE; set_cache <= TRUE; set_cache++) { + for (set_cache = false; set_cache <= true; set_cache++) { /* Disable chunk caching on fapl2 */ if (set_cache) { diff --git a/test/trefer.c b/test/trefer.c index e2a09c0a21e..8847608265c 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -578,11 +578,11 @@ test_reference_obj(void) /* Check if references are equal */ htri_t is_equal = H5Requal(&wbuf[0], &wbuf_cp[0]); CHECK(is_equal, FAIL, "H5Requal"); - VERIFY(is_equal, TRUE, "H5Requal"); + VERIFY(is_equal, true, "H5Requal"); is_equal = H5Requal(&wbuf[0], &wbuf[2]); CHECK(is_equal, FAIL, "H5Requal"); - VERIFY(is_equal, FALSE, "H5Requal"); + VERIFY(is_equal, false, "H5Requal"); ret = H5Rdestroy(&wbuf_cp[0]); CHECK(ret, FAIL, "H5Rdestroy"); diff --git a/test/ttsafe_rec_rwlock.c b/test/ttsafe_rec_rwlock.c index 6fafbb4f8c8..5840cc38107 100644 --- a/test/ttsafe_rec_rwlock.c +++ b/test/ttsafe_rec_rwlock.c @@ -115,7 +115,7 @@ typedef struct rec_rwlock_test_udata_t { static H5TS_THREAD_RETURN_TYPE tts_rec_rwlock_smoke_check_test_thread(void *_udata) { - hbool_t read; + bool read; int32_t rec_lock_depth = 0; int32_t max_rec_lock_depth; int32_t rd_locks_remaining; @@ -132,14 +132,14 @@ tts_rec_rwlock_smoke_check_test_thread(void *_udata) while (rd_locks_remaining > 0 || wr_locks_remaining > 0) { if (wr_locks_remaining == 0) - read = TRUE; + read = true; else if (rd_locks_remaining == 0) - read = FALSE; + read = false; else { if ((rand() % 2) == 0) - read = TRUE; + read = true; else - read = FALSE; + read = false; } if (read) { @@ -556,7 +556,7 @@ tts_rec_rwlock_smoke_check_2(const void H5_ATTR_UNUSED *params) H5TS_thread_t threads[MAX_NUM_THREADS]; rec_rwlock_test_udata_t *udata = NULL; #if H5TS_ENABLE_REC_RWLOCK_STATS - hbool_t verbose = FALSE; + bool verbose = false; int32_t total_target_rd_lock_cycles = 0; int32_t total_target_wr_lock_cycles = 0; H5TS_rec_rwlock_stats_t stats; @@ -762,7 +762,7 @@ tts_rec_rwlock_smoke_check_3(const void H5_ATTR_UNUSED *params) H5TS_thread_t threads[MAX_NUM_THREADS]; rec_rwlock_test_udata_t *udata = NULL; #if H5TS_ENABLE_REC_RWLOCK_STATS - hbool_t verbose = FALSE; + bool verbose = false; int32_t total_target_rd_lock_cycles = 0; int32_t total_target_wr_lock_cycles = 0; H5TS_rec_rwlock_stats_t stats; @@ -968,7 +968,7 @@ tts_rec_rwlock_smoke_check_4(const void H5_ATTR_UNUSED *params) H5TS_thread_t threads[MAX_NUM_THREADS]; rec_rwlock_test_udata_t *udata = NULL; #if H5TS_ENABLE_REC_RWLOCK_STATS - hbool_t verbose = FALSE; + bool verbose = false; int32_t total_target_rd_lock_cycles = 0; int32_t total_target_wr_lock_cycles = 0; H5TS_rec_rwlock_stats_t stats; diff --git a/test/vol.c b/test/vol.c index 92b64c2532d..7d61f4f2daa 100644 --- a/test/vol.c +++ b/test/vol.c @@ -902,8 +902,8 @@ test_basic_file_operation(const char *driver_name) */ h5_check_file_locking_env_var(&use_locking_env, &ignore_disabled_env); if (use_locking_env != FAIL) { - hbool_t default_use_locking = true; - hbool_t default_ignore_disabled_locks = true; + bool default_use_locking = true; + bool default_ignore_disabled_locks = true; if (H5Pget_file_locking(H5P_DEFAULT, &default_use_locking, &default_ignore_disabled_locks) < 0) TEST_ERROR; From bfcb91652ad7dfd86ab3f3c056c6b6638ac22291 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 18 Oct 2024 07:58:43 -0700 Subject: [PATCH 07/10] Moved timer functionality to (new) H5timer.h (#4970) --- src/CMakeLists.txt | 1 + src/H5private.h | 41 ++-------------------- src/H5timer.c | 86 +++++++++------------------------------------- src/H5timer.h | 65 +++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 107 deletions(-) create mode 100644 src/H5timer.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 438d60fffc7..b57e9bf27b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -863,6 +863,7 @@ set (H5_PUBLIC_HEADERS set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h + ${HDF5_SRC_DIR}/H5timer.h ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h diff --git a/src/H5private.h b/src/H5private.h index 0d2d7ed9f9e..42a6dccb22b 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -507,14 +507,6 @@ #endif #endif -/* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */ -#define H5_KB (1024.0F) -#define H5_MB (1024.0F * 1024.0F) -#define H5_GB (1024.0F * 1024.0F * 1024.0F) -#define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F) -#define H5_PB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) -#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) - #ifndef H5_HAVE_FLOCK /* flock() operations. Used in the source so we have to define them when * the call is not available (e.g.: Windows). These should NOT be used @@ -607,37 +599,10 @@ typedef _Float16 H5__Float16; typedef int (*H5_sort_func_cb_t)(const void *, const void *); /* Typedefs and functions for timing certain parts of the library. */ +#include "H5timer.h" -/* A set of elapsed/user/system times emitted as a time point by the - * platform-independent timers. - */ -typedef struct { - double user; /* User time in seconds */ - double system; /* System time in seconds */ - double elapsed; /* Elapsed (wall clock) time in seconds */ -} H5_timevals_t; - -/* Timer structure for platform-independent timers */ -typedef struct { - H5_timevals_t initial; /* Current interval start time */ - H5_timevals_t final_interval; /* Last interval elapsed time */ - H5_timevals_t total; /* Total elapsed time for all intervals */ - bool is_running; /* Whether timer is running */ -} H5_timer_t; - -/* Returns library bandwidth as a pretty string */ -H5_DLL void H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds); - -/* Timer functionality */ -H5_DLL time_t H5_now(void); -H5_DLL uint64_t H5_now_usec(void); -H5_DLL herr_t H5_timer_init(H5_timer_t *timer /*in,out*/); -H5_DLL herr_t H5_timer_start(H5_timer_t *timer /*in,out*/); -H5_DLL herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/); -H5_DLL herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); -H5_DLL herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); -H5_DLL char *H5_timer_get_time_string(double seconds); -H5_DLL char *H5_strcasestr(const char *haystack, const char *needle); +/* Substitute for strcasestr() when that doesn't exist on the platform */ +H5_DLL char *H5_strcasestr(const char *haystack, const char *needle); /* Depth of object copy */ typedef enum { diff --git a/src/H5timer.c b/src/H5timer.c index db609ec611e..4111cf46f20 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -11,26 +11,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- - * Created: H5timer.c - * - * Purpose: Internal, platform-independent 'timer' support routines. + * H5timer.c * + * Internal, platform-independent 'timer' support routines *------------------------------------------------------------------------- */ -/****************/ -/* Module Setup */ -/****************/ #include "H5module.h" /* This source code file is part of the H5 module */ -/***********/ -/* Headers */ -/***********/ -#include "H5private.h" /* Generic Functions */ - -/****************/ -/* Local Macros */ -/****************/ +#include "H5private.h" /* Size of a generated time string. * Most time strings should be < 20 or so characters (max!) so this should be a @@ -43,30 +32,6 @@ #define H5_SEC_PER_HOUR (60.0 * 60.0) #define H5_SEC_PER_MIN (60.0) -/******************/ -/* Local Typedefs */ -/******************/ - -/********************/ -/* Package Typedefs */ -/********************/ - -/********************/ -/* Local Prototypes */ -/********************/ - -/*********************/ -/* Package Variables */ -/*********************/ - -/*****************************/ -/* Library Private Variables */ -/*****************************/ - -/*******************/ -/* Local Variables */ -/*******************/ - /*------------------------------------------------------------------------- * Function: H5_bandwidth * @@ -86,7 +51,6 @@ * 6.678e+106 For really big values * * Return: void - * *------------------------------------------------------------------------- */ void @@ -130,8 +94,8 @@ H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds) snprintf(buf, bufsize, "%10.4e", bw); if (strlen(buf) > 10) snprintf(buf, bufsize, "%10.3e", bw); - } /* end else-if */ - } /* end else */ + } + } } /* end H5_bandwidth() */ /*------------------------------------------------------------------------- @@ -140,7 +104,6 @@ H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds) * Purpose: Retrieves the current time, as seconds after the UNIX epoch. * * Return: # of seconds from the epoch (can't fail) - * *------------------------------------------------------------------------- */ time_t @@ -155,11 +118,11 @@ H5_now(void) HDgettimeofday(&now_tv, NULL); now = now_tv.tv_sec; } -#else /* H5_HAVE_GETTIMEOFDAY */ +#else now = time(NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ +#endif - return (now); + return now; } /* end H5_now() */ /*------------------------------------------------------------------------- @@ -168,7 +131,6 @@ H5_now(void) * Purpose: Retrieves the current time, as microseconds after the UNIX epoch. * * Return: # of microseconds from the epoch (can't fail) - * *------------------------------------------------------------------------- */ uint64_t @@ -197,13 +159,13 @@ H5_now_usec(void) * calculations are done in 64 bit, to prevent overflow */ now = ((uint64_t)now_tv.tv_sec * ((uint64_t)1000 * (uint64_t)1000)) + (uint64_t)now_tv.tv_usec; } -#else /* H5_HAVE_GETTIMEOFDAY */ +#else /* Cast all values in this expression to uint64_t to ensure that all intermediate calculations * are done in 64 bit, to prevent overflow */ now = ((uint64_t)time(NULL) * ((uint64_t)1000 * (uint64_t)1000)); -#endif /* H5_HAVE_GETTIMEOFDAY */ +#endif - return (now); + return now; } /* end H5_now_usec() */ /*-------------------------------------------------------------------------- @@ -213,7 +175,6 @@ H5_now_usec(void) * * Return: Success: A non-negative time value * Failure: -1.0 (in theory, can't currently fail) - * *-------------------------------------------------------------------------- */ double @@ -252,13 +213,11 @@ H5_get_time(void) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ static herr_t H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) { - /* Sanity check */ assert(times); /* Windows call handles both system/user and elapsed times */ @@ -269,7 +228,7 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) times->user = -1.0; return -1; - } /* end if */ + } #else /* H5_HAVE_WIN32_API */ /************************* @@ -349,13 +308,11 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ herr_t H5_timer_init(H5_timer_t *timer /*in,out*/) { - /* Sanity check */ assert(timer); /* Initialize everything */ @@ -371,13 +328,11 @@ H5_timer_init(H5_timer_t *timer /*in,out*/) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ herr_t H5_timer_start(H5_timer_t *timer /*in,out*/) { - /* Sanity check */ assert(timer); /* Start the timer @@ -398,13 +353,11 @@ H5_timer_start(H5_timer_t *timer /*in,out*/) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/) { - /* Sanity check */ assert(timer); /* Stop the timer */ @@ -446,13 +399,11 @@ H5_timer_stop(H5_timer_t *timer /*in,out*/) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) { - /* Sanity check */ assert(times); if (timer.is_running) { @@ -467,12 +418,12 @@ H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) times->elapsed = now.elapsed - timer.initial.elapsed; times->system = now.system - timer.initial.system; times->user = now.user - timer.initial.user; - } /* end if */ + } else { times->elapsed = timer.final_interval.elapsed; times->system = timer.final_interval.system; times->user = timer.final_interval.user; - } /* end else */ + } return 0; } /* end H5_timer_get_times() */ @@ -498,13 +449,11 @@ H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) * * Return: Success: 0 * Failure: -1 - * *------------------------------------------------------------------------- */ herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) { - /* Sanity check */ assert(times); if (timer.is_running) { @@ -519,12 +468,12 @@ H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) times->elapsed = timer.total.elapsed + (now.elapsed - timer.initial.elapsed); times->system = timer.total.system + (now.system - timer.initial.system); times->user = timer.total.user + (now.user - timer.initial.user); - } /* end if */ + } else { times->elapsed = timer.total.elapsed; times->system = timer.total.system; times->user = timer.total.user; - } /* end else */ + } return 0; } /* end H5_timer_get_total_times() */ @@ -548,7 +497,6 @@ H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) * "%.f h %.f m %.f s" longer times * * Failure: NULL - * *------------------------------------------------------------------------- */ char * @@ -580,7 +528,7 @@ H5_timer_get_time_string(double seconds) remainder_sec -= (minutes * H5_SEC_PER_MIN); /* The # of seconds left is in remainder_sec */ - } /* end if */ + } /* Allocate */ if (NULL == (s = (char *)calloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) diff --git a/src/H5timer.h b/src/H5timer.h new file mode 100644 index 00000000000..459f55a9a51 --- /dev/null +++ b/src/H5timer.h @@ -0,0 +1,65 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * H5timer.h + * + * Internal, platform-independent 'timer' support routines + *------------------------------------------------------------------------- + */ + +#ifndef H5timer_H +#define H5timer_H + +#include +#include +#include + +/* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */ +#define H5_KB (1024.0F) +#define H5_MB (1024.0F * 1024.0F) +#define H5_GB (1024.0F * 1024.0F * 1024.0F) +#define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F) +#define H5_PB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) +#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) + +/* A set of elapsed/user/system times emitted as a time point by the + * platform-independent timers. + */ +typedef struct { + double user; /* User time in seconds */ + double system; /* System time in seconds */ + double elapsed; /* Elapsed (wall clock) time in seconds */ +} H5_timevals_t; + +/* Timer structure for platform-independent timers */ +typedef struct { + H5_timevals_t initial; /* Current interval start time */ + H5_timevals_t final_interval; /* Last interval elapsed time */ + H5_timevals_t total; /* Total elapsed time for all intervals */ + bool is_running; /* Whether timer is running */ +} H5_timer_t; + +/* Returns library bandwidth as a pretty string */ +H5_DLL void H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds); + +/* Timer functionality */ +H5_DLL time_t H5_now(void); +H5_DLL uint64_t H5_now_usec(void); +H5_DLL herr_t H5_timer_init(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_start(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); +H5_DLL herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); +H5_DLL char *H5_timer_get_time_string(double seconds); + +#endif /* H5timer_H */ From 610648efd2cc132b918b20fcececda02d05deed3 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 18 Oct 2024 11:03:42 -0500 Subject: [PATCH 08/10] The h5(p)*c parser retains escaped whitespace character (#4967) --- bin/h5cc.in | 4 ++++ c++/src/h5c++.in | 4 ++++ fortran/src/h5fc.in | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/bin/h5cc.in b/bin/h5cc.in index 9938c31f098..3e6f818ed60 100644 --- a/bin/h5cc.in +++ b/bin/h5cc.in @@ -263,6 +263,10 @@ for arg in $@ ; do qarg='"'"$arg"'"' qargs="$qargs $qarg" ;; + *\ *) + qarg=$arg + qargs="$qargs $qarg" + ;; *) if test -s "$arg"; then ext=`expr "$arg" : '.*\(\..*\)'` diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index 8830f3cd9a2..c031c9d69ca 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -253,6 +253,10 @@ for arg in $@ ; do qarg='"'"$arg"'"' qargs="$qargs $qarg" ;; + *\ *) + qarg=$arg + qargs="$qargs $qarg" + ;; *) if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index e0e35f5a1b8..562d56d2089 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -237,6 +237,10 @@ for arg in $@ ; do qarg='"'"$arg"'"' qargs="$qargs $qarg" ;; + *\ *) + qarg=$arg + qargs="$qargs $qarg" + ;; *) if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` From e12f51381d41edad49593ebfd5f3a64fa499fa26 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:21:43 -0700 Subject: [PATCH 09/10] Move warning suppression macros to H5warnings.h (#4972) --- src/CMakeLists.txt | 1 + src/H5FDmulti.c | 38 ++++------------------- src/H5private.h | 60 ++---------------------------------- src/H5warnings.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 89 deletions(-) create mode 100644 src/H5warnings.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b57e9bf27b5..5ce3b7cac18 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -864,6 +864,7 @@ set (H5_PUBLIC_HEADERS set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h ${HDF5_SRC_DIR}/H5timer.h + ${HDF5_SRC_DIR}/H5warnings.h ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 2838ed00bff..56ee7b1a198 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -24,6 +24,8 @@ #include "hdf5.h" +#include "H5warnings.h" + #ifndef false #define false 0 #endif @@ -40,34 +42,6 @@ #define my_strdup strdup #endif -/* Macros for enabling/disabling particular GCC / clang warnings - * - * These are duplicated in H5private.h. If you make changes here, be sure to - * update those as well. - * - * (see the following web-sites for more info: - * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html - * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas - */ -#define H5_MULTI_DIAG_JOINSTR(x, y) x y -#define H5_MULTI_DIAG_DO_PRAGMA(x) _Pragma(#x) -#define H5_MULTI_DIAG_PRAGMA(x) H5_MULTI_DIAG_DO_PRAGMA(GCC diagnostic x) - -#define H5_MULTI_DIAG_OFF(x) \ - H5_MULTI_DIAG_PRAGMA(push) H5_MULTI_DIAG_PRAGMA(ignored H5_MULTI_DIAG_JOINSTR("-W", x)) -#define H5_MULTI_DIAG_ON(x) H5_MULTI_DIAG_PRAGMA(pop) - -/* Macros for enabling/disabling particular GCC / clang warnings. - * These macros should be used for warnings supported by both gcc and clang. - */ -#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__) -#define H5_MULTI_GCC_CLANG_DIAG_OFF(x) H5_MULTI_DIAG_OFF(x) -#define H5_MULTI_GCC_CLANG_DIAG_ON(x) H5_MULTI_DIAG_ON(x) -#else -#define H5_MULTI_GCC_CLANG_DIAG_OFF(x) -#define H5_MULTI_GCC_CLANG_DIAG_ON(x) -#endif - /* Loop through all mapped files */ #define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \ { \ @@ -2032,7 +2006,7 @@ compute_next(H5FD_multi_t *file) * tmp in the code below, but early (4.4.7, at least) gcc only * allows diagnostic pragmas to be toggled outside of functions. */ -H5_MULTI_GCC_CLANG_DIAG_OFF("format-nonliteral") +H5_GCC_CLANG_DIAG_OFF("format-nonliteral") static int open_members(H5FD_multi_t *file) { @@ -2070,7 +2044,7 @@ open_members(H5FD_multi_t *file) return 0; } -H5_MULTI_GCC_CLANG_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: H5FD_multi_delete @@ -2081,7 +2055,7 @@ H5_MULTI_GCC_CLANG_DIAG_ON("format-nonliteral") * *------------------------------------------------------------------------- */ -H5_MULTI_GCC_CLANG_DIAG_OFF("format-nonliteral") +H5_GCC_CLANG_DIAG_OFF("format-nonliteral") static herr_t H5FD_multi_delete(const char *filename, hid_t fapl_id) { @@ -2135,7 +2109,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) return 0; } /* end H5FD_multi_delete() */ -H5_MULTI_GCC_CLANG_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: H5FD_multi_ctl diff --git a/src/H5private.h b/src/H5private.h index 42a6dccb22b..a7bab99c581 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -152,6 +152,9 @@ #endif /*H5_HAVE_WIN32_API*/ +/* Macros for suppressing warnings */ +#include "H5warnings.h" + #ifndef F_OK #define F_OK 00 #define W_OK 02 @@ -519,63 +522,6 @@ #define LOCK_UN 0x08 #endif /* H5_HAVE_FLOCK */ -/* Macros for enabling/disabling particular GCC / clang warnings - * - * These are duplicated in H5FDmulti.c (we don't want to put them in the - * public header and the multi VFD can't use private headers). If you make - * changes here, be sure to update those as well. - * - * (see the following web-sites for more info: - * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html - * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas - */ -#define H5_DIAG_JOINSTR(x, y) x y -#define H5_DIAG_DO_PRAGMA(x) _Pragma(#x) -#define H5_DIAG_PRAGMA(x) H5_DIAG_DO_PRAGMA(GCC diagnostic x) - -/* Allow suppression of compiler diagnostics unless H5_SHOW_ALL_WARNINGS is - * defined (enabled with '--enable-show-all-warnings' configure option). - */ -#ifndef H5_SHOW_ALL_WARNINGS -#define H5_DIAG_OFF(x) H5_DIAG_PRAGMA(push) H5_DIAG_PRAGMA(ignored H5_DIAG_JOINSTR("-W", x)) -#define H5_DIAG_ON(x) H5_DIAG_PRAGMA(pop) -#else -#define H5_DIAG_OFF(x) -#define H5_DIAG_ON(x) -#endif - -/* Macros for enabling/disabling particular GCC-only warnings. - * These pragmas are only implemented usefully in gcc 4.6+ - */ -#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) -#define H5_GCC_DIAG_OFF(x) H5_DIAG_OFF(x) -#define H5_GCC_DIAG_ON(x) H5_DIAG_ON(x) -#else -#define H5_GCC_DIAG_OFF(x) -#define H5_GCC_DIAG_ON(x) -#endif - -/* Macros for enabling/disabling particular clang-only warnings. - */ -#if defined(__clang__) -#define H5_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x) -#define H5_CLANG_DIAG_ON(x) H5_DIAG_ON(x) -#else -#define H5_CLANG_DIAG_OFF(x) -#define H5_CLANG_DIAG_ON(x) -#endif - -/* Macros for enabling/disabling particular GCC / clang warnings. - * These macros should be used for warnings supported by both gcc and clang. - */ -#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__) -#define H5_GCC_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x) -#define H5_GCC_CLANG_DIAG_ON(x) H5_DIAG_ON(x) -#else -#define H5_GCC_CLANG_DIAG_OFF(x) -#define H5_GCC_CLANG_DIAG_ON(x) -#endif - /* If necessary, create a typedef for library usage of the * _Float16 type to avoid issues when compiling the library * with the -pedantic flag or similar where we get warnings diff --git a/src/H5warnings.h b/src/H5warnings.h new file mode 100644 index 00000000000..ae0027ab629 --- /dev/null +++ b/src/H5warnings.h @@ -0,0 +1,77 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Macros for suppressing warnings + */ + +#ifndef H5warnings_H +#define H5warnings_H + +/* Macros for enabling/disabling particular GCC / clang warnings + * + * These are duplicated in H5FDmulti.c (we don't want to put them in the + * public header and the multi VFD can't use private headers). If you make + * changes here, be sure to update those as well. + * + * (see the following web-sites for more info: + * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html + * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas + */ +#define H5_DIAG_JOINSTR(x, y) x y +#define H5_DIAG_DO_PRAGMA(x) _Pragma(#x) +#define H5_DIAG_PRAGMA(x) H5_DIAG_DO_PRAGMA(GCC diagnostic x) + +/* Allow suppression of compiler diagnostics unless H5_SHOW_ALL_WARNINGS is + * defined (enabled with '--enable-show-all-warnings' configure option). + */ +#ifndef H5_SHOW_ALL_WARNINGS +#define H5_DIAG_OFF(x) H5_DIAG_PRAGMA(push) H5_DIAG_PRAGMA(ignored H5_DIAG_JOINSTR("-W", x)) +#define H5_DIAG_ON(x) H5_DIAG_PRAGMA(pop) +#else +#define H5_DIAG_OFF(x) +#define H5_DIAG_ON(x) +#endif + +/* Macros for enabling/disabling particular GCC-only warnings. + * These pragmas are only implemented usefully in gcc 4.6+ + */ +#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) +#define H5_GCC_DIAG_OFF(x) H5_DIAG_OFF(x) +#define H5_GCC_DIAG_ON(x) H5_DIAG_ON(x) +#else +#define H5_GCC_DIAG_OFF(x) +#define H5_GCC_DIAG_ON(x) +#endif + +/* Macros for enabling/disabling particular clang-only warnings. + */ +#if defined(__clang__) +#define H5_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x) +#define H5_CLANG_DIAG_ON(x) H5_DIAG_ON(x) +#else +#define H5_CLANG_DIAG_OFF(x) +#define H5_CLANG_DIAG_ON(x) +#endif + +/* Macros for enabling/disabling particular GCC / clang warnings. + * These macros should be used for warnings supported by both gcc and clang. + */ +#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__) +#define H5_GCC_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x) +#define H5_GCC_CLANG_DIAG_ON(x) H5_DIAG_ON(x) +#else +#define H5_GCC_CLANG_DIAG_OFF(x) +#define H5_GCC_CLANG_DIAG_ON(x) +#endif + +#endif /* H5warnings_H */ From 4a10a0607232ce26e5b6f93f6ca211374eddbc08 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:51:47 -0700 Subject: [PATCH 10/10] Switch HDoff_t from __int64 to int64_t on Windows (#4973) __int64 raises warnings when building with clang --- release_docs/RELEASE.txt | 2 +- src/H5public.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cf9b65cc086..3520e8a6d96 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -69,7 +69,7 @@ New Features POSIX large-file support (LFS). On Windows, however, off_t is defined as a 32-bit type, even on 64-bit Windows. - HDoff_t has been added to H5public.h and is defined to be __int64 on + HDoff_t has been added to H5public.h and is defined to be int64_t on Windows and the library has been updated to use HDoff_t in place of off_t throughout. The H5Pset_external() offset parameter has also been updated to be HDoff_t. diff --git a/src/H5public.h b/src/H5public.h index 460aca5f1e1..b50f4d4652c 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -301,14 +301,14 @@ typedef long long ssize_t; typedef uint64_t hsize_t; /* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows, - * so on Windows we define HDoff_t to be __int64, which is the type of the - * st_size field of the _stati64 struct. + * so on Windows we define HDoff_t to be int64_t, which is equivalent to __int64, + * the type of the st_size field of the _stati64 struct. */ #ifdef H5_HAVE_WIN32_API /** * Platform-independent offset */ -typedef __int64 HDoff_t; +typedef int64_t HDoff_t; #else /** * Platform-independent offset