Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -Wsuggest-override for gcc, and add missing override qualifiers
Browse files Browse the repository at this point in the history
rouault committed Aug 15, 2024
1 parent 5a2afd8 commit 458746b
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -309,7 +309,7 @@ target_compile_options(geos_developer_cxx_flags
INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:-W4> # consider -analyze
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Werror -pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wsign-conversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common>
$<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates -Wno-psabi -Wsuggest-attribute=format>
$<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates -Wno-psabi -Wsuggest-attribute=format -Wsuggest-override>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-unknown-warning-option>
)

4 changes: 2 additions & 2 deletions capi/geos_ts_c.cpp
Original file line number Diff line number Diff line change
@@ -1631,13 +1631,13 @@ extern "C" {
Geometry*
GEOSGeom_transformXY_r(GEOSContextHandle_t handle, const GEOSGeometry* g, GEOSTransformXYCallback callback, void* userdata) {

struct TransformFilter : public geos::geom::CoordinateFilter {
struct TransformFilter final: public geos::geom::CoordinateFilter {
TransformFilter(GEOSTransformXYCallback p_callback,
void* p_userdata) :
m_callback(p_callback),
m_userdata(p_userdata) {}

void filter_rw(CoordinateXY* c) const final {
void filter_rw(CoordinateXY* c) const override {
if (!m_callback(&(c->x), &(c->y), m_userdata)) {
throw std::runtime_error(std::string("Failed to transform coordinates."));
}
2 changes: 1 addition & 1 deletion include/geos/algorithm/hull/HullTriangulation.h
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ class HullTriangulation
: triList(p_triList)
{};

void visit(std::array<QuadEdge*, 3>& triEdges);
void visit(std::array<QuadEdge*, 3>& triEdges) override;

}; // HullTriVisitor

Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ class GEOS_DLL PointwisePrecisionReducerTransformer : public geom::util::Geometr

std::unique_ptr<geom::CoordinateSequence> transformCoordinates(
const geom::CoordinateSequence* coords,
const geom::Geometry* parent);
const geom::Geometry* parent) override;


};
4 changes: 2 additions & 2 deletions src/operation/overlayng/OverlayPoints.cpp
Original file line number Diff line number Diff line change
@@ -27,14 +27,14 @@ namespace geos { // geos
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng

struct PointExtractingFilter: public GeometryComponentFilter {
struct PointExtractingFilter final: public GeometryComponentFilter {

PointExtractingFilter(std::map<CoordinateXY, std::unique_ptr<Point>>& p_ptMap, const PrecisionModel* p_pm)
: ptMap(p_ptMap), pm(p_pm)
{}

void
filter_ro(const Geometry* geom)
filter_ro(const Geometry* geom) override
{
if (geom->getGeometryTypeId() != GEOS_POINT) return;

4 changes: 2 additions & 2 deletions util/geosop/GeosOp.cpp
Original file line number Diff line number Diff line change
@@ -189,8 +189,8 @@ class comma_numpunct : public std::numpunct<char>
:m_thousands_sep(p_thousands_sep),
m_grouping(p_grouping){}
protected:
char do_thousands_sep() const {return m_thousands_sep;}
std::string do_grouping() const {return m_grouping;}
char do_thousands_sep() const override {return m_thousands_sep;}
std::string do_grouping() const override {return m_grouping;}
private:
char m_thousands_sep;
std::string m_grouping;

0 comments on commit 458746b

Please sign in to comment.