diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-04-06 19:20:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 19:20:07 (GMT) |
commit | 30861588e0bd10aad25fd8a1eb249ec2ac3944d5 (patch) | |
tree | 910ae47e92fce1572b0085f4e48623b3f658d5a3 | |
parent | a2b6c477267ac97dbe077e722b7bb8ba2e2c8dfa (diff) | |
download | hdf5-30861588e0bd10aad25fd8a1eb249ec2ac3944d5.zip hdf5-30861588e0bd10aad25fd8a1eb249ec2ac3944d5.tar.gz hdf5-30861588e0bd10aad25fd8a1eb249ec2ac3944d5.tar.bz2 |
Hdf5 merge issue 537 v110 (#545)
* close #195. (#196)
* Update HDF5PluginMacros.cmake
* Update HDF5PluginMacros.cmake
* Modify temporary rpath for testing in java example scripts. (#230)
* Fix undefined left shifting of negative numbers (#338)
Undefined Bahavior Sanitizer errored here about left shifting negative numbers.
* Update license url (#332)
* Modify temporary rpath for testing in java example scripts.
* Update URL in source file Copyright headers for web copy of COPYING
file - src and test directories.
* Cleans up a couple of MSVC warnings in testhdf5 (#475)
* Fixes a few testhdf5 warnings raised in Visual Studio
Visual Studio is grumpier about treating pointers like integers than
gcc.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix typos and grammar errors. (#476)
* Suppresses the tcheck_version test's abort dialog on Windows (#477)
* Suppresses the tcheck_version test's abort dialog on Windows
Windows raises a modal abort/retry/ignore dialog box when CRT
calls abort(). This change installs a report hook that suppresses
the dialog so that the CMake tests don't time out waiting for a
nonexistent user to click a dialog box.
* Committing clang-format changes
* Removes __cdecl from callback
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* More warning fixes (#400)
* Fixed -Wunused-local-typedef warning
* Fixed -Wformat warnings
In one case also removed a `z` character. There was a `z%d` that I think was supposed to be `%zd`
* Fixed -Wshorten-64-to-32 warnings
* Fixed -Wself-assign warnings
* Fixed -Wreserved-id-macro warnings
* Commit format changes from clang-format, clang version 10.0.1.
* Fixed -Wself-assign warnings
* Fixed -Wunused-local-typedef warning
* Fixed -Wformat warnings
In two cases also removed a `z` character. There was a `z%d` that was supposed to be `%zd`.
* Fixed -Wshorten-64-to-32 warnings
* Fixed -Wreserved-id-macro warnings
* Fixed -Wself-assign warnings
* Format source.
* Remove blank lines to pass format check.
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
* Changes found during merge to 1.12 (#414)
* OESS-98 convert plugin option to FetchContent, add tests
* Fixes for pkcfg files because of plugin option
* OESS-98 fix tools test for plugins
* Keep doxygen comments under 100 chars long - format hint
* Whitespace
* HDFFV-11144 - Reclassify CMake messages
* HDFFV-11099/11100 added help text
* Reworked switch statement to compare string instead
* Fix typo
* Update CDash mode
* Correct name of threadsafe
* Correct option name
* Undo accidental commit
* Note LLVM 10 to 11 format default changes
* Update format plugin
* Undo clang-format version 11 changes
* One more correction
* Update supported platforms
* Revert whitespace changes
* Correct whitespace
* Changes from PR#3
* HDFFV-11213 added option to control gcc10 warnings diagnostics
* HDFFV-11212 Use the new references correctly in JNI utility and tests
* format source
* Fix typo
* Add new test file
* HDFFV-11212 - update test and remove unused arg
* Minor non-space formatting changes
* Use H5I_INVALID_ID instead of "-1"
* source formatting
* add missing testfile, update jni function
* Undo commit of debug code
* remove mislocated file
* Fix h5repack test for handling of fapls and id close
* Update h5diff test files usage text
* HDFFV-11212 add new ref tests for JNI export dataset
* src format update
* Remove blank line typo
* src format typo
* long double requires %Lg
* Another long double foramt specifer S.B. %Lg
* issue with t128bit test
* Windows issue with h5dump and type.
* Fix review issues
* refactor function nesting and fix error checks
* format fixes
* Remove untested functions and javadoc quiet comments
* Restore TRY block.
* Change string append errors to memory exception
* revert to H5_JNI_FATAL_ERROR - support functions need work
* Add assertion error for h5util functions
* remove duplicate function
* format fix
* Revert HD function error handling
* Update copyright comments
* GH #386 java folder copyright corrections
* Whitespace
* GH #359 implement and fix tools 1.6 API usage
* remove excessive comments
* Flip inits to correct ifdef section
* rework ifdef to be simpler
* format issue
* Reformat ifdef inits
* remove static attribute
* format compliance
* Update names
* Revert because logic relies on float not being int
* Changes noticed from creating merge of #412
* Double underscore change
* Correct compiler version variable used
* Remove header guard underscores
* Whitespace cleanup
* File locks now work on Windows (#480)
* File locks now work on Windows
Uses LockFileEx() and UnlockFileEx(). Fixes HDFFV-10191 (partial).
* Committing clang-format changes
* Committing clang-format changes
* Fixes commenting in h5repack
* Reworks H5Fis_accessible()
H5Fis_accessible() created a new file handle and attempted to read
through it, which will fail when a file has been opened with an
exclusive lock on operating systems that have mandatory locks.
This change uses the same scheme we use in H5Fopen() to check if
the file is already open and only tries to read the file signature
if the file has not already been opened.
Also adds a test for this behavior.
* Committing clang-format changes
* Trivial change to force github to run actions
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* small edits (#481)
* fixed missed closing of a dataset
* fixed missed closing of a dataset
* fixed typo in error return
* Committing clang-format changes
* minor edits
* code format
* Committing clang-format changes
* code format
* minor edit
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Adds an implementation for nanosleep on Windows (#483)
* Adds an implementation for nanosleep on Windows
* Committing clang-format changes
* Fix insane formatter issue
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Updates HSYS_GOTO_ERROR to emit GetLastError() values on Win32 (#492)
* Committing clang-format changes
* Updates H5SYS_GOTO_ERROR to emit Win32's GetLastError()
* Committing clang-format changes
* Format source changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Updates that allow accum SWMR tests to work on Windows (#493)
* Committing clang-format changes
* Updates the accum test to work on Windows
Uses CreateProcess() on Windows
* Source formatting
* Fix for Unix child result
* Fixes process return code bug on Windows
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Disable long double tests and remove CMake flag groups (#494)
* OESS-98 convert plugin option to FetchContent, add tests
* Fixes for pkcfg files because of plugin option
* OESS-98 fix tools test for plugins
* Keep doxygen comments under 100 chars long - format hint
* Whitespace
* HDFFV-11144 - Reclassify CMake messages
* HDFFV-11099/11100 added help text
* Reworked switch statement to compare string instead
* Fix typo
* Update CDash mode
* Correct name of threadsafe
* Correct option name
* Undo accidental commit
* Note LLVM 10 to 11 format default changes
* Update format plugin
* Undo clang-format version 11 changes
* One more correction
* Update supported platforms
* Revert whitespace changes
* Correct whitespace
* Changes from PR#3
* HDFFV-11213 added option to control gcc10 warnings diagnostics
* HDFFV-11212 Use the new references correctly in JNI utility and tests
* format source
* Fix typo
* Add new test file
* HDFFV-11212 - update test and remove unused arg
* Minor non-space formatting changes
* Use H5I_INVALID_ID instead of "-1"
* source formatting
* add missing testfile, update jni function
* Undo commit of debug code
* remove mislocated file
* Fix h5repack test for handling of fapls and id close
* Update h5diff test files usage text
* HDFFV-11212 add new ref tests for JNI export dataset
* src format update
* Remove blank line typo
* src format typo
* long double requires %Lg
* Another long double foramt specifer S.B. %Lg
* issue with t128bit test
* Windows issue with h5dump and type.
* Fix review issues
* refactor function nesting and fix error checks
* format fixes
* Remove untested functions and javadoc quiet comments
* Restore TRY block.
* Change string append errors to memory exception
* revert to H5_JNI_FATAL_ERROR - support functions need work
* Add assertion error for h5util functions
* remove duplicate function
* format fix
* Revert HD function error handling
* Update copyright comments
* GH #386 java folder copyright corrections
* Whitespace
* GH #359 implement and fix tools 1.6 API usage
* remove excessive comments
* Flip inits to correct ifdef section
* rework ifdef to be simpler
* format issue
* Reformat ifdef inits
* remove static attribute
* format compliance
* Update names
* Revert because logic relies on float not being int
* Changes noticed from creating merge of #412
* Double underscore change
* Correct compiler version variable used
* Remove header guard underscores
* Whitespace cleanup
* Split format source and commit changes on repo push
* remove pre-split setting
* Change windows TS to use older VS.
* correct window os name
* HDFFV-11212 JNI export util and Javadoc
* Suggested review changes
* Another change found
* Committing clang-format changes
* HDFFV-11113 long double in tools
* HDFFV-11113 add note
* Disable long double tests for now
* HDFFV-11228 remove arbitrary CMake warning groups.
* Make each flag a string
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Misc warning fixes (#495)
* Committing clang-format changes
* Misc warning fixes from Visual Studio
* Committing clang-format changes
* Fixes warnings in swmr.c test
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Correct merge errors.
* Committing clang-format changes
Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
Co-authored-by: Sean McBride <sean@rogue-research.com>
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
38 files changed, 490 insertions, 464 deletions
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index cb43c73..b84867b 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef AbstractDs_H -#define AbstractDs_H +#ifndef H5AbstractDs_H +#define H5AbstractDs_H namespace H5 { @@ -81,4 +81,4 @@ class H5_DLLCPP AbstractDs { }; // end of AbstractDs } // namespace H5 -#endif // AbstractDs_H +#endif // H5AbstractDs_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 368883b..d87f9ca 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef CommonFG_H -#define CommonFG_H +#ifndef H5CommonFG_H +#define H5CommonFG_H namespace H5 { @@ -83,7 +83,7 @@ class H5_DLLCPP CommonFG { }; // end of CommonFG } // namespace H5 -#endif // CommonFG_H +#endif // H5CommonFG_H /*************************************************************************** Design Note diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index fb9fbe7..b5f7e51 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef Group_H -#define Group_H +#ifndef H5Group_H +#define H5Group_H namespace H5 { @@ -83,4 +83,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { }; // end of Group } // namespace H5 -#endif // Group_H +#endif // H5Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 4f75849..383d42d 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef IdComponent_H -#define IdComponent_H +#ifndef H5IdComponent_H +#define H5IdComponent_H namespace H5 { @@ -113,4 +113,4 @@ class H5_DLLCPP IdComponent { }; // end class IdComponent } // namespace H5 -#endif // IdComponent_H +#endif // H5IdComponent_H diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index ce1eae9..7525c5f 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -81,7 +81,7 @@ test_array_compound_array() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -178,8 +178,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -196,8 +197,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -246,8 +248,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -262,9 +265,9 @@ test_array_compound_array() for (idxi = 0; idxi < SPACE1_DIM1; idxi++) { for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) { - TestErrPrintf( - "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", - idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); + TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, " + "rdata[%lld][%lld].i=%d\n", + idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); continue; } // end if } // end for @@ -383,7 +386,7 @@ test_array_info() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -455,7 +458,7 @@ test_array_info() for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 85a1484..228b787 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -169,8 +169,8 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Create two more attributes for this dataset, but only write to one. Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space); @@ -185,7 +185,7 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close both attributes @@ -448,8 +448,8 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Close attribute attr1.close(); @@ -472,7 +472,7 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close attribute @@ -537,7 +537,7 @@ test_attr_basic_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); /* @@ -568,9 +568,9 @@ test_attr_basic_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) { - TestErrPrintf( - "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); } PASSED(); } // end try block @@ -1044,7 +1044,7 @@ test_attr_mult_read() hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions int ndims = space.getSimpleExtentDims(dims); if ((long)dims[0] != (long)ATTR1_DIM1) - TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n", __LINE__, + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__, (int)dims[0], ATTR1_DIM1); /* Verify Datatype */ @@ -1072,8 +1072,8 @@ test_attr_mult_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Verify Name H5std_string attr_name = attr.getName(); @@ -1127,9 +1127,9 @@ test_attr_mult_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) - TestErrPrintf( - "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); // Verify Name attr_name = attr.getName(); @@ -1182,8 +1182,8 @@ test_attr_mult_read() for (j = 0; j < ATTR3_DIM2; j++) for (k = 0; k < ATTR3_DIM3; k++) if (attr_data3[i][j][k] != read_data3[i][j][k]) - TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, " - "read_data3[%d][%d][%d]=%f\n", + TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, " + "read_data3[%llu][%llu][%llu]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); // Verify Name diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 12dec20..757692c 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -91,8 +91,8 @@ if (NOT MSVC AND NOT MINGW) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CXXFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CXXFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CXXFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CXXFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED @@ -100,9 +100,9 @@ if (NOT MSVC AND NOT MINGW) # add the general CXX flags for g++ compiler versions 4.8 and above. ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") else () - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") endif () endif () elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -122,20 +122,20 @@ if (NOT MSVC AND NOT MINGW) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # list (APPEND H5_CXXFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") + # list (APPEND H5_CXXFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () @@ -144,41 +144,41 @@ if (NOT MSVC AND NOT MINGW) # we should approach them a bit cautiously... Only needed for gcc 4.X if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () # Append more extra warning flags that only gcc 4.8+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") endif () # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") else () - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") endif () endif () # Append more extra warning flags that only gcc 6.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about @@ -187,34 +187,34 @@ if (NOT MSVC AND NOT MINGW) ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () - # ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") #if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") #else () - # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") #endif () if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") endif () endif () else () @@ -232,97 +232,17 @@ if (HDF5_ENABLE_ALL_WARNINGS) if (HDF5_ENABLE_DEV_WARNINGS) if (CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall" "/wd4668") endif () else () if (CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127") endif () endif () else () if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPZERO_WARNINGS) - message (STATUS "....Group Zero warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPONE_WARNINGS) - message (STATUS "....Group One warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS1}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPTWO_WARNINGS) - message (STATUS "....Group Two warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS2}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPTHREE_WARNINGS) - message (STATUS "....Group Three warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS3}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPFOUR_WARNINGS) - message (STATUS "....Group Four warnings are enabled") - if (NOT MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS4}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS}) endif () endif () endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index bce906d..add40bb 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -15,6 +15,7 @@ set(CMAKE_C_STANDARD_REQUIRED TRUE) set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_SANITIZER_FLAGS} ${CMAKE_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Warnings Configuration: default: ${CMAKE_C_FLAGS} : ${CMAKE_CXX_FLAGS}") endif () @@ -111,34 +112,34 @@ if (NOT MSVC AND NOT MINGW) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_C_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") - list (APPEND H5_CFLAGS0 "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") - list (APPEND H5_CFLAGS0 "-Wreturn-type -Wstrict-prototypes -Wuninitialized") - list (APPEND H5_CFLAGS0 "-Wunknown-pragmas -Wunused-function -Wunused-variable") + list (APPEND H5_CFLAGS "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + list (APPEND H5_CFLAGS "-Wreturn-type -Wstrict-prototypes -Wuninitialized") + list (APPEND H5_CFLAGS "-Wunknown-pragmas -Wunused-function -Wunused-variable") # this is just a failsafe - list (APPEND H5_CFLAGS0 "-finline-functions") + list (APPEND H5_CFLAGS "-finline-functions") if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Add general CFlags for GCC versions 4.8 and above if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") else () - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") endif () endif () # gcc automatically inlines based on the optimization level # this is just a failsafe - list (APPEND H5_CFLAGS0 "-finline-functions") + list (APPEND H5_CFLAGS "-finline-functions") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") else () - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") endif () elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") @@ -156,17 +157,17 @@ if (NOT MSVC AND NOT MINGW) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") + list (APPEND H5_CFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () @@ -174,65 +175,79 @@ if (NOT MSVC AND NOT MINGW) # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... Only needed for gcc 4.X if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () # Append more extra warning flags that only gcc 4.8+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") endif () # Append more extra warning flags that only gcc 5.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") else () - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") endif () endif () # Append more extra warning flags that only gcc 6.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () - # ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") endif () if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + endif () + + # Append more extra warning flags that only gcc 9.3+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") + endif () + + # Append more extra warning flags that only gcc 10.x+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") + endif () endif () endif () endif () @@ -240,86 +255,19 @@ endif () #----------------------------------------------------------------------------- # Option to allow the user to enable all warnings #----------------------------------------------------------------------------- -option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) +option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" ON) if (HDF5_ENABLE_ALL_WARNINGS) message (STATUS "....All Warnings are enabled") if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668") + list (APPEND HDF5_CMAKE_C_FLAGS "/Wall" "/wd4668") else () string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W3") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127") endif () else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) -if (HDF5_ENABLE_GROUPZERO_WARNINGS) - message (STATUS "....Group Zero warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W1") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) -if (HDF5_ENABLE_GROUPONE_WARNINGS) - message (STATUS "....Group One warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W2") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) -if (HDF5_ENABLE_GROUPTWO_WARNINGS) - message (STATUS "....Group Two warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W3") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) -if (HDF5_ENABLE_GROUPTHREE_WARNINGS) - message (STATUS "....Group Three warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W4") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) -if (HDF5_ENABLE_GROUPFOUR_WARNINGS) - message (STATUS "....Group Four warnings are enabled") - if (NOT MSVC) - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS}) endif () endif () diff --git a/doc/contributing.md b/doc/contributing.md index 3f738c8..7f9e8d3 100644 --- a/doc/contributing.md +++ b/doc/contributing.md @@ -1,12 +1,12 @@ -# How to contribute to HDF5 (Draft) +# How to contribute to HDF5 -The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any type of contributions -from small typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process simple and enjoyable. +The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any contributions, +from minor typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process enjoyable and straightforward. This document describes guiding principles for the HDF5 code contributors and does not pretend to address any possible contribution. If in doubt, please do not hesitate to ask us for guidance. ***Note that no contribution may be accepted unless the donor agrees with the HDF Group software license terms -found in the COPYING file in the top source directory of every branch.*** +found in the COPYING file in every branch's top source directory.*** > We will assume that you are familiar with `git` and `GitHub`. If not, you may go through the GitHub tutorial found at [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/). This tutorial should only take around 10 minutes. @@ -14,7 +14,7 @@ found in the COPYING file in the top source directory of every branch.*** ## Table of Contents * [Workflow](#workflow) -* [Acceptance criteria for pull request](#criteria) +* [Acceptance criteria for a pull request](#criteria) * [Check List](#checklist) # Workflow <A NAME="workflow"></A> @@ -27,36 +27,35 @@ The process for contributing code to HDF5 is as follows: * Fork the [HDF5](https://github.com/HDFGroup/hdf5) repository. * Make the desired changes to the HDF5 software. - * New features should always go to develop branch first and later should be merged to the appropriate maintenance branches. - * Bug fixes should go to all appropriate branches (develop and maintenance). -* Build and test your changes. Detailed instructions on how to build and test HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. + * New features should always go to _develop_ branch first and later should be merged to the appropriate maintenance branches. + * Bug fixes should go to all appropriate branches (_develop_ and maintenance). +* Build and test your changes. Detailed instructions on building and testing HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. * Push your changes to GitHub. * Issue a pull request and address any code formatting and testing issues reported. -Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests.. -The HDF Group developers will work with you to assure that the pull request satisfies acceptance criteria described in the next section. +Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests. +The HDF Group developers will work with you to ensure that the pull request satisfies the acceptance criteria described in the next section. -# Acceptance criteria for pull request <A NAME="criteria"></A> +# Acceptance criteria for a pull request <A NAME="criteria"></A> -We appreciate every contribution we receive, but we may not accept them all. Those that we *do* accept satisfy the following criteria: +We appreciate every contribution we receive, but we may not accept them all. Those that we *do* satisfy the following criteria: * **The pull request has a clear purpose** - What does the pull request address? How does it benefit the HDF5 community? -If the pull request does not have a clear purpose and benefits it will not be accepted. +If the pull request does not have a clear purpose and benefits, it will not be accepted. * **The pull request is documented** - The HDF5 developers must understand not only *what* a change is doing, but *how* it is doing it. - Documenting the code makes it easier for us to understand your patch and will help to maintaine the code in the future. + Documenting the code makes it easier for us to understand your patch and maintain the code in the future. * **The pull request passes HDF5 regression testing** - Any issue fixed or functionality added should be accompanied by the corresponding tests and pass HDF5 regression testing run by The HDF Group. We do not expect you to perform comprehensive testing across multiple platforms -before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will i -work with you on the fixes. +before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will work with you on the fixes. * **The pull request does not compromise the principles behind HDF5** - HDF5 has a 100% commitment to backward compatibility. * Any file ever created with HDF5 must be readable by any future version of HDF5. - If the purpose of your patch is to modify HDF5 data model or file format, + If your patch's purpose is to modify the HDF5 data model or file format, **please** discuss this with us first. File format changes and features required by those changes can be introduced only in a new major release. * HDF5 has a commitment to remaining *machine-independent*; data created on one platform/environment/architecture **must** remain readable by HDF5 on any other. - * For binary compatibility no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. + * For binary compatibility, no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. * **New features are documented** - Any new features should have proper documentation; talk to us if you have any questions. @@ -68,7 +67,7 @@ Please make sure that you check the items applicable to your pull request: * Code * [ ] Does the pull request have a corresponding GitHub issue and clear purpose? * [ ] Does the pull request follow HDF5 best practices (naming conventions, code portability, code structure, etc.)? <<TODO: link to the document>> - * [ ] If changes were done to autotools build were they added to CMake and vice versa? + * [ ] If changes were done to Autotools build, were they added to CMake and vice versa? * [ ] Is the pull request applicable to any other branches? If yes, which ones? Please document it in the GitHub issue. * [ ] Is the new code sufficiently documented for future maintenance? * [ ] Does the new feature require a change to an existing API? See "API Compatibility Macros" document (https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros) @@ -79,7 +78,7 @@ Please make sure that you check the items applicable to your pull request: * [ ] Was new functionality documented for the HDF5 community (the level of documentation depends on the feature; ask us what would be appropriate) * Testing * [ ] Does the pull request have tests? - * [ ] Does the pull request affect HDF5 library perfromance? + * [ ] Does the pull request affect HDF5 library performance? We want as many contributions as we can get, and we are here to help. Feel free to reach out to us if you have any questions diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index cba9a8a..4dbe71e 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -232,7 +232,7 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata) float * float_array; /* Pointer to the array attribute. */ /* avoid warnings */ - opdata = opdata; + (void)opdata; /* * Open the attribute using its name. diff --git a/examples/h5_group.c b/examples/h5_group.c index 59b0422..45b3330 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -171,9 +171,9 @@ static herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) { /* avoid compiler warnings */ - loc_id = loc_id; - opdata = opdata; - linfo = linfo; + (void)loc_id; + (void)opdata; + (void)linfo; /* * Display group name. The name is passed to the function by @@ -198,8 +198,8 @@ group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata int rank_chunk; /* avoid warnings */ - opdata = opdata; - linfo = linfo; + (void)opdata; + (void)linfo; /* * Open the datasets using their names. diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 2b56ec0..2600367 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -619,11 +619,11 @@ TestHDFFV_9758() s1_t s1[NUM_PACKETS]; for (hsize_t i = 0; i < NUM_PACKETS; i++) { - s1[i].a = i; + s1[i].a = static_cast<int>(i); s1[i].b = 1.f * static_cast<float>(i * i); s1[i].c = 1. / (i + 1); HDsprintf(s1[i].d, "string%d", (int)i); - s1[i].e = 100 + i; + s1[i].e = static_cast<int>(100 + i); } printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)"); diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 310d665..ff10d57 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -169,6 +169,11 @@ find_palette(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const if (name == NULL) return -1; + /* Shut compiler up */ + (void)loc_id; + (void)ainfo; + (void)op_data; + /* Define a positive value for return value if the attribute was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0288ac6..45cf317 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1312,6 +1312,10 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const if (name == NULL) return ret; + /* Shut the compiler up */ + (void)loc_id; + (void)linfo; + /* Define a positive value for return value if the dataset was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success @@ -1850,6 +1854,10 @@ find_attr(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const H5 if (name == NULL) return H5_ITER_CONT; + /* Shut compiler up */ + (void)loc_id; + (void)ainfo; + /* Define a positive value for return value if the attribute was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 941b44a..ead5c65 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -3554,9 +3554,9 @@ verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) int ret = 0; /* unused */ - dset = dset; - dim = dim; - visitor_data = visitor_data; + (void)dset; + (void)dim; + (void)visitor_data; /* define a positive value for return value. This will cause the iterator to immediately return that positive value, indicating short-circuit success @@ -3602,8 +3602,8 @@ read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) char * data = (char *)visitor_data; /* unused */ - dset = dset; - dim = dim; + (void)dset; + (void)dim; /* get space */ if ((sid = H5Dget_space(scale_id)) < 0) @@ -3691,7 +3691,7 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data) hsize_t storage_size; /* Stop compiler from whining about "unused parameters" */ - visitor_data = visitor_data; + (void)visitor_data; /*------------------------------------------------------------------------- * get DID (dataset) space info @@ -3769,9 +3769,9 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* Stop compiler from whining about "unused parameters" */ - dset = dset; - dim = dim; - scale_id = scale_id; + (void)dset; + (void)dim; + (void)scale_id; if (visitor_data != NULL) { (*(int *)visitor_data)++; @@ -3802,9 +3802,9 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* Stop compiler from whining about "unused parameters" */ - dset = dset; - dim = dim; - scale_id = scale_id; + (void)dset; + (void)dim; + (void)scale_id; if (visitor_data != NULL) { (*(int *)visitor_data)++; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f03b1be..e063506 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -201,6 +201,49 @@ New Features Library: -------- + - HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows + + HSYS_GOTO_ERROR is an internal macro that is used to produce error + messages when system calls fail. These strings include errno and the + the associated strerror() value, which are not particularly useful + when a Win32 API call fails. + + On Windows, this macro has been updated to include the result of + GetLastError(). When a system call fails on Windows, usually only + one of errno and GetLastError() will be useful, however we emit both + for the user to parse. The Windows error message is not emitted as + it would be awkward to free the FormatMessage() buffer given the + existing HDF5 error framework. Users will have to look up the error + codes in MSDN. + + The format string on Windows has been changed from: + + "%s, errno = %d, error message = '%s'" + + to: + + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %"PRIu32"" + + for those inclined to parse it for error values. + + (DER - 2021/03/21) + + - File locking now works on Windows + + Since version 1.10.0, the HDF5 library has used a file locking scheme + to help enforce one reader at a time accessing an HDF5 file, which can + be helpful when setting up readers and writers to use the single- + writer/multiple-readers (SWMR) access pattern. + + In the past, this was only functional on POSIX systems where flock() or + fcntl() were present. Windows used a no-op stub that always succeeded. + + HDF5 now uses LockFileEx() and UnlockFileEx() to lock the file using the + same scheme as POSIX systems. We lock the entire file when we set up the + locks (by passing DWORDMAX as both size parameters to LockFileEx()). + + (DER - 2021/03/19, HDFFV-10191) + - H5Epush_ret() now requires a trailing semicolon H5Epush_ret() is a function-like macro that has been changed to @@ -319,6 +362,19 @@ Bug Fixes since HDF5-1.10.7 release Configuration ------------- + - Remove arbitrary warning flag groups from CMake builds + + The arbitrary groups were created to reduce the quantity of warnings being + reported that overwhelmed testing report systems. Considerable work has + been accomplished to reduce the warning count and these arbitrary groups + are no longer needed. + Also the default for all warnings, HDF5_ENABLE_ALL_WARNINGS, is now ON. + + Visual Studio warnings C4100, C4706, and C4127 have been moved to + developer warnings, HDF5_ENABLE_DEV_WARNINGS, and are disabled for normal builds. + + (ADB - 2021/03/22, HDFFV-11228) + - Reclassify CMake messages, to allow new modes and --log-level option CMake message commands have a mode argument. By default, STATUS mode diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 58010a3..c3c440f 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -111,6 +111,7 @@ typedef struct H5E_t H5E_t; /* Retrieve the error code description string and push it onto the error * stack. */ +#ifndef H5_HAVE_WIN32_API #define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \ { \ int myerrno = errno; \ @@ -129,6 +130,35 @@ typedef struct H5E_t H5E_t; HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \ HDstrerror(myerrno)); \ } +#else /* H5_HAVE_WIN32_API */ +/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a + * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will + * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero, + * though I wouldn't count on that. + */ +#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \ + { \ + int myerrno = errno; \ + DWORD win_error = GetLastError(); \ + /* Other projects may rely on the description format to get the errno and any changes should be \ + * considered as an API change \ + */ \ + HDONE_ERROR(majorcode, minorcode, retcode, \ + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ + myerrno, HDstrerror(myerrno), win_error); \ + } +#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \ + { \ + int myerrno = errno; \ + DWORD win_error = GetLastError(); \ + /* Other projects may rely on the description format to get the errno and any changes should be \ + * considered as an API change \ + */ \ + HGOTO_ERROR(majorcode, minorcode, retcode, \ + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ + myerrno, HDstrerror(myerrno), win_error); \ + } +#endif /* H5_HAVE_WIN32_API */ #ifdef H5_HAVE_PARALLEL /* diff --git a/src/H5Fint.c b/src/H5Fint.c index 9ddd3d7..c8e2cad 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -918,9 +918,10 @@ done: htri_t H5F__is_hdf5(const char *name) { - H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t * file = NULL; /* Low-level file struct */ + H5F_shared_t *shared = NULL; /* Shared part of file */ + haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -928,10 +929,20 @@ H5F__is_hdf5(const char *name) if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file") - /* The file is an hdf5 file if the hdf5 file signature can be found */ - if (H5FD_locate_signature(file, &sig_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") - ret_value = (HADDR_UNDEF != sig_addr); + /* If the file is already open, it's an HDF5 file + * + * If the file is open with an exclusive lock on an operating system that enforces + * mandatory file locks (like Windows), creating a new file handle and attempting + * to read through it will fail so we have to try this first. + */ + if ((shared = H5F__sfile_search(file)) != NULL) + ret_value = TRUE; + else { + /* The file is an HDF5 file if the HDF5 file signature can be found */ + if (H5FD_locate_signature(file, &sig_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") + ret_value = (HADDR_UNDEF != sig_addr); + } done: /* Close the file */ @@ -1603,7 +1614,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) FUNC_ENTER_NOAPI(NULL) /* - * If the driver has a `cmp' method then the driver is capable of + * If the driver has a 'cmp' method then the driver is capable of * determining when two file handles refer to the same file and the * library can insure that when the application opens a file twice * that the two handles coordinate their operations appropriately. @@ -3546,10 +3557,17 @@ H5F__start_swmr_write(H5F_t *f) setup = TRUE; /* Place an advisory lock on the file */ - if (H5F_USE_FILE_LOCKING(f)) + if (H5F_USE_FILE_LOCKING(f)) { + /* Have to unlock on Windows as Win32 doesn't support changing the lock + * type (exclusive vs shared) with a second call. + */ + if (H5FD_unlock(f->shared->lf) < 0) { + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + } if (H5FD_lock(f->shared->lf, TRUE) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") } + } /* Mark superblock as dirty */ if (H5F_super_dirty(f) < 0) diff --git a/src/H5system.c b/src/H5system.c index 26054e7..99a6f4d 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -924,8 +924,8 @@ Wgetlogin(void) { #ifdef H5_HAVE_WINSOCK2_H - long bufferCount = WloginBuffer_count; - if (GetUserName(Wlogin_buffer, &bufferCount) == 0) + DWORD bufferCount = WloginBuffer_count; + if (GetUserName(Wlogin_buffer, &bufferCount) != 0) return (Wlogin_buffer); else #endif /* H5_HAVE_WINSOCK2_H */ @@ -969,61 +969,45 @@ c99_vsnprintf(char *str, size_t size, const char *format, va_list ap) *------------------------------------------------------------------------- */ int -Wflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) +Wflock(int fd, int operation) { -/* This is a no-op while we implement a Win32 VFD */ -#if 0 -int -Wflock(int fd, int operation) { - - HANDLE hFile; - DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; - DWORD dwReserved = 0; - /* MAXDWORD for entire file */ - DWORD nNumberOfBytesToLockLow = MAXDWORD; - DWORD nNumberOfBytesToLockHigh = MAXDWORD; - /* Must initialize OVERLAPPED struct */ - OVERLAPPED overlapped = {0}; + HANDLE hFile; + DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; + DWORD dwReserved = 0; + /* MAXDWORD locks the entire file */ + DWORD nNumberOfBytesToLockLow = MAXDWORD; + DWORD nNumberOfBytesToLockHigh = MAXDWORD; + /* Must initialize OVERLAPPED struct */ + OVERLAPPED overlapped = {0}; /* Get Windows HANDLE */ - hFile = _get_osfhandle(fd); + if (INVALID_HANDLE_VALUE == (hFile = (HANDLE)_get_osfhandle(fd))) + return -1; /* Convert to Windows flags */ - if(operation & LOCK_EX) + if (operation & LOCK_EX) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; /* Lock or unlock */ - if(operation & LOCK_UN) - if(0 == UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, - nNumberOfBytesToLockHigh, &overlapped)) - return -1; - else - if(0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, - nNumberOfBytesToLockHigh, &overlapped)) + if (operation & LOCK_UN) { + if (0 == + UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &overlapped)) { + /* Attempting to unlock an already unlocked file will fail and this can happen + * in H5Fstart_swmr_write(). For now, just ignore the "error" (error code: 0x9e / 158). + */ + if (GetLastError() != 158) + return -1; + } + } + else { + if (0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, + &overlapped)) return -1; -#endif /* 0 */ - return 0; -} /* end Wflock() */ + } -/*-------------------------------------------------------------------------- - * Function: Wnanosleep - * - * Purpose: Sleep for a given # of nanoseconds (Windows version) - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * Fall 2016 - *-------------------------------------------------------------------------- - */ -int -Wnanosleep(const struct timespec *req, struct timespec *rem) -{ - /* XXX: Currently just a placeholder */ return 0; - -} /* end Wnanosleep() */ +} /* end Wflock() */ /*------------------------------------------------------------------------- * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf @@ -1403,6 +1387,9 @@ done: * * Purpose: Sleep for a given # of nanoseconds * + * Note that commodity hardware is probably going to have a + * resolution of milliseconds, not nanoseconds. + * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol @@ -1412,15 +1399,26 @@ done: void H5_nanosleep(uint64_t nanosec) { - struct timespec sleeptime; /* Struct to hold time to sleep */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Set up time to sleep */ - sleeptime.tv_sec = 0; - sleeptime.tv_nsec = (long)nanosec; +#ifdef H5_HAVE_WIN32_API + + /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep() + * causes the thread to relinquish the rest of its time slice. + */ + Sleep(nanosec / (1000 * 1000)); + +#else + { + struct timespec sleeptime; /* Struct to hold time to sleep */ + + /* Set up time to sleep */ + sleeptime.tv_sec = 0; + sleeptime.tv_nsec = (long)nanosec; - HDnanosleep(&sleeptime, NULL); + HDnanosleep(&sleeptime, NULL); + } +#endif FUNC_LEAVE_NOAPI_VOID } /* end H5_nanosleep() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 8f3947a..9cd0afb 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -174,7 +174,6 @@ H5_DLL int Wflock(int fd, int operation); H5_DLL char * Wgetlogin(void); H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); -H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL wchar_t *H5_get_utf16_str(const char *s); H5_DLL int Wopen_utf8(const char *path, int oflag, ...); diff --git a/test/accum.c b/test/accum.c index 3658879..330c656 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2066,13 +2066,14 @@ error: /*------------------------------------------------------------------------- * Function: test_swmr_write_big * - * Purpose: A SWMR test: verifies that writing "large" metadata to a file - * opened with SWMR_WRITE will flush the existing metadata in the - * accumulator to disk first before writing the "large" metadata - * to disk. - * This test will fork and exec a reader "accum_swmr_reader" which - * opens the same file with SWMR_READ and verifies that the correct - * metadata is read from disk. + * Purpose: A SWMR test: verifies that writing "large" metadata to a file + * opened with SWMR_WRITE will flush the existing metadata in the + * accumulator to disk first before writing the "large" metadata + * to disk. + * + * This test will fork and exec a reader "accum_swmr_reader" which + * opens the same file with SWMR_READ and verifies that the correct + * metadata is read from disk. * * Return: Success: 0 * Failure: 1 @@ -2292,6 +2293,7 @@ test_swmr_write_big(hbool_t newest_format) FAIL_STACK_ERROR; /* Pop API context */ + if (api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; diff --git a/test/cache.c b/test/cache.c index 92cc50d..cd7826e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -27275,7 +27275,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) /* Fill out the rest of the cache with entries */ /* Verify expected status of entries after each insertion */ - for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + for (; entry_idx < 50; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -27409,7 +27409,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) * After each insertion, verify the expected status of the * entries in the cache. */ - for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + for (; entry_idx < 100; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -33221,7 +33221,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) /* Fill out the rest of the cache with entries */ /* Verify expected status of entries after each insertion */ - for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + for (; entry_idx < 50; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -33282,7 +33282,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) if (pass) { /* Insert 50 more entries (indices 50-99) into the cache. */ - for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + for (; entry_idx < 100; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ diff --git a/test/dtypes.c b/test/dtypes.c index e342f03..383361b 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1482,7 +1482,7 @@ test_compound_8(void) int b; } s1; - typedef struct s2 { + struct s2 { char c; s1 d; } s2; diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index 8f57121..d2011d4 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -73,7 +73,7 @@ mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_valu return 0; /* Assignment to eliminate unused parameter warning */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /* READ - Divide the original value by MULTIPLIER */ diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index eeec269..630dcd6 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -74,7 +74,7 @@ append_to_group_name(unsigned int flags, size_t cd_nelmts, const unsigned int *c return 0; /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /* READ - Remove the suffix from the group name */ diff --git a/test/swmr.c b/test/swmr.c index 0764ae4..9a6fee4 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -846,14 +846,17 @@ error: static int test_metadata_read_retry_info(hid_t in_fapl) { - hid_t fapl, new_fapl; /* File access property list */ - hid_t fid, fid1; /* File IDs */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ H5F_retry_info_t info, info1; /* The collection of metadata retries */ H5F_t * f = NULL, *f1 = NULL; /* Internal file object pointers */ unsigned i, j, n; /* Local index variables */ - hid_t did1, did2; /* Dataset IDs */ - hid_t sid; /* Dataspace ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t did1 = H5I_INVALID_HID; /* Dataset ID */ + hid_t did2 = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {6, 10}; /* Dataset dimensions */ char filename[NAME_BUF_SIZE]; /* File name */ int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */ @@ -1622,7 +1625,7 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR /* Should be 100 */ - if (attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS)) + if (attempts != (unsigned int)(new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS)) TEST_ERROR; /* Close the property list */ @@ -4498,8 +4501,9 @@ error: static int test_file_lock_swmr_same(hid_t in_fapl) { - hid_t fid, fid2; /* File IDs */ - hid_t fapl; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File IDs */ + hid_t fid2 = H5I_INVALID_HID; + hid_t fapl = H5I_INVALID_HID; /* File access property list */ char filename[NAME_BUF_SIZE]; /* file name */ /* Output message about test being performed */ @@ -6557,10 +6561,18 @@ error: static int test_bug_refresh(hid_t in_fapl) { - hid_t fid = -1; /* File ID */ - hid_t fapl; + hid_t fid = H5I_INVALID_HID; + hid_t fapl = H5I_INVALID_HID; H5F_t *f; - hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; + hid_t gid4 = H5I_INVALID_HID; + hid_t gid5 = H5I_INVALID_HID; + hid_t gid6 = H5I_INVALID_HID; + hid_t gid7 = H5I_INVALID_HID; + hid_t gid8 = H5I_INVALID_HID; + hid_t gid9 = H5I_INVALID_HID; char filename[NAME_BUF_SIZE]; /* File name */ /* Create a copy of the input parameter in_fapl */ diff --git a/test/tarray.c b/test/tarray.c index 4fa4d1d..59a38a8 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -157,8 +157,8 @@ test_array_atomic_1d(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -490,8 +490,8 @@ test_array_array_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims1; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -668,8 +668,8 @@ test_array_compound_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -889,8 +889,8 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -951,8 +951,9 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Nested array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1209,8 +1210,8 @@ test_array_vlen_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1439,8 +1440,8 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1471,8 +1472,8 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2080,8 +2081,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2127,8 +2129,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ diff --git a/test/tfile.c b/test/tfile.c index 250fced..2b7ada1 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5486,7 +5486,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n /* Get the internal file pointer if the create succeeds */ if (fid >= 0) { f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); } /* Retrieve the low/high bounds */ @@ -5660,7 +5660,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* The file's superblock version */ super_vers = f->shared->sblock->super_vers; @@ -5701,7 +5701,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non /* Get the internal file pointer if the open succeeds */ if (fid >= 0) { f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); } /* Verify the file open succeeds or fails */ @@ -5878,7 +5878,7 @@ test_libver_bounds_obj(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* Create a group in the file */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -5986,7 +5986,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal dataset pointer */ dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + CHECK_PTR(dset, "H5I_object"); /* Verify version for layout and fill value messages */ if (low == H5F_LIBVER_EARLIEST) { @@ -6034,7 +6034,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal dataset pointer */ dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + CHECK_PTR(dset, "H5I_object"); /* Verify layout message version and chunk indexing type */ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_4, "H5O_layout_ver_bounds"); @@ -6096,7 +6096,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6104,7 +6104,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal file pointer */ dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + CHECK_PTR(dset, "H5I_object"); /* Verify the dataset's layout, fill value and filter pipeline message versions */ /* Also verify the chunk indexing type */ @@ -6225,7 +6225,7 @@ test_libver_bounds_dataspace(hid_t fapl) sid = H5Dget_space(did); CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); space = (H5S_t *)H5I_object(sid); - CHECK(space, NULL, "H5I_object"); + CHECK_PTR(space, "H5I_object"); /* Verify the dataspace version */ VERIFY(space->extent.version, H5O_sdspace_ver_bounds[low], "H5O_sdspace_ver_bounds"); @@ -6242,7 +6242,7 @@ test_libver_bounds_dataspace(hid_t fapl) sid_null = H5Dget_space(did_null); CHECK(sid_null, H5I_INVALID_HID, "H5Dget_space"); space_null = (H5S_t *)H5I_object(sid_null); - CHECK(space_null, NULL, "H5I_object"); + CHECK_PTR(space_null, "H5I_object"); /* Verify the dataspace version */ VERIFY(space_null->extent.version, H5O_SDSPACE_VERSION_2, "H5O_sdspace_ver_bounds"); @@ -6320,7 +6320,7 @@ test_libver_bounds_dataspace(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6330,7 +6330,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid = H5Dget_space(did); CHECK(tmp_sid, H5I_INVALID_HID, "H5Dget_space"); tmp_space = (H5S_t *)H5I_object(tmp_sid); - CHECK(tmp_space, NULL, "H5I_object"); + CHECK_PTR(tmp_space, "H5I_object"); /* Create the compact dataset */ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, @@ -6341,7 +6341,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid_compact = H5Dget_space(did_compact); CHECK(tmp_sid_compact, H5I_INVALID_HID, "H5Dget_space"); tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact); - CHECK(tmp_space_compact, NULL, "H5I_object"); + CHECK_PTR(tmp_space_compact, "H5I_object"); /* Create the contiguous dataset */ did_contig = @@ -6352,7 +6352,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid_contig = H5Dget_space(did_contig); CHECK(tmp_sid_contig, H5I_INVALID_HID, "H5Dget_space"); tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig); - CHECK(tmp_space_contig, NULL, "H5I_object"); + CHECK_PTR(tmp_space_contig, "H5I_object"); /* Verify versions for the three dataspaces */ VERIFY(tmp_space->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], @@ -6576,7 +6576,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); - CHECK(dtype, NULL, "H5I_object"); + CHECK_PTR(dtype, "H5I_object"); /* Verify the datatype message version */ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY: @@ -6650,13 +6650,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* Open the committed datatype */ str_tid = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(str_tid, FAIL, "H5Topen2"); str_dtype = (H5T_t *)H5I_object(str_tid); - CHECK(str_dtype, NULL, "H5I_object"); + CHECK_PTR(str_dtype, "H5I_object"); /* Verify the committed datatype message version */ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], @@ -6676,7 +6676,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); - CHECK(dtype, NULL, "H5I_object"); + CHECK_PTR(dtype, "H5I_object"); /* Verify the dataset's datatype message version */ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY: @@ -6809,7 +6809,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + CHECK_PTR(attr, "H5I_object"); /* Verify the attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -6828,7 +6828,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + CHECK_PTR(attr, "H5I_object"); /* Verify attribute version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds"); @@ -6849,7 +6849,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + CHECK_PTR(attr, "H5I_object"); /* Verify attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -6914,7 +6914,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + CHECK_PTR(attr, "H5I_object"); /* Verify the attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -6976,7 +6976,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + CHECK_PTR(f, "H5I_object"); /* Open the group */ gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT); @@ -6988,7 +6988,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + CHECK_PTR(attr, "H5I_object"); /* Verify the attribute message version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], diff --git a/test/th5s.c b/test/th5s.c index 59bdffb..e698490 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1233,7 +1233,7 @@ test_h5s_encode(void) if (sbuf_size > 0) { sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size); - CHECK(sbuf, NULL, "HDcalloc"); + CHECK_PTR(sbuf, "HDcalloc"); } /* Try decoding bogus buffer */ @@ -1294,7 +1294,7 @@ test_h5s_encode(void) if (null_size > 0) { null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size); - CHECK(null_sbuf, NULL, "HDcalloc"); + CHECK_PTR(null_sbuf, "HDcalloc"); } /* Encode the null dataspace in the buffer */ @@ -1330,7 +1330,7 @@ test_h5s_encode(void) if (scalar_size > 0) { scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size); - CHECK(scalar_buf, NULL, "HDcalloc"); + CHECK_PTR(scalar_buf, "HDcalloc"); } /* Encode the scalar dataspace in the buffer */ @@ -2494,7 +2494,7 @@ test_versionbounds(void) /* Its version should be H5O_SDSPACE_VERSION_1 */ spacep = (H5S_t *)H5I_object(space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound"); /* Set high bound to V18 */ @@ -2515,7 +2515,7 @@ test_versionbounds(void) dset_space = H5Dget_space(dset); CHECK(dset_space, FAIL, "H5Dget_space"); spacep = (H5S_t *)H5I_object(dset_space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); /* Dataspace version should remain as H5O_SDSPACE_VERSION_1 */ VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound"); @@ -2552,7 +2552,7 @@ test_versionbounds(void) dset_space = H5Dget_space(dset); CHECK(dset_space, FAIL, "H5Dget_space"); spacep = (H5S_t *)H5I_object(dset_space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); /* Verify the dataspace version */ VERIFY(spacep->extent.version, H5O_sdspace_ver_bounds[low], "upgraded dataspace version"); @@ -513,7 +513,7 @@ test_id_type_list(void) /* Sanity check */ if ((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ - CHECK(1, 1, "H5Iregister_type"); + ERROR("H5Iregister_type"); goto out; } /* Create types up to H5I_MAX_NUM_TYPES */ diff --git a/test/titerate.c b/test/titerate.c index a0f763c..faabf14 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -947,7 +947,7 @@ test_links(hid_t fapl) else if (!HDstrcmp(obj_name, "softlink")) VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); else - CHECK(0, 0, "unknown object name"); + ERROR("unknown object name"); } /* end for */ ret = H5Gclose(gid); diff --git a/test/tvltypes.c b/test/tvltypes.c index f8734b6..17b93ad 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2508,8 +2508,8 @@ test_vltypes_fill_value(void) hid_t large_dspace_id; /* Dataspace ID for large datasets */ hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */ hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */ - hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */ - hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */ + hid_t dset_dspace_id = -1; /* Dataspace ID for a particular dataset */ + hid_t dset_select_dspace_id = -1; /* Dataspace ID for selection in a particular dataset */ hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */ hid_t single_dspace_id; /* Dataspace ID for single element selection */ hsize_t single_offset[] = {2}; /* Offset of single element selection */ @@ -2525,8 +2525,8 @@ test_vltypes_fill_value(void) hid_t dset_id; hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; - size_t dset_elmts; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", + size_t dset_elmts = 0; /* Number of elements in a particular dataset */ + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; dtype1_struct * rbuf = NULL; /* Buffer for reading data */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 4c45549..ffb4844 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -305,14 +305,6 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout); /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) - if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); - - /*------------------------------------------------------------------------- * get list of objects *------------------------------------------------------------------------- */ @@ -346,27 +338,60 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) } /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input + * Close the file and everything in it so the lock is removed + *------------------------------------------------------------------------- + */ + if (H5Pclose(fcpl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Pclose(options->fout_fapl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + options->fout_fapl = H5P_DEFAULT; + if (H5Pclose(gcpl_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Gclose(grp_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidout) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidin) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + + /*------------------------------------------------------------------------- + * NOTE: The userblock MUST be written out AFTER the file is closed or + * the file locking will cause failures on Windows, where file locks + * are mandatory, not advisory. + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * Write a new user block if requested, using the input file user block if + * there is no separate user block file input *------------------------------------------------------------------------- */ - if (ub_size > 0 && options->ublock_size == 0) + if (options->ublock_size > 0) { + if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) + H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } + else if (ub_size > 0 && options->ublock_size == 0) { if (copy_user_block(fnamein, fnameout, ub_size) < 0) H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } done: - H5E_BEGIN_TRY - { - H5Pclose(fcpl); - H5Pclose(options->fout_fapl); - options->fout_fapl = H5P_DEFAULT; - H5Pclose(gcpl_in); - H5Gclose(grp_in); - H5Pclose(fcpl_in); - H5Fclose(fidout); - H5Fclose(fidin); + if (-1 == ret_value) { + H5E_BEGIN_TRY + { + H5Pclose(fcpl); + H5Pclose(options->fout_fapl); + options->fout_fapl = H5P_DEFAULT; + H5Pclose(gcpl_in); + H5Gclose(grp_in); + H5Pclose(fcpl_in); + H5Fclose(fidout); + H5Fclose(fidin); + } + H5E_END_TRY; } - H5E_END_TRY; if (travt) trav_table_free(travt); diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index d6e91fc..b954a22 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index ce65f24..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index ce65f24..433522d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index ff1598d..a4ad058 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10884,7 +10884,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index ce65f24..433522d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ |