diff --git a/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx b/Modules/Core/Common/CMake/itkCheckHasFenvtStructMember.cxx index 2c6d1c12984..008230e9dca 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 0dcf41b78eb..e2e3ccba324 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 aa0ced6394e..b2957e4814f 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/itkObjectFactoryBase.h b/Modules/Core/Common/include/itkObjectFactoryBase.h index 208cf97a23a..f45afed5758 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/itkSingletonMacro.h b/Modules/Core/Common/include/itkSingletonMacro.h index 8796233e0ca..9286456f0e9 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 9ac17930743..f55cb4c0f84 100644 --- a/Modules/Core/Common/include/itkVariableLengthVector.h +++ b/Modules/Core/Common/include/itkVariableLengthVector.h @@ -151,10 +151,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; @@ -1032,9 +1030,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; } }; @@ -1051,9 +1048,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 db61b61e224..2b1405db4e5 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 4a9e0d22af8..874d21002ba 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 cdf7f68de57..ca126369102 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 bf35cae0532..4ffc2892a71 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 0d7d6426470..866e38af785 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 7889b3e84e2..e83decaa4c1 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 592f607c314..8703eab2f3d 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h @@ -216,10 +216,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{}; } @@ -333,15 +308,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 edc2892cced..90bc1c8c8cd 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 3ddd7c87dfa..7adcf04256e 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 6123b601ffa..63ec53a022b 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 a1d3ef9bc2c..4a9189f878b 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/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx index 11a7409d87e..082c20d1a6c 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest.cxx @@ -18,6 +18,7 @@ #include "itkQuadEdgeMeshEulerOperatorCreateCenterVertexFunction.h" #include "itkQuadEdgeMeshEulerOperatorsTestHelper.h" +#include "itkTestingMacros.h" int itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest(int, char *[]) @@ -73,8 +74,8 @@ itkQuadEdgeMeshEulerOperatorCreateCenterVertexTest(int, char *[]) } std::cout << "OK" << std::endl; #endif - - (void)createCenterVertex->GetNameOfClass(); + ITK_TEST_EXPECT_EQUAL(std::string_view("QuadEdgeMeshEulerOperatorCreateCenterVertexFunction"), + std::string_view(createCenterVertex->GetNameOfClass())); createCenterVertex->SetInput(mesh); #ifndef NDEBUG diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx index 98b866be81c..9fbbd842f6d 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexTest.cxx @@ -22,11 +22,8 @@ #include "itkTestingMacros.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 98c9e12042d..94b8ddb7157 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 5bed4f88fa3..5594042729e 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 3571d6137c5..ca08fa338ec 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 9523224d95c..1a9f0a1ecfe 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 bff3f3cd59d..e5772c66c29 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 ba108748beb..9c3c312aaab 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 185ee9482cc..10519f2523d 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 f3e78068841..07cb50634e3 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 8bf8d6d3b59..da9e7820086 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 426ef98b973..58c07651647 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 97035d77222..f3c091f52ce 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 08278839a50..d42721c3f58 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 a303c46e1a9..1f599c3541f 100644 --- a/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileReaderTest1.cxx @@ -21,9 +21,9 @@ int -itkImageFileReaderTest1(int itkNotUsed(argc), char * argv[]) +itkImageFileReaderTest1(int argc, char * argv[]) { - + ITK_TEST_EXPECT_TRUE(argc == 1); using ImageNDType = itk::Image; using ReaderType = itk::ImageFileReader; diff --git a/Modules/IO/JPEG/src/itkJPEGImageIO.cxx b/Modules/IO/JPEG/src/itkJPEGImageIO.cxx index 079a153ed16..3be88ffa11d 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 c22ea94a3f1..f99afcf75a6 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/TransformFactory/src/itkTransformFactoryBase.cxx b/Modules/IO/TransformFactory/src/itkTransformFactoryBase.cxx index 728715e1ad9..955c3e80694 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 72e97b9b8dd..ed9cbcb0352 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 467ed8da3f4..d9667143418 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/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx index bc97c35d6d0..9cad31d6379 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 82ef2bf0266..30b2d0804ef 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/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx index 9ff16b1b686..fe260f80fa3 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkBSplineSyNImageRegistrationTest.cxx @@ -75,8 +75,9 @@ class CommandIterationUpdate : public itk::Command template int -PerformBSplineSyNImageRegistration(int itkNotUsed(argc), char * argv[]) +PerformBSplineSyNImageRegistration(int argc, char * argv[]) { + ITK_TEST_EXPECT_TRUE(argc == 4); const unsigned int ImageDimension = TDimension; using PixelType = double; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest3.cxx index 893f7d7f947..d3d0cf691e2 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 != 5) + { + 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/itkSimpleImageRegistrationTest4.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx index cf953e0e5cf..571a609f037 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest4.cxx @@ -77,8 +77,9 @@ class CommandIterationUpdate : public itk::Command template int -ImageRegistration(int itkNotUsed(argc), char * argv[]) +ImageRegistration(int argc, char * argv[]) { + ITK_TEST_EXPECT_TRUE(argc == 4); const unsigned int ImageDimension = TDimension; diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSyNImageRegistrationTest.cxx index 409919151ca..5654883d414 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 != 5) + { + std::cout << "ERROR: incorrect number of arguments" << std::endl; + return EXIT_FAILURE; + } const unsigned int ImageDimension = TDimension; using PixelType = double;