Commit 5d382fa5 authored by Nikolay Agishev's avatar Nikolay Agishev Committed by Chris Friedt
Browse files

toolchain: Move extra warning options to toolchain abstraction

Move extra warning option from generic twister script into
compiler-dependent config files.
ARCMWDT compiler doesn't support extra warning options ex.
"-Wl,--fatal-warnings". To avoid build fails flag
"disable_warnings_as_errors" should be passed to twister.
This allows all warning messages and make atomatic test useles.

Signed-off-by: default avatarNikolay Agishev <agishev@synopsys.com>
(cherry picked from commit 0dec4cf9)
parent e677cfd6
Loading
Loading
Loading
Loading
+7 −0
Changes for CMakeLists.txt: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -162,6 +162,13 @@ zephyr_compile_options(${OPTIMIZATION_FLAG})
# @Intent: Obtain compiler specific flags related to C++ that are not influenced by kconfig
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,required>>)

# Extra warnings options for twister run
if (CONFIG_COMPILER_WARNINGS_AS_ERRORS)
  zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,warnings_as_errors>>)
  zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:asm,warnings_as_errors>>)
  zephyr_link_libraries($<TARGET_PROPERTY:linker,warnings_as_errors>)
endif()

# @Intent: Obtain compiler specific flags for compiling under different ISO standards of C++
if(CONFIG_CPLUSPLUS)
  # From kconfig choice, pick a single dialect.
+5 −1
Changes for Kconfig.zephyr: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -305,9 +305,13 @@ config NO_OPTIMIZATIONS
	help
	  Compiler optimizations will be set to -O0 independently of other
	  options.

endchoice

config COMPILER_WARNINGS_AS_ERRORS
	bool "Treat warnings as errors"
	help
	  Turn on "warning as error" toolchain flags

config COMPILER_COLOR_DIAGNOSTICS
	bool "Enable colored diganostics"
	default y
+4 −0
Changes for cmake/compiler/arcmwdt/compiler_flags.cmake: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -132,6 +132,10 @@ set_property(TARGET compiler-cpp PROPERTY dialect_cpp2a "")
set_property(TARGET compiler-cpp PROPERTY dialect_cpp20 "")
set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b "")

# Flags for set extra warnigs (ARCMWDT asm can't recognize --fatal-warnings. Skip it)
set_property(TARGET compiler PROPERTY warnings_as_errors -Werror)
set_property(TARGET asm PROPERTY warnings_as_errors -Werror)

# Disable exeptions flag in C++
set_property(TARGET compiler-cpp PROPERTY no_exceptions "-fno-exceptions")

+4 −0
Changes for cmake/compiler/compiler_flags_template.cmake: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ set_property(TARGET compiler-cpp PROPERTY dialect_cpp2a)
set_property(TARGET compiler-cpp PROPERTY dialect_cpp20)
set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b)

# Extra warnings options for twister run
set_property(TARGET compiler PROPERTY warnings_as_errors)
set_property(TARGET asm PROPERTY warnings_as_errors)

# Flag for disabling exeptions in C++
set_property(TARGET compiler-cpp PROPERTY no_exceptions)

+4 −0
Changes for cmake/compiler/gcc/compiler_flags.cmake: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ set_property(TARGET compiler-cpp PROPERTY dialect_cpp20 "-std=c++20"
set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b "-std=c++2b"
  "-Wno-register" "-Wno-volatile")

# Flags for set extra warnigs (ARCMWDT asm can't recognize --fatal-warnings. Skip it)
set_property(TARGET compiler PROPERTY warnings_as_errors -Werror)
set_property(TARGET asm PROPERTY warnings_as_errors -Werror)

# Disable exeptions flag in C++
set_property(TARGET compiler-cpp PROPERTY no_exceptions "-fno-exceptions")

Loading