Skip to content
Permalink
Browse files

cmake: Toolchain abstraction: Introduce toolchain_cc_warning_base

This is placeholder for base warning flags, common to most toolchains.

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 6, 2019
1 parent 8650b15 commit bdb229faff46edd1a8cd8227a0ebde4788efe051
Showing with 20 additions and 9 deletions.
  1. +3 −9 CMakeLists.txt
  2. +17 −0 cmake/compiler/gcc/target_warnings.cmake
@@ -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
@@ -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(

0 comments on commit bdb229f

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