COMP: Replace hdf5.h includes with itk_hdf5.h in MINC library#5978
Merged
blowekamp merged 1 commit intoInsightSoftwareConsortium:mainfrom Mar 25, 2026
Merged
Conversation
0568f94 to
627d149
Compare
Fixes -Wshadow-header warnings about multiple candidates for header 'hdf5.h': Modules/ThirdParty/MINC/src/libminc/libsrc2/minc2.h:8:10: warning: multiple candidates for header 'hdf5.h' found; directory '.../HDF5/src/itkhdf5' chosen, ignoring others including '.../HDF5/src/itkhdf5/src' [-Wshadow-header] The MINC library src/CMakeLists.txt manually added both itkhdf5/ and itkhdf5/src/ to the include path, causing two hdf5.h candidates. Replace this with the proper ITK::ITKHDF5Module target, which carries the correct include directories via imported target properties. Update all MINC source files to use the ITK wrapper <itk_hdf5.h> instead of <hdf5.h> directly.
627d149 to
f4bcee4
Compare
thewtex
approved these changes
Mar 24, 2026
Member
thewtex
left a comment
There was a problem hiding this comment.
I am surprised that we missed this!
Contributor
Greptile SummaryThis PR fixes Key changes:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["MINC source files\n(*.c, *.h)"] -->|"#include"| B{"itk_hdf5.h\n(wrapper)"}
B -->|"ITK_USE_SYSTEM_HDF5 ON"| C["<hdf5.h>\n(system HDF5)"]
B -->|"ITK_USE_SYSTEM_HDF5 OFF"| D["itkhdf5/hdf5.h\n(bundled HDF5)"]
E["CMakeLists.txt\nMINC/src/"] -->|"sets"| F["HDF5_LIBRARIES =\nITK::ITKHDF5Module"]
F -->|"target_link_libraries\npropagates INTERFACE_INCLUDE_DIRECTORIES"| G["${ITKHDF5_BINARY_DIR}/src\n(where itk_hdf5.h lives)"]
G --> A
H["Old approach\n(removed)"] -.->|"explicit include_directories()\nITKHDF5_SOURCE_DIR paths"| I["hdf5.h shadow warning\n(two candidate paths)"]
style H fill:#fdd,stroke:#f88
style I fill:#fdd,stroke:#f88
style B fill:#dfd,stroke:#8d8
style F fill:#dfd,stroke:#8d8
Reviews (1): Last reviewed commit: "COMP: Replace hdf5.h includes with itk_h..." | Re-trigger Greptile |
Member
Author
|
Related: #5980 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes -Wshadow-header warnings about duplicate header candidates. The MINC library sources included <hdf5.h> directly, which could resolve to two different headers (itkhdf5/hdf5.h and itkhdf5/src/hdf5.h) causing a shadow header warning.
Use ITK's itk_hdf5.h wrapper instead, which properly handles both internal and system HDF5 configurations.
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.