From f1dde7a9245a257eac50c902b2080dcd25ba22c5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 May 2024 09:00:46 +0000 Subject: cppcheck: Fix missingOverride complaints. --- src/indicator.h | 2 +- src/service.h | 2 +- tests/utils/glib-fixture.h | 2 +- tests/utils/test-dbus-fixture.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/indicator.h b/src/indicator.h index c9ccb1e..db8c5ac 100644 --- a/src/indicator.h +++ b/src/indicator.h @@ -65,7 +65,7 @@ class SimpleProfile: public Profile { public: SimpleProfile(const char* name, const std::shared_ptr& menu): m_name(name), m_menu(menu) {} - virtual ~SimpleProfile(); + virtual ~SimpleProfile() override; std::string name() const override {return m_name;} core::Property
& header() override {return m_header;} diff --git a/src/service.h b/src/service.h index da8d8ba..f134853 100644 --- a/src/service.h +++ b/src/service.h @@ -30,7 +30,7 @@ class DisplayIndicator: public Indicator { public: DisplayIndicator(); - ~DisplayIndicator(); + ~DisplayIndicator() override; const char* name() const override; GSimpleActionGroup* action_group() const override; diff --git a/tests/utils/glib-fixture.h b/tests/utils/glib-fixture.h index ccdeccd..b56654b 100644 --- a/tests/utils/glib-fixture.h +++ b/tests/utils/glib-fixture.h @@ -35,7 +35,7 @@ class GlibFixture : public ::testing::Test { public: - virtual ~GlibFixture() =default; + virtual ~GlibFixture() override =default; protected: diff --git a/tests/utils/test-dbus-fixture.h b/tests/utils/test-dbus-fixture.h index b01405a..e98a002 100644 --- a/tests/utils/test-dbus-fixture.h +++ b/tests/utils/test-dbus-fixture.h @@ -30,7 +30,7 @@ class TestDBusFixture: public GlibFixture public: explicit TestDBusFixture() {}; - virtual ~TestDBusFixture() =default; + virtual ~TestDBusFixture() override =default; explicit TestDBusFixture(const std::vector& service_dirs_in): service_dirs(service_dirs_in) {} -- cgit v1.2.3 From 8c4b2d9c01ae3d526bde00d5ca8925ced053f9fc Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 May 2024 09:01:16 +0000 Subject: cppcheck: Suppress constParameterCallback. See https://sourceforge.net/p/cppcheck/discussion/general/thread/6046fc0f43/ --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 81e083c..531f58b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,7 +28,7 @@ endif() add_compile_options(${CXX_WARNING_ARGS}) -add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=unusedFunction --suppress=uselessOverride) +add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=constParameterCallback --suppress=unusedFunction --suppress=uselessOverride) add_subdirectory (unit) -- cgit v1.2.3 From 9b3eb0bcb6bc6347874b79cdbf2a5c45e2f3c314 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 May 2024 09:02:26 +0000 Subject: cppcheck: Replace C-style casts by C++-style static_cast<> casts. See: https://stackoverflow.com/questions/40899581/is-it-always-safe-to-change-a-c-style-cast-to-a-static-cast --- src/service.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service.cpp b/src/service.cpp index 26faec9..b26664a 100644 --- a/src/service.cpp +++ b/src/service.cpp @@ -334,7 +334,7 @@ private: #ifdef COLOR_TEMP_ENABLED static void onUserChanged (GDBusConnection *pConnection, const gchar *sSender, const gchar *sPath, const gchar *sInterface, const gchar *sSignal, GVariant *pParameters, gpointer pUserData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pUserData; + DisplayIndicator::Impl *pImpl = static_cast(pUserData); g_variant_get (pParameters, "(s)", &pImpl->sUser); loadManager (pImpl); } @@ -449,7 +449,7 @@ private: static gboolean updateColor (gpointer pData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast(pData); if (pImpl->bReadingAccountsService) { @@ -760,7 +760,7 @@ private: static void onGeoClueLoaded (GObject *pObject, GAsyncResult *pResult, gpointer pData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast(pData); GError *pError = NULL; GClueSimple *pSimple = gclue_simple_new_finish (pResult, &pError); @@ -816,7 +816,7 @@ private: { g_simple_action_set_state (pAction, pVariant); - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast(pData); if (pImpl->bAutoSliderUpdate) { -- cgit v1.2.3 From bfb74193db0e172bb1db5fc837a4b1ee4688259f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 May 2024 09:03:13 +0000 Subject: cppcheck: Run with --check-level=exhaustive. Resolves 1: /ayatana-indicator-display/src/service.cpp:0:0: information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches] --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 531f58b..bdc074f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,7 +28,7 @@ endif() add_compile_options(${CXX_WARNING_ARGS}) -add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=constParameterCallback --suppress=unusedFunction --suppress=uselessOverride) +add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --check-level=exhaustive --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=constParameterCallback --suppress=unusedFunction --suppress=uselessOverride) add_subdirectory (unit) -- cgit v1.2.3