From 98dad71b0eb1caa0ada3e3c363aa4c4028379c85 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sat, 25 Dec 2021 13:50:34 +0100 Subject: [PATCH] STYLE: Do not use `void` in empty function parameter list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following ITK commits: "STYLE: removing void if used in place of empty parameter list" by Dženan Zukić, 11 September 2018 https://github.com/InsightSoftwareConsortium/ITK/commit/60807f4abcfd7c4d42ddf93796d6acf272aa442b "STYLE: Remove redundant void argument lists" by Hans Johnson, 20 February 2020 pull request https://github.com/InsightSoftwareConsortium/ITK/pull/1628 https://github.com/InsightSoftwareConsortium/ITK/commit/e6d859ecae955a4e2a44b9e60677093dc254a4ca In accordance with C++ Core Guidelines, August 19, 2021: "Don't use void as an argument type" https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#nl25-dont-use-void-as-an-argument-type Clang-Tidy "modernize-redundant-void-arg" check: https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html --- CMake/ITK_CheckCCompilerFlag.cmake | 2 +- SoftwareGuide/Cover/Source/ModelBasedSegmentation.cxx | 2 +- SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMake/ITK_CheckCCompilerFlag.cmake b/CMake/ITK_CheckCCompilerFlag.cmake index a531f92b..5458fc7f 100644 --- a/CMake/ITK_CheckCCompilerFlag.cmake +++ b/CMake/ITK_CheckCCompilerFlag.cmake @@ -25,7 +25,7 @@ include(CheckCSourceCompiles) macro (ITK_CHECK_C_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") - CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} + CHECK_C_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "warning: command line option .* is valid for .* but not for C" # Apple gcc diff --git a/SoftwareGuide/Cover/Source/ModelBasedSegmentation.cxx b/SoftwareGuide/Cover/Source/ModelBasedSegmentation.cxx index 1ace42e3..2cb041d4 100644 --- a/SoftwareGuide/Cover/Source/ModelBasedSegmentation.cxx +++ b/SoftwareGuide/Cover/Source/ModelBasedSegmentation.cxx @@ -169,7 +169,7 @@ class SimpleImageToSpatialObjectMetric : std::cout << "Number of points in the metric = " << static_cast( m_PointList.size() ) << std::endl; } - unsigned int GetNumberOfParameters(void) const {return SpaceDimension;}; + unsigned int GetNumberOfParameters() const {return SpaceDimension;}; /** Get the Derivatives of the Match Measure */ void GetDerivative( const ParametersType &, diff --git a/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex b/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex index 48333fc8..5976c8d4 100644 --- a/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex +++ b/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex @@ -3142,7 +3142,7 @@ \section{Using Standard Macros} Some of the more important object macros are: \begin{itemize} -\item \code{itkNewMacro(T)}: Creates the static class method \code{New(void)} +\item \code{itkNewMacro(T)}: Creates the static class method \code{New()} that interacts with the object factory to instantiate objects. The method returns a \code{SmartPointer} properly reference counted. \item \code{itkTypeMacro(thisClass, superclass)}: Adds standard methods a @@ -3252,7 +3252,7 @@ \section{Exception Handling} \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cpp} /** Initialize the components related to supporting multiple threads. */ -virtual void MultiThreadingInitialize(void) throw (ExceptionObject); +virtual void MultiThreadingInitialize() throw (ExceptionObject); \end{minted} \normalsize