From dccc94fb66a57eb8166ec4dc1e1e4f1e8b5402b2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 1 Jun 2025 12:35:44 +0200 Subject: [PATCH] Enable -Wimplicit-fallthrough, -Wdeprecated-copy-dtor, -Wweak-vtables, -Wdocumentation-unknown-command when possible --- CMakeLists.txt | 12 +++++++++++- src/projections/aitoff.cpp | 2 +- src/sqlite3_utils.cpp | 8 +++++--- test/unit/test_operationfactory.cpp | 6 ++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a92446cc0f..f5670877e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") -Wduplicated-cond -Wduplicated-branches -Wlogical-op + -Wimplicit-fallthrough ) set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wmissing-prototypes @@ -71,6 +72,7 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") # -Wold-style-cast -Woverloaded-virtual -Wzero-as-null-pointer-constant + -Wdeprecated-copy-dtor ) elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(PROJ_common_WARN_FLAGS ${PROJ_common_WARN_FLAGS} @@ -79,8 +81,14 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") -Wdocumentation -Wno-documentation-deprecated-sync -Wfloat-conversion -Wlogical-op-parentheses - # -Wweak-vtables + -Wimplicit-fallthrough ) + + # Not sure about the minimum version, but clang 12 complains about \file, @cond Doxygen_Suppress, etc. + if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL 18.0.0) + set(PROJ_common_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wdocumentation-unknown-command) + endif() + set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wmissing-prototypes -Wc11-extensions @@ -93,6 +101,8 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") -Wshorten-64-to-32 -Wunused-private-field -Wzero-as-null-pointer-constant + -Wdeprecated-copy-dtor + -Wweak-vtables ) elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") add_definitions(/D_CRT_SECURE_NO_WARNINGS) # Eliminate deprecation warnings diff --git a/src/projections/aitoff.cpp b/src/projections/aitoff.cpp index fed9dfcc08..5998226889 100644 --- a/src/projections/aitoff.cpp +++ b/src/projections/aitoff.cpp @@ -96,7 +96,7 @@ static PJ_XY aitoff_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ * Inverse for Aitoff projection in poles is undefined, longitude value of 0 is *assumed. * - * Contact : dtutic@geof.hr + * Contact : dtutic at geof.hr * Date: 2015-02-16 * ************************************************************************************/ diff --git a/src/sqlite3_utils.cpp b/src/sqlite3_utils.cpp index 5f37b0b8af..8f578a92ae 100644 --- a/src/sqlite3_utils.cpp +++ b/src/sqlite3_utils.cpp @@ -236,11 +236,13 @@ std::unique_ptr SQLite3VFS::create(bool fakeSync, bool fakeLock, #ifdef EMBED_RESOURCE_FILES struct pj_sqlite3_memvfs : public pj_sqlite3_vfs { - ~pj_sqlite3_memvfs() override { - pj_sqlite3_memvfs_deallocate_user_data(&base); - } + ~pj_sqlite3_memvfs() override; }; +pj_sqlite3_memvfs::~pj_sqlite3_memvfs() { + pj_sqlite3_memvfs_deallocate_user_data(&base); +} + /* static */ std::unique_ptr SQLite3VFS::createMem(const void *membuffer, size_t bufferSize) { diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp index c532014b5d..741131daeb 100644 --- a/test/unit/test_operationfactory.cpp +++ b/test/unit/test_operationfactory.cpp @@ -9929,6 +9929,9 @@ TEST(operation, createOperation_ossfuzz_18587) { class derivedGeographicCRS_with_to_wgs84_to_geographicCRS : public ::testing::Test { + public: + ~derivedGeographicCRS_with_to_wgs84_to_geographicCRS() override; + protected: void run(const CRSNNPtr &src) { auto objDst = PROJStringParser().createFromPROJString( @@ -9992,6 +9995,9 @@ class derivedGeographicCRS_with_to_wgs84_to_geographicCRS } }; +derivedGeographicCRS_with_to_wgs84_to_geographicCRS:: + ~derivedGeographicCRS_with_to_wgs84_to_geographicCRS() = default; + // --------------------------------------------------------------------------- TEST_F(derivedGeographicCRS_with_to_wgs84_to_geographicCRS, src_from_proj) {