From 7f8732a29e83acca48c1167ee258ca22cd70193e Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Thu, 11 Apr 2024 17:12:40 -0500 Subject: [PATCH] STYLE: Prefer c++11 [[maybe_unused]] attribute over (void) The use of (void)varname was a mechansim to silence compiler warnings prior to universal language support in c++11 for the [[maybe_unused]] attribute specifier. --- .../include/itkTreeIteratorBase.hxx | 2 +- .../CMake/itkCheckHasFenvtStructMember.cxx | 9 +- .../itkExtractImageFilterRegionCopier.h | 3 +- .../include/itkImageBoundaryCondition.h | 4 +- .../Common/include/itkObjectFactoryBase.h | 4 +- .../Core/Common/include/itkPolyLineCell.hxx | 2 +- .../Core/Common/include/itkPolygonCell.hxx | 2 +- .../Core/Common/include/itkSingletonMacro.h | 9 +- .../Common/include/itkVariableLengthVector.h | 20 +-- .../Common/src/itkFloatingPointExceptions.cxx | 2 +- .../src/itkFloatingPointExceptions_unix.cxx | 1 - .../Core/Common/src/itkObjectFactoryBase.cxx | 3 +- Modules/Core/Common/test/itkBitCastGTest.cxx | 3 +- .../Core/Common/test/itkCrossHelperTest.cxx | 5 +- .../include/itkGPUFiniteDifferenceFunction.h | 2 +- ...itkBSplineInterpolateImageFunctionTest.cxx | 2 +- ...itkRayCastInterpolateImageFunctionTest.cxx | 2 +- .../QuadEdgeMesh/include/itkQuadEdgeMesh.h | 91 ++++------- .../QuadEdgeMesh/include/itkQuadEdgeMesh.hxx | 4 +- .../include/itkQuadEdgeMeshFrontIterator.h | 15 +- .../include/itkQuadEdgeMeshLineCell.hxx | 18 +-- .../include/itkQuadEdgeMeshPolygonCell.hxx | 9 +- .../test/itkQuadEdgeMeshCellInterfaceTest.cxx | 14 +- ...eshEulerOperatorCreateCenterVertexTest.cxx | 2 +- ...eshEulerOperatorDeleteCenterVertexTest.cxx | 5 +- ...TestingStretchIntensityImageFilterTest.cxx | 2 +- .../Transform/include/itkCompositeTransform.h | 6 +- ...ureAnisotropicDiffusionImageFilterTest.cxx | 2 +- ...entAnisotropicDiffusionImageFilterTest.cxx | 2 +- ...torAnisotropicDiffusionImageFilterTest.cxx | 2 +- .../itkIterativeDeconvolutionImageFilter.h | 2 +- .../itkPatchBasedDenoisingImageFilter.h | 2 +- Modules/Filtering/FFT/include/itkFFTWCommon.h | 100 ++++++------ .../FFT/include/itkFFTWCommonExtended.h | 146 +++++++++++------- .../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 | 8 +- .../itkFastMarchingQuadEdgeMeshFilterBase.hxx | 33 ++-- .../test/itkFastMarchingBaseTest.cxx | 8 +- .../itkFastMarchingImageFilterRealTest1.cxx | 2 +- .../itkFastMarchingImageFilterRealTest2.cxx | 2 +- .../include/itkGPUCastImageFilter.h | 2 +- ...torNeighborhoodOperatorImageFilterTest.cxx | 2 +- .../itkBSplineResampleImageFilterTest.cxx | 2 +- .../test/itkGaborKernelFunctionTest.cxx | 2 +- .../itkEdgeDecimationQuadEdgeMeshFilter.hxx | 6 +- .../itkInternationalizationIOHelpers.h | 3 +- .../test/itkImageFileReaderTest1.cxx | 2 +- Modules/IO/JPEG/src/itkJPEGImageIO.cxx | 4 +- Modules/IO/MINC/src/itkMINCImageIO.cxx | 8 +- .../include/itkMeshConvertPixelTraits.h | 2 +- .../src/itkTransformFactoryBase.cxx | 2 +- .../test/itkTriangleHelperTest.cxx | 5 +- .../Review/test/itkTimeAndMemoryProbeTest.cxx | 5 +- Modules/Numerics/FEM/include/itkFEMSolver.hxx | 2 +- ...indowConvergenceMonitoringFunctionTest.cxx | 2 +- .../include/itkCovarianceSampleFilter.hxx | 3 +- .../include/itkMeanSampleFilter.hxx | 3 +- .../itkImageRegistrationMethodTest_16.cxx | 2 +- .../itkBSplineSyNImageRegistrationTest.cxx | 2 +- .../itkBSplineSyNPointSetRegistrationTest.cxx | 2 +- .../test/itkSimpleImageRegistrationTest3.cxx | 2 +- .../test/itkSimpleImageRegistrationTest4.cxx | 2 +- .../itkSimplePointSetRegistrationTest.cxx | 2 +- .../test/itkSyNImageRegistrationTest.cxx | 2 +- .../test/itkSyNPointSetRegistrationTest.cxx | 2 +- ...eVelocityFieldPointSetRegistrationTest.cxx | 2 +- ...ComponentImageFilterTooManyObjectsTest.cxx | 2 +- .../include/itkOpenCVVideoCapture.hxx | 2 +- .../BridgeOpenCV/include/itkOpenCVVideoIO.h | 4 +- .../itkFrameDifferenceVideoFilterTest.cxx | 2 +- 74 files changed, 289 insertions(+), 367 deletions(-) diff --git a/Modules/Compatibility/Deprecated/include/itkTreeIteratorBase.hxx b/Modules/Compatibility/Deprecated/include/itkTreeIteratorBase.hxx index 5f4a77a40076..f5b54a01a661 100644 --- a/Modules/Compatibility/Deprecated/include/itkTreeIteratorBase.hxx +++ b/Modules/Compatibility/Deprecated/include/itkTreeIteratorBase.hxx @@ -124,7 +124,7 @@ TreeIteratorBase::Add(ValueType element) template bool -TreeIteratorBase::Add(int itkNotUsed(childPosition), ValueType element) +TreeIteratorBase::Add([[maybe_unused]] int childPosition, ValueType element) { if (m_Position) { diff --git a/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx b/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx index 2c6d1c129843..008230e9dcaa 100644 --- a/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx +++ b/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx @@ -21,15 +21,14 @@ int main() { - fenv_t fenv; + [[maybe_unused]] fenv_t fenv; #if defined(ITK_CHECK_FENV_T_CONTROL) - (void)sizeof(fenv.__control); + [[maybe_unused]] const auto tempSize = sizeof(fenv.__control); #elif defined(ITK_CHECK_FENV_T_CONTROL_WORD) - (void)sizeof(fenv.__control_word); + [[maybe_unused]] const auto tempSize = sizeof(fenv.__control_word); #elif defined(ITK_CHECK_FENV_T_CW) - (void)sizeof(fenv.__cw); + [[maybe_unused]] const auto tempSize = sizeof(fenv.__cw); #else - (void)fenv; # error \ "Unknown fenv_t struct member test: Make sure to specify a compile definition of the form -DITK_CHECK_FENV_T_xxx" #endif diff --git a/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h b/Modules/Core/Common/include/itkExtractImageFilterRegionCopier.h index 0dcf41b78eb2..05719d694b02 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) + [[maybe_unused]] const ImageRegion & 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..d76575b11909 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 & outputRequestedRegion) const { - (void)outputRequestedRegion; return inputLargestPossibleRegion; } diff --git a/Modules/Core/Common/include/itkObjectFactoryBase.h b/Modules/Core/Common/include/itkObjectFactoryBase.h index 208cf97a23a8..f45afed57585 100644 --- a/Modules/Core/Common/include/itkObjectFactoryBase.h +++ b/Modules/Core/Common/include/itkObjectFactoryBase.h @@ -218,12 +218,10 @@ class ITKCommon_EXPORT ObjectFactoryBase : public Object {}; // Factory registration, made thread-safe by "magic statics" (as introduced with C++11). - static const FactoryRegistration staticFactoryRegistration = [] { + [[maybe_unused]] static const FactoryRegistration staticFactoryRegistration = [] { RegisterFactoryInternal(TFactory::New()); return FactoryRegistration{}; }(); - - (void)staticFactoryRegistration; } /** Initialize the static members of ObjectFactoryBase. */ diff --git a/Modules/Core/Common/include/itkPolyLineCell.hxx b/Modules/Core/Common/include/itkPolyLineCell.hxx index e7467e294a5e..2172b3a9fa75 100644 --- a/Modules/Core/Common/include/itkPolyLineCell.hxx +++ b/Modules/Core/Common/include/itkPolyLineCell.hxx @@ -126,7 +126,7 @@ PolyLineCell::SetPointIds(PointIdConstIterator first) */ template void -PolyLineCell::SetPointIds(int itkNotUsed(dummy), int num, PointIdConstIterator first) +PolyLineCell::SetPointIds([[maybe_unused]] int dummy, int num, PointIdConstIterator first) { PointIdConstIterator ii(first); diff --git a/Modules/Core/Common/include/itkPolygonCell.hxx b/Modules/Core/Common/include/itkPolygonCell.hxx index d48fb8ef5c6d..e2283737fb55 100644 --- a/Modules/Core/Common/include/itkPolygonCell.hxx +++ b/Modules/Core/Common/include/itkPolygonCell.hxx @@ -144,7 +144,7 @@ PolygonCell::GetBoundaryFeature(int dimension, */ template void -PolygonCell::SetPointIds(int itkNotUsed(dummy), int num, PointIdConstIterator first) +PolygonCell::SetPointIds([[maybe_unused]] int dummy, int num, PointIdConstIterator first) { PointIdConstIterator ii(first); diff --git a/Modules/Core/Common/include/itkSingletonMacro.h b/Modules/Core/Common/include/itkSingletonMacro.h index 8796233e0ca5..9286456f0e90 100644 --- a/Modules/Core/Common/include/itkSingletonMacro.h +++ b/Modules/Core/Common/include/itkSingletonMacro.h @@ -25,11 +25,10 @@ #ifndef itkSingletonMacro_h #define itkSingletonMacro_h -#define itkInitGlobalsMacro(VarName) \ - { \ - static auto * staticGlobals = Get##VarName##Pointer(); \ - (void)staticGlobals; \ - } \ +#define itkInitGlobalsMacro(VarName) \ + { \ + [[maybe_unused]] static auto * staticGlobals = Get##VarName##Pointer(); \ + } \ ITK_MACROEND_NOOP_STATEMENT #define itkGetGlobalDeclarationMacro(Type, VarName) static Type * Get##VarName##Pointer() diff --git a/Modules/Core/Common/include/itkVariableLengthVector.h b/Modules/Core/Common/include/itkVariableLengthVector.h index 6eece59fd6eb..d89261a71348 100644 --- a/Modules/Core/Common/include/itkVariableLengthVector.h +++ b/Modules/Core/Common/include/itkVariableLengthVector.h @@ -125,7 +125,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector struct AlwaysReallocate : AllocateRootPolicy { bool - operator()(unsigned int itkNotUsed(newSize), unsigned int itkNotUsed(oldSize)) const + operator()([[maybe_unused]] unsigned int newSize, [[maybe_unused]] unsigned int oldSize) const { return true; } @@ -152,10 +152,8 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector struct NeverReallocate : AllocateRootPolicy { bool - operator()(unsigned int newSize, unsigned int oldSize) const + operator()([[maybe_unused]] unsigned int newSize, [[maybe_unused]] unsigned int oldSize) const { - (void)newSize; - (void)oldSize; itkAssertInDebugAndIgnoreInReleaseMacro(newSize == oldSize && "SetSize is expected to never change the VariableLengthVector size..."); return true; @@ -298,10 +296,10 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector { template void - operator()(unsigned int itkNotUsed(newSize), - unsigned int itkNotUsed(oldSize), - TValue2 * itkNotUsed(oldBuffer), - TValue2 * itkNotUsed(newBuffer)) const + operator()([[maybe_unused]] unsigned int newSize, + [[maybe_unused]] unsigned int oldSize, + TValue2 * itkNotUsed(oldBuffer), + TValue2 * itkNotUsed(newBuffer)) const {} }; //@} @@ -1033,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, [[maybe_unused]] unsigned int idx) { - (void)idx; return v; } }; @@ -1052,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/itkFloatingPointExceptions.cxx b/Modules/Core/Common/src/itkFloatingPointExceptions.cxx index db61b61e2245..2b1405db4e59 100644 --- a/Modules/Core/Common/src/itkFloatingPointExceptions.cxx +++ b/Modules/Core/Common/src/itkFloatingPointExceptions.cxx @@ -113,7 +113,7 @@ itkFloatingPointExceptionsAbortOrExit() } } -void +[[maybe_unused]] void itkFloatingPointExceptionsNotSupported() { std::cerr << "FloatingPointExceptions are not supported on this platform." << std::endl; diff --git a/Modules/Core/Common/src/itkFloatingPointExceptions_unix.cxx b/Modules/Core/Common/src/itkFloatingPointExceptions_unix.cxx index 4a9e0d22af88..874d21002ba2 100644 --- a/Modules/Core/Common/src/itkFloatingPointExceptions_unix.cxx +++ b/Modules/Core/Common/src/itkFloatingPointExceptions_unix.cxx @@ -165,7 +165,6 @@ FloatingPointExceptions::Enable() sigaction(SIGFPE, &act, nullptr); # endif FloatingPointExceptions::m_PimplGlobals->m_Enabled = true; - (void)itkFloatingPointExceptionsNotSupported; // avoid unused-function warning #else itkFloatingPointExceptionsNotSupported(); #endif 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/itkBitCastGTest.cxx b/Modules/Core/Common/test/itkBitCastGTest.cxx index bf35cae0532b..4ffc2892a713 100644 --- a/Modules/Core/Common/test/itkBitCastGTest.cxx +++ b/Modules/Core/Common/test/itkBitCastGTest.cxx @@ -40,7 +40,6 @@ TEST(BitCast, ResultIsBitwiseEqualToArgument) Expect_return_value_is_bitwise_equal_to_function_argument(i); } - int value; - (void)value; + [[maybe_unused]] int value; Expect_return_value_is_bitwise_equal_to_function_argument(&value); } diff --git a/Modules/Core/Common/test/itkCrossHelperTest.cxx b/Modules/Core/Common/test/itkCrossHelperTest.cxx index 0d7d6426470f..11655954f3ca 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..bf81ecdc00d4 100644 --- a/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h +++ b/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFunction.h @@ -103,7 +103,7 @@ class ITK_TEMPLATE_EXPORT GPUFiniteDifferenceFunction : public FiniteDifferenceF /** Allocate GPU buffers for computing metric statistics * */ virtual void - GPUAllocateMetricData(unsigned int itkNotUsed(numPixels)) + GPUAllocateMetricData([[maybe_unused]] unsigned int numPixels) {} /** Release GPU buffers for computing metric statistics diff --git a/Modules/Core/ImageFunction/test/itkBSplineInterpolateImageFunctionTest.cxx b/Modules/Core/ImageFunction/test/itkBSplineInterpolateImageFunctionTest.cxx index 49e7baf2bf10..76b32c549bc7 100644 --- a/Modules/Core/ImageFunction/test/itkBSplineInterpolateImageFunctionTest.cxx +++ b/Modules/Core/ImageFunction/test/itkBSplineInterpolateImageFunctionTest.cxx @@ -659,7 +659,7 @@ testEvaluateValueAndDerivative() } int -itkBSplineInterpolateImageFunctionTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkBSplineInterpolateImageFunctionTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { int flag = 0; /* Did this test program work? */ diff --git a/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx b/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx index 7703c045108f..cd99d3807f3b 100644 --- a/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx +++ b/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx @@ -26,7 +26,7 @@ int -itkRayCastInterpolateImageFunctionTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkRayCastInterpolateImageFunctionTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { using PixelType = unsigned char; diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h index d3e5fb6e8fc1..488d9cd97192 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([[maybe_unused]] int dimension, + [[maybe_unused]] CellIdentifier cellId, + [[maybe_unused]] CellFeatureIdentifier featureId, + [[maybe_unused]] std::set * cellSet) { - (void)dimension; - (void)cellId; - (void)featureId; - (void)cellSet; return CellIdentifier{}; } /** NOTE ALEX: this method do not use CellFeature and thus could be recoded */ CellIdentifier - GetCellNeighbors(CellIdentifier itkNotUsed(cellId), std::set * itkNotUsed(cellSet)) + GetCellNeighbors([[maybe_unused]] CellIdentifier cellId, [[maybe_unused]] std::set * cellSet) { return CellIdentifier{}; } /** overloaded method for backward compatibility */ bool - GetAssignedCellBoundaryIfOneExists(int dimension, - CellIdentifier cellId, - CellFeatureIdentifier featureId, - CellAutoPointer & cellAP) const + GetAssignedCellBoundaryIfOneExists([[maybe_unused]] int dimension, + [[maybe_unused]] CellIdentifier cellId, + [[maybe_unused]] CellFeatureIdentifier featureId, + [[maybe_unused]] CellAutoPointer & cellAP) const { - (void)dimension; - (void)cellId; - (void)featureId; - (void)cellAP; return (false); // ALEX: is it the good way? } diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx index 6a5e5ece172b..974c36165017 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx @@ -337,10 +337,8 @@ QuadEdgeMesh::Splice(QEPrimal * a, QEPrimal * b) -> */ template void -QuadEdgeMesh::SetCell(CellIdentifier cId, CellAutoPointer & cell) +QuadEdgeMesh::SetCell([[maybe_unused]] CellIdentifier 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..0091881af3b0 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([[maybe_unused]] QEType * 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([[maybe_unused]] const MeshType * mesh = (MeshType *)0, + [[maybe_unused]] bool start = true, + [[maybe_unused]] QEType * 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..694d5e2cdc1c 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([[maybe_unused]] int dimension, + [[maybe_unused]] CellFeatureIdentifier cellId, + [[maybe_unused]] CellAutoPointer & cell) { // TODO : FIXME - (void)dimension; - (void)cellId; - (void)cell; return (false); } @@ -173,9 +170,9 @@ QuadEdgeMeshLineCell::InternalSetPointIds(PointIdInternalConstIt // --------------------------------------------------------------------- template void -QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, PointIdConstIterator last) +QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, + [[maybe_unused]] PointIdConstIterator last) { - (void)last; this->GetQEGeom()->SetOrigin(*first); ++first; this->GetQEGeom()->SetDestination(*first); @@ -184,10 +181,9 @@ QuadEdgeMeshLineCell::SetPointIds(PointIdConstIterator first, Po // --------------------------------------------------------------------- template void -QuadEdgeMeshLineCell::InternalSetPointIds(PointIdInternalConstIterator first, - PointIdInternalConstIterator last) +QuadEdgeMeshLineCell::InternalSetPointIds(PointIdInternalConstIterator first, + [[maybe_unused]] PointIdInternalConstIterator 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..35d8634b702c 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([[maybe_unused]] int dimension, + [[maybe_unused]] CellFeatureIdentifier cellId, + [[maybe_unused]] CellAutoPointer & 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..e97d28b38a31 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([[maybe_unused]] unsigned long cellId, [[maybe_unused]] QELineCellType * t) + {} virtual ~CustomQELineVisitor() = default; }; @@ -61,11 +58,8 @@ class CustomQEPolyVisitor { public: void - Visit(unsigned long cellId, QEPolygonCellType * t) - { - (void)cellId; - (void)t; - } + Visit([[maybe_unused]] unsigned long cellId, [[maybe_unused]] QEPolygonCellType * t) + {} virtual ~CustomQEPolyVisitor() = default; }; diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx index 11a7409d87ec..ac2f6d128412 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx @@ -74,7 +74,7 @@ itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest(int, char *[]) std::cout << "OK" << std::endl; #endif - (void)createCenterVertex->GetNameOfClass(); + [[maybe_unused]] const std::string name_of_class = createCenterVertex->GetNameOfClass(); createCenterVertex->SetInput(mesh); #ifndef NDEBUG diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx index db0120df5adb..1adea7aebc12 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([[maybe_unused]] int argc, [[maybe_unused]] char * argv[]) { - (void)argc; - (void)argv; - using MeshType = itk::QuadEdgeMesh; using MeshPointer = MeshType::Pointer; using QEType = MeshType::QEType; diff --git a/Modules/Core/TestKernel/test/itkTestingStretchIntensityImageFilterTest.cxx b/Modules/Core/TestKernel/test/itkTestingStretchIntensityImageFilterTest.cxx index db14ef510112..75cb8534aec5 100644 --- a/Modules/Core/TestKernel/test/itkTestingStretchIntensityImageFilterTest.cxx +++ b/Modules/Core/TestKernel/test/itkTestingStretchIntensityImageFilterTest.cxx @@ -22,7 +22,7 @@ #include "itkImageRegionIterator.h" int -itkTestingStretchIntensityImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkTestingStretchIntensityImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; using PixelType = short; diff --git a/Modules/Core/Transform/include/itkCompositeTransform.h b/Modules/Core/Transform/include/itkCompositeTransform.h index ef90b3ec513f..f3615c609017 100644 --- a/Modules/Core/Transform/include/itkCompositeTransform.h +++ b/Modules/Core/Transform/include/itkCompositeTransform.h @@ -42,11 +42,11 @@ namespace itk * Example: * A user wants to optimize two Affine transforms together, then add a * Deformation Field (DF) transform, and optimize it separately. - * He first adds the two Affines, then runs the optimization and both Affines - * transforms are optimized. Next, he adds the DF transform and calls + * They first add the two Affines, then run the optimization and both Affines + * transform parameters are optimized. Next, they add the DF transform and call * SetOnlyMostRecentTransformToOptimizeOn, which clears the optimization flags * for both of the affine transforms, and leaves the flag set only for the DF - * transform, since it was the last transform added. Now he runs the + * transform, since it was the last transform added. Now they run the * optimization and only the DF transform is optimized, but the affines are * included in the transformation during the optimization. * diff --git a/Modules/Filtering/AnisotropicSmoothing/test/itkCurvatureAnisotropicDiffusionImageFilterTest.cxx b/Modules/Filtering/AnisotropicSmoothing/test/itkCurvatureAnisotropicDiffusionImageFilterTest.cxx index 43700eacb860..28053539b5a5 100644 --- a/Modules/Filtering/AnisotropicSmoothing/test/itkCurvatureAnisotropicDiffusionImageFilterTest.cxx +++ b/Modules/Filtering/AnisotropicSmoothing/test/itkCurvatureAnisotropicDiffusionImageFilterTest.cxx @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -itkCurvatureAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkCurvatureAnisotropicDiffusionImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; diff --git a/Modules/Filtering/AnisotropicSmoothing/test/itkGradientAnisotropicDiffusionImageFilterTest.cxx b/Modules/Filtering/AnisotropicSmoothing/test/itkGradientAnisotropicDiffusionImageFilterTest.cxx index d92d2a7cd780..faafaed33066 100644 --- a/Modules/Filtering/AnisotropicSmoothing/test/itkGradientAnisotropicDiffusionImageFilterTest.cxx +++ b/Modules/Filtering/AnisotropicSmoothing/test/itkGradientAnisotropicDiffusionImageFilterTest.cxx @@ -22,7 +22,7 @@ #include "itkTestingMacros.h" int -itkGradientAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkGradientAnisotropicDiffusionImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; diff --git a/Modules/Filtering/AnisotropicSmoothing/test/itkVectorAnisotropicDiffusionImageFilterTest.cxx b/Modules/Filtering/AnisotropicSmoothing/test/itkVectorAnisotropicDiffusionImageFilterTest.cxx index c1c75bdda507..a070e20a813a 100644 --- a/Modules/Filtering/AnisotropicSmoothing/test/itkVectorAnisotropicDiffusionImageFilterTest.cxx +++ b/Modules/Filtering/AnisotropicSmoothing/test/itkVectorAnisotropicDiffusionImageFilterTest.cxx @@ -30,7 +30,7 @@ operator<<(std::ostream & o, const itk::Vector & v) } int -itkVectorAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkVectorAnisotropicDiffusionImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { try { diff --git a/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.h b/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.h index 53657a0b2f07..beadfe8adf6f 100644 --- a/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.h +++ b/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.h @@ -109,7 +109,7 @@ class ITK_TEMPLATE_EXPORT IterativeDeconvolutionImageFilter /** Performs an iteration. */ virtual void - Iteration(ProgressAccumulator * itkNotUsed(progress), float itkNotUsed(iterationProgressWeight)) = 0; + Iteration(ProgressAccumulator * itkNotUsed(progress), [[maybe_unused]] float iterationProgressWeight) = 0; /** Runs after iterating. */ virtual void diff --git a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.h b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.h index ca5bdb24ae1a..60de455e32e3 100644 --- a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.h +++ b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.h @@ -246,7 +246,7 @@ class ITK_TEMPLATE_EXPORT PatchBasedDenoisingImageFilter */ template typename DisableIfMultiComponent::type - GetComponent(const T pix, unsigned int itkNotUsed(idx)) const + GetComponent(const T pix, [[maybe_unused]] unsigned int idx) const { // The enable if idiom is used to overload this method for both // scalars and multi-component types. By exploiting that diff --git a/Modules/Filtering/FFT/include/itkFFTWCommon.h b/Modules/Filtering/FFT/include/itkFFTWCommon.h index 98c9e12042da..94b8ddb71570 100644 --- a/Modules/Filtering/FFT/include/itkFFTWCommon.h +++ b/Modules/Filtering/FFT/include/itkFFTWCommon.h @@ -124,19 +124,17 @@ class Proxy } static PlanType - Plan_dft_c2r(int rank, - const int * n, - ComplexType * in, - PixelType * out, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft_c2r(int rank, + const int * n, + ComplexType * in, + PixelType * out, + unsigned int flags, + [[maybe_unused]] int 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 @@ -223,20 +221,18 @@ class Proxy } static PlanType - Plan_dft_r2c(int rank, - const int * n, - PixelType * in, - ComplexType * out, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft_r2c(int rank, + const int * n, + PixelType * in, + ComplexType * out, + unsigned int flags, + [[maybe_unused]] int 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 @@ -325,20 +321,18 @@ class Proxy } static PlanType - Plan_dft(int rank, - const int * n, - ComplexType * in, - ComplexType * out, - int sign, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft(int rank, + const int * n, + ComplexType * in, + ComplexType * out, + int sign, + unsigned int flags, + [[maybe_unused]] int 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 @@ -460,19 +454,17 @@ class Proxy } static PlanType - Plan_dft_c2r(int rank, - const int * n, - ComplexType * in, - PixelType * out, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft_c2r(int rank, + const int * n, + ComplexType * in, + PixelType * out, + unsigned int flags, + [[maybe_unused]] int 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 @@ -559,19 +551,17 @@ class Proxy } static PlanType - Plan_dft_r2c(int rank, - const int * n, - PixelType * in, - ComplexType * out, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft_r2c(int rank, + const int * n, + PixelType * in, + ComplexType * out, + unsigned int flags, + [[maybe_unused]] int 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 @@ -660,20 +650,18 @@ class Proxy } static PlanType - Plan_dft(int rank, - const int * n, - ComplexType * in, - ComplexType * out, - int sign, - unsigned int flags, - int threads = 1, - bool canDestroyInput = false) + Plan_dft(int rank, + const int * n, + ComplexType * in, + ComplexType * out, + int sign, + unsigned int flags, + [[maybe_unused]] int 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..5594042729eb 100644 --- a/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h +++ b/Modules/Filtering/FFT/include/itkFFTWCommonExtended.h @@ -62,110 +62,129 @@ 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, [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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 +217,132 @@ 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, [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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, + [[maybe_unused]] int 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..4d775ea8e82a 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..ad580e7a4a9a 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..c71128f28c9a 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..11c3e941b7b8 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..7ee8d3a18d23 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, - const NodeType & iNode, - InternalNodeStructureArray & iNeighbors) const +FastMarchingImageFilterBase::Solve([[maybe_unused]] OutputImageType * 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..7c9126150e9a 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx @@ -375,21 +375,20 @@ FastMarchingQuadEdgeMeshFilterBase::ComputeUpdate(const OutputV template bool -FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle(OutputMeshType * oMesh, - const OutputPointIdentifierType & iId, - const OutputPointType & iP, - const OutputPointIdentifierType & iId1, - const OutputPointType & iP1, - const OutputPointIdentifierType & iId2, - const OutputPointType & iP2, - OutputVectorRealType & oNorm, - OutputVectorRealType & oSqNorm, - OutputVectorRealType & oDot1, - OutputVectorRealType & oDot2, - OutputPointIdentifierType & oId) const +FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle( + OutputMeshType * oMesh, + [[maybe_unused]] const OutputPointIdentifierType & iId, + const OutputPointType & iP, + const OutputPointIdentifierType & iId1, + const OutputPointType & iP1, + const OutputPointIdentifierType & iId2, + const OutputPointType & iP2, + OutputVectorRealType & oNorm, + OutputVectorRealType & oSqNorm, + OutputVectorRealType & oDot1, + OutputVectorRealType & oDot2, + OutputPointIdentifierType & oId) const { - (void)iId; - OutputVectorType Edge1 = iP1 - iP; OutputVectorRealType Norm1 = Edge1.GetNorm(); @@ -569,11 +568,9 @@ FastMarchingQuadEdgeMeshFilterBase::UnfoldTriangle(OutputMeshTy template bool -FastMarchingQuadEdgeMeshFilterBase::CheckTopology(OutputMeshType * oMesh, const NodeType & iNode) +FastMarchingQuadEdgeMeshFilterBase::CheckTopology([[maybe_unused]] OutputMeshType * oMesh, + [[maybe_unused]] const NodeType & 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/FastMarching/test/itkFastMarchingImageFilterRealTest1.cxx b/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest1.cxx index b7409d06361f..09be8c8585b1 100644 --- a/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest1.cxx +++ b/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest1.cxx @@ -42,7 +42,7 @@ class ShowProgressObject } // namespace int -itkFastMarchingImageFilterRealTest1(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkFastMarchingImageFilterRealTest1([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { itk::OutputWindow::SetInstance(itk::TextOutput::New().GetPointer()); diff --git a/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest2.cxx b/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest2.cxx index 20fd5f76751f..077e42c41bac 100644 --- a/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest2.cxx +++ b/Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest2.cxx @@ -44,7 +44,7 @@ class ShowProgressObject } // namespace int -itkFastMarchingImageFilterRealTest2(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkFastMarchingImageFilterRealTest2([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { itk::OutputWindow::SetInstance(itk::TextOutput::New().GetPointer()); diff --git a/Modules/Filtering/GPUImageFilterBase/include/itkGPUCastImageFilter.h b/Modules/Filtering/GPUImageFilterBase/include/itkGPUCastImageFilter.h index 4be26bd91044..af8d6ced1919 100644 --- a/Modules/Filtering/GPUImageFilterBase/include/itkGPUCastImageFilter.h +++ b/Modules/Filtering/GPUImageFilterBase/include/itkGPUCastImageFilter.h @@ -60,7 +60,7 @@ class ITK_TEMPLATE_EXPORT GPUCast : public GPUFunctorBase * Returns current argument index to set additional arguments in the GPU kernel. */ int - SetGPUKernelArguments(GPUKernelManager::Pointer itkNotUsed(kernelManager), int itkNotUsed(kernelHandle)) + SetGPUKernelArguments(GPUKernelManager::Pointer itkNotUsed(kernelManager), [[maybe_unused]] int kernelHandle) { return 0; } diff --git a/Modules/Filtering/ImageFilterBase/test/itkVectorNeighborhoodOperatorImageFilterTest.cxx b/Modules/Filtering/ImageFilterBase/test/itkVectorNeighborhoodOperatorImageFilterTest.cxx index eaf6c4d75a2a..f84928ffc2a5 100644 --- a/Modules/Filtering/ImageFilterBase/test/itkVectorNeighborhoodOperatorImageFilterTest.cxx +++ b/Modules/Filtering/ImageFilterBase/test/itkVectorNeighborhoodOperatorImageFilterTest.cxx @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -itkVectorNeighborhoodOperatorImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkVectorNeighborhoodOperatorImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { try { diff --git a/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx index 24ea05b7e1f2..3be51ffa59c5 100644 --- a/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx @@ -594,7 +594,7 @@ test2D_Centered_L2_NthOrderSpline_filter(unsigned int splineOrder) } int -itkBSplineResampleImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkBSplineResampleImageFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { int flag = 0; int dummyflag = 0; diff --git a/Modules/Filtering/ImageSources/test/itkGaborKernelFunctionTest.cxx b/Modules/Filtering/ImageSources/test/itkGaborKernelFunctionTest.cxx index 34e5b16dabea..82a942e7718a 100644 --- a/Modules/Filtering/ImageSources/test/itkGaborKernelFunctionTest.cxx +++ b/Modules/Filtering/ImageSources/test/itkGaborKernelFunctionTest.cxx @@ -21,7 +21,7 @@ #include "itkTestingMacros.h" int -itkGaborKernelFunctionTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkGaborKernelFunctionTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { using KernelFunctionType = itk::GaborKernelFunction; auto gabor = KernelFunctionType::New(); diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx index 97035d77222f..3de098104f56 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, + [[maybe_unused]] const OutputPointIdentifier & 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..766d845cfe8a 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, [[maybe_unused]] std::ios_base::openmode 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 a303c46e1a94..2bf993cce818 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([[maybe_unused]] int argc, char * argv[]) { 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/IO/MINC/src/itkMINCImageIO.cxx b/Modules/IO/MINC/src/itkMINCImageIO.cxx index c22ea94a3f16..f99afcf75a6b 100644 --- a/Modules/IO/MINC/src/itkMINCImageIO.cxx +++ b/Modules/IO/MINC/src/itkMINCImageIO.cxx @@ -34,8 +34,6 @@ extern "C" void MINCIOFreeTmpDimHandle(unsigned int size, midimhandle_t * ptr) { - int error = 0; - unsigned int x = 0; if (!ptr) { /* @@ -46,16 +44,14 @@ extern "C" #endif return; } - for (; x < size; ++x) + for (unsigned int x = 0; x < size; ++x) { - error = mifree_dimension_handle(ptr[x]); + [[maybe_unused]] int error = mifree_dimension_handle(ptr[x]); #ifndef NDEBUG if (error != MI_NOERROR) { printf("MINCIOFreeTmpDimHandle: mifree_dimension_handle(ptr[%u]) returned %d", x, error); } -#else - (void)error; #endif } } diff --git a/Modules/IO/MeshBase/include/itkMeshConvertPixelTraits.h b/Modules/IO/MeshBase/include/itkMeshConvertPixelTraits.h index 944b86240fcf..8bb6e3cdbe23 100644 --- a/Modules/IO/MeshBase/include/itkMeshConvertPixelTraits.h +++ b/Modules/IO/MeshBase/include/itkMeshConvertPixelTraits.h @@ -101,7 +101,7 @@ class MeshConvertPixelTraits return 1; \ } \ static ComponentType \ - GetNthComponent(int itkNotUsed(c), const type & pixel) \ + GetNthComponent([[maybe_unused]] int c, const type & pixel) \ { \ return pixel; \ } \ diff --git a/Modules/IO/TransformFactory/src/itkTransformFactoryBase.cxx b/Modules/IO/TransformFactory/src/itkTransformFactoryBase.cxx index 728715e1ad9d..955c3e806947 100644 --- a/Modules/IO/TransformFactory/src/itkTransformFactoryBase.cxx +++ b/Modules/IO/TransformFactory/src/itkTransformFactoryBase.cxx @@ -73,7 +73,7 @@ TransformFactoryBase::RegisterDefaultTransforms() // make sure that the factory instance has // been created. All normal paths to this method // already do this but this makes certain sure it's done - (void)TransformFactoryBase::GetFactory(); + [[maybe_unused]] auto currentFactory = TransformFactoryBase::GetFactory(); if (!TransformFactoryBasePrivate::DefaultTransformsRegistered) { diff --git a/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx b/Modules/Nonunit/IntegratedTest/test/itkTriangleHelperTest.cxx index 72e97b9b8dd5..fb5a7b742ac2 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([[maybe_unused]] int argc, [[maybe_unused]] char * 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..3ab4da69a6ce 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([[maybe_unused]] int argc, [[maybe_unused]] char * argv[]) { - (void)argc; - (void)argv; - itk::TimeProbe timeProbe; itk::MemoryProbesCollectorBase memoryProbes; diff --git a/Modules/Numerics/FEM/include/itkFEMSolver.hxx b/Modules/Numerics/FEM/include/itkFEMSolver.hxx index a96783f15277..74435b5a0733 100644 --- a/Modules/Numerics/FEM/include/itkFEMSolver.hxx +++ b/Modules/Numerics/FEM/include/itkFEMSolver.hxx @@ -109,7 +109,7 @@ Solver::GetTimeStep() const -> Float template void -Solver::SetTimeStep(Float itkNotUsed(dt)) +Solver::SetTimeStep([[maybe_unused]] float dt) {} template diff --git a/Modules/Numerics/Optimizersv4/test/itkWindowConvergenceMonitoringFunctionTest.cxx b/Modules/Numerics/Optimizersv4/test/itkWindowConvergenceMonitoringFunctionTest.cxx index 9d384cc4b06b..525cfd2c666b 100644 --- a/Modules/Numerics/Optimizersv4/test/itkWindowConvergenceMonitoringFunctionTest.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkWindowConvergenceMonitoringFunctionTest.cxx @@ -19,7 +19,7 @@ #include "itkWindowConvergenceMonitoringFunction.h" int -itkWindowConvergenceMonitoringFunctionTest(int itkNotUsed(argc), char *[]) +itkWindowConvergenceMonitoringFunctionTest([[maybe_unused]] int argc, char *[]) { using RealType = float; diff --git a/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx index bc97c35d6d02..9cad31d63796 100644 --- a/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx @@ -72,8 +72,7 @@ CovarianceSampleFilter::MakeOutput(DataObjectPointerArraySizeType index if (index == 1) { - MeasurementVectorRealType mean; - (void)mean; // for complainty pants : valgrind + [[maybe_unused]] MeasurementVectorRealType mean; NumericTraits::SetLength(mean, this->GetMeasurementVectorSize()); // NumericTraits::SetLength also initializes array to zero auto decoratedMean = MeasurementVectorDecoratedType::New(); diff --git a/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx index 82ef2bf02669..30b2d0804ef6 100644 --- a/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx @@ -54,8 +54,7 @@ template auto MeanSampleFilter::MakeOutput(DataObjectPointerArraySizeType itkNotUsed(idx)) -> DataObjectPointer { - MeasurementVectorRealType mean; - (void)mean; // for complainty pants : valgrind + [[maybe_unused]] MeasurementVectorRealType mean; NumericTraits::SetLength(mean, this->GetMeasurementVectorSize()); // NumericTraits::SetLength also initializes array to zero auto decoratedMean = MeasurementVectorDecoratedType::New(); diff --git a/Modules/Registration/Common/test/itkImageRegistrationMethodTest_16.cxx b/Modules/Registration/Common/test/itkImageRegistrationMethodTest_16.cxx index e8912c889d84..ef71868c4bbe 100644 --- a/Modules/Registration/Common/test/itkImageRegistrationMethodTest_16.cxx +++ b/Modules/Registration/Common/test/itkImageRegistrationMethodTest_16.cxx @@ -174,7 +174,7 @@ DoRegistration() return pass; } int -itkImageRegistrationMethodTest_16(int itkNotUsed(argc), char *[] itkNotUsed(argv)) +itkImageRegistrationMethodTest_16([[maybe_unused]] int argc, char *[] itkNotUsed(argv)) { bool result_uc, result_c, result_us, result_s, result_ui, result_i, result_ul, result_l, result_f, result_d; result_uc = DoRegistration(); diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx index 9ff16b1b6865..db2d982e50ee 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx @@ -75,7 +75,7 @@ class CommandIterationUpdate : public itk::Command template int -PerformBSplineSyNImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformBSplineSyNImageRegistration([[maybe_unused]] int argc, char * argv[]) { const unsigned int ImageDimension = TDimension; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNPointSetRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNPointSetRegistrationTest.cxx index 12d8f6363244..b35da3855d45 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNPointSetRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNPointSetRegistrationTest.cxx @@ -22,7 +22,7 @@ #include "itkEuclideanDistancePointSetToPointSetMetricv4.h" int -itkBSplineSyNPointSetRegistrationTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkBSplineSyNPointSetRegistrationTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx index 893f7d7f9471..6093c921ed40 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx @@ -118,7 +118,7 @@ class CommandIterationUpdate : public itk::Command template int -PerformCompositeImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformCompositeImageRegistration([[maybe_unused]] int argc, char * argv[]) { const unsigned int ImageDimension = TDimension; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx index cf953e0e5cf1..201bc1dbe164 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx @@ -77,7 +77,7 @@ class CommandIterationUpdate : public itk::Command template int -ImageRegistration(int itkNotUsed(argc), char * argv[]) +ImageRegistration([[maybe_unused]] int argc, char * argv[]) { const unsigned int ImageDimension = TDimension; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimplePointSetRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimplePointSetRegistrationTest.cxx index 6041dbb8373a..f33a18a261d6 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimplePointSetRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimplePointSetRegistrationTest.cxx @@ -102,7 +102,7 @@ class CommandIterationUpdate : public itk::Command }; int -itkSimplePointSetRegistrationTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkSimplePointSetRegistrationTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; constexpr unsigned int numberOfIterations = 20; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx index 409919151ca8..268b8f0f5a20 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx @@ -109,7 +109,7 @@ class CommandIterationUpdate : public itk::Command template int -PerformDisplacementFieldImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformDisplacementFieldImageRegistration([[maybe_unused]] int argc, char * argv[]) { const unsigned int ImageDimension = TDimension; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSyNPointSetRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSyNPointSetRegistrationTest.cxx index eb33a40d2639..b471661c24df 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSyNPointSetRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSyNPointSetRegistrationTest.cxx @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -itkSyNPointSetRegistrationTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkSyNPointSetRegistrationTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest.cxx index e8f303312047..78dedf58a846 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest.cxx @@ -24,7 +24,7 @@ #include "itkVector.h" int -itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkTimeVaryingBSplineVelocityFieldPointSetRegistrationTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { constexpr unsigned int Dimension = 2; diff --git a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTooManyObjectsTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTooManyObjectsTest.cxx index a82d9f4df47b..9c9cd59b9e88 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTooManyObjectsTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTooManyObjectsTest.cxx @@ -20,7 +20,7 @@ #include "itkSimpleFilterWatcher.h" int -itkConnectedComponentImageFilterTooManyObjectsTest(int itkNotUsed(argc), char *[] itkNotUsed(argv)) +itkConnectedComponentImageFilterTooManyObjectsTest([[maybe_unused]] int argc, char *[] itkNotUsed(argv)) { using PixelType = unsigned char; diff --git a/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoCapture.hxx b/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoCapture.hxx index 1ee85d446a05..adbfe5c54a12 100644 --- a/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoCapture.hxx +++ b/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoCapture.hxx @@ -130,7 +130,7 @@ OpenCVVideoCapture::grab() // template bool -OpenCVVideoCapture::retrieve(cv::Mat & image, int itkNotUsed(channel)) +OpenCVVideoCapture::retrieve(cv::Mat & image, [[maybe_unused]] int channel) { // We only support 2D if (this->Dimensions != 2) diff --git a/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoIO.h b/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoIO.h index f2bea3588c90..42c348b11c2a 100644 --- a/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoIO.h +++ b/Modules/Video/BridgeOpenCV/include/itkOpenCVVideoIO.h @@ -132,12 +132,12 @@ class ITKVideoBridgeOpenCV_EXPORT OpenCVVideoIO : public VideoIOBase /** Override Accessors to pass default values since OpenCV doesn't handle * this type of meta data. */ virtual double - GetSpacing(unsigned int itkNotUsed(i)) const + GetSpacing([[maybe_unused]] unsigned int i) const { return 1.0; } virtual double - GetOrigin(unsigned int itkNotUsed(i)) const + GetOrigin([[maybe_unused]] unsigned int i) const { return 0.0; } diff --git a/Modules/Video/Filtering/test/itkFrameDifferenceVideoFilterTest.cxx b/Modules/Video/Filtering/test/itkFrameDifferenceVideoFilterTest.cxx index 5b80e6759fb6..81de70fe4caa 100644 --- a/Modules/Video/Filtering/test/itkFrameDifferenceVideoFilterTest.cxx +++ b/Modules/Video/Filtering/test/itkFrameDifferenceVideoFilterTest.cxx @@ -82,7 +82,7 @@ CreateInputFrame(InputPixelType val) * Main test */ int -itkFrameDifferenceVideoFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +itkFrameDifferenceVideoFilterTest([[maybe_unused]] int argc, char * itkNotUsed(argv)[]) { // Instantiate the filter using FilterType = itk::FrameDifferenceVideoFilter;