1# Overview of used compiler properties for gcc / g++ compilers.
2#
3# Define the flags your toolchain support, and keep the unsupported flags empty.
4
5#####################################################
6# This section covers flags related to optimization #
7#####################################################
8set_compiler_property(PROPERTY no_optimization)
9
10set_compiler_property(PROPERTY optimization_debug)
11
12set_compiler_property(PROPERTY optimization_speed)
13
14set_compiler_property(PROPERTY optimization_size)
15
16#######################################################
17# This section covers flags related to warning levels #
18#######################################################
19
20# Property for standard warning base in Zephyr, this will always bet set when compiling.
21set_compiler_property(PROPERTY warning_base)
22
23# GCC options for warning levels 1, 2, 3, when using `-DW=[1|2|3]`
24# Property for warning levels 1, 2, 3 in Zephyr when using `-DW=[1|2|3]`
25set_compiler_property(PROPERTY warning_dw_1)
26
27set_compiler_property(PROPERTY warning_dw_2)
28
29set_compiler_property(PROPERTY warning_dw_3)
30
31# Extended warning set supported by the compiler
32set_compiler_property(PROPERTY warning_extended)
33
34# Compiler property that will issue error if a declaration does not specify a type
35set_compiler_property(PROPERTY warning_error_implicit_int)
36
37# Compiler flags to use when compiling according to MISRA
38set_compiler_property(PROPERTY warning_error_misra_sane)
39
40###########################################################################
41# This section covers flags related to C or C++ standards / standard libs #
42###########################################################################
43
44# Compiler flags for C standard. The specific standard must be appended by user.
45# For example, gcc specifies this as: set_compiler_property(PROPERTY cstd -std=)
46set_compiler_property(PROPERTY cstd)
47
48# Compiler flags for disabling C standard include and instead specify include
49# dirs in nostdinc_include to use.
50set_compiler_property(PROPERTY nostdinc)
51set_compiler_property(PROPERTY nostdinc_include)
52
53# Compiler flags for disabling C++ standard include.
54set_compiler_property(TARGET compiler-cpp PROPERTY nostdincxx)
55
56# Required C++ flags when compiling C++ code
57set_property(TARGET compiler-cpp PROPERTY required)
58
59# Compiler flags to use for specific C++ dialects
60set_property(TARGET compiler-cpp PROPERTY dialect_cpp98)
61set_property(TARGET compiler-cpp PROPERTY dialect_cpp11)
62set_property(TARGET compiler-cpp PROPERTY dialect_cpp14)
63set_property(TARGET compiler-cpp PROPERTY dialect_cpp17)
64set_property(TARGET compiler-cpp PROPERTY dialect_cpp2a)
65set_property(TARGET compiler-cpp PROPERTY dialect_cpp20)
66set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b)
67
68# Extra warnings options for twister run
69set_property(TARGET compiler PROPERTY warnings_as_errors)
70set_property(TARGET asm PROPERTY warnings_as_errors)
71
72# Flag for disabling exeptions in C++
73set_property(TARGET compiler-cpp PROPERTY no_exceptions)
74
75# Flag for disabling rtti in C++
76set_property(TARGET compiler-cpp PROPERTY no_rtti)
77
78
79###################################################
80# This section covers all remaining C / C++ flags #
81###################################################
82
83# Flags for coverage generation
84set_compiler_property(PROPERTY coverage)
85
86# Security canaries flags.
87set_compiler_property(PROPERTY security_canaries)
88
89set_compiler_property(PROPERTY security_fortify)
90
91# Flag for a hosted (no-freestanding) application
92set_compiler_property(PROPERTY hosted)
93
94# gcc flag for a freestanding application
95set_compiler_property(PROPERTY freestanding)
96
97# Flag to include debugging symbol in compilation
98set_compiler_property(PROPERTY debug)
99
100set_compiler_property(PROPERTY no_common)
101
102# Flags for imacros. The specific header must be appended by user.
103set_compiler_property(PROPERTY imacros)
104
105# Compiler flags for sanitizing.
106set_compiler_property(PROPERTY sanitize_address)
107
108set_compiler_property(PROPERTY sanitize_undefined)
109
110# Compiler flag for turning off thread-safe initialization of local statics
111set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics)
112
113# Required ASM flags when compiling
114set_property(TARGET asm PROPERTY required)
115