Skip to content

Commit

Permalink
COMP: Remove inclusion of .hxx files as headers
Browse files Browse the repository at this point in the history
The ability to include either .h or .hxx files as
header files required recursively reading the
.h files twice.  The added complexity is
unnecessary, costly, and can confuse static
analysis tools that monitor header guardes (due
to reaching the maximum depth of recursion
limits for nested #ifdefs in checking).

Co-authored-by: Simon Rit <simon.rit@creatis.insa-lyon.fr>
  • Loading branch information
hjmjohnson and Simon Rit committed Dec 15, 2021
1 parent 09926f0 commit aafd1f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions CMake/ITKModuleHeaderTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ macro( itk_module_headertest _name )
# effected.
set( _include ${${_name}_SOURCE_DIR}/include )
file( GLOB _h_files ${_include}/*.h )
file( GLOB _hxx_files ${_include}/*.hxx )
set( _header_files ${_h_files} ${_hxx_files} )
set( _header_files ${_h_files} )
list( LENGTH _h_files _num_headers )
set( _outputs ${${_name}_BINARY_DIR}/test/${_name}HeaderTest1.cxx )
set( _test_num 1 )
Expand Down
4 changes: 0 additions & 4 deletions Utilities/Maintenance/BuildHeaderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,11 @@ def main():
else:
max_idx = added_header_idx + maximum_number_of_headers
for i in range(added_header_idx, max_idx):
# Use the .hxx if possible.
hxx_file = h_files[i][:-1] + "hxx"
# Files that include VTK headers need to link to VTK.
if h_files[i] in BANNED_HEADERS or h_files[i].lower().find("vtk") != -1:
to_include = (
'// #include "' + h_files[i] + '" // Banned in BuildHeaderTest.py\n'
)
elif os.path.exists(os.path.join(module_source_path, "include", hxx_file)):
to_include = '#include "' + hxx_file + '"\n'
else:
to_include = '#include "' + h_files[i] + '"\n'

Expand Down

0 comments on commit aafd1f9

Please sign in to comment.