From d69c780a5083212610951b723122db63a39f7eb4 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Fri, 12 Apr 2024 06:54:59 -0500 Subject: [PATCH] COMP: Prefer itkNotUsed over (void)varname in function signatures Function signature variable names are preserved using itkNotUsed macro for documentation purposes. --- .../itkExtractImageFilterRegionCopier.h | 3 +- .../include/itkImageBoundaryCondition.h | 4 +- .../Common/include/itkVariableLengthVector.h | 6 +- .../Core/Common/src/itkObjectFactoryBase.cxx | 3 +- .../Core/Common/test/itkCrossHelperTest.cxx | 5 +- .../include/itkGPUFiniteDifferenceFunction.h | 2 +- .../QuadEdgeMesh/include/itkQuadEdgeMesh.h | 89 +++++-------- .../QuadEdgeMesh/include/itkQuadEdgeMesh.hxx | 4 +- .../include/itkQuadEdgeMeshFrontIterator.h | 15 +-- .../include/itkQuadEdgeMeshLineCell.hxx | 15 +-- .../include/itkQuadEdgeMeshPolygonCell.hxx | 9 +- .../test/itkQuadEdgeMeshCellInterfaceTest.cxx | 14 +- ...eshEulerOperatorDeleteCenterVertexTest.cxx | 5 +- Modules/Filtering/FFT/include/itkFFTWCommon.h | 24 +--- .../FFT/include/itkFFTWCommonExtended.h | 126 ++++++++++-------- .../FFT/test/itkFFTPadImageFilterTest.cxx | 3 +- .../Filtering/FFT/test/itkFFTWF_FFTTest.cxx | 5 +- .../FFT/test/itkFFTWF_RealFFTTest.cxx | 5 +- .../FFT/test/itkVnlFFTWF_FFTTest.cxx | 5 +- .../FFT/test/itkVnlFFTWF_RealFFTTest.cxx | 5 +- .../itkFastMarchingImageFilterBase.hxx | 4 +- .../itkFastMarchingQuadEdgeMeshFilterBase.hxx | 10 +- .../test/itkFastMarchingBaseTest.cxx | 8 +- .../itkEdgeDecimationQuadEdgeMeshFilter.hxx | 6 +- .../itkInternationalizationIOHelpers.h | 3 +- .../test/itkImageFileReaderTest1.cxx | 2 +- Modules/IO/JPEG/src/itkJPEGImageIO.cxx | 4 +- .../test/itkTriangleHelperTest.cxx | 5 +- .../Review/test/itkTimeAndMemoryProbeTest.cxx | 5 +- .../test/itkSimpleImageRegistrationTest3.cxx | 7 +- .../test/itkSyNImageRegistrationTest.cxx | 7 +- 31 files changed, 166 insertions(+), 242 deletions(-) diff --git a/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h b/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h index 0dcf41b78eb2..e2e3ccba324e 100644 --- a/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h +++ b/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h @@ -57,9 +57,8 @@ ExtractImageFilterCopyRegion( const typename BinaryUnsignedIntDispatch::FirstLessThanSecondType & firstLessThanSecond, ImageRegion & destRegion, const ImageRegion & srcRegion, - const ImageRegion & totalInputExtractionRegion) + const ImageRegion & itkNotUsed(totalInputExtractionRegion)) { - (void)totalInputExtractionRegion; ImageToImageFilterDefaultCopyRegion(firstLessThanSecond, destRegion, srcRegion); } diff --git a/Modules/Core/Common/include/itkImageBoundaryCondition.h b/Modules/Core/Common/include/itkImageBoundaryCondition.h index aa0ced6394ef..b2957e4814f6 100644 --- a/Modules/Core/Common/include/itkImageBoundaryCondition.h +++ b/Modules/Core/Common/include/itkImageBoundaryCondition.h @@ -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; } diff --git a/Modules/Core/Common/include/itkVariableLengthVector.h b/Modules/Core/Common/include/itkVariableLengthVector.h index de2de11f22ea..d496fd17cf01 100644 --- a/Modules/Core/Common/include/itkVariableLengthVector.h +++ b/Modules/Core/Common/include/itkVariableLengthVector.h @@ -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; } }; @@ -1050,9 +1049,8 @@ struct GetType */ template inline std::enable_if_t, mpl::IsArray>::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(); } diff --git a/Modules/Core/Common/src/itkObjectFactoryBase.cxx b/Modules/Core/Common/src/itkObjectFactoryBase.cxx index cdf7f68de57b..ca1263691023 100644 --- a/Modules/Core/Common/src/itkObjectFactoryBase.cxx +++ b/Modules/Core/Common/src/itkObjectFactoryBase.cxx @@ -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(); @@ -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; diff --git a/Modules/Core/Common/test/itkCrossHelperTest.cxx b/Modules/Core/Common/test/itkCrossHelperTest.cxx index 0d7d6426470f..866e38af7857 100644 --- a/Modules/Core/Common/test/itkCrossHelperTest.cxx +++ b/Modules/Core/Common/test/itkCrossHelperTest.cxx @@ -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; diff --git a/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h b/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h index 7889b3e84e21..e83decaa4c15 100644 --- a/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h +++ b/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h @@ -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; diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h index d3e5fb6e8fc1..98a86462ccc0 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h @@ -215,10 +215,8 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh * cellSet) + GetCellBoundaryFeatureNeighbors(int itkNotUsed(dimension), + CellIdentifier itkNotUsed(cellId), + CellFeatureIdentifier itkNotUsed(featureId), + std::set * itkNotUsed(cellSet)) { - (void)dimension; - (void)cellId; - (void)featureId; - (void)cellSet; return CellIdentifier{}; } @@ -332,15 +307,11 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh::Splice(QEPrimal * a, QEPrimal * b) -> */ template void -QuadEdgeMesh::SetCell(CellIdentifier cId, CellAutoPointer & cell) +QuadEdgeMesh::SetCell(CellIdentifier itkNotUsed(cId), CellAutoPointer & cell) { - (void)cId; - // NOTE ALEX: should add some checking to be sure everything went fine EdgeCellType * qe; PolygonCellType * pe; diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h index 5d81a5ca8cb7..4f81bd6658dc 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h @@ -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); } @@ -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; diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.hxx b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.hxx index 3ddd7c87dfa7..7adcf04256ed 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.hxx +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.hxx @@ -135,14 +135,11 @@ QuadEdgeMeshLineCell::GetNumberOfBoundaryFeatures(int dimension) // --------------------------------------------------------------------- template bool -QuadEdgeMeshLineCell::GetBoundaryFeature(int dimension, - CellFeatureIdentifier cellId, - CellAutoPointer & cell) +QuadEdgeMeshLineCell::GetBoundaryFeature(int itkNotUsed(dimension), + CellFeatureIdentifier itkNotUsed(cellId), + CellAutoPointer & itkNotUsed(cell)) { // TODO : FIXME - (void)dimension; - (void)cellId; - (void)cell; return (false); } @@ -173,9 +170,8 @@ QuadEdgeMeshLineCell::InternalSetPointIds(PointIdInternalConstIt // --------------------------------------------------------------------- template void -QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, PointIdConstIterator last) +QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, PointIdConstIterator itkNotUsed(last)) { - (void)last; this->GetQEGeom()->SetOrigin(*first); ++first; this->GetQEGeom()->SetDestination(*first); @@ -185,9 +181,8 @@ QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, Po template void QuadEdgeMeshLineCell::InternalSetPointIds(PointIdInternalConstIterator first, - PointIdInternalConstIterator last) + PointIdInternalConstIterator itkNotUsed(last)) { - (void)last; this->GetQEGeom()->SetOrigin(*first); ++first; this->GetQEGeom()->SetDestination(*first); diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.hxx b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.hxx index 6123b601ffa8..63ec53a022be 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.hxx +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.hxx @@ -160,14 +160,11 @@ QuadEdgeMeshPolygonCell::GetNumberOfBoundaryFeatures(int dimensi // --------------------------------------------------------------------- template bool -QuadEdgeMeshPolygonCell::GetBoundaryFeature(int dimension, - CellFeatureIdentifier cellId, - CellAutoPointer & cell) +QuadEdgeMeshPolygonCell::GetBoundaryFeature(int itkNotUsed(dimension), + CellFeatureIdentifier itkNotUsed(cellId), + CellAutoPointer & itkNotUsed(cell)) { /// \todo - (void)dimension; - (void)cellId; - (void)cell; return (false); } diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx index a1d3ef9bc2c2..4a9189f878b8 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx @@ -49,11 +49,8 @@ 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; }; @@ -61,11 +58,8 @@ 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; }; diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx index 15a50df030c5..9fed7f9c2cc9 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx @@ -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; using MeshPointer = MeshType::Pointer; using QEType = MeshType::QEType; diff --git a/Modules/Filtering/FFT/include/itkFFTWCommon.h b/Modules/Filtering/FFT/include/itkFFTWCommon.h index 98c9e12042da..1939f3dc3b20 100644 --- a/Modules/Filtering/FFT/include/itkFFTWCommon.h +++ b/Modules/Filtering/FFT/include/itkFFTWCommon.h @@ -129,14 +129,12 @@ class Proxy ComplexType * in, PixelType * out, unsigned int flags, - int threads = 1, + int itkNotused(threads) = 1, bool canDestroyInput = false) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input @@ -228,15 +226,13 @@ class Proxy PixelType * in, ComplexType * out, unsigned int flags, - int threads = 1, + int itkNotUsed(threads) = 1, bool canDestroyInput = false) { // # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input @@ -331,14 +327,12 @@ class Proxy ComplexType * out, int sign, unsigned int flags, - int threads = 1, + int itkNotUsed(threads) = 1, bool canDestroyInput = false) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input @@ -465,14 +459,12 @@ class Proxy ComplexType * in, PixelType * out, unsigned int flags, - int threads = 1, + int itkNotUsed(threads) = 1, bool canDestroyInput = false) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input @@ -564,14 +556,12 @@ class Proxy PixelType * in, ComplexType * out, unsigned int flags, - int threads = 1, + int itkNotUsed(threads) = 1, bool canDestroyInput = false) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input @@ -666,14 +656,12 @@ class Proxy ComplexType * out, int sign, unsigned int flags, - int threads = 1, + int itkNotUsed(threads) = 1, bool canDestroyInput = false) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif // don't add FFTW_WISDOM_ONLY if the plan rigor is FFTW_ESTIMATE // because FFTW_ESTIMATE guarantee to not destroy the input diff --git a/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h b/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h index 5bed4f88fa34..0cfbcddad203 100644 --- a/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h +++ b/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h @@ -62,110 +62,119 @@ class ComplexToComplexProxy using Self = ComplexToComplexProxy; static PlanType - Plan_dft_c2r_1d(int n, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_1d(int n, ComplexType * in, PixelType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_c2r_1d(n, in, out, flags); return plan; } static PlanType - Plan_dft_c2r_2d(int nx, int ny, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_2d(int nx, int ny, ComplexType * in, PixelType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_c2r_2d(nx, ny, in, out, flags); return plan; } static PlanType - Plan_dft_c2r_3d(int nx, int ny, int nz, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_3d(int nx, + int ny, + int nz, + ComplexType * in, + PixelType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_c2r_3d(nx, ny, nz, in, out, flags); return plan; } static PlanType - Plan_dft_c2r(int rank, const int * n, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r(int rank, + const int * n, + ComplexType * in, + PixelType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_c2r(rank, n, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_1d(int n, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_1d(int n, PixelType * in, ComplexType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_r2c_1d(n, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_2d(int nx, int ny, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_2d(int nx, int ny, PixelType * in, ComplexType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_r2c_2d(nx, ny, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_3d(int nx, int ny, int nz, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_3d(int nx, + int ny, + int nz, + PixelType * in, + ComplexType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_r2c_3d(nx, ny, nz, in, out, flags); return plan; } static PlanType - Plan_dft_r2c(int rank, const int * n, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c(int rank, + const int * n, + PixelType * in, + ComplexType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_r2c(rank, n, in, out, flags); return plan; } static PlanType - Plan_dft_1d(const int n, ComplexType * in, ComplexType * out, int sign, unsigned int flags, int threads = 1) + Plan_dft_1d(const int n, + ComplexType * in, + ComplexType * out, + int sign, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftwf_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftwf_plan_dft_1d(n, in, out, sign, flags); return plan; @@ -198,113 +207,122 @@ class ComplexToComplexProxy using Self = ComplexToComplexProxy; static PlanType - Plan_dft_c2r_1d(int n, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_1d(int n, ComplexType * in, PixelType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_c2r_1d(n, in, out, flags); return plan; } static PlanType - Plan_dft_c2r_2d(int nx, int ny, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_2d(int nx, int ny, ComplexType * in, PixelType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_c2r_2d(nx, ny, in, out, flags); return plan; } static PlanType - Plan_dft_c2r_3d(int nx, int ny, int nz, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r_3d(int nx, + int ny, + int nz, + ComplexType * in, + PixelType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_c2r_3d(nx, ny, nz, in, out, flags); return plan; } static PlanType - Plan_dft_c2r(int rank, const int * n, ComplexType * in, PixelType * out, unsigned int flags, int threads = 1) + Plan_dft_c2r(int rank, + const int * n, + ComplexType * in, + PixelType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_c2r(rank, n, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_1d(int n, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_1d(int n, PixelType * in, ComplexType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_r2c_1d(n, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_2d(int nx, int ny, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_2d(int nx, int ny, PixelType * in, ComplexType * out, unsigned int flags, itkNotUsed(threads) = 1) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_r2c_2d(nx, ny, in, out, flags); return plan; } static PlanType - Plan_dft_r2c_3d(int nx, int ny, int nz, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c_3d(int nx, + int ny, + int nz, + PixelType * in, + ComplexType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_r2c_3d(nx, ny, nz, in, out, flags); return plan; } static PlanType - Plan_dft_r2c(int rank, const int * n, PixelType * in, ComplexType * out, unsigned int flags, int threads = 1) + Plan_dft_r2c(int rank, + const int * n, + PixelType * in, + ComplexType * out, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_r2c(rank, n, in, out, flags); return plan; } static PlanType - Plan_dft_1d(const int n, ComplexType * in, ComplexType * out, int sign, unsigned int flags, int threads = 1) + Plan_dft_1d(const int n, + ComplexType * in, + ComplexType * out, + int sign, + unsigned int flags, + int itkNotUsed(threads = 1)) { # ifndef ITK_USE_CUFFTW const std::lock_guard lockGuard(FFTWGlobalConfiguration::GetLockMutex()); fftw_plan_with_nthreads(threads); -# else - (void)threads; # endif PlanType plan = fftw_plan_dft_1d(n, in, out, sign, flags); return plan; diff --git a/Modules/Filtering/FFT/test/itkFFTPadImageFilterTest.cxx b/Modules/Filtering/FFT/test/itkFFTPadImageFilterTest.cxx index 3571d6137c50..ca08fa338ecd 100644 --- a/Modules/Filtering/FFT/test/itkFFTPadImageFilterTest.cxx +++ b/Modules/Filtering/FFT/test/itkFFTPadImageFilterTest.cxx @@ -107,8 +107,7 @@ itkFFTPadImageFilterTest(int argc, char * argv[]) // Ensure we can build with a different output image type. using OutputImageType = itk::Image; using FFTPadWithOutputType = itk::FFTPadImageFilter; - auto fftPadWithOutput = FFTPadWithOutputType::New(); - (void)fftPadWithOutput; + [[maybe_unused]] auto fftPadWithOutput = FFTPadWithOutputType::New(); return EXIT_SUCCESS; } diff --git a/Modules/Filtering/FFT/test/itkFFTWF_FFTTest.cxx b/Modules/Filtering/FFT/test/itkFFTWF_FFTTest.cxx index 9523224d95c8..1a9f0a1ecfe3 100644 --- a/Modules/Filtering/FFT/test/itkFFTWF_FFTTest.cxx +++ b/Modules/Filtering/FFT/test/itkFFTWF_FFTTest.cxx @@ -28,7 +28,7 @@ // dimensions are taken from the array.The data types used are float and // double. int -itkFFTWF_FFTTest(int argc, char * argv[]) +itkFFTWF_FFTTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using ImageF1 = itk::Image; using ImageCF1 = itk::Image, 1>; @@ -55,9 +55,6 @@ itkFFTWF_FFTTest(int argc, char * argv[]) std::cout << "WisdomCacheBase " << itk::FFTWGlobalConfiguration::GetWisdomCacheBase() << std::endl; std::cout << "WisdomeFile " << itk::FFTWGlobalConfiguration::GetWisdomFileDefaultBaseName() << std::endl; # endif - // Avoid unused parameter warnings. - (void)argc; - (void)argv; unsigned int SizeOfDimensions1[] = { 4, 4, 4 }; unsigned int SizeOfDimensions2[] = { 3, 5, 4 }; diff --git a/Modules/Filtering/FFT/test/itkFFTWF_RealFFTTest.cxx b/Modules/Filtering/FFT/test/itkFFTWF_RealFFTTest.cxx index bff3f3cd59d3..e5772c66c29a 100644 --- a/Modules/Filtering/FFT/test/itkFFTWF_RealFFTTest.cxx +++ b/Modules/Filtering/FFT/test/itkFFTWF_RealFFTTest.cxx @@ -26,7 +26,7 @@ // template argument and the size of these dimensions are taken from // the array.The data types used are float and double. int -itkFFTWF_RealFFTTest(int argc, char * argv[]) +itkFFTWF_RealFFTTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using ImageF1 = itk::Image; using ImageCF1 = itk::Image, 1>; @@ -53,9 +53,6 @@ itkFFTWF_RealFFTTest(int argc, char * argv[]) std::cout << "WisdomCacheBase " << itk::FFTWGlobalConfiguration::GetWisdomCacheBase() << std::endl; std::cout << "WisdomeFile " << itk::FFTWGlobalConfiguration::GetWisdomFileDefaultBaseName() << std::endl; # endif - // Avoid unused parameter warnings. - (void)argc; - (void)argv; unsigned int SizeOfDimensions1[] = { 4, 4, 4 }; unsigned int SizeOfDimensions2[] = { 3, 5, 4 }; diff --git a/Modules/Filtering/FFT/test/itkVnlFFTWF_FFTTest.cxx b/Modules/Filtering/FFT/test/itkVnlFFTWF_FFTTest.cxx index ba108748beb9..9c3c312aaab2 100644 --- a/Modules/Filtering/FFT/test/itkVnlFFTWF_FFTTest.cxx +++ b/Modules/Filtering/FFT/test/itkVnlFFTWF_FFTTest.cxx @@ -27,7 +27,7 @@ // of these dimensions are taken from the array.The data types used are float // and double. int -itkVnlFFTWF_FFTTest(int argc, char * argv[]) +itkVnlFFTWF_FFTTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using ImageF1 = itk::Image; using ImageF2 = itk::Image; @@ -47,9 +47,6 @@ itkVnlFFTWF_FFTTest(int argc, char * argv[]) std::cout << "WisdomCacheBase " << itk::FFTWGlobalConfiguration::GetWisdomCacheBase() << std::endl; std::cout << "WisdomeFile " << itk::FFTWGlobalConfiguration::GetWisdomFileDefaultBaseName() << std::endl; # endif - // Avoid unused parameter warnings. - (void)argc; - (void)argv; unsigned int SizeOfDimensions1[] = { 4, 4, 4 }; unsigned int SizeOfDimensions2[] = { 3, 5, 4 }; diff --git a/Modules/Filtering/FFT/test/itkVnlFFTWF_RealFFTTest.cxx b/Modules/Filtering/FFT/test/itkVnlFFTWF_RealFFTTest.cxx index 185ee9482ccc..10519f2523d3 100644 --- a/Modules/Filtering/FFT/test/itkVnlFFTWF_RealFFTTest.cxx +++ b/Modules/Filtering/FFT/test/itkVnlFFTWF_RealFFTTest.cxx @@ -27,7 +27,7 @@ // template argument and the size of these dimensions are taken from // the array. The data types used are float and double. int -itkVnlFFTWF_RealFFTTest(int argc, char * argv[]) +itkVnlFFTWF_RealFFTTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using ImageF1 = itk::Image; using ImageF2 = itk::Image; @@ -47,9 +47,6 @@ itkVnlFFTWF_RealFFTTest(int argc, char * argv[]) std::cout << "WisdomCacheBase " << itk::FFTWGlobalConfiguration::GetWisdomCacheBase() << std::endl; std::cout << "WisdomeFile " << itk::FFTWGlobalConfiguration::GetWisdomFileDefaultBaseName() << std::endl; # endif - // Avoid unused parameter warnings. - (void)argc; - (void)argv; unsigned int SizeOfDimensions1[] = { 4, 4, 4 }; unsigned int SizeOfDimensions2[] = { 3, 5, 4 }; diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx index f3e780688415..07cb50634e36 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx @@ -264,12 +264,10 @@ FastMarchingImageFilterBase::GetInternalNodesUsed(OutputImageTy template double -FastMarchingImageFilterBase::Solve(OutputImageType * oImage, +FastMarchingImageFilterBase::Solve(OutputImageType * itkNotUsed(oImage), const NodeType & iNode, InternalNodeStructureArray & iNeighbors) const { - (void)oImage; - // Sort the local list std::sort(iNeighbors.Begin(), iNeighbors.End()); diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx index 8bf8d6d3b594..da9e78200869 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx @@ -376,7 +376,7 @@ FastMarchingQuadEdgeMeshFilterBase::ComputeUpdate(const OutputV template bool FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle(OutputMeshType * oMesh, - const OutputPointIdentifierType & iId, + const OutputPointIdentifierType & itkNotUsed(iId), const OutputPointType & iP, const OutputPointIdentifierType & iId1, const OutputPointType & iP1, @@ -388,8 +388,6 @@ FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle(OutputMeshTy OutputVectorRealType & oDot2, OutputPointIdentifierType & oId) const { - (void)iId; - OutputVectorType Edge1 = iP1 - iP; OutputVectorRealType Norm1 = Edge1.GetNorm(); @@ -569,11 +567,9 @@ FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle(OutputMeshTy template bool -FastMarchingQuadEdgeMeshFilterBase::CheckTopology(OutputMeshType * oMesh, const NodeType & iNode) +FastMarchingQuadEdgeMeshFilterBase::CheckTopology(OutputMeshType * itkNotUsed(oMesh), + const NodeType & itkNotUsed(iNode)) { - (void)oMesh; - (void)iNode; - return true; } diff --git a/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx b/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx index 426ef98b9730..58c076516470 100644 --- a/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx +++ b/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx @@ -190,9 +190,7 @@ itkFastMarchingBaseTest(int argc, char * argv[]) using OutputImageType = ImageFastMarching::OutputDomainType; - OutputImageType::Pointer output = fmm->GetOutput(); - - (void)output; + [[maybe_unused]] OutputImageType::Pointer output = fmm->GetOutput(); } else if (useMeshVsImage == 1) { @@ -208,9 +206,7 @@ itkFastMarchingBaseTest(int argc, char * argv[]) using OutputMeshType = MeshFastMarching::OutputDomainType; - OutputMeshType::Pointer output = fmm->GetOutput(); - - (void)output; + [[maybe_unused]] OutputMeshType::Pointer output = fmm->GetOutput(); } // Test streaming enumeration for FastMarchingTraitsEnums::TopologyCheck elements diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx index 97035d77222f..f3c091f52ce0 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx @@ -273,10 +273,10 @@ EdgeDecimationQuadEdgeMeshFilter::JoinVertexFailed( template void -EdgeDecimationQuadEdgeMeshFilter::DeletePoint(const OutputPointIdentifier & iIdToBeDeleted, - const OutputPointIdentifier & iRemaining) +EdgeDecimationQuadEdgeMeshFilter::DeletePoint( + const OutputPointIdentifier & iIdToBeDeleted, + const OutputPointIdentifier & itkNotUsed(iRemaining)) { - (void)iRemaining; this->GetOutput()->DeletePoint(iIdToBeDeleted); } diff --git a/Modules/IO/ImageBase/include/itkInternationalizationIOHelpers.h b/Modules/IO/ImageBase/include/itkInternationalizationIOHelpers.h index 08278839a506..d42721c3f58f 100644 --- a/Modules/IO/ImageBase/include/itkInternationalizationIOHelpers.h +++ b/Modules/IO/ImageBase/include/itkInternationalizationIOHelpers.h @@ -241,13 +241,12 @@ class I18nOfstream : public std::ostream class I18nIfstream : public std::istream { public: - I18nIfstream(const char * str, std::ios_base::openmode mode = std::ios_base::in) + I18nIfstream(const char * str, std::ios_base::openmode itkNotused(mode) = std::ios_base::in) : std::istream(0) , m_fd(I18nOpenForReading(str)) , m_buf(m_fd) { ///\todo better handle mode flag - (void)mode; this->rdbuf(&m_buf); } diff --git a/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx b/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx index d83944e0ab0a..1f599c3541f7 100644 --- a/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx @@ -21,7 +21,7 @@ int -itkImageFileReaderTest1(int itkNotUsed(argc), char * argv[]) +itkImageFileReaderTest1(int argc, char * argv[]) { ITK_TEST_EXPECT_TRUE(argc == 1); using ImageNDType = itk::Image; diff --git a/Modules/IO/JPEG/src/itkJPEGImageIO.cxx b/Modules/IO/JPEG/src/itkJPEGImageIO.cxx index 7dbc334bc505..00dd724a85af 100644 --- a/Modules/IO/JPEG/src/itkJPEGImageIO.cxx +++ b/Modules/IO/JPEG/src/itkJPEGImageIO.cxx @@ -38,7 +38,7 @@ struct itk_jpeg_error_mgr extern "C" { - METHODDEF(void) itk_jpeg_error_exit(j_common_ptr cinfo) + METHODDEF(void) itk_jpeg_error_exit([[maybe_unused]] j_common_ptr cinfo) { /* cinfo->err really points to an itk_jpeg_error_mgr struct, so coerce pointer */ @@ -58,8 +58,6 @@ extern "C" char buffer[JMSG_LENGTH_MAX + 1]; (*cinfo->err->format_message)(cinfo, buffer); printf("%s\n", buffer); -#else - (void)cinfo; #endif } } diff --git a/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx b/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx index 72e97b9b8dd5..ed9cbcb0352e 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx +++ b/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx @@ -20,11 +20,8 @@ #include int -itkTriangleHelperTest(int argc, char * argv[]) +itkTriangleHelperTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { - (void)argc; - (void)argv; - constexpr unsigned int Dimension = 3; using CoordRepType = double; using PointType = itk::Point; diff --git a/Modules/Nonunit/Review/test/itkTimeAndMemoryProbeTest.cxx b/Modules/Nonunit/Review/test/itkTimeAndMemoryProbeTest.cxx index 467ed8da3f42..d9667143418a 100644 --- a/Modules/Nonunit/Review/test/itkTimeAndMemoryProbeTest.cxx +++ b/Modules/Nonunit/Review/test/itkTimeAndMemoryProbeTest.cxx @@ -21,11 +21,8 @@ #include int -itkTimeAndMemoryProbeTest(int argc, char * argv[]) +itkTimeAndMemoryProbeTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { - (void)argc; - (void)argv; - itk::TimeProbe timeProbe; itk::MemoryProbesCollectorBase memoryProbes; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx index 893f7d7f9471..aa83c6ecb751 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx @@ -118,8 +118,13 @@ class CommandIterationUpdate : public itk::Command template int -PerformCompositeImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformCompositeImageRegistration(int argc, char * argv[]) { + if (argc != 4) + { + std::cout << "ERROR: incorrect number of arguments" << std::endl; + return EXIT_FAILURE; + } const unsigned int ImageDimension = TDimension; using PixelType = double; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx index 409919151ca8..831cde43a2e8 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx @@ -109,8 +109,13 @@ class CommandIterationUpdate : public itk::Command template int -PerformDisplacementFieldImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformDisplacementFieldImageRegistration(int argc, char * argv[]) { + if (argc != 4) + { + std::cout << "ERROR: incorrect number of arguments" << std::endl; + return EXIT_FAILURE; + } const unsigned int ImageDimension = TDimension; using PixelType = double;