1385 Commits
Author SHA1 Message Date
1da455e53a Various improvement in documentation and a decoding function (#6383)
* Various improvement in documentation and a decoding function

- Improves documentation on the type size when creating/accessing a compound datatype with no predefined struct (GH issue #5371)
- Provides better description of the min_meta_perc and min_raw_perc arguments in the H5Pset_page_buffer_size() (GH issue #5711)
- Adds error checkings to an internal decoding function

* Corrected the checks, the base address equals the end-of-file is valid.

* Skip for multi-file and split drivers when validating addresses against stored_eof

* Committing clang-format changes

* Remove incorrect name

* Fix typos

* Modified description of type_size arguments

* Used a more robust condition when checking EOF

* Corrected incorrect conflict resolving

* Update src/H5Fsuper_cache.c

Co-authored-by: Neil Fortner <fortnern@gmail.com>

* Update src/H5Fsuper_cache.c

Co-authored-by: Neil Fortner <fortnern@gmail.com>

* Committing clang-format changes

* Modified per feedbacks.

* Fix comparison per feedbacks

* Omit unused parameter name in a catch block

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Neil Fortner <fortnern@gmail.com>
2026-07-21 16:54:08 -04:00
Scot Breitenfeld a3892b08aa ☀️ Fix memory safety vulnerabilities in high-level and VFD code (#6140)
* Fix memory safety vulnerabilities in high-level and VFD code

H5FDstdio (src/H5FDstdio.c):
- Fix five error paths in H5FD_stdio_open() that called fclose(f) after
  free(file): the correct resource to close is file->fp.  Reorder to
  fclose before free to match standard cleanup idiom and prevent file
  descriptor leaks under memory-pressure failures.

H5VLnative (src/H5VLnative.c):
- Add assert(obj) and assert(file) to H5VL_native_get_file_struct() to
  catch NULL-pointer programming errors early in debug builds.

H5LT (hl/src/H5LT.c):
- Add NULL check after strdup() in H5LTtext_to_dtype(); push H5E_NOSPACE
  so the HDF5 error stack is populated on OOM.
- Fix H5Tclose(super) leak in H5T_ENUM, H5T_VLEN, H5T_ARRAY, H5T_COMPLEX
  branches of H5LT_dtype_to_text(): super was only closed on the success
  path; any failure between H5Tget_super and the final realloc_and_append
  leaked the type ID.  Super is now closed immediately after use.
- Refactor the repeated "get super-type text and append" pattern (four
  near-identical ~15-line blocks) into static helper append_dtype_super_text().
  Pushes H5E_NOSPACE on internal calloc failure.
- Rewrite realloc_and_append() doc comment to document the asymmetric
  ownership contract (callee frees buf on realloc failure in
  library-managed mode; no free in user-buf mode).
- Move the buf == NULL guard to before the _no_user_buf branch so both
  modes short-circuit identically.

H5TB (hl/src/H5TB.c):
- Clarify H5TBget_field_info() else-branch comment: the two-branch copy
  structure is an efficiency optimization (copy name_len+1 bytes rather
  than HLTB_MAX_FIELD_LEN-1), not a backward-compatibility concern.

CHANGELOG (release_docs/CHANGELOG.md):
- Add entries for the stdio VFD leak fix, VOL NULL checks, and H5LT
  memory-safety improvements.

* HL: add realloc_and_append invariant comments per fortnern review

Document the failure-path contract for realloc_and_append: buf is
passed by value so the caller's pointer is never written by the
function; failure is signaled solely through a NULL return; in
library-managed mode the underlying memory is freed on failure so
callers must not access the original pointer afterward.

Also annotate the point after a successful realloc where the
function can no longer fail.



* HL: reposition 'cannot fail' comment before buf assignment

The comment should mark the transition out of the failure zone —
after the only exit path (goto out), before buf = tmp_realloc.
Also drop the redundant else since the if body always exits.

* HL: fix nested comment syntax error in realloc_and_append Note
2026-06-04 13:35:06 -05:00
Scot Breitenfeld e4c16e9fca Fortran: simplify H5config_f.inc.cmake to use #cmakedefine directly (#6423)
All #cmakedefine01 CMAKE_H5_* blocks used a five-line pattern:

  #cmakedefine01 CMAKE_H5_HAVE_FOO
  #if CMAKE_H5_HAVE_FOO == 0
  #undef H5_HAVE_FOO
  #else
  #define H5_HAVE_FOO
  #endif

This is exactly what #cmakedefine H5_HAVE_FOO does: it emits
#define H5_HAVE_FOO (no value) when the CMake variable is truthy and
/* #undef H5_HAVE_FOO */ when falsy.  The CMAKE_H5_* intermediate
variables in fortran/src/CMakeLists.txt were only needed to feed these
blocks and are no longer required.

Replace all such blocks with #cmakedefine H5_HAVE_FOO, using the H5_*
variable directly.  MPI_LOGICAL_KIND retains its value via
#cmakedefine H5_MPI_LOGICAL_KIND @H5_MPI_LOGICAL_KIND@.

This also fixes a real bug: H5_FORTRAN_C_BOOL_IS_UNIQUE was emitted as
#define H5_FORTRAN_C_BOOL_IS_UNIQUE 0 when C_BOOL and default LOGICAL
are the same kind (e.g. Apple PowerPC ABI).  #ifdef only tests whether
a macro is defined, not its value, so the guard in H5_test_buildiface.F90
was always true and verify_c_bool was written into tf_gen.F90 regardless,
causing an "Ambiguous interfaces" build failure on that platform.
2026-06-02 08:13:50 -05:00
Scot Breitenfeld 853451a3a7 HL: Fix prefix-match bugs in H5TB field lookup and H5DS/H5IM CLASS checks (#6371)
- H5TB: strcmp replaces strncmp in H5TBfind_field so that field names
  that are a prefix of a requested name (or vice-versa) are no longer
  matched. HLTB_MAX_FIELD_LEN (255) is now public in H5TBpublic.h and
  exposed to Fortran as HLTB_MAX_FIELD_LEN_F in H5TBff.F90.
  H5TBget_field_info documents the buffer-size requirement and truncation
  behaviour. H5TBget_field_info guards against overflow on long names.

- H5IM: H5IMis_image and H5IMis_palette refactored into a shared helper
  (H5IM__class_attr_equals). The helper now reads both fixed-length and
  variable-length CLASS string attributes, using H5Treclaim for VL memory.
  strcmp replaces strncmp for exact-match semantics.

- H5DS: H5DSis_scale and H5DS_is_reserved both support variable-length
  CLASS string attributes via H5Aget_space/H5Aread/H5Treclaim. The
  fixed-length path retains the 16-byte size guard. strcmp is used
  throughout for exact comparison.

- Tests: new test functions test_is_scale_class_prefix,
  test_is_reserved_class_prefix, and test_class_prefix cover fixed-length
  prefix/exact/wrong-value cases and variable-length string cases.
  test_table.c adds write and read field-name prefix rejection cases and
  boundary-length truncation verification. All malloc calls are NULL-checked.

- CHANGELOG updated with a summary of all fixes.
2026-05-22 11:28:24 -05:00
Scot Breitenfeld 05737ece7f H5DSget_label_f returned size fixed (#6327)
* fixed assignment of size in the wrapper

* Call H5DSget_label directly from Fortran wrapper

Replace the intermediate C wrapper h5dsget_label_c with a direct
bind(c) call to H5DSget_label from H5DSget_label_f. This eliminates
the malloc/free of a temporary buffer and the associated failure path
where size was incorrectly set when H5DSget_label failed. The Fortran
wrapper now handles the C-to-Fortran string conversion (equivalent to
HD5packFstring) by blank-padding the buffer from the returned label
length to the end.

* Remove unused h5dsget_label_c C wrapper
2026-03-30 15:45:25 -05:00
jhendersonHDF 8f960cae4b Fix display of '--' options in documentation (#6318)
* Fix display of '--' options in documentation

* Fix more formatting
2026-03-30 10:49:23 -05:00
jhendersonHDF 2952bb9216 Mark several CMake variables as advanced (#6321) 2026-03-27 11:30:23 -05:00
Scot Breitenfeld 05758a6168 Security hardening (#6302)
Addresses CodeQL issues (Critical and High).
2026-03-18 22:32:03 -05:00
Scot Breitenfeld 71763e74e7 Skip building Doxygen when no documentation inputs have changed (#6245)
Optimize Doxygen build process by skipping rebuilds when input files are unchanged, using timestamp checks in CMake configuration.

Behavior:
Skip Doxygen build if input files unchanged using timestamp check in CMakeLists.txt, hl/src/CMakeLists.txt, and src/CMakeLists.txt.
Introduces stamp files (hdf5lib_doc.stamp, hdf5hllib_doc.stamp) to track changes.
Documentation:
add_custom_command and add_custom_target used to manage Doxygen builds.
Shared Doxygen content inputs defined in top-level CMakeLists.txt for reuse.
Misc:
Reorder add_subdirectory(src) in CMakeLists.txt for visibility of Doxygen variables.
2026-03-10 06:56:39 -05:00
Scot Breitenfeld a7ec64a857 Split static targets into separate optional target [UPDATED] (#6216)
Build-tree exports can't diverge from install-tree exports — the export(EXPORT ...) reads directly from the install export sets. No manual list to keep in sync.

Removed 3 global variables (HDF5_STATIC_LIBRARIES_TO_EXPORT, HDF5_JAVA_LIBRARIES_TO_EXPORT, HDF5_UTILS_TO_EXPORT) and their ~21 set_global_variable calls across tool/utility files.

Fixed the static-only build bug in the PR where the base export set was guarded by BUILD_SHARED_LIBS, breaking tools export.

Removed redundant utils in export files — the PR was dumping tools into all three build-tree export files (java, static, shared). Now they correctly appear only in the base export.
2026-02-24 17:04:25 -06:00
jhendersonHDF 5f430099e9 Add CMake function to extract pkg-config info from libraries (#6220) 2026-02-18 12:12:34 -07:00
Julien Schueller d58638be09 CMake: Fix Fortran cross-compilation support
Refactor the cross-compilation infrastructure to rely on the standard
CMAKE_CROSSCOMPILING_EMULATOR variable instead of the custom
CROSSCOMPILING_PATH environment hack.

Key changes:
- Removed `ENVIRONMENT "${CROSSCOMPILING_PATH}"` from all test definitions.
- Updated custom commands (e.g., H5match_types, H5_gen) to invoke the
  emulator explicitly when cross-compiling.
- Updated ConfigureChecks.cmake and HDF5UseFortran.cmake to enable
  `try_run` checks when an emulator is defined.
- Added config/toolchain/mingw-w64-x86-64-wine.sh wrapper to automatically
  locate MinGW runtime libraries (like libgfortran) for Wine execution.
- Cleaned up toolchain files to remove hardcoded emulator paths, deferring
  configuration to the build environment.
2026-02-13 14:45:02 -06:00
efferre79 476c60961c the targets interface should support HDF5_INSTALL_INCLUDE_DIR (#6142) 2026-01-13 10:27:38 -06:00
jhendersonHDF d1efeba7be Add predefined datatype for FP4 format (#6122)
Adds predefined datatype for FP4 data in E2M1 format

Does not add support for any native FP4 types; datatype conversions are performed in software
2025-12-31 11:44:08 -06:00
jhendersonHDF 441d83a896 Add predefined datatypes for FP6 formats (#6097)
Adds predefined datatypes for FP6 data in E2M3 and E3M2 formats

Does not add support for any native FP6 types; datatype conversions are performed in software
2025-12-19 12:56:54 -06:00
Scot Breitenfeld d3cebd7dc5 Addressed TODO documentation issues (#6063)
* Fix Doxygen comments showing backslash continuations in macros, fixes #3947

* Replace "@todo Under Construction" with complete documentation, fixes 3105

* Completed "under construction" documentation sections:
  * H5Smodule.h: Add dataspace selection and data transfer documentation
  * H5module.h: Add link types and organization documentation
  * H5Emodule.h: Add error handling programming model documentation

* Fix grammar in documentation block of H5FDioc.c and improve consistency.

* rephrased H5Smodule.h documentation
2025-12-08 14:23:49 -06:00
Scot Breitenfeld 91ae855c0b Add Fortran SWMR wrappers (#5985)
* Add Fortran wrappers for H5Fstart_swmr_write, H5Dflush, and H5P{set,get}_append_flush
* corrected C doxygen docs for H5Pget_append_flush, clarified Fortran
2025-11-11 15:32:31 -06:00
jhendersonHDF eb72e67ed2 Add predefined datatypes for FP8 formats (#5882)
Adds predefined datatypes for FP8 data in E4M3 and E5M2 formats

Does not add support for any native FP8 types; datatype conversions are performed in software
2025-11-03 15:10:22 -06:00
Neil Fortner 5e03b3a315 Change default file format to 1.8 (#5949)
Change default file format to 1.8 across various tests and examples, updating file creation and access logic accordingly.

Behavior:
Default file format version changed to 1.8 in H5Pfapl.c.
Updated file creation and access to use 1.8 format in h5ex_g_compact.c and test_file_image.c.
Set earliest file format in multiple test files including cache_tagging.c, dtypes.c, and links.c.
Tests:
Modified expected output in tools/test/misc/expected/*.ls files to reflect new file format locations.
Adjusted test logic in test_file_image.c and cache_tagging.c to accommodate format changes.
Misc:
Added comments and TODOs for future format testing in test_file_image.c.
Minor variable renaming for clarity in test_file_image.c.
2025-10-30 15:26:12 -05:00
Allen Byrne fb35cde24a Rework Fortran configure to allow cross compile overrides (#5720)
Behavior:
Modify HDF5UseFortran.cmake to handle cross-compilation by providing default KINDs and sizes when CMAKE_CROSSCOMPILING is true.
Default values for INTEGER and REAL KINDs and their sizes are set when cross-compiling.
Error messages are adjusted to reflect cross-compilation scenarios.
Logic:
Conditional checks added for CMAKE_CROSSCOMPILING to determine if default values should be used.
Default values include INTEGER KINDs {1,2,4,8,16} and REAL KINDs {4,8,10,16}.
Default sizes for native kinds are set to 4 for INTEGER and REAL, and 8 for DOUBLE PRECISION when cross-compiling.
Misc:
Adjustments to verbose messages to indicate when defaults are used during cross-compilation.
2025-10-12 17:30:46 -05:00
jhendersonHDF 748875a7d7 Add predefined datatypes for bfloat16 data (#5402)
Adds predefined datatypes for little- and big-endian bfloat16 data

Does not add support for any native bfloat16 types; datatype conversions are performed in software

Also adds missing float16 predefined types to fortran
2025-09-26 13:33:56 -05:00
Dana Robinson 3b47e2d227 Remove hbool_t from the public API (#5802)
* Remove hbool_t from the public API

This was previously removed from the source code, but the API calls
retained hbool_t in the public API calls. This commit removes
hbool_t from the public APIs.

hbool_t is retained as a typedef for bool in H5public.h so existing
code doesn't break.
2025-09-15 17:36:22 -05:00
Allen Byrne 63803d7115 allow better CMake version testing (#5727)
* add cmake latest workflow with lukka/get-cmake@latest
* Upgrade minimum CMake version to 3.26
2025-08-23 06:43:20 -05:00
Allen Byrne 497b65ad0f Add file header comments to CMake files (#5688) 2025-08-13 07:19:57 -05:00
jhendersonHDF 4a12cfec19 Align CMake compiler wrappers with old Autotools versions (#5649)
Implemented missing --help/-h, -c, -echo and -shlib/-noshlib options

Added new -nohl option to avoid building and linking against
high-level HDF5 libraries if desired

Implemented adding of HDF5 installation library directory to rpath of
resulting executable/library and added new -norpath option to avoid
this behavior if desired

Added parsing of HDF5_USE_SHLIB environment variable to determine
whether to link against shared or static HDF5 libraries

Added parsing of HDF5_PKG_CONFIG_ARGS environment variable to separate
pkg-config-specific options from compiler-specific options and prevent
conflicts
2025-07-28 07:42:52 -05:00
Allen Byrne ed5c07223a Create a file containing the major CMake options (#5666) 2025-07-18 14:47:02 -05:00
Allen Byrne 968cc9dd44 Add script to test examples with h5*cc pkg-config wrappers (#5486) 2025-07-16 13:57:43 -05:00
Allen Byrne 0509e66208 Add cmake_dependent_option command (#5635)
* Add subfiling option to cmake_dependent option format
* Set the default option state to a hard value
2025-07-12 10:16:54 -05:00
Allen Byrne f9ebbb9ab2 Move fortran flags processing after fortran enabled (#5627) 2025-07-10 10:31:47 -05:00
Matt L 3b054fe7cc Always build test generators (#5622) 2025-06-23 07:47:05 -05:00
Neil Fortner 1ca48703e3 Add H5Dread_chunk2() (#5506) 2025-06-17 11:11:13 -05:00
Allen Byrne 4cc7161fc2 refactor run scripts to a single macros with includes (#5538)
* Refactor the CMake scripts into a single script
* Adjust args to do grep testing
2025-05-24 16:26:46 -05:00
Dana Robinsonandgithub-actions d9f5f5020c Refactor warning macros (#5432)
* Refactor warning macros

Replaces the scheme in H5warnings.h with a more compiler-agnostic
one that relocates ifdef complexity to the warnings header file
and uses better naming.

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-23 11:46:40 -05:00
Allen Byrne aa9784ea25 Refactor the config/cmake folder #5446 (#5540)
* Update config/examples/HDF5AsSubdirMacros.cmake
* Move f90 config file and remove m4 dir
2025-05-22 11:20:51 -05:00
Dana Robinson 07e995d472 Clean up API decorations in H5api_adpt.h (#5511)
* Simplify H5api_adpt.h

This change also uses the shared markup (e.g., __declspec) in both
static and shared libraries as the shared markup is ignored when
building static libs.

* Renamed some API decorations

Some API decorations (used to hide __declspec on Windows, among other
things) have been renamed:

    H5_DLLCPP(VAR)           --> H5CPP_DLL(VAR)
    H5_HLDLL(VAR)            --> H5HL_DLL(VAR)
    H5_HLCPPDLL(VAR)         --> H5CPP_HL_DLL(VAR)
    H5_FCDLL(VAR)            --> H5FC_DLL(VAR)
    H5_FCTESTDLL(VAR)        --> H5FC_TEST_DLL(VAR)
    HDF5_HL_F90CSTUBDLL(VAR) --> H5FC_HL_DLL(VAR)

The shared library decorations are also now used when building static
libraries (where they are meaningless and ignored).
2025-05-06 09:00:56 -05:00
Allen Byrne 84028437b0 Add navigation links to doxygen pages (#5498)
* Add navigation links to doxygen pages

* Fix missing link and revert merge issues
2025-05-02 12:20:18 -05:00
Michał Górny edb930f367 h5cc: Allow overriding the compilers written into the file (#5467)
* h5cc: Allow overriding the compilers written into the file

Add a set of `HDF5_H5CC_C_COMPILER`, `HDF5_H5CC_CXX_COMPILER`
and `HDF5_H5CC_Fortran_COMPILER` CMake variables that can be used to
override the compiler string written into `h5cc`, `h5c++`, etc.  This is
particularly useful when e.g. using ccache during the build,
as the ccache path otherwise ends up in `h5cc`.
2025-04-25 17:00:48 -05:00
jhendersonHDF be63ed0cb0 Enable building of test generator programs against shared libraries (#5404)
Build test generator programs against shared libraries, if available,
by default. Otherwise, build them against static libraries. If
HDF5_BUILD_STATIC_TOOLS is set to ON, the tools test generator
programs will be built against static libraries even if shared
libraries are available.
2025-03-26 14:26:19 -05:00
Allen Byrne 1602e1fbfe Remove autotools files and docs (#5358) 2025-03-14 13:28:44 -05:00
Allen Byrne d81ae5586a Add presets cookbook and use cases (#5323)
* RPM has issue with packaging RPM of a parallel library
2025-02-27 09:58:03 -06:00
Allen Byrne b26089af1b Fix the HL H5TB fill-info #5332 (#5333) 2025-02-25 14:38:19 -06:00
Allen Byrne 409f738e9d Translate release-specific changes docs to doxygen (#5314) 2025-02-18 11:21:27 -06:00
Scot BreitenfeldandMichael Breitenfeld dbbc7122df Cray cce/18.0.1 work-around (#5313)
Co-authored-by: Michael Breitenfeld <brtnfld@login04.frontier.olcf.ornl.gov>
2025-02-12 09:11:10 -06:00
Allen Byrne d84337ad8c Fix codespell issues (#5256) 2025-01-21 17:36:27 -06:00
Allen Byrne 2ad03911d9 Convert doc folder files to doxygen (#5216) 2025-01-17 11:48:58 -06:00
Dana Robinson 8f2c03b2da Remove the hash_size param from H5Iregister_type() (#5170)
The hash_size parameter of H5Iregister_type() hasn't been used since 1.8.
It's been removed and the API call has been versioned.

This PR also updates the make_vers script to handle v2.0.0.

Fixes #4344
2024-12-10 00:34:40 -08:00
Allen Byrne f07537722c Convert HL Dim Scales doc to doxy UG (#5152) 2024-12-03 07:33:26 -06:00
Allen Byrne 2ce2fb0054 Convert file image ops file to doxygen (#5134) 2024-11-23 12:00:16 -08:00
H. Joe Lee cd7682cd18 Remove CMake-3.31.0 warnings (#5091) 2024-11-19 13:09:31 -06:00
Allen Byrne ad3ea2633a Move hl example into HDF5Examples (#5057) 2024-11-04 05:22:27 -08:00