Skip to content
Permalink
Browse files

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>
  • Loading branch information...
daor-oti authored and aescolar committed May 16, 2019
1 parent 8e5a95e commit 025ffa249246b27d95d8d5e76e676cb27704b980
Showing with 17 additions and 6 deletions.
  1. +3 −6 CMakeLists.txt
  2. +7 −0 cmake/compiler/clang/target_warnings.cmake
  3. +7 −0 cmake/compiler/gcc/target_warnings.cmake
@@ -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)

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

0 comments on commit 025ffa2

Please sign in to comment.
You can’t perform that action at this time.