Skip to content

Commit 3ce78b4

Browse files
committed
Add -Wswitch-enum to default GCC/Clang build options
This is now consistent with the warnings that Visual Studio would generate, which warns about missing enum cases in switch/case even when a default: is present.
1 parent 553e169 commit 3ce78b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
2424
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
2525
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
2626
# Enable lots of warnings
27-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror -Wno-deprecated-declarations")
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror -Wno-deprecated-declarations -Wswitch-enum")
2828
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
2929
# This would be the place to enable warnings for Windows builds, although
3030
# config.inc doesn't seem to do that currently

src/config.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BUILD_ENV = AUTO
55
ifeq ($(BUILD_ENV),MSVC)
66
#CXXFLAGS += /Wall /WX
77
else
8-
CXXFLAGS += -Wall -pedantic -Werror -Wno-deprecated-declarations
8+
CXXFLAGS += -Wall -pedantic -Werror -Wno-deprecated-declarations -Wswitch-enum
99
endif
1010

1111
# Select optimisation or debug info

0 commit comments

Comments
 (0)