Skip to content

Commit

Permalink
Add -Wsuggest-override for gcc, and add missing override qualifiers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored Aug 15, 2024
1 parent 1821b67 commit 6c9b94a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ target_compile_options(geos_developer_cxx_flags
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-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
#-----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions capi/geos_ts_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
}
Expand Down
2 changes: 1 addition & 1 deletion include/geos/algorithm/hull/HullTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


};
Expand Down
4 changes: 2 additions & 2 deletions src/operation/overlayng/OverlayPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions util/geosop/GeosOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6c9b94a

Please sign in to comment.