From f29f59e8114bc038afae65ea9d6937cee8906f66 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 10 Mar 2016 00:25:09 +0300 Subject: [PATCH] Replace -Wswitch-enum with -Wswitch, and add it into cmake rules too According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html: -Wswitch-enum Warn whenever a switch statement has an index of enumerated type and lacks a case for one or more of the named codes of that enumeration. case labels outside the enumeration range also provoke warnings when this option is used. The only difference between -Wswitch and this option is that this option gives a warning about an omitted enumeration code even if there is a *default label*. --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 708f8a1b..53ec8c5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ if (CMAKE_COMPILER_IS_GNUCC) option(EVENT__ENABLE_GCC_FUNCTION_SECTIONS "Enable gcc function sections" OFF) option(EVENT__ENABLE_GCC_WARNINGS "Make all GCC warnings into errors" OFF) - list(APPEND __FLAGS -Wall) + list(APPEND __FLAGS -Wall -Wswitch) if (EVENT__DISABLE_GCC_WARNINGS) list(APPEND __FLAGS -w) diff --git a/configure.ac b/configure.ac index 6a669fb7..52710b54 100644 --- a/configure.ac +++ b/configure.ac @@ -792,7 +792,7 @@ if test x$enable_gcc_warnings != xno && test "$GCC" = "yes"; then #error #endif])], have_clang=yes, have_clang=no) - CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum" + CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch" if test x$enable_gcc_warnings = xyes; then CFLAGS="$CFLAGS -Werror" fi