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