From 772c657e07f91d543890213a7df74570f53fad81 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 15 Sep 2026 14:44:57 +0200 Subject: [PATCH] STYLE: Remove `virtual` keyword from member functions marked `override` Following C++ Core Guidelines, Jun 14, 2026, "Virtual functions should specify exactly one of `virtual`, `override`, or `final`", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final Using Notepad++, Replace in Files, doing: Find what: ` virtual (.*[\r\n]*.*override)` Replace with: ` \1` `[v]` Match case `(*)` Regular expression Manually removed three more `virtual` keywords from LandmarkRegistrationEstimator, as detected by Greptile AI. --- .../Core/Common/include/itkCellInterface.h | 21 +++++++++---------- Modules/Core/Common/include/itkEventObject.h | 8 +++---- .../itkLandmarkRegistrationEstimator.h | 16 +++++++------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Modules/Core/Common/include/itkCellInterface.h b/Modules/Core/Common/include/itkCellInterface.h index 7bf9679ec6e..96b0fdc05f2 100644 --- a/Modules/Core/Common/include/itkCellInterface.h +++ b/Modules/Core/Common/include/itkCellInterface.h @@ -29,17 +29,16 @@ // Define a macro for CellInterface sub-classes to use // to define the Accept and GetTopologyId virtuals used // by the MultiVisitor class -#define itkCellVisitMacro(TopologyId) \ - static constexpr CellGeometryEnum GetTopologyId() { return TopologyId; } \ - virtual void Accept(CellIdentifier cellid, typename CellInterface::MultiVisitor * mv) \ - override \ - { \ - typename CellInterfaceVisitor::Pointer v = mv->GetVisitor(TopologyId); \ - if (v) \ - { \ - v->VisitFromCell(cellid, this); \ - } \ - } \ +#define itkCellVisitMacro(TopologyId) \ + static constexpr CellGeometryEnum GetTopologyId() { return TopologyId; } \ + void Accept(CellIdentifier cellid, typename CellInterface::MultiVisitor * mv) override \ + { \ + typename CellInterfaceVisitor::Pointer v = mv->GetVisitor(TopologyId); \ + if (v) \ + { \ + v->VisitFromCell(cellid, this); \ + } \ + } \ ITK_MACROEND_NOOP_STATEMENT // Define a macro for the common type alias required by the diff --git a/Modules/Core/Common/include/itkEventObject.h b/Modules/Core/Common/include/itkEventObject.h index 9ab4422f2c7..c434be4c342 100644 --- a/Modules/Core/Common/include/itkEventObject.h +++ b/Modules/Core/Common/include/itkEventObject.h @@ -128,12 +128,12 @@ operator<<(std::ostream & os, const EventObject & e) using Superclass = super; \ classname() = default; \ classname(const Self & s); \ - virtual ~classname() override; \ - virtual const char * \ + ~classname() override; \ + const char * \ GetEventName() const override; \ - virtual bool \ + bool \ CheckEvent(const itk::EventObject * e) const override; \ - virtual itk::EventObject * \ + itk::EventObject * \ MakeObject() const override; \ \ private: \ diff --git a/Modules/Registration/RANSAC/include/itkLandmarkRegistrationEstimator.h b/Modules/Registration/RANSAC/include/itkLandmarkRegistrationEstimator.h index c12425635be..5822d6f0361 100644 --- a/Modules/Registration/RANSAC/include/itkLandmarkRegistrationEstimator.h +++ b/Modules/Registration/RANSAC/include/itkLandmarkRegistrationEstimator.h @@ -54,29 +54,29 @@ class LandmarkRegistrationEstimator : public itk::ParametersEstimator *> & data, std::vector & parameters) override; - virtual void + void Estimate(std::vector> & data, std::vector & parameters) override; - virtual void + void LeastSquaresEstimate(std::vector *> & data, std::vector & parameters) override; - virtual void + void LeastSquaresEstimate(std::vector> & data, std::vector & parameters) override; - virtual bool + bool Agree(std::vector & parameters, Point & data) override; - virtual std::vector + std::vector AgreeMultiple(std::vector & parameters, std::vector> & data, unsigned int currentBest) override; - virtual bool + bool CheckCorresspondenceDistance(std::vector & parameters, std::vector *> & data) override; - virtual bool + bool CheckCorresspondenceEdgeLength(std::vector & parameters, std::vector *> & data, double edgeLength) override;