From 30ca936b1663f7153122fe60d534cdf62270bc80 Mon Sep 17 00:00:00 2001 From: konstantysz Date: Sat, 22 Nov 2025 20:54:59 +0100 Subject: [PATCH 1/2] Fix compilation warnings and enable stricter checks --- CHANGELOG.md | 8 ++++++++ CMakeLists.txt | 6 ++++++ include/Layer.h | 4 ++-- tests/TestApplication.cpp | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36157e6..568db15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.1] - 2025-11-22 + +### Fixed + +- Compilation warnings for unused parameters in `Layer` class +- `nodiscard` warning in `TestApplication` tests +- Enabled stricter warning flags (`/W4` for MSVC, `-Wall -Wextra -Wpedantic -Werror` for others) in CMake build system + ## [0.5.0] - 2025-11-15 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 7202acb..0269603 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,12 @@ target_link_libraries(Kappa PUBLIC target_compile_features(Kappa PUBLIC cxx_std_20) +if(MSVC) + target_compile_options(Kappa PRIVATE /W4) +else() + target_compile_options(Kappa PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() + # Setup code quality targets and IDE integration kappa_add_code_quality_targets() kappa_setup_ide_integration() diff --git a/include/Layer.h b/include/Layer.h index d110a0e..d3951d9 100644 --- a/include/Layer.h +++ b/include/Layer.h @@ -19,7 +19,7 @@ namespace Kappa * @brief Called when an event occurs. * @param event Event to handle */ - virtual void OnEvent(Event &event) + virtual void OnEvent(Event & /*event*/) { } @@ -27,7 +27,7 @@ namespace Kappa * @brief Called every frame to update the layer. * @param deltaTime Time elapsed since last update */ - virtual void OnUpdate(float deltaTime) + virtual void OnUpdate(float /*deltaTime*/) { } diff --git a/tests/TestApplication.cpp b/tests/TestApplication.cpp index b4e2afc..ea8bf4f 100644 --- a/tests/TestApplication.cpp +++ b/tests/TestApplication.cpp @@ -233,7 +233,7 @@ TEST_F(ApplicationTest, ApplicationHasEventBus) { TestApplication app(spec); - EXPECT_NO_THROW(app.GetEventBus()); + EXPECT_NO_THROW((void)app.GetEventBus()); } // ============================================================================ From 1d671ae49e36fd242c93639555f6fef89dc29f70 Mon Sep 17 00:00:00 2001 From: konstantysz Date: Sat, 22 Nov 2025 20:58:11 +0100 Subject: [PATCH 2/2] Use modern C++ features for warning suppression --- include/Layer.h | 4 ++-- tests/TestApplication.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Layer.h b/include/Layer.h index d3951d9..39589f0 100644 --- a/include/Layer.h +++ b/include/Layer.h @@ -19,7 +19,7 @@ namespace Kappa * @brief Called when an event occurs. * @param event Event to handle */ - virtual void OnEvent(Event & /*event*/) + virtual void OnEvent([[maybe_unused]] Event &event) { } @@ -27,7 +27,7 @@ namespace Kappa * @brief Called every frame to update the layer. * @param deltaTime Time elapsed since last update */ - virtual void OnUpdate(float /*deltaTime*/) + virtual void OnUpdate([[maybe_unused]] float deltaTime) { } diff --git a/tests/TestApplication.cpp b/tests/TestApplication.cpp index ea8bf4f..a000d2a 100644 --- a/tests/TestApplication.cpp +++ b/tests/TestApplication.cpp @@ -233,7 +233,7 @@ TEST_F(ApplicationTest, ApplicationHasEventBus) { TestApplication app(spec); - EXPECT_NO_THROW((void)app.GetEventBus()); + EXPECT_NO_THROW(static_cast(app.GetEventBus())); } // ============================================================================