Skip to content

Commit

Permalink
STYLE: Run clang-format.exe manually at the client side
Browse files Browse the repository at this point in the history
Ran at bash:

    find . -regex '.*itk.*\.\(hxx\|h\|cxx\)' -exec /f/bin/ITK/ClangFormat-prefix/src/ClangFormat/clang-format.exe -style=file -i {} \;

Manually reverted changes in ThirdParty.

At the moment, the "client side" is responsible for running clang-format.exe

Related commits:

- pull request InsightSoftwareConsortium#4712
commit c7e8b25
"BUG: Remove Apply clang-format to PR", June 5, 2024

- pull request InsightSoftwareConsortium#4707
commit 4b0d263
"ENH: Remove Clang Format Linter Action", June 3 2024
  • Loading branch information
N-Dekker committed Sep 23, 2024
1 parent 9a5dade commit 835c6f3
Show file tree
Hide file tree
Showing 21 changed files with 126 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunction

#if !defined(ITK_LEGACY_REMOVE)
/** Get support region size. */
itkLegacyMacro(SizeType GetSupportSize() const) { return Self::SupportSize; }
itkLegacyMacro(SizeType GetSupportSize() const)
{
return Self::SupportSize;
}

/** Get number of weights. */
itkLegacyMacro(unsigned int GetNumberOfWeights() const) { return Self::NumberOfWeights; }
itkLegacyMacro(unsigned int GetNumberOfWeights() const)
{
return Self::NumberOfWeights;
}
#endif

protected:
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkFixedArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ class ITK_TEMPLATE_EXPORT FixedArray

/** Allow the FixedArray to be indexed normally. No bounds checking is done.
*/
// false positive warnings with GCC
ITK_GCC_PRAGMA_PUSH
ITK_GCC_SUPPRESS_Warray_bounds
// false positive warnings with GCC
ITK_GCC_PRAGMA_PUSH
ITK_GCC_SUPPRESS_Warray_bounds
constexpr reference operator[](unsigned int index) { return m_InternalArray[index]; }
constexpr const_reference operator[](unsigned int index) const { return m_InternalArray[index]; }
ITK_GCC_PRAGMA_POP
ITK_GCC_PRAGMA_POP

/** Set/Get element methods are more convenient in wrapping languages */
void
Expand Down
3 changes: 2 additions & 1 deletion Modules/Core/Common/include/itkMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ namespace itk
#if defined(__clang__) && defined(__has_warning)
# define ITK_CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
# define ITK_CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant ITK_PRAGMA(clang diagnostic ignored "-Wzero-as-null-pointer-constant")
# define ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant \
ITK_PRAGMA(clang diagnostic ignored "-Wzero-as-null-pointer-constant")
#else
# define ITK_CLANG_PRAGMA_PUSH
# define ITK_CLANG_PRAGMA_POP
Expand Down
24 changes: 12 additions & 12 deletions Modules/Core/Common/include/itkMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,20 @@ class ITK_TEMPLATE_EXPORT Matrix
swap(this->m_Matrix, other.m_Matrix);
}

inline void PrintSelf(std::ostream & os, Indent indent) const
{
os << indent << "Matrix (" << VRows << "x" << VColumns << ")\n";
for (unsigned int r = 0; r < VRows; ++r)
inline void
PrintSelf(std::ostream & os, Indent indent) const
{
os << indent << "Matrix (" << VRows << "x" << VColumns << ")\n";
for (unsigned int r = 0; r < VRows; ++r)
{
os << indent << " ";
for (unsigned int c = 0; c < VColumns; ++c)
{
os << indent << " ";
for (unsigned int c = 0; c < VColumns; ++c)
{
os << m_Matrix(r, c) << " ";
}
os << "\n";
os << m_Matrix(r, c) << " ";
}

}
os << "\n";
}
}

private:
InternalMatrixType m_Matrix{};
Expand Down
5 changes: 4 additions & 1 deletion Modules/Core/Common/include/itkMultiThreaderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ class ITKCommon_EXPORT MultiThreaderBase : public Object
this->SetMaximumNumberOfThreads(numberOfThreads);
this->SetNumberOfWorkUnits(this->GetMaximumNumberOfThreads()); // Might be clamped
}
itkLegacyMacro(virtual ThreadIdType GetNumberOfThreads()) { return this->GetNumberOfWorkUnits(); }
itkLegacyMacro(virtual ThreadIdType GetNumberOfThreads())
{
return this->GetNumberOfWorkUnits();
}

/** This is the structure that is passed to the thread that is
* created from the SingleMethodExecute. It is passed in as a void *,
Expand Down
3 changes: 2 additions & 1 deletion Modules/Core/Common/include/itkSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
*/
template <typename T>
[[deprecated("Preferably use the C++ `[[maybe_unused]]` attribute instead!")]] inline void
Unused(const T &){}
Unused(const T &)
{}
#endif

namespace itk
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/test/itkSmartPointerGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ TEST(SmartPointer, EmptyAndNull)
cptr = nullptr;
EXPECT_TRUE(cptr.IsNull());

ITK_CLANG_PRAGMA_PUSH
ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
ITK_CLANG_PRAGMA_PUSH
ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant

// NOLINTNEXTLINE(modernize-use-nullptr)
ptr = NULL; // Do not change NULL, null, Null in this file. This file intentionally contains usage of legacy NULL
EXPECT_TRUE(ptr.IsNull());

// NOLINTNEXTLINE(modernize-use-nullptr)
cptr = NULL; // Do not change NULL, null, Null in this file. This file intentionally contains usage of legacy NULL
ITK_CLANG_PRAGMA_POP
ITK_CLANG_PRAGMA_POP

EXPECT_TRUE(cptr.IsNull());

Expand Down
26 changes: 19 additions & 7 deletions Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,25 @@ class ITK_TEMPLATE_EXPORT EllipseSpatialObject : public SpatialObject<TDimension
using Superclass::IsInsideInObjectSpace;

#if !defined(ITK_LEGACY_REMOVE)
itkLegacyMacro(void SetRadius(double radius)) { this->SetRadiusInObjectSpace(radius); }

itkLegacyMacro(void SetRadius(ArrayType radii)) { this->SetRadiusInObjectSpace(radii); }

itkLegacyMacro(ArrayType GetRadius() const) { return this->GetRadiusInObjectSpace(); }

itkLegacyMacro(void SetRadiiInObjectSpace(ArrayType radii)) { this->SetRadiusInObjectSpace(radii); }
itkLegacyMacro(void SetRadius(double radius))
{
this->SetRadiusInObjectSpace(radius);
}

itkLegacyMacro(void SetRadius(ArrayType radii))
{
this->SetRadiusInObjectSpace(radii);
}

itkLegacyMacro(ArrayType GetRadius() const)
{
return this->GetRadiusInObjectSpace();
}

itkLegacyMacro(void SetRadiiInObjectSpace(ArrayType radii))
{
this->SetRadiusInObjectSpace(radii);
}
#endif
protected:
/** Get the boundaries of a specific object. This function needs to
Expand Down
12 changes: 9 additions & 3 deletions Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,15 @@ class ITK_TEMPLATE_EXPORT GaussianSpatialObject : public SpatialObject<TDimensio
GetEllipsoid() const;

#if !defined(ITK_LEGACY_REMOVE)
itkLegacyMacro(void SetSigma(double sigma)) { return this->SetSigmaInObjectSpace(sigma); }

itkLegacyMacro(double GetSigma() const) { return this->GetSigmaInObjectSpace(); }
itkLegacyMacro(void SetSigma(double sigma))
{
return this->SetSigmaInObjectSpace(sigma);
}

itkLegacyMacro(double GetSigma() const)
{
return this->GetSigmaInObjectSpace();
}
#endif
protected:
/** This function needs to be called every time one of the object's
Expand Down
5 changes: 4 additions & 1 deletion Modules/Core/SpatialObjects/include/itkImageSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ class ITK_TEMPLATE_EXPORT ImageSpatialObject : public SpatialObject<TDimension>
}

#if !defined(ITK_LEGACY_REMOVE)
itkLegacyMacro(const char * GetPixelTypeName()) { return m_PixelType.c_str(); }
itkLegacyMacro(const char * GetPixelTypeName())
{
return m_PixelType.c_str();
}
#endif

/** Set/Get the interpolator. */
Expand Down
5 changes: 4 additions & 1 deletion Modules/Core/SpatialObjects/include/itkMeshSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ class ITK_TEMPLATE_EXPORT MeshSpatialObject : public SpatialObject<TMesh::PointD

#if !defined(ITK_LEGACY_REMOVE)
/** \deprecated Return the type of pixel used */
itkLegacyMacro(const char * GetPixelTypeName()) { return m_PixelType.c_str(); }
itkLegacyMacro(const char * GetPixelTypeName())
{
return m_PixelType.c_str();
}
#endif

/** Set/Get the precision for the IsInsideInObjectSpace function.
Expand Down
5 changes: 4 additions & 1 deletion Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ class ITK_TEMPLATE_EXPORT TubeSpatialObject : public PointBasedSpatialObject<TDi

#if !defined(ITK_LEGACY_REMOVE)
/** Compute the tangents and normals of the centerline of the tube. */
itkLegacyMacro(bool ComputeTangentAndNormals()) { return ComputeTangentsAndNormals(); }
itkLegacyMacro(bool ComputeTangentAndNormals())
{
return ComputeTangentsAndNormals();
}
#endif

/** Remove duplicate points. */
Expand Down
5 changes: 4 additions & 1 deletion Modules/Core/Transform/include/itkBSplineBaseTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ class ITK_TEMPLATE_EXPORT BSplineBaseTransform : public Transform<TParametersVal

#if !defined(ITK_LEGACY_REMOVE)
/** Get number of weights. */
itkLegacyMacro(unsigned long GetNumberOfWeights() const) { return m_WeightsFunction->GetNumberOfWeights(); }
itkLegacyMacro(unsigned long GetNumberOfWeights() const)
{
return m_WeightsFunction->GetNumberOfWeights();
}
#endif

/** Method to transform a vector -
Expand Down
9 changes: 6 additions & 3 deletions Modules/Core/Transform/include/itkBSplineTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,17 @@ class ITK_TEMPLATE_EXPORT BSplineTransform : public BSplineBaseTransform<TParame

/** Methods have empty implementations */
void
SetFixedParametersGridSizeFromTransformDomainInformation() const override{}
SetFixedParametersGridSizeFromTransformDomainInformation() const override
{}
void
SetFixedParametersGridOriginFromTransformDomainInformation() const override{}
SetFixedParametersGridOriginFromTransformDomainInformation() const override
{}
void
SetFixedParametersGridSpacingFromTransformDomainInformation() const override
{}
void
SetFixedParametersGridDirectionFromTransformDomainInformation() const override{}
SetFixedParametersGridDirectionFromTransformDomainInformation() const override
{}

/** Check if a continuous index is inside the valid region. */
bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class ITK_TEMPLATE_EXPORT ConvolutionImageFilterBase : public ImageToImageFilter
/** Default superclass implementation ensures that input images
* occupy same physical space. This is not needed for this filter. */
void
VerifyInputInformation() const override{}
VerifyInputInformation() const override
{}

private:
bool m_Normalize{ false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ class ITK_TEMPLATE_EXPORT VelocityFieldTransform : public DisplacementFieldTrans

/** Trigger the computation of the displacement field by integrating the velocity field. */
virtual void
IntegrateVelocityField(){}
IntegrateVelocityField()
{}

/**
* Set the lower time bound defining the integration domain of the transform.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class NullImageToImageFilterDriver
{
public:
NullImageToImageFilterDriver()
: m_Filter(nullptr){}
: m_Filter(nullptr)
{}

using ImageSizeType = typename TInputImage::SizeType;
using InputPixelType = typename TInputImage::PixelType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class CommandIterationUpdatev4 : public Command
/**
* Constructor
*/
CommandIterationUpdatev4(){}
CommandIterationUpdatev4() {}

private:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ class ITK_TEMPLATE_EXPORT ObjectToObjectOptimizerBaseTemplate : public Object
/** Set the number of work units to use when threading.
*
* NOTE: deprecated. Use SetNumberOfWorkUnits() */
itkLegacyMacro(virtual void SetNumberOfThreads(ThreadIdType number)) { return this->SetNumberOfWorkUnits(number); }
itkLegacyMacro(virtual const ThreadIdType & GetNumberOfThreads() const) { return this->m_NumberOfWorkUnits; }
itkLegacyMacro(virtual void SetNumberOfThreads(ThreadIdType number))
{
return this->SetNumberOfWorkUnits(number);
}
itkLegacyMacro(virtual const ThreadIdType & GetNumberOfThreads() const)
{
return this->m_NumberOfWorkUnits;
}
#endif // !ITK_LEGACY_REMOVE

/** Get the number of work units set to be used. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class TransformParametersAdaptor

/** Initialize the transform using the specified fixed parameters */
void
AdaptTransformParameters() override{}
AdaptTransformParameters() override
{}

protected:
TransformParametersAdaptor() = default;
Expand Down
30 changes: 24 additions & 6 deletions Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,22 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetricv4
#if !defined(ITK_LEGACY_REMOVE)
/** UseFixedSampledPointSet is deprecated and has been replaced
* with UseSampledPointsSet. */
itkLegacyMacro(virtual void SetUseFixedSampledPointSet(bool v)) { this->SetUseSampledPointSet(v); }
itkLegacyMacro(virtual bool GetUseFixedSampledPointSet() const) { return this->GetUseSampledPointSet(); }
itkLegacyMacro(virtual void UseFixedSampledPointSetOn()) { return this->UseSampledPointSetOn(); }
itkLegacyMacro(virtual void UseFixedSampledPointSetOff()) { return this->UseSampledPointSetOff(); }
itkLegacyMacro(virtual void SetUseFixedSampledPointSet(bool v))
{
this->SetUseSampledPointSet(v);
}
itkLegacyMacro(virtual bool GetUseFixedSampledPointSet() const)
{
return this->GetUseSampledPointSet();
}
itkLegacyMacro(virtual void UseFixedSampledPointSetOn())
{
return this->UseSampledPointSetOn();
}
itkLegacyMacro(virtual void UseFixedSampledPointSetOff())
{
return this->UseSampledPointSetOff();
}
#endif


Expand Down Expand Up @@ -515,7 +527,10 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetricv4
* GetValue() has been called.
*
* NOTE: deprecated. Use GetNumberOfWorkUnitsUsed() */
itkLegacyMacro(virtual ThreadIdType GetNumberOfThreadsUsed() const) { return this->GetNumberOfWorkUnitsUsed(); }
itkLegacyMacro(virtual ThreadIdType GetNumberOfThreadsUsed() const)
{
return this->GetNumberOfWorkUnitsUsed();
}

/** Set number of threads to use. This the maximum number of threads to use
* when multithreaded. The actual number of threads used (may be less than
Expand All @@ -527,7 +542,10 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetricv4
{
this->SetMaximumNumberOfWorkUnits(count);
}
itkLegacyMacro(virtual ThreadIdType GetMaximumNumberOfThreads() const) { return this->GetMaximumNumberOfWorkUnits(); }
itkLegacyMacro(virtual ThreadIdType GetMaximumNumberOfThreads() const)
{
return this->GetMaximumNumberOfWorkUnits();
}
#endif // !ITK_LEGACY_REMOVE


Expand Down

0 comments on commit 835c6f3

Please sign in to comment.