Skip to content

Commit

Permalink
STYLE: clang-format AlignEscapedNewlines Left (for macro definitions)
Browse files Browse the repository at this point in the history
Aligns escaped (`\`) newlines as far left as possible, according to
https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Applies especially to macro definitions.

Aims to fix a kwrobot-v1/ghostflow-check-master error at pull request
#2785
"Remove virtual from Get/Set macro definitions", as reported by
Dženan Zukić:

> commit 8f26661 creates blob [...] at Modules/Core/Common/include/itkMacro.h
> with size 101090 bytes (98.72 KiB) which is greater than the maximum
> size 100000 bytes (97.66 KiB). If the file is intended to be
> committed, set the hooks-max-size attribute on its path.

Manually adjusted the six "clang-format off" sections in itkMacro.h according to
the clang-format preferences.
  • Loading branch information
N-Dekker committed Oct 13, 2021
1 parent f31d563 commit 7829ef6
Show file tree
Hide file tree
Showing 84 changed files with 2,500 additions and 2,500 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
# clang 9.0 AllowAllArgumentsOnNextLine: true
Expand Down
18 changes: 9 additions & 9 deletions Modules/Bridge/VTK/include/itkVTKImageImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
#include "itkImageSource.h"
#include "itkImportImageContainer.h"

#define itkSetMacro2(name, type) \
virtual void Set##name(type _arg) \
{ \
itkDebugMacro("setting " #name " to " << _arg); \
if (this->m_##name != _arg) \
{ \
this->m_##name = _arg; \
this->Modified(); \
} \
#define itkSetMacro2(name, type) \
virtual void Set##name(type _arg) \
{ \
itkDebugMacro("setting " #name " to " << _arg); \
if (this->m_##name != _arg) \
{ \
this->m_##name = _arg; \
this->Modified(); \
} \
}

namespace itk
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ main()
(void)sizeof(fenv.__cw);
#else
(void)fenv;
# error \
# error \
"Unknown fenv_t struct member test: Make sure to specify a compile definition of the form -DITK_CHECK_FENV_T_xxx"
#endif
return 0;
Expand Down
94 changes: 47 additions & 47 deletions Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,52 @@
// Define a macro for CellInterface sub-classes to use
// to define the Accept and GetTopologyId virtuals used
// by the MultiVisitor class
#define itkCellVisitMacro(TopologyId) \
static constexpr CellGeometryEnum GetTopologyId() { return TopologyId; } \
virtual void Accept(CellIdentifier cellid, typename CellInterface<PixelType, CellTraits>::MultiVisitor * mv) \
override \
{ \
typename CellInterfaceVisitor<PixelType, CellTraits>::Pointer v = mv->GetVisitor(TopologyId); \
if (v) \
{ \
v->VisitFromCell(cellid, this); \
} \
#define itkCellVisitMacro(TopologyId) \
static constexpr CellGeometryEnum GetTopologyId() { return TopologyId; } \
virtual void Accept(CellIdentifier cellid, typename CellInterface<PixelType, CellTraits>::MultiVisitor * mv) \
override \
{ \
typename CellInterfaceVisitor<PixelType, CellTraits>::Pointer v = mv->GetVisitor(TopologyId); \
if (v) \
{ \
v->VisitFromCell(cellid, this); \
} \
}

// Define a macro for the common type alias required by the
// classes deriving form CellInterface (included).
#define itkCellCommonTypedefs(celltype) \
using Self = celltype; \
using ConstSelfAutoPointer = AutoPointer<const Self>; \
using SelfAutoPointer = AutoPointer<Self>; \
using RawPointer = Self *; \
#define itkCellCommonTypedefs(celltype) \
using Self = celltype; \
using ConstSelfAutoPointer = AutoPointer<const Self>; \
using SelfAutoPointer = AutoPointer<Self>; \
using RawPointer = Self *; \
using ConstRawPointer = const Self *

// Define a macro for the common type alias required by the
// classes deriving form CellInterface (excluded).
#define itkCellInheritedTypedefs(superclassArg) \
using Superclass = superclassArg; \
using typename Superclass::PixelType; \
using CellType = typename Superclass::CellType; \
using typename Superclass::CellAutoPointer; \
using typename Superclass::CellConstAutoPointer; \
using typename Superclass::CellRawPointer; \
using typename Superclass::CellConstRawPointer; \
using typename Superclass::CellTraits; \
using typename Superclass::CoordRepType; \
using typename Superclass::InterpolationWeightType; \
using typename Superclass::PointIdentifier; \
using typename Superclass::PointIdIterator; \
using typename Superclass::PointIdConstIterator; \
using typename Superclass::CellIdentifier; \
using typename Superclass::CellFeatureIdentifier; \
using CellFeatureCount = typename Superclass::CellFeatureIdentifier; \
using typename Superclass::PointType; \
using typename Superclass::VectorType; \
using typename Superclass::PointsContainer; \
using typename Superclass::UsingCellsContainer; \
using typename Superclass::ParametricCoordArrayType; \
using typename Superclass::ShapeFunctionsArrayType; \
#define itkCellInheritedTypedefs(superclassArg) \
using Superclass = superclassArg; \
using typename Superclass::PixelType; \
using CellType = typename Superclass::CellType; \
using typename Superclass::CellAutoPointer; \
using typename Superclass::CellConstAutoPointer; \
using typename Superclass::CellRawPointer; \
using typename Superclass::CellConstRawPointer; \
using typename Superclass::CellTraits; \
using typename Superclass::CoordRepType; \
using typename Superclass::InterpolationWeightType; \
using typename Superclass::PointIdentifier; \
using typename Superclass::PointIdIterator; \
using typename Superclass::PointIdConstIterator; \
using typename Superclass::CellIdentifier; \
using typename Superclass::CellFeatureIdentifier; \
using CellFeatureCount = typename Superclass::CellFeatureIdentifier; \
using typename Superclass::PointType; \
using typename Superclass::VectorType; \
using typename Superclass::PointsContainer; \
using typename Superclass::UsingCellsContainer; \
using typename Superclass::ParametricCoordArrayType; \
using typename Superclass::ShapeFunctionsArrayType; \
static constexpr unsigned int PointDimension = Superclass::PointDimension

namespace itk
Expand Down Expand Up @@ -537,15 +537,15 @@ class ITK_TEMPLATE_EXPORT CellTraitsInfo
using PointIdConstIterator = const PointIdentifier *;
};

#define itkMakeCellTraitsMacro \
CellTraitsInfo<Self::PointDimension, \
CoordRepType, \
InterpolationWeightType, \
PointIdentifier, \
CellIdentifier, \
CellFeatureIdentifier, \
PointType, \
PointsContainer, \
#define itkMakeCellTraitsMacro \
CellTraitsInfo<Self::PointDimension, \
CoordRepType, \
InterpolationWeightType, \
PointIdentifier, \
CellIdentifier, \
CellFeatureIdentifier, \
PointType, \
PointsContainer, \
UsingCellsContainer>
} // end namespace itk

Expand Down
46 changes: 23 additions & 23 deletions Modules/Core/Common/include/itkConceptChecking.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@
// Leave ()'s off the sizeof to force the caller to pass them in the
// concept argument of the itkConceptMacro. This is necessary because
// the argument may contain commas.
# define itkConceptConstraintsMacro() \
template <void (Constraints::*)()> \
struct Enforcer \
{}; \
using EnforcerInstantiation = Enforcer<&Constraints::constraints>; \
# define itkConceptConstraintsMacro() \
template <void (Constraints::*)()> \
struct Enforcer \
{}; \
using EnforcerInstantiation = Enforcer<&Constraints::constraints>; \
ITK_MACROEND_NOOP_STATEMENT
# define itkConceptMacro(name, concept) \
enum \
{ \
name = sizeof concept \
}; \
# define itkConceptMacro(name, concept) \
enum \
{ \
name = sizeof concept \
}; \
ITK_MACROEND_NOOP_STATEMENT

#elif defined(ITK_CONCEPT_IMPLEMENTATION_VTABLE)
Expand All @@ -76,32 +76,32 @@
* run-time overhead. The "vtable" approach was invented for this
* project by Brad King at Kitware.
*/
# define itkConceptConstraintsMacro() \
# define itkConceptConstraintsMacro() \
virtual void Enforcer() { &Constraints::constraints; }
# define itkConceptMacro(name, concept) \
enum \
{ \
name = sizeof concept \
# define itkConceptMacro(name, concept) \
enum \
{ \
name = sizeof concept \
}

#elif defined(ITK_CONCEPT_IMPLEMENTATION_CALL)

/** Not implemented. */
# define itkConceptConstraintsMacro()
# define itkConceptMacro(name, concept) \
enum \
{ \
name = 0 \
# define itkConceptMacro(name, concept) \
enum \
{ \
name = 0 \
}

#else

/** Disable concept checking. */
# define itkConceptConstraintsMacro()
# define itkConceptMacro(name, concept) \
enum \
{ \
name = 0 \
# define itkConceptMacro(name, concept) \
enum \
{ \
name = 0 \
}

#endif
Expand Down
Loading

0 comments on commit 7829ef6

Please sign in to comment.