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
16set_compiler_property(PROPERTY optimization_size_aggressive)
17
18set_compiler_property(PROPERTY optimization_fast)
19
20#######################################################
21# This section covers flags related to warning levels #
22#######################################################
23
24# Property for standard warning base in Zephyr, this will always bet set when compiling.
25set_compiler_property(PROPERTY warning_base)
26
27# GCC options for warning levels 1, 2, 3, when using `-DW=[1|2|3]`
28# Property for warning levels 1, 2, 3 in Zephyr when using `-DW=[1|2|3]`
29set_compiler_property(PROPERTY warning_dw_1)
30
31set_compiler_property(PROPERTY warning_dw_2)
32
33set_compiler_property(PROPERTY warning_dw_3)
34
35# Extended warning set supported by the compiler
36set_compiler_property(PROPERTY warning_extended)
37
38# Compiler property that will issue error if a declaration does not specify a type
39set_compiler_property(PROPERTY warning_error_implicit_int)
40
41# Compiler flags to use when compiling according to MISRA
42set_compiler_property(PROPERTY warning_error_misra_sane)
43
44###########################################################################
45# This section covers flags related to C or C++ standards / standard libs #
46###########################################################################
47
48# Compiler flags for C standard. The specific standard must be appended by user.
49# For example, gcc specifies this as: set_compiler_property(PROPERTY cstd -std=)
50set_compiler_property(PROPERTY cstd)
51
52# Compiler flags for disabling C standard include and instead specify include
53# dirs in nostdinc_include to use.
54set_compiler_property(PROPERTY nostdinc)
55set_compiler_property(PROPERTY nostdinc_include)
56
57# Compiler flags for disabling C++ standard include.
58set_property(TARGET compiler-cpp PROPERTY nostdincxx)
59
60# Required C++ flags when compiling C++ code
61set_property(TARGET compiler-cpp PROPERTY required)
62
63# Compiler flags to use for specific C++ dialects
64set_property(TARGET compiler-cpp PROPERTY dialect_cpp98)
65set_property(TARGET compiler-cpp PROPERTY dialect_cpp11)
66set_property(TARGET compiler-cpp PROPERTY dialect_cpp14)
67set_property(TARGET compiler-cpp PROPERTY dialect_cpp17)
68set_property(TARGET compiler-cpp PROPERTY dialect_cpp2a)
69set_property(TARGET compiler-cpp PROPERTY dialect_cpp20)
70set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b)
71
72# Flag for disabling strict aliasing rule in C and C++
73set_compiler_property(PROPERTY no_strict_aliasing)
74
75# Extra warnings options for twister run
76set_property(TARGET compiler PROPERTY warnings_as_errors)
77set_property(TARGET asm PROPERTY warnings_as_errors)
78
79# Flag for disabling exceptions in C++
80set_property(TARGET compiler-cpp PROPERTY no_exceptions)
81
82# Flag for disabling rtti in C++
83set_property(TARGET compiler-cpp PROPERTY no_rtti)
84
85# Flag for disabling optimizations around printf return value
86set_compiler_property(PROPERTY no_printf_return_value)
87
88###################################################
89# This section covers all remaining C / C++ flags #
90###################################################
91
92# Flags for coverage generation
93set_compiler_property(PROPERTY coverage)
94
95# Security canaries flags.
96set_compiler_property(PROPERTY security_canaries)
97set_compiler_property(PROPERTY security_canaries_strong)
98set_compiler_property(PROPERTY security_canaries_all)
99set_compiler_property(PROPERTY security_canaries_explicit)
100
101set_compiler_property(PROPERTY security_fortify_compile_time)
102set_compiler_property(PROPERTY security_fortify_run_time)
103
104# Flag for a hosted (no-freestanding) application
105set_compiler_property(PROPERTY hosted)
106
107# gcc flag for a freestanding application
108set_compiler_property(PROPERTY freestanding)
109
110# Flag to include debugging symbol in compilation
111set_compiler_property(PROPERTY debug)
112
113# Flags to save temporary object files
114set_compiler_property(PROPERTY save_temps)
115
116# Flag to specify linker script
117set_compiler_property(PROPERTY linker_script)
118
119set_compiler_property(PROPERTY no_common)
120
121# Flags for imacros. The specific header must be appended by user.
122set_compiler_property(PROPERTY imacros)
123
124# Compiler flag for turning off thread-safe initialization of local statics
125set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics)
126
127# Required ASM flags when compiling
128set_property(TARGET asm PROPERTY required)
129
130# GCC compiler flags for imacros. The specific header must be appended by user.
131set_property(TARGET asm PROPERTY imacros)
132
133# Compiler flag for disabling pointer arithmetic warnings
134set_compiler_property(PROPERTY warning_no_pointer_arithmetic)
135
136# Compiler flags for disabling position independent code / executable
137set_compiler_property(PROPERTY no_position_independent)
138
139# Compiler flag to avoid combine more than one global variable into a single aggregate.
140# gen_kobject_list.py is does not understand it and end up identifying objects as if
141# they had the same address.
142set_compiler_property(PROPERTY no_global_merge)
143
144# Compiler flag for warning about shadow variables
145set_compiler_property(PROPERTY warning_shadow_variables)
146# Compiler flag for disabling warning about array bounds
147set_compiler_property(PROPERTY warning_no_array_bounds)
148
149# Compiler flags to avoid recognizing built-in functions
150set_compiler_property(PROPERTY no_builtin)
151set_compiler_property(PROPERTY no_builtin_malloc)
152
153# Compiler flag for defining specs. Used only by gcc, other compilers may keep
154# this undefined.
155set_compiler_property(PROPERTY specs)
156
157# Compiler flag for defining preinclude files.
158set_compiler_property(PROPERTY include_file)
159
160# Compiler flag for trustzone
161set_compiler_property(PROPERTY cmse)
162
163set_property(TARGET asm PROPERTY cmse)
164