diff --git a/CMakeLists.txt b/CMakeLists.txt index 69805e4a62e..59f56ceb74e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,9 @@ endif() # @Intent: Add extended, more specific, toolchain warning flags toolchain_cc_warning_extended() +# @Intent: Trigger an error when a declaration does not specify a type +toolchain_cc_warning_error_implicit_int() + # Allow the user to inject options when calling cmake, e.g. # 'cmake -DEXTRA_CFLAGS="-Werror -Wno-deprecated-declarations" ..' include(cmake/extra_flags.cmake) @@ -292,9 +295,6 @@ endif() 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) - # 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 @@ -303,9 +303,6 @@ zephyr_cc_option(-Werror=implicit-int) # importantly makes builds more deterministic zephyr_cc_option(-fmacro-prefix-map=${ZEPHYR_BASE}=.) -# Prohibit date/time macros, which would make the build non-deterministic -# cc-option(-Werror=date-time) - # TODO: Archiver arguments # ar_option(D) diff --git a/cmake/compiler/clang/target_warnings.cmake b/cmake/compiler/clang/target_warnings.cmake index 129f7643f05..771726f5a96 100644 --- a/cmake/compiler/clang/target_warnings.cmake +++ b/cmake/compiler/clang/target_warnings.cmake @@ -95,6 +95,13 @@ macro(toolchain_cc_warning_extended) endmacro() +macro(toolchain_cc_warning_error_implicit_int) + + # Force an error when things like SYS_INIT(foo, ...) occur with a missing header + zephyr_cc_option(-Werror=implicit-int) + +endmacro() + # # The following macros leaves it up to the root CMakeLists.txt to choose # the variables in which to put the requested flags, and whether or not diff --git a/cmake/compiler/gcc/target_warnings.cmake b/cmake/compiler/gcc/target_warnings.cmake index 3152ded8121..a14233d0313 100644 --- a/cmake/compiler/gcc/target_warnings.cmake +++ b/cmake/compiler/gcc/target_warnings.cmake @@ -81,6 +81,13 @@ macro(toolchain_cc_warning_extended) endmacro() +macro(toolchain_cc_warning_error_implicit_int) + + # Force an error when things like SYS_INIT(foo, ...) occur with a missing header + zephyr_cc_option(-Werror=implicit-int) + +endmacro() + # # The following macros leaves it up to the root CMakeLists.txt to choose # the variables in which to put the requested flags, and whether or not