diff --git a/CMakeLists.txt b/CMakeLists.txt index a9073bd28b1..993b91ccd4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,13 +197,8 @@ toolchain_cc_nostdinc() zephyr_compile_options( -g # TODO: build configuration enough? - -Wall - -Wformat - -Wformat-security - -Wno-format-zero-length -imacros ${AUTOCONF_H} -ffreestanding - -Wno-main -fno-common ${TOOLCHAIN_C_FLAGS} ) @@ -232,6 +227,9 @@ if(CONFIG_LIB_CPLUSPLUS) toolchain_ld_cpp() endif() +# @Intent Add the basic toolchain warning flags +toolchain_cc_warning_base() + # ========================================================================== # # cmake -DW=... settings @@ -262,7 +260,6 @@ zephyr_cc_option(-fno-asynchronous-unwind-tables) zephyr_cc_option(-fno-pie) zephyr_cc_option(-fno-pic) zephyr_cc_option(-fno-strict-overflow) -zephyr_cc_option(-Wno-pointer-sign) if(CONFIG_OVERRIDE_FRAME_POINTER_DEFAULT) if(CONFIG_OMIT_FRAME_POINTER) @@ -311,9 +308,6 @@ zephyr_cc_option_ifdef(CONFIG_STACK_USAGE -fstack-usage) # Force an error when things like SYS_INIT(foo, ...) occur with a missing header. zephyr_cc_option(-Werror=implicit-int) -# Prohibit void pointer arithmetic. Illegal in C99 -zephyr_cc_option(-Wpointer-arith) - # If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the # __FILE__ macro used in __ASSERT*, in the # .noinit."/home/joe/zephyr/fu/bar.c" section names and in any diff --git a/cmake/compiler/gcc/target_warnings.cmake b/cmake/compiler/gcc/target_warnings.cmake index 19cc146b394..775273d202e 100644 --- a/cmake/compiler/gcc/target_warnings.cmake +++ b/cmake/compiler/gcc/target_warnings.cmake @@ -2,6 +2,23 @@ # See root CMakeLists.txt for description and expectations of these macros +macro(toolchain_cc_warning_base) + + zephyr_compile_options( + -Wall + -Wformat + -Wformat-security + -Wno-format-zero-length + -Wno-main + ) + + zephyr_cc_option(-Wno-pointer-sign) + + # Prohibit void pointer arithmetic. Illegal in C99 + zephyr_cc_option(-Wpointer-arith) + +endmacro() + macro(toolchain_cc_warning_dw_1) zephyr_compile_options(