Skip to content

Commit

Permalink
COMP: Prefer itkNotUsed over (void)varname in function signatures
Browse files Browse the repository at this point in the history
Function signature variable names are preserved using
itkNotUsed macro for documentation purposes.
  • Loading branch information
hjmjohnson committed Apr 12, 2024
1 parent 126169a commit e773540
Show file tree
Hide file tree
Showing 31 changed files with 166 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ ExtractImageFilterCopyRegion(
const typename BinaryUnsignedIntDispatch<T1, T2>::FirstLessThanSecondType & firstLessThanSecond,
ImageRegion<T1> & destRegion,
const ImageRegion<T2> & srcRegion,
const ImageRegion<T1> & totalInputExtractionRegion)
const ImageRegion<T1> & itkNotUsed(totalInputExtractionRegion))
{
(void)totalInputExtractionRegion;
ImageToImageFilterDefaultCopyRegion<T1, T2>(firstLessThanSecond, destRegion, srcRegion);
}

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageBoundaryCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ class ITK_TEMPLATE_EXPORT ImageBoundaryCondition
* pixel values in the outputRequestedRegion.
*/
virtual RegionType
GetInputRequestedRegion(const RegionType & inputLargestPossibleRegion, const RegionType & outputRequestedRegion) const
GetInputRequestedRegion(const RegionType & inputLargestPossibleRegion,
[[maybe_unused]] const RegionType & itkNotUsed(outputRequestedRegion)) const
{
(void)outputRequestedRegion;
return inputLargestPossibleRegion;
}

Expand Down
6 changes: 2 additions & 4 deletions Modules/Core/Common/include/itkVariableLengthVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,8 @@ struct GetType
* \note the default unspecialized behaviour returns the input number \c v.
*/
static Type
Load(Type const & v, unsigned int idx)
Load(Type const & v, unsigned int itkNotUsed(idx))
{
(void)idx;
return v;
}
};
Expand All @@ -1050,9 +1049,8 @@ struct GetType
*/
template <typename TExpr1, typename TExpr2>
inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>::Value, unsigned int>
GetSize(TExpr1 const & lhs, TExpr2 const & rhs)
GetSize(TExpr1 const & lhs, [[maybe_unused]] TExpr2 const & rhs)
{
(void)rhs;
itkAssertInDebugAndIgnoreInReleaseMacro(lhs.Size() == rhs.Size());
return lhs.Size();
}
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/src/itkObjectFactoryBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ using ITK_LOAD_FUNCTION = ObjectFactoryBase * (*)();
* lower case for LibExtension values.
*/
inline bool
NameIsSharedLibrary(const char * name)
NameIsSharedLibrary([[maybe_unused]] const char * name)
{
#ifdef ITK_DYNAMIC_LOADING
std::string extension = itksys::DynamicLoader::LibExtension();
Expand All @@ -368,7 +368,6 @@ NameIsSharedLibrary(const char * name)
return true;
}
#else // ITK_DYNAMIC_LOADING
(void)name;
itkGenericExceptionMacro("ITK was not built with support for dynamic loading.");
#endif
return false;
Expand Down
5 changes: 1 addition & 4 deletions Modules/Core/Common/test/itkCrossHelperTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@


int
itkCrossHelperTest(int argc, char * argv[])
itkCrossHelperTest(int itkNotUsed(argc), char * itkNotUsed(argv)[])
{
(void)argc;
(void)argv;

constexpr unsigned int Dimension2D = 2;
constexpr unsigned int Dimension3D = 3;
constexpr unsigned int Dimension4D = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ITK_TEMPLATE_EXPORT GPUFiniteDifferenceFunction : public FiniteDifferenceF
PixelType
ComputeUpdate(const NeighborhoodType & itkNotUsed(neighborhood),
void * itkNotUsed(globalData),
const FloatOffsetType & itkNotUsed(offset = FloatOffsetType(0.0))) override
const FloatOffsetType & itkNotUsed(offset) = FloatOffsetType(0.0)) override
{
PixelType pix{};
return pix;
Expand Down
89 changes: 30 additions & 59 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh<TPixel, VDimension, TTraits
* https://public.kitware.com/pipermail/insight-users/2005-April/012613.html
*/
void
CopyInformation(const DataObject * data) override
{
(void)data;
}
CopyInformation(const DataObject * itkNotUsed(data)) override
{}
void
Graft(const DataObject * data) override;

Expand All @@ -234,92 +232,69 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh<TPixel, VDimension, TTraits
#if !defined(ITK_WRAPPING_PARSER)
/** overloaded method for backward compatibility */
void
SetBoundaryAssignments(int dimension, BoundaryAssignmentsContainer * container)
{
(void)dimension;
(void)container;
}
SetBoundaryAssignments(int itkNotUsed(dimension), BoundaryAssignmentsContainer * itkNotUsed(container))
{}

/** overloaded method for backward compatibility */
BoundaryAssignmentsContainerPointer
GetBoundaryAssignments(int dimension)
GetBoundaryAssignments(int itkNotUsed(dimension))
{
(void)dimension;
return (nullptr);
}

/** overloaded method for backward compatibility */
const BoundaryAssignmentsContainerPointer
GetBoundaryAssignments(int dimension) const
GetBoundaryAssignments(int itkNotUsed(dimension)) const
{
(void)dimension;
return (nullptr);
}

#endif

/** overloaded method for backward compatibility */
void
SetBoundaryAssignment(int dimension,
CellIdentifier cellId,
CellFeatureIdentifier featureId,
CellIdentifier boundaryId)
{
(void)dimension;
(void)cellId;
(void)featureId;
(void)boundaryId;
}
SetBoundaryAssignment(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId),
CellIdentifier itkNotUsed(boundaryId))
{}

/** overloaded method for backward compatibility */
bool
GetBoundaryAssignment(int dimension,
CellIdentifier cellId,
CellFeatureIdentifier featureId,
CellIdentifier * boundaryId) const
GetBoundaryAssignment(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId),
CellIdentifier * itkNotUsed(boundaryId))
{
(void)dimension;
(void)cellId;
(void)featureId;
(void)boundaryId;
return (false); // ALEX: is it the good way?
}

/** overloaded method for backward compatibility */
bool
RemoveBoundaryAssignment(int dimension, CellIdentifier cellId, CellFeatureIdentifier featureId)
RemoveBoundaryAssignment(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId))
{
(void)dimension;
(void)cellId;
(void)featureId;
return (false); // ALEX: is it the good way?
}

/** overloaded method for backward compatibility */
bool
GetCellBoundaryFeature(int dimension,
CellIdentifier cellId,
CellFeatureIdentifier featureId,
CellAutoPointer & cellAP) const
GetCellBoundaryFeature(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId),
CellAutoPointer & itkNotUsed(cellAP)) const
{
(void)dimension;
(void)cellId;
(void)featureId;
(void)cellAP;
return (false);
}

/** overloaded method for backward compatibility */
CellIdentifier
GetCellBoundaryFeatureNeighbors(int dimension,
CellIdentifier cellId,
CellFeatureIdentifier featureId,
std::set<CellIdentifier> * cellSet)
GetCellBoundaryFeatureNeighbors(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId),
std::set<CellIdentifier> * itkNotUsed(cellSet))
{
(void)dimension;
(void)cellId;
(void)featureId;
(void)cellSet;
return CellIdentifier{};
}

Expand All @@ -332,15 +307,11 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh<TPixel, VDimension, TTraits

/** overloaded method for backward compatibility */
bool
GetAssignedCellBoundaryIfOneExists(int dimension,
CellIdentifier cellId,
CellFeatureIdentifier featureId,
CellAutoPointer & cellAP) const
GetAssignedCellBoundaryIfOneExists(int itkNotUsed(dimension),
CellIdentifier itkNotUsed(cellId),
CellFeatureIdentifier itkNotUsed(featureId),
CellAutoPointer & itkNotUsed(cellAP)) const
{
(void)dimension;
(void)cellId;
(void)featureId;
(void)cellAP;
return (false); // ALEX: is it the good way?
}

Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,8 @@ QuadEdgeMesh<TPixel, VDimension, TTraits>::Splice(QEPrimal * a, QEPrimal * b) ->
*/
template <typename TPixel, unsigned int VDimension, typename TTraits>
void
QuadEdgeMesh<TPixel, VDimension, TTraits>::SetCell(CellIdentifier cId, CellAutoPointer & cell)
QuadEdgeMesh<TPixel, VDimension, TTraits>::SetCell(CellIdentifier itkNotUsed(cId), CellAutoPointer & cell)
{
(void)cId;

// NOTE ALEX: should add some checking to be sure everything went fine
EdgeCellType * qe;
PolygonCellType * pe;
Expand Down
15 changes: 5 additions & 10 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,8 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshFrontBaseIterator
* to the "topological metric" i.e. all edges have unit length.
*/
virtual CoordRepType
GetCost(QEType * edge)
GetCost(QEType * itkNotUsed(edge))
{
(void)edge;
return (1);
}

Expand Down Expand Up @@ -271,14 +270,10 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshConstFrontIterator : public QuadEdgeMeshFr

public:
/** Object creation methods. */
QuadEdgeMeshConstFrontIterator(const MeshType * mesh = (MeshType *)0,
bool start = true,
QEType * seed = (QEType *)nullptr)
{
(void)mesh;
(void)start;
(void)seed;
}
QuadEdgeMeshConstFrontIterator(const MeshType * itkNotUsed(mesh) = (MeshType *)0,
bool itkNotUsed(start) = true,
QEType * itkNotUsed(seed) = (QEType *)nullptr)
{}

/** \todo do we need here a : Superclass( mesh, start, seed ) { } */
~QuadEdgeMeshConstFrontIterator() override = default;
Expand Down
15 changes: 5 additions & 10 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,11 @@ QuadEdgeMeshLineCell<TCellInterface>::GetNumberOfBoundaryFeatures(int dimension)
// ---------------------------------------------------------------------
template <typename TCellInterface>
bool
QuadEdgeMeshLineCell<TCellInterface>::GetBoundaryFeature(int dimension,
CellFeatureIdentifier cellId,
CellAutoPointer & cell)
QuadEdgeMeshLineCell<TCellInterface>::GetBoundaryFeature(int itkNotUsed(dimension),
CellFeatureIdentifier itkNotUsed(cellId),
CellAutoPointer & itkNotUsed(cell))
{
// TODO : FIXME
(void)dimension;
(void)cellId;
(void)cell;
return (false);
}

Expand Down Expand Up @@ -173,9 +170,8 @@ QuadEdgeMeshLineCell<TCellInterface>::InternalSetPointIds(PointIdInternalConstIt
// ---------------------------------------------------------------------
template <typename TCellInterface>
void
QuadEdgeMeshLineCell<TCellInterface>::SetPointIds(PointIdConstIterator first, PointIdConstIterator last)
QuadEdgeMeshLineCell<TCellInterface>::SetPointIds(PointIdConstIterator first, PointIdConstIterator itkNotUsed(last))
{
(void)last;
this->GetQEGeom()->SetOrigin(*first);
++first;
this->GetQEGeom()->SetDestination(*first);
Expand All @@ -185,9 +181,8 @@ QuadEdgeMeshLineCell<TCellInterface>::SetPointIds(PointIdConstIterator first, Po
template <typename TCellInterface>
void
QuadEdgeMeshLineCell<TCellInterface>::InternalSetPointIds(PointIdInternalConstIterator first,
PointIdInternalConstIterator last)
PointIdInternalConstIterator itkNotUsed(last))
{
(void)last;
this->GetQEGeom()->SetOrigin(*first);
++first;
this->GetQEGeom()->SetDestination(*first);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,11 @@ QuadEdgeMeshPolygonCell<TCellInterface>::GetNumberOfBoundaryFeatures(int dimensi
// ---------------------------------------------------------------------
template <typename TCellInterface>
bool
QuadEdgeMeshPolygonCell<TCellInterface>::GetBoundaryFeature(int dimension,
CellFeatureIdentifier cellId,
CellAutoPointer & cell)
QuadEdgeMeshPolygonCell<TCellInterface>::GetBoundaryFeature(int itkNotUsed(dimension),
CellFeatureIdentifier itkNotUsed(cellId),
CellAutoPointer & itkNotUsed(cell))
{
/// \todo
(void)dimension;
(void)cellId;
(void)cell;
return (false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,17 @@ class CustomQELineVisitor
{
public:
void
Visit(unsigned long cellId, QELineCellType * t)
{
(void)cellId;
(void)t;
}
Visit(unsigned long itkNotUsed(cellId), QELineCellType * itkNotUsed(t))
{}
virtual ~CustomQELineVisitor() = default;
};

class CustomQEPolyVisitor
{
public:
void
Visit(unsigned long cellId, QEPolygonCellType * t)
{
(void)cellId;
(void)t;
}
Visit(unsigned long itkNotUsed(cellId), QEPolygonCellType * itkNotUsed(t))
{}
virtual ~CustomQEPolyVisitor() = default;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
#include "itkQuadEdgeMeshEulerOperatorsTestHelper.h"

int
itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest(int argc, char * argv[])
itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest(int itkNotUsed(argc), char * itkNotUsed(argv)[])
{
(void)argc;
(void)argv;

using MeshType = itk::QuadEdgeMesh<double, 3>;
using MeshPointer = MeshType::Pointer;
using QEType = MeshType::QEType;
Expand Down
Loading

0 comments on commit e773540

Please sign in to comment.