InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.47k stars 686 forks source link

Incorrect expansion of macros with `;` by CMake for doxygen `PREDEFINED` #5193

Closed albert-github closed 1 week ago

albert-github commented 1 week ago

Description

I was looking at issue #4161 to get a bit of a feeling for it, and saw the definition (so another problem):

itkBooleanMacro(EnforceConnectivity);

Which should result in 2 functions:

EnforceConnectivityOn
EnforceConnectivityOff

In the C++ code (itkMacro.h) we see this happening, but in the documentation there is no trace of EnforceConnectivityOff.

Expected information

The function EnforceConnectivityOff is present as well

Actual information

The function EnforceConnectivityOff is missing

Versions

master 5df209ffdd

Additional Information

In the DoxygenConfig.cmake we see (with PREDEFINED):

"itkBooleanMacro(name)=                   virtual void name##On ();                   virtual void name##Off ();"

and when running this through cmake we see:

"itkBooleanMacro(name)=                   virtual void name##On ()" "                   virtual void name##Off ()"

Note: the ; are gone and it are 2 strings, so doxygen will not see the Off version. The solution for it is to escape the ; like:

"itkBooleanMacro(name)=                   virtual void name##On ()\;                   virtual void name##Off ()\;"

Note this will give in the mentioned case: virtual void EnforceConnectivityOn(); virtual void EnforceConnectivityOff();; as in the C++ code there is a ; behind the the used macro, this is not a problem as doxygen will ignore the empty statement.

albert-github commented 1 week ago

Proposed patch: diff.patch