1# SPDX-License-Identifier: Apache-2.0
2
3include(${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake)
4
5# nostdinc needs to be cleared as it is needed for xtensa/config/core.h.
6# nostdinc_include contains path to llvm headers.
7set_compiler_property(PROPERTY nostdinc)
8set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC})
9
10if($ENV{XCC_NO_G_FLAG})
11  # Older xcc/clang cannot use "-g" due to this bug:
12  # https://bugs.llvm.org/show_bug.cgi?id=11740.
13  # Clear the related flag(s) here so it won't cause issues.
14  set_compiler_property(PROPERTY debug)
15endif()
16
17# Clang version used by Xtensa does not support -fno-pic and -fno-pie
18set_compiler_property(PROPERTY no_position_independent "")
19
20# Remove after testing that -Wshadow works
21set_compiler_property(PROPERTY warning_shadow_variables)
22
23# xt-clang is usually based on older version of clang, and
24# Zephyr main targets more recent versions. Because of this,
25# some newer compiler flags may cause warnings where twister
26# would mark as test being failed. To workaround that,
27# add -Wno-unknown-warning-option to suppress those warnings.
28check_set_compiler_property(APPEND PROPERTY warning_extended
29                            -Wno-unknown-warning-option
30)
31