From 57f027e478bd645de587df452d2ecb7fb476ef14 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 17 Apr 2020 12:22:43 -0700 Subject: [PATCH] Add -Werror=implicit-fallthrough to CMakeLists.txt This turns the implicit-fallthrough warning into a full compile-time error. Implicit fallthrough is when you forget a break statement in a case-switch, thus letting one case fall through into the next case and causing debugging headaches. This is different from the good type of fallthrough that you use to have one case with multiple different names, like so: case 0: case 1: case 2: In that case, it's obvious that you want to have fallthrough there. --- desktop_version/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 121441e9..d2d28f9e 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -150,6 +150,8 @@ ELSEIF(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED") ADD_DEFINITIONS(-DNO_CUSTOM_LEVELS -DNO_EDITOR) ENDIF() +TARGET_COMPILE_OPTIONS(VVVVVV PRIVATE -Werror=implicit-fallthrough) + # Library information ADD_LIBRARY(tinyxml-static STATIC ${XML_SRC}) ADD_LIBRARY(physfs-static STATIC ${PFS_SRC} ${PFSP_SRC})