From ed549df6e7fc60f0da8b98ca9af0e334ddbf3099 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 10 May 2017 01:21:13 +0200 Subject: [PATCH] Add warning -Wswitch-enum --- CMakeLists.txt | 1 + tests/CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce118bd..c4158ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wunused-macros -Wmissing-variable-declarations -Wused-but-marked-unused + -Wswitch-enum ) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5dee1af..f3d07af 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,6 +25,14 @@ if(ENABLE_CJSON_TEST) target_compile_options(unity PRIVATE "-fno-sanitize=float-divide-by-zero") endif() endif() + # Disable -Wswitch-enum for Unity + if (FLAG_SUPPORTED_Wswitchenum) + if ("${CMAKE_VERSION}" VERSION_LESS "2.8.12") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-switch-enum") + else() + target_compile_options(unity PRIVATE "-Wno-switch-enum") + endif() + endif() #copy test files file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inputs")