compiler: gcc: Add warning option to spot poblematic switches
Option -Wimplicit-fallthrough as the name suggests raises a warning when there is an implicit fallthrough in a switch clause. This warning does not happen when the last statement is a return or a call to a function declared with noreturn attribute. This flag helps to enforce two MISRA-C rules (not completely), 16.1 and 16.3 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
86b2cbc5ea
commit
680f401ef2
|
@ -12,6 +12,12 @@ macro(toolchain_cc_warning_base)
|
|||
-Wno-main
|
||||
)
|
||||
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER "7.1.0")
|
||||
zephyr_compile_options(
|
||||
-Wimplicit-fallthrough=2
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "9.1.0")
|
||||
zephyr_compile_options(
|
||||
# FIXME: Remove once #16587 is fixed
|
||||
|
|
Loading…
Reference in a new issue