1 /*
2  * Copyright (c) 2025 Google, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_TESTSUITE_INCLUDE_TEST_TOOLCHAIN_H_
8 #define ZEPHYR_TESTSUITE_INCLUDE_TEST_TOOLCHAIN_H_
9 
10 #include <zephyr/toolchain.h>
11 
12 #if defined(__llvm__) || (defined(_LINKER) && defined(__LLD_LINKER_CMD__))
13 #include <zephyr/test_toolchain/llvm.h>
14 #elif defined(__GNUC__) || (defined(_LINKER) && defined(__GCC_LINKER_CMD__))
15 #include <zephyr/test_toolchain/gcc.h>
16 #endif
17 
18 /**
19  * @def TOOLCHAIN_WARNING_ALLOC_SIZE_LARGER_THAN
20  * @brief Toolchain-specific warning for allocations larger than a given size.
21  *
22  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
23  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
24  */
25 #ifndef TOOLCHAIN_WARNING_ALLOC_SIZE_LARGER_THAN
26 #define TOOLCHAIN_WARNING_ALLOC_SIZE_LARGER_THAN
27 #endif
28 
29 /**
30  * @def TOOLCHAIN_WARNING_DANGLING_POINTER
31  * @brief Toolchain-specific warning for dangling pointers.
32  *
33  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
34  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
35  */
36 #ifndef TOOLCHAIN_WARNING_DANGLING_POINTER
37 #define TOOLCHAIN_WARNING_DANGLING_POINTER
38 #endif
39 
40 /**
41  * @def TOOLCHAIN_WARNING_FORMAT_TRUNCATION
42  * @brief Toolchain-specific warning for format truncation.
43  *
44  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
45  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
46  */
47 #ifndef TOOLCHAIN_WARNING_FORMAT_TRUNCATION
48 #define TOOLCHAIN_WARNING_FORMAT_TRUNCATION
49 #endif
50 
51 /**
52  * @def TOOLCHAIN_WARNING_INFINITE_RECURSION
53  * @brief Toolchain-specific warning for infinite recursion.
54  *
55  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
56  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
57  */
58 #ifndef TOOLCHAIN_WARNING_INFINITE_RECURSION
59 #define TOOLCHAIN_WARNING_INFINITE_RECURSION
60 #endif
61 
62 /**
63  * @def TOOLCHAIN_WARNING_INTEGER_OVERFLOW
64  * @brief Toolchain-specific warning for integer overflow.
65  *
66  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
67  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
68  */
69 #ifndef TOOLCHAIN_WARNING_INTEGER_OVERFLOW
70 #define TOOLCHAIN_WARNING_INTEGER_OVERFLOW
71 #endif
72 
73 /**
74  * @def TOOLCHAIN_WARNING_OVERFLOW
75  * @brief Toolchain-specific warning for integer overflow.
76  *
77  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
78  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
79  */
80 #ifndef TOOLCHAIN_WARNING_OVERFLOW
81 #define TOOLCHAIN_WARNING_OVERFLOW
82 #endif
83 
84 /**
85  * @def TOOLCHAIN_WARNING_PRAGMAS
86  * @brief Toolchain-specific warning for unknown pragmas.
87  *
88  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
89  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
90  */
91 #ifndef TOOLCHAIN_WARNING_PRAGMAS
92 #define TOOLCHAIN_WARNING_PRAGMAS
93 #endif
94 
95 /**
96  * @def TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY
97  * @brief Toolchain-specific warning for sizeof array decay.
98  *
99  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
100  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
101  */
102 #ifndef TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY
103 #define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY
104 #endif
105 
106 /**
107  * @def TOOLCHAIN_WARNING_STRINGOP_OVERFLOW
108  * @brief Toolchain-specific warning for stringop overflow.
109  *
110  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
111  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
112  */
113 #ifndef TOOLCHAIN_WARNING_STRINGOP_OVERFLOW
114 #define TOOLCHAIN_WARNING_STRINGOP_OVERFLOW
115 #endif
116 
117 /**
118  * @def TOOLCHAIN_WARNING_STRINGOP_TRUNCATION
119  * @brief Toolchain-specific warning for stringop truncation.
120  *
121  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
122  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
123  */
124 #ifndef TOOLCHAIN_WARNING_STRINGOP_TRUNCATION
125 #define TOOLCHAIN_WARNING_STRINGOP_TRUNCATION
126 #endif
127 
128 /**
129  * @def TOOLCHAIN_WARNING_UNUSED_FUNCTION
130  * @brief Toolchain-specific warning for unused function.
131  *
132  * Use this as an argument to the @ref TOOLCHAIN_DISABLE_WARNING and
133  * @ref TOOLCHAIN_ENABLE_WARNING family of macros.
134  */
135 #ifndef TOOLCHAIN_WARNING_UNUSED_FUNCTION
136 #define TOOLCHAIN_WARNING_UNUSED_FUNCTION
137 #endif
138 
139 #endif
140