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*.
This commit is contained in:
Azat Khuzhin 2016-03-10 00:25:09 +03:00
parent 060e5a2d8d
commit f29f59e811
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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