From 3cb55e40d2db4ada72d5b855cff47fbc44ae8e25 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 15 Sep 2024 10:33:28 +0200 Subject: [PATCH] CMake: Selectively enable -Werror for common sources of errors --- CMakeLists.txt | 3 +++ source/gui-sdl/main.cpp | 1 + source/video_core/CMakeLists.txt | 3 +++ 3 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd35b8e..fc73e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,9 @@ endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) +add_compile_options(-Werror=implicit-fallthrough) +add_compile_options(-Werror=return-type) + # Prefer Conan-provided packages over system ones set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) diff --git a/source/gui-sdl/main.cpp b/source/gui-sdl/main.cpp index feaa32b..c74004c 100644 --- a/source/gui-sdl/main.cpp +++ b/source/gui-sdl/main.cpp @@ -90,6 +90,7 @@ inline std::ostream& operator<<(std::ostream& os, ShaderEngine engine) { case ShaderEngine::GLSL: return (os << "glsl"); } + return os; } } diff --git a/source/video_core/CMakeLists.txt b/source/video_core/CMakeLists.txt index 5c493eb..28ecde6 100644 --- a/source/video_core/CMakeLists.txt +++ b/source/video_core/CMakeLists.txt @@ -53,3 +53,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Required for g_vulkan_queue_mutex target_link_options(video_core PRIVATE "-undefined;dynamic_lookup") endif() + +# Selectively disable Werror to cover false positives +target_compile_options(video_core PRIVATE -Wno-error=return-type)