cmake: Toolchain abstraction: Abstraction of implicit-int error flag

Introducing the macro toolchain_cc_warning_error_implicit_int which,
abstracts the implicit_int error flag thus leaving it to the toolchain
to decide whether this flag is needed or not.

The intent here is to abstract Zephyr's dependence on toolchains,
thus allowing for easier porting to other, perhaps commercial,
toolchains and/or usecases.

No functional change expected.

Signed-off-by: Danny Oerndrup <daor@demant.com>
This commit is contained in:
Danny Oerndrup 2019-05-16 12:58:40 +02:00 committed by Alberto Escolar
parent 8e5a95e4df
commit 025ffa2492
3 changed files with 17 additions and 6 deletions

View file

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

View file

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

View file

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