Repository navigation
Conversation
[Medium impact] The PR appears safe to merge.
|
itk::Indent uses itkLegacyMacro so itkMacro.h should be included directly. Also forward-declare itk::Indent in itkPrintHelper.h to avoid circular include dependency problems.
ef233a2 to
b6f25f6
Compare
dzenanz
left a comment
There was a problem hiding this comment.
Looks good on a glance. What commit introduced this build error?
There was a problem hiding this comment.
Thanks @mymonin for tracking this down and for the clear repro in #7025. I'd like to take a different route, so I opened #7028, which keeps your diagnosis and your itkIndent.h-first regression include (credited as co-author).
Two concerns with the forward declarations here:
- The forward-declared
operator<<lacksITKCommon_EXPORT. The real declaration isfriend ITKCommon_EXPORT std::ostream & operator<<(std::ostream &, const Indent &);(itkIndent.h). In a file that includesitkIndent.hfirst, the plain declaration is seen before the exported one, which MSVC shared builds can reject as inconsistent DLL linkage (C2375/C4273). - Two declarations of the same signature to keep in sync. Item 1 is that drift already happening. I'd rather remove the cycle than paper over it.
#7028 restores @blowekamp's earlier fix (79f01ca, 4f524e8), where itkIndent.h does not include itkMacro.h, by including only ITKCommonExport.h and itkConfigure.h and marking the legacy New()/Delete() with [[deprecated]] instead of itkLegacyMacro. It also adds an #error in itkPrintHelper.h that names the fix if itkIndent.h ever pulls in itkMacro.h again.
|
I agree #7028 is a better fix if we can afford moving the macro definition to a more suitable header. Avoiding any circular include dependency makes the header logic much easier to reason about. |
|
@mymonin 7028 was harder to complete than I expected. Can you please verify (on that PR) that the proposed solution works for you? |
|
Superceeded. |
Closes #7025
This should fix ARMBUILD-Ubuntu-24.04-arm compilation failures which can be observed in other PRs like #7024 (cdash build error trace) and #7021 (cdash build error trace).
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.