From 35ed19e0d3d8d7dc49fd8bddf5357ae0d4ae306c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Fri, 12 Jul 2024 11:53:16 +0200 Subject: [PATCH 1/2] Fix some issues reported by Cppcheck Some member initialization moved to initializer list and an unused variable got removed. --- src/KDGui/platform/android/android_platform_event_loop.h | 1 - src/KDGui/platform/linux/xcb/linux_xkb_keyboard.cpp | 3 +-- src/KDGui/window.cpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/KDGui/platform/android/android_platform_event_loop.h b/src/KDGui/platform/android/android_platform_event_loop.h index 4b59c62..33ad630 100644 --- a/src/KDGui/platform/android/android_platform_event_loop.h +++ b/src/KDGui/platform/android/android_platform_event_loop.h @@ -62,7 +62,6 @@ class KDGUI_API AndroidPlatformEventLoop : public KDFoundation::AbstractPlatform static int32_t androidHandleInputEvent(struct android_app *app, AInputEvent *event); private: - int m_events; std::unordered_map m_notifiers; AndroidPlatformIntegration *m_androidPlatformInitegration; }; diff --git a/src/KDGui/platform/linux/xcb/linux_xkb_keyboard.cpp b/src/KDGui/platform/linux/xcb/linux_xkb_keyboard.cpp index e6d25c6..8b95c18 100644 --- a/src/KDGui/platform/linux/xcb/linux_xkb_keyboard.cpp +++ b/src/KDGui/platform/linux/xcb/linux_xkb_keyboard.cpp @@ -24,9 +24,8 @@ using namespace KDGui; LinuxXkbKeyboard::LinuxXkbKeyboard(LinuxXcbPlatformIntegration *platformIntegration) : m_platformIntegration{ platformIntegration } + , m_logger{ KDUtils::Logger::logger("xkeyboard", spdlog::level::trace) } { - m_logger = KDUtils::Logger::logger("xkeyboard", spdlog::level::trace); - // Query the core keyboard device id m_deviceId = xkb_x11_get_core_keyboard_device_id(m_platformIntegration->connection()); if (m_deviceId == -1) { diff --git a/src/KDGui/window.cpp b/src/KDGui/window.cpp index 0c4569f..fe73e00 100644 --- a/src/KDGui/window.cpp +++ b/src/KDGui/window.cpp @@ -21,8 +21,8 @@ using namespace KDGui; Window::Window() : Object() + , m_logger{ KDUtils::Logger::logger("window", spdlog::level::info) } { - m_logger = KDUtils::Logger::logger("window", spdlog::level::info); visible.valueChanged().connect(&Window::onVisibleChanged, this); m_resizeConnectionIds = { From 36fdc9f7bf5f1b1f97bb67cf4b4aea999b79882d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Fri, 12 Jul 2024 14:29:18 +0200 Subject: [PATCH 2/2] Suppress ODR violation Cppcheck check for tests Cppcheck treats the whole codebase as if it was to be compiled into a single object and in tests we have some helper classes with the same name in multiple executables. --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index df033e8..3339216 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -78,6 +78,7 @@ jobs: cppcheck --quiet --language=c++ --force --inline-suppr --enable=warning,performance,portability,information --disable=missingInclude --check-level=exhaustive + --suppress="ctuOneDefinitionRuleViolation:tests/*" -i build --library=std.cfg --error-exitcode=42 . if($LASTEXITCODE -eq 42) {