diff --git a/CMakeLists.txt b/CMakeLists.txt index fb7f4ebd7e..d9f3322175 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,10 @@ target_compile_options(geos_developer_cxx_flags $<$,$>:-Wno-unknown-warning-option> ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.2) + target_compile_options(geos_developer_cxx_flags INTERFACE -Wsuggest-override) +endif() + #----------------------------------------------------------------------------- # Define a coverage build #----------------------------------------------------------------------------- diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index b6efb7e03e..ef238229aa 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -1629,13 +1629,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.")); } diff --git a/include/geos/algorithm/hull/HullTriangulation.h b/include/geos/algorithm/hull/HullTriangulation.h index f6db2eac8d..05808c8425 100644 --- a/include/geos/algorithm/hull/HullTriangulation.h +++ b/include/geos/algorithm/hull/HullTriangulation.h @@ -124,7 +124,7 @@ class HullTriangulation : triList(p_triList) {}; - void visit(std::array& triEdges); + void visit(std::array& triEdges) override; }; // HullTriVisitor diff --git a/include/geos/precision/PointwisePrecisionReducerTransformer.h b/include/geos/precision/PointwisePrecisionReducerTransformer.h index 1b5df1db42..9ea06717ff 100644 --- a/include/geos/precision/PointwisePrecisionReducerTransformer.h +++ b/include/geos/precision/PointwisePrecisionReducerTransformer.h @@ -63,7 +63,7 @@ class GEOS_DLL PointwisePrecisionReducerTransformer : public geom::util::Geometr std::unique_ptr transformCoordinates( const geom::CoordinateSequence* coords, - const geom::Geometry* parent); + const geom::Geometry* parent) override; }; diff --git a/src/operation/overlayng/OverlayPoints.cpp b/src/operation/overlayng/OverlayPoints.cpp index c1c37799cc..6afe7a2112 100644 --- a/src/operation/overlayng/OverlayPoints.cpp +++ b/src/operation/overlayng/OverlayPoints.cpp @@ -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>& 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; diff --git a/util/geosop/GeosOp.cpp b/util/geosop/GeosOp.cpp index 5774d7a77f..43a453b3ad 100644 --- a/util/geosop/GeosOp.cpp +++ b/util/geosop/GeosOp.cpp @@ -189,8 +189,8 @@ class comma_numpunct : public std::numpunct :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;