Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing semicolons causing compile issues with some compilers #1224

Closed
Wildcarde opened this issue Aug 29, 2024 · 5 comments · Fixed by #1227
Closed

Missing semicolons causing compile issues with some compilers #1224

Wildcarde opened this issue Aug 29, 2024 · 5 comments · Fixed by #1227

Comments

@Wildcarde
Copy link
Contributor

I've generated a quick patch of the tweaks i needed to make to get Elastix to build on Rocky 9 with the intel OneAPI 2024.02 compiler and a from source build of ITK's github version:

diff --git a/Components/Optimizers/ConjugateGradient/itkGenericConjugateGradientOptimizer.h b/Components/Optimizers/ConjugateGradient/itkGenericConjugateGradientOptimizer.h
index 3146b50e..1a513a06 100644
--- a/Components/Optimizers/ConjugateGradient/itkGenericConjugateGradientOptimizer.h
+++ b/Components/Optimizers/ConjugateGradient/itkGenericConjugateGradientOptimizer.h
@@ -111,7 +111,7 @@ public:
    *   GradientMagnitudeTolerance * \max(1, \|CurrentPosition\| ) \f$
    */
   itkGetConstMacro(GradientMagnitudeTolerance, double);
-  itkSetMacro(GradientMagnitudeTolerance, double)
+  itkSetMacro(GradientMagnitudeTolerance, double);
 
     /** Setting: a stopping criterion, the value tolerance. By default 1e-5.
      *
diff --git a/Components/Transforms/AdvancedAffineTransform/elxAdvancedAffineTransform.hxx b/Components/Transforms/AdvancedAffineTransform/elxAdvancedAffineTransform.hxx
index fe655e4e..ea7b1491 100644
--- a/Components/Transforms/AdvancedAffineTransform/elxAdvancedAffineTransform.hxx
+++ b/Components/Transforms/AdvancedAffineTransform/elxAdvancedAffineTransform.hxx
@@ -107,7 +107,7 @@ AdvancedAffineTransformElastix<TElastix>::ReadFromFile()
     if (itkFixedParameterValues == nullptr)
     {
       log::error("ERROR: No center of rotation is specified in the transform parameter file");
-      itkExceptionMacro("Transform parameter file is corrupt.")
+      itkExceptionMacro("Transform parameter file is corrupt.");
     }
   }
 
diff --git a/Components/Transforms/AffineDTITransform/elxAffineDTITransform.hxx b/Components/Transforms/AffineDTITransform/elxAffineDTITransform.hxx
index 53d35752..50955f77 100644
--- a/Components/Transforms/AffineDTITransform/elxAffineDTITransform.hxx
+++ b/Components/Transforms/AffineDTITransform/elxAffineDTITransform.hxx
@@ -78,7 +78,7 @@ AffineDTITransformElastix<TElastix>::ReadFromFile()
   if (!pointRead)
   {
     log::error("ERROR: No center of rotation is specified in the transform parameter file");
-    itkExceptionMacro("Transform parameter file is corrupt.")
+    itkExceptionMacro("Transform parameter file is corrupt.");
   }
 
   /** Set the center in this Transform. */
diff --git a/Components/Transforms/AffineLogStackTransform/elxAffineLogStackTransform.hxx b/Components/Transforms/AffineLogStackTransform/elxAffineLogStackTransform.hxx
index 16a7ac59..2fd7957b 100644
--- a/Components/Transforms/AffineLogStackTransform/elxAffineLogStackTransform.hxx
+++ b/Components/Transforms/AffineLogStackTransform/elxAffineLogStackTransform.hxx
@@ -119,7 +119,7 @@ AffineLogStackTransform<TElastix>::ReadFromFile()
     if (!pointRead)
     {
       log::error("ERROR: No center of rotation is specified in the transform parameter file");
-      itkExceptionMacro("Transform parameter file is corrupt.")
+      itkExceptionMacro("Transform parameter file is corrupt.");
     }
 
     this->InitializeAffineLogTransform();
diff --git a/Components/Transforms/BSplineStackTransform/elxBSplineStackTransform.hxx b/Components/Transforms/BSplineStackTransform/elxBSplineStackTransform.hxx
index 35df168f..ef0d2162 100644
--- a/Components/Transforms/BSplineStackTransform/elxBSplineStackTransform.hxx
+++ b/Components/Transforms/BSplineStackTransform/elxBSplineStackTransform.hxx
@@ -494,7 +494,7 @@ BSplineStackTransform<TElastix>::ReadFromFile()
     {
       itkExceptionMacro("NumberOfSubTransforms, StackOrigin, StackSpacing, GridSize, GridIndex, GridSpacing and "
                         "GridOrigin is required by "
-                        << this->GetNameOfClass() << ".")
+                        << this->GetNameOfClass() << ".");
     }
 
     /** Set it all. */
diff --git a/Components/Transforms/EulerStackTransform/elxEulerStackTransform.hxx b/Components/Transforms/EulerStackTransform/elxEulerStackTransform.hxx
index 2fb37bb5..0601c44f 100644
--- a/Components/Transforms/EulerStackTransform/elxEulerStackTransform.hxx
+++ b/Components/Transforms/EulerStackTransform/elxEulerStackTransform.hxx
@@ -117,7 +117,7 @@ EulerStackTransform<TElastix>::ReadFromFile()
     if (!pointRead && !indexRead)
     {
       log::error("ERROR: No center of rotation is specified in the transform parameter file");
-      itkExceptionMacro("Transform parameter file is corrupt.")
+      itkExceptionMacro("Transform parameter file is corrupt.");
     }
 
     this->InitializeEulerTransform();
diff --git a/Components/Transforms/EulerTransform/elxEulerTransform.hxx b/Components/Transforms/EulerTransform/elxEulerTransform.hxx
index 211f2155..6b416355 100644
--- a/Components/Transforms/EulerTransform/elxEulerTransform.hxx
+++ b/Components/Transforms/EulerTransform/elxEulerTransform.hxx
@@ -77,7 +77,7 @@ EulerTransformElastix<TElastix>::ReadFromFile()
     if (!pointRead)
     {
       log::error("ERROR: No center of rotation is specified in the transform parameter file");
-      itkExceptionMacro("Transform parameter file is corrupt.")
+      itkExceptionMacro("Transform parameter file is corrupt.");
     }
 
     /** Set the center in this Transform. */
diff --git a/Components/Transforms/SimilarityTransform/elxSimilarityTransform.hxx b/Components/Transforms/SimilarityTransform/elxSimilarityTransform.hxx
index dcb0c675..a1b413c1 100644
--- a/Components/Transforms/SimilarityTransform/elxSimilarityTransform.hxx
+++ b/Components/Transforms/SimilarityTransform/elxSimilarityTransform.hxx
@@ -86,7 +86,7 @@ SimilarityTransformElastix<TElastix>::ReadFromFile()
     if (!pointRead && !indexRead)
     {
       log::error("ERROR: No center of rotation is specified in the transform parameter file.");
-      itkExceptionMacro("Transform parameter file is corrupt.")
+      itkExceptionMacro("Transform parameter file is corrupt.");
     }
 
     /** Set the center in this Transform. */
diff --git a/Core/Main/elxParameterObject.cxx b/Core/Main/elxParameterObject.cxx
index befd021c..a75cf2bf 100644
--- a/Core/Main/elxParameterObject.cxx
+++ b/Core/Main/elxParameterObject.cxx
@@ -229,7 +229,7 @@ ParameterObject::ReadParameterFiles(const ParameterFileNameVectorType & paramete
   {
     if (!itksys::SystemTools::FileExists(parameterFileName))
     {
-      itkExceptionMacro("Parameter file \"" << parameterFileName << "\" does not exist.")
+      itkExceptionMacro("Parameter file \"" << parameterFileName << "\" does not exist.");
     }
 
     this->AddParameterFile(parameterFileName);
diff --git a/Core/Main/itkTransformixFilter.hxx b/Core/Main/itkTransformixFilter.hxx
index 40b6113a..102231d8 100644
--- a/Core/Main/itkTransformixFilter.hxx
+++ b/Core/Main/itkTransformixFilter.hxx
@@ -82,7 +82,7 @@ TransformixFilter<TImage>::GenerateData()
   if (m_ComputeDeformationField && !m_FixedPointSetFileName.empty())
   {
     itkExceptionMacro("For backwards compatibility, only one of ComputeDeformationFieldOn() or "
-                      "SetFixedPointSetFileName() can be active at any one time.")
+                      "SetFixedPointSetFileName() can be active at any one time.");
   }
 
   // Setup argument map which transformix uses internally ito figure out what needs to be done
@@ -124,7 +124,7 @@ TransformixFilter<TImage>::GenerateData()
 
   if (!m_OutputDirectory.empty() && !itksys::SystemTools::FileExists(m_OutputDirectory))
   {
-    itkExceptionMacro("Output directory \"" << m_OutputDirectory << "\" does not exist.")
+    itkExceptionMacro("Output directory \"" << m_OutputDirectory << "\" does not exist.");
   }
 
   if (!m_OutputDirectory.empty())

Nothing major and it looks like it may have been a copy/paste error but I figured you should know. This appears to also be present in the released version 5.2.0 as well so I'm not sure if this is just an issue of compiler strictness or not.

@N-Dekker
Copy link
Member

Thanks @Wildcarde ! Just to explain the issue, we now use the ITK v5.4.0 tag of May 20, 2024 to build elastix. It appears that ITK has become more strict with respect to semicolons, just after the v5.4.0 tag. Specifically after pull request InsightSoftwareConsortium/ITK#4706 (June 4, 2024).

Would it be possible for you to put your fix into a pull request, for https://github.com/SuperElastix/elastix/pulls?

N-Dekker added a commit that referenced this issue Aug 30, 2024
Aims to resolve issue #1224 "Missing semicolons causing compile issues with some compilers".

ITK has become stricter with respect to those semicolons from ITK pull request InsightSoftwareConsortium/ITK#4706 commit InsightSoftwareConsortium/ITK@55e2339 "ENH: Default to allow ITK_MACROEND_NOOP_STATEMENT", Hans Johnson, June 4, 2024.

Co-authored-by: Wildcarde <[email protected]>
N-Dekker added a commit that referenced this issue Aug 30, 2024
Aims to resolve issue #1224 "Missing semicolons causing compile issues with some compilers".

ITK has become stricter with respect to those semicolons from ITK pull request InsightSoftwareConsortium/ITK#4706 commit InsightSoftwareConsortium/ITK@55e2339 "ENH: Default to allow ITK_MACROEND_NOOP_STATEMENT", Hans Johnson, June 4, 2024.

Co-authored-by: Wildcarde <[email protected]>
@N-Dekker
Copy link
Member

N-Dekker commented Aug 30, 2024

@N-Dekker N-Dekker linked a pull request Aug 30, 2024 that will close this issue
@Wildcarde
Copy link
Contributor Author

Thanks @Wildcarde ! Just to explain the issue, we now use the ITK v5.4.0 tag of May 20, 2024 to build elastix. It appears that ITK has become more strict with respect to semicolons, just after the v5.4.0 tag. Specifically after pull request InsightSoftwareConsortium/ITK#4706 (June 4, 2024).

Would it be possible for you to put your fix into a pull request, for https://github.com/SuperElastix/elastix/pulls?

yea sorry I was hammering through this to get something out and tested with some of our researchers before the holiday weekend, so i just grabbed the git diff and kept running.

on the ITK note, I did notice one additional thing, you are reliant on a file only available in itk 6.0 which isn't 'officially' on their release list yet with elastix 5.2.0 and the git version of elastix. Specifically this file: https://insightsoftwareconsortium.github.io/ITKDoxygen/itkDeref_8h_source.html

Since we were just trying to scramble and get this done for the lab I bumped our ITK build to the github main line version from 8/28/2024 and that has the file in question but older itk versions including 5.4 do not seem to include that header.

@N-Dekker
Copy link
Member

No problem, thanks! "itkDeref.h" is included with ITK tag v5.4.0 (https://github.com/InsightSoftwareConsortium/ITK/blob/v5.4.0/Modules/Core/Common/include/itkDeref.h), which is the ITK tag we were using when releasing elastix 5.2.0. So I believe it's ok for elastix to already use this rather new header file. Although it would have been even nicer if ITK v5.4.0 would have been released officially, already. 🤷 But I believe ITK v5.4.0 will be officially released any day now 😃

N-Dekker added a commit that referenced this issue Aug 30, 2024
Aims to resolve issue #1224 "Missing semicolons causing compile issues with some compilers".

ITK has become stricter with respect to those semicolons from ITK pull request InsightSoftwareConsortium/ITK#4706 commit InsightSoftwareConsortium/ITK@55e2339 "ENH: Default to allow ITK_MACROEND_NOOP_STATEMENT", Hans Johnson, June 4, 2024.

Co-authored-by: Wildcarde <[email protected]>
@Wildcarde
Copy link
Contributor Author

I noticed the 5.4 tag which isn't posted yet on the actual website for download, but the builds all seem to make the folder actually named itk 6.0 not 5.4. whichever it is, it's not currently available outside of pulling from source directly which is what I wanted to put on your radar incase there's any documentation that needs to be updated to note that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants