Branch data Line data Source code
1 : : /* Copyright (C) 2001-2024 Free Software Foundation, Inc.
2 : : Contributed by Joseph Myers <jsm28@cam.ac.uk>.
3 : :
4 : : This file is part of GCC.
5 : :
6 : : GCC is free software; you can redistribute it and/or modify it under
7 : : the terms of the GNU General Public License as published by the Free
8 : : Software Foundation; either version 3, or (at your option) any later
9 : : version.
10 : :
11 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : : for more details.
15 : :
16 : : You should have received a copy of the GNU General Public License
17 : : along with GCC; see the file COPYING3. If not see
18 : : <http://www.gnu.org/licenses/>. */
19 : :
20 : : /* This header provides a declarative way of describing the attributes
21 : : that are applied to some built-in functions by default. Attributes
22 : : that are meant to be used by user-defined functions but aren't used
23 : : by any built-ins, or attributes that apply to types or variables
24 : : but not to functions need not and should not be defined here.
25 : :
26 : : Before including this header, you must define the following macros.
27 : : In each case where there is an ENUM, it is an identifier used to
28 : : reference the tree in subsequent definitions.
29 : :
30 : : DEF_ATTR_NULL_TREE (ENUM)
31 : :
32 : : Constructs a NULL_TREE.
33 : :
34 : : DEF_ATTR_INT (ENUM, VALUE)
35 : :
36 : : Constructs an INTEGER_CST with value VALUE (an integer representable
37 : : in HOST_WIDE_INT).
38 : :
39 : : DEF_ATTR_IDENT (ENUM, STRING)
40 : :
41 : : Constructs an IDENTIFIER_NODE for STRING.
42 : :
43 : : DEF_ATTR_TREE_LIST (ENUM, PURPOSE, VALUE, CHAIN)
44 : :
45 : : Constructs a TREE_LIST with given PURPOSE, VALUE and CHAIN (given
46 : : as previous ENUM names). */
47 : :
48 : 226773 : DEF_ATTR_NULL_TREE (ATTR_NULL)
49 : :
50 : : /* Construct a tree for a given integer and a list containing it. */
51 : : #define DEF_ATTR_FOR_INT(VALUE) \
52 : : DEF_ATTR_INT (ATTR_##VALUE, VALUE) \
53 : : DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE, ATTR_NULL, \
54 : : ATTR_##VALUE, ATTR_NULL)
55 : 226773 : DEF_ATTR_FOR_INT (0)
56 : 226773 : DEF_ATTR_FOR_INT (1)
57 : 226773 : DEF_ATTR_FOR_INT (2)
58 : 226773 : DEF_ATTR_FOR_INT (3)
59 : 226773 : DEF_ATTR_FOR_INT (4)
60 : 226773 : DEF_ATTR_FOR_INT (5)
61 : 226773 : DEF_ATTR_FOR_INT (6)
62 : : #undef DEF_ATTR_FOR_INT
63 : :
64 : : /* Construct a tree for a given string and a list containing it. */
65 : : #define DEF_ATTR_FOR_STRING(ENUM, VALUE) \
66 : : DEF_ATTR_STRING (ATTR_##ENUM, VALUE) \
67 : : DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL, \
68 : : ATTR_##ENUM, ATTR_NULL)
69 : 226773 : DEF_ATTR_FOR_STRING (STR1, "1 ")
70 : 226773 : DEF_ATTR_FOR_STRING (STRERRNOC, ".C")
71 : 226773 : DEF_ATTR_FOR_STRING (STRERRNOP, ".P")
72 : : #undef DEF_ATTR_FOR_STRING
73 : :
74 : : /* Construct a tree for a list of two integers. */
75 : : #define DEF_LIST_INT_INT(VALUE1, VALUE2) \
76 : : DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE1##_##VALUE2, ATTR_NULL, \
77 : : ATTR_##VALUE1, ATTR_LIST_##VALUE2)
78 : 226773 : DEF_LIST_INT_INT (1,0)
79 : 226773 : DEF_LIST_INT_INT (1,2)
80 : 226773 : DEF_LIST_INT_INT (1,3)
81 : 226773 : DEF_LIST_INT_INT (1,4)
82 : 226773 : DEF_LIST_INT_INT (1,5)
83 : 226773 : DEF_LIST_INT_INT (2,0)
84 : 226773 : DEF_LIST_INT_INT (2,3)
85 : 226773 : DEF_LIST_INT_INT (3,0)
86 : 226773 : DEF_LIST_INT_INT (3,4)
87 : 226773 : DEF_LIST_INT_INT (4,0)
88 : 226773 : DEF_LIST_INT_INT (4,5)
89 : 226773 : DEF_LIST_INT_INT (5,0)
90 : 226773 : DEF_LIST_INT_INT (5,6)
91 : : #undef DEF_LIST_INT_INT
92 : :
93 : : /* Construct trees for identifiers used in built-in function attributes.
94 : : The construction contributes to startup costs so only attributes that
95 : : are used to define built-ins should be defined here. */
96 : 226773 : DEF_ATTR_IDENT (ATTR_ALLOC_SIZE, "alloc_size")
97 : 227916 : DEF_ATTR_IDENT (ATTR_COLD, "cold")
98 : 227916 : DEF_ATTR_IDENT (ATTR_CONST, "const")
99 : 226773 : DEF_ATTR_IDENT (ATTR_FORMAT, "format")
100 : 226773 : DEF_ATTR_IDENT (ATTR_FORMAT_ARG, "format_arg")
101 : 226773 : DEF_ATTR_IDENT (ATTR_MALLOC, "malloc")
102 : 226818 : DEF_ATTR_IDENT (ATTR_NONNULL, "nonnull")
103 : 227916 : DEF_ATTR_IDENT (ATTR_NORETURN, "noreturn")
104 : 227916 : DEF_ATTR_IDENT (ATTR_NOTHROW, "nothrow")
105 : 227916 : DEF_ATTR_IDENT (ATTR_LEAF, "leaf")
106 : 226773 : DEF_ATTR_IDENT (ATTR_FNSPEC, "fn spec")
107 : 226773 : DEF_ATTR_IDENT (ATTR_PRINTF, "printf")
108 : 226773 : DEF_ATTR_IDENT (ATTR_ASM_FPRINTF, "asm_fprintf")
109 : 226773 : DEF_ATTR_IDENT (ATTR_GCC_DIAG, "gcc_diag")
110 : 226773 : DEF_ATTR_IDENT (ATTR_GCC_CDIAG, "gcc_cdiag")
111 : 226773 : DEF_ATTR_IDENT (ATTR_GCC_CXXDIAG, "gcc_cxxdiag")
112 : 226788 : DEF_ATTR_IDENT (ATTR_PURE, "pure")
113 : 226773 : DEF_ATTR_IDENT (ATTR_NOVOPS, "no vops")
114 : 226773 : DEF_ATTR_IDENT (ATTR_SCANF, "scanf")
115 : 226773 : DEF_ATTR_IDENT (ATTR_SENTINEL, "sentinel")
116 : 226773 : DEF_ATTR_IDENT (ATTR_STRFMON, "strfmon")
117 : 226773 : DEF_ATTR_IDENT (ATTR_STRFTIME, "strftime")
118 : 226788 : DEF_ATTR_IDENT (ATTR_TYPEGENERIC, "type generic")
119 : 226773 : DEF_ATTR_IDENT (ATTR_TM_REGPARM, "*tm regparm")
120 : 226773 : DEF_ATTR_IDENT (ATTR_TM_TMPURE, "transaction_pure")
121 : 226773 : DEF_ATTR_IDENT (ATTR_RETURNS_TWICE, "returns_twice")
122 : 226773 : DEF_ATTR_IDENT (ATTR_RETURNS_NONNULL, "returns_nonnull")
123 : 226773 : DEF_ATTR_IDENT (ATTR_WARN_UNUSED_RESULT, "warn_unused_result")
124 : :
125 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LIST, ATTR_NOVOPS, ATTR_NULL, ATTR_NULL)
126 : :
127 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOVOPS_LIST)
128 : :
129 : 226773 : DEF_ATTR_TREE_LIST (ATTR_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NULL)
130 : :
131 : 227916 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LIST, ATTR_NOTHROW, ATTR_NULL, ATTR_NULL)
132 : :
133 : 227916 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_LIST)
134 : :
135 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOVOPS_NOTHROW_LEAF_LIST, ATTR_NOVOPS, \
136 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
137 : 226773 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LIST, ATTR_CONST, \
138 : : ATTR_NULL, ATTR_NOTHROW_LIST)
139 : 227916 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_CONST, \
140 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
141 : 226773 : DEF_ATTR_TREE_LIST (ATTR_ERRNOCONST_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
142 : : ATTR_LIST_STRERRNOC, ATTR_NOTHROW_LEAF_LIST)
143 : 226773 : DEF_ATTR_TREE_LIST (ATTR_ERRNOPURE_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
144 : : ATTR_LIST_STRERRNOP, ATTR_NOTHROW_LEAF_LIST)
145 : 226773 : DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LIST, ATTR_PURE, \
146 : : ATTR_NULL, ATTR_NOTHROW_LIST)
147 : 226773 : DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LEAF_LIST, ATTR_PURE, \
148 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
149 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LIST, ATTR_NORETURN, \
150 : : ATTR_NULL, ATTR_NOTHROW_LIST)
151 : 227916 : DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_LIST, ATTR_NORETURN,\
152 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
153 : 227916 : DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
154 : : ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
155 : 226773 : DEF_ATTR_TREE_LIST (ATTR_RT_NOTHROW_LEAF_LIST, ATTR_RETURNS_TWICE,\
156 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
157 : 226773 : DEF_ATTR_TREE_LIST (ATTR_COLD_NOTHROW_LEAF_LIST, ATTR_COLD,\
158 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
159 : 226773 : DEF_ATTR_TREE_LIST (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST, ATTR_COLD,\
160 : : ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
161 : 226778 : DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
162 : : ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
163 : 226778 : DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
164 : : ATTR_NULL, ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST)
165 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LIST, ATTR_MALLOC, \
166 : : ATTR_NULL, ATTR_NOTHROW_LIST)
167 : 226773 : DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST, ATTR_WARN_UNUSED_RESULT, \
168 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
169 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST, ATTR_MALLOC, \
170 : : ATTR_NULL, ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
171 : 226773 : DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
172 : : ATTR_NULL, ATTR_NOTHROW_LIST)
173 : 226773 : DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_SENTINEL, \
174 : : ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
175 : 226773 : DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
176 : : ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
177 : :
178 : : /* Allocation functions like malloc and realloc whose first argument
179 : : with _SIZE_1, or second argument with _SIZE_2, specifies the size
180 : : of the allocated object. */
181 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
182 : : ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LIST)
183 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LIST, ATTR_WARN_UNUSED_RESULT, \
184 : : ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
185 : 226773 : DEF_ATTR_TREE_LIST (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
186 : : ATTR_LIST_2, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LIST)
187 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
188 : : ATTR_LIST_1, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
189 : : /* Alloca is just like malloc except that it never returns null. */
190 : 226773 : DEF_ATTR_TREE_LIST (ATTR_ALLOCA_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST, ATTR_RETURNS_NONNULL,
191 : : ATTR_NULL, ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_NOTHROW_LEAF_LIST)
192 : :
193 : : /* Allocation functions like calloc the product of whose first two arguments
194 : : specifies the size of the allocated object. */
195 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
196 : : ATTR_LIST_1_2, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
197 : :
198 : : /* Allocation functions like realloc whose second argument specifies
199 : : the size of the allocated object. */
200 : 226773 : DEF_ATTR_TREE_LIST (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
201 : : ATTR_LIST_2, ATTR_WARN_UNUSED_RESULT_NOTHROW_LEAF_LIST)
202 : :
203 : : /* Functions whose pointer parameter(s) are all nonnull. */
204 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
205 : : /* Functions whose first parameter is a nonnull pointer. */
206 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
207 : : /* Functions whose second parameter is a nonnull pointer. */
208 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
209 : : /* Functions whose third parameter is a nonnull pointer. */
210 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, ATTR_NULL)
211 : : /* Nothrow functions with the sentinel(1) attribute. */
212 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
213 : : ATTR_NOTHROW_LIST)
214 : : /* Nothrow functions whose pointer parameter(s) are all nonnull. */
215 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \
216 : : ATTR_NOTHROW_LIST)
217 : : /* Nothrow leaf functions whose pointer parameter(s) are all nonnull. */
218 : 226818 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF, ATTR_NONNULL, ATTR_NULL, \
219 : : ATTR_NOTHROW_LEAF_LIST)
220 : 226788 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_NONNULL_LEAF)
221 : : /* Nothrow functions whose first parameter is a nonnull pointer. */
222 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \
223 : : ATTR_NOTHROW_LIST)
224 : : /* Nothrow functions whose second parameter is a nonnull pointer. */
225 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, \
226 : : ATTR_NOTHROW_LIST)
227 : : /* Nothrow functions whose third parameter is a nonnull pointer. */
228 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
229 : : ATTR_NOTHROW_LIST)
230 : : /* Nothrow functions whose fourth parameter is a nonnull pointer. */
231 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_4, ATTR_NONNULL, ATTR_LIST_4, \
232 : : ATTR_NOTHROW_LIST)
233 : : /* Nothrow functions whose fifth parameter is a nonnull pointer. */
234 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_5, ATTR_NONNULL, ATTR_LIST_5, \
235 : : ATTR_NOTHROW_LIST)
236 : :
237 : : /* Same as ATTR_NONNULL_1. */
238 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
239 : : /* Functions like {v,}fprintf whose first and second parameters are
240 : : nonnull pointers. As cancellation points the functions are not
241 : : nothrow. */
242 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, ATTR_NULL)
243 : : /* The following don't have {v,}fprintf forms. They exist only to
244 : : make it possible to declare {v,}{f,s}printf attributes using
245 : : the same macro. */
246 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, ATTR_NULL)
247 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, ATTR_NULL)
248 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, ATTR_NULL)
249 : :
250 : : /* Same as ATTR_NOTHROW_NONNULL_1. */
251 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1,
252 : : ATTR_NOTHROW_LIST)
253 : : /* Nothrow functions like {v,}sprintf whose first and second parameters
254 : : are nonnull pointers. */
255 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, \
256 : : ATTR_NOTHROW_LIST)
257 : : /* Nothrow functions like {v,}snprintf whose first and third parameters
258 : : are nonnull pointers. */
259 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, \
260 : : ATTR_NOTHROW_LIST)
261 : : /* Nothrow functions like {v,}sprintf_chk whose first and fourth parameters
262 : : are nonnull pointers. */
263 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, \
264 : : ATTR_NOTHROW_LIST)
265 : : /* Nothrow functions like {v,}snprintf_chk whose first and fifth parameters
266 : : are nonnull pointers. */
267 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, \
268 : : ATTR_NOTHROW_LIST)
269 : :
270 : : /* Nothrow leaf functions which are type-generic. */
271 : 226773 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
272 : : ATTR_NOTHROW_LEAF_LIST)
273 : : /* Nothrow nonnull leaf functions that are type-generic. */
274 : 226788 : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF,
275 : : ATTR_TYPEGENERIC, ATTR_NULL,
276 : : ATTR_NOTHROW_NONNULL_LEAF)
277 : : /* Nothrow const functions whose pointer parameter(s) are all nonnull. */
278 : 226773 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \
279 : : ATTR_NOTHROW_NONNULL)
280 : : /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
281 : : and which return their first argument. */
282 : 226773 : DEF_ATTR_TREE_LIST (ATTR_RET1_NOTHROW_NONNULL_LEAF, ATTR_FNSPEC, ATTR_LIST_STR1, \
283 : : ATTR_NOTHROW_NONNULL_LEAF)
284 : : /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
285 : : and return value is also nonnull. */
286 : 226773 : DEF_ATTR_TREE_LIST (ATTR_RETNONNULL_NOTHROW_LEAF, ATTR_RETURNS_NONNULL, ATTR_NULL, \
287 : : ATTR_NOTHROW_NONNULL_LEAF)
288 : : /* Nothrow const leaf functions whose pointer parameter(s) are all nonnull. */
289 : 226773 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL_LEAF, ATTR_CONST, ATTR_NULL, \
290 : : ATTR_NOTHROW_NONNULL_LEAF)
291 : : /* Nothrow const functions which are type-generic. */
292 : 226773 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC, ATTR_TYPEGENERIC, ATTR_NULL, \
293 : : ATTR_CONST_NOTHROW_LIST)
294 : : /* Nothrow const leaf functions which are type-generic. */
295 : 226773 : DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
296 : : ATTR_CONST_NOTHROW_LEAF_LIST)
297 : : /* Nothrow pure functions whose pointer parameter(s) are all nonnull. */
298 : 226773 : DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL, ATTR_PURE, ATTR_NULL, \
299 : : ATTR_NOTHROW_NONNULL)
300 : : /* Nothrow pure leaf functions whose pointer parameter(s) are all nonnull. */
301 : 226788 : DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL_LEAF, ATTR_PURE, ATTR_NULL, \
302 : : ATTR_NOTHROW_NONNULL_LEAF)
303 : : /* Nothrow malloc functions whose pointer parameter(s) are all nonnull. */
304 : 226773 : DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL, ATTR_WARN_UNUSED_RESULT, ATTR_NULL, \
305 : : ATTR_NOTHROW_NONNULL)
306 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL, ATTR_MALLOC, ATTR_NULL, \
307 : : ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL)
308 : : /* Nothrow malloc leaf functions whose pointer parameter(s) are all nonnull. */
309 : 226773 : DEF_ATTR_TREE_LIST (ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF, ATTR_WARN_UNUSED_RESULT, ATTR_NULL, \
310 : : ATTR_NOTHROW_NONNULL_LEAF)
311 : 226773 : DEF_ATTR_TREE_LIST (ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF, ATTR_MALLOC, ATTR_NULL, \
312 : : ATTR_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
313 : :
314 : : /* Construct a tree for the format attribute (and implicitly nonnull). */
315 : : #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES) \
316 : : DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
317 : : ATTR_##TYPE, ATTR_LIST_##VALUES) \
318 : : DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
319 : : ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA)
320 : :
321 : : /* Construct a tree for the format and nothrow attributes (format
322 : : implies nonnull). */
323 : : #define DEF_FORMAT_ATTRIBUTE_NOTHROW(TYPE, FA, VALUES) \
324 : : DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
325 : : ATTR_##TYPE, ATTR_LIST_##VALUES) \
326 : : DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
327 : : ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
328 : :
329 : : /* Construct one tree for the format attribute and another for the format
330 : : and nothrow attributes (in both cases format implies nonnull). */
331 : : #define DEF_FORMAT_ATTRIBUTE_BOTH(TYPE, FA, VALUES) \
332 : : DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
333 : : ATTR_##TYPE, ATTR_LIST_##VALUES) \
334 : : DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
335 : : ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA) \
336 : : DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
337 : : ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
338 : :
339 : : /* Construct a pair of trees for the nonnull attribute for the first
340 : : argument, plus format printf attribute (format implies nonnull):
341 : : the first ordinary and the second nothrow. */
342 : : #define DEF_FORMAT_ATTRIBUTE_NONNULL(TYPE, FA, VALUES) \
343 : : DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
344 : : ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
345 : : ATTR_NONNULL_1_##FA) \
346 : : DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
347 : : ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
348 : : ATTR_NOTHROW_NONNULL_1_##FA)
349 : :
350 : 226773 : DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
351 : 226773 : DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
352 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_0)
353 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_3)
354 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_0)
355 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_4)
356 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_0)
357 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_5)
358 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_0)
359 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_6)
360 : :
361 : : /* Attributes for fprintf(f, f, va). */
362 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,1,1_2)
363 : : /* Attributes for v{f,s}printf(d, f, va). vsprintf is nothrow, vfprintf
364 : : is not. */
365 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_0)
366 : : /* Attributes for {f,s}printf(d, f, ...). sprintf is nothrow, fprintf
367 : : is not. */
368 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_3)
369 : : /* Attributes for vprintf_chk. */
370 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_0)
371 : : /* Attributes for printf_chk. */
372 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_4)
373 : : /* Attributes for v{f,s}printf_chk(d, t, bos, f, va). vsprintf_chk is
374 : : nothrow, vfprintf_chk is not. */
375 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_0)
376 : : /* Attributes for {f,s}printf_chk(d, t, bos, f, ...). sprintf_chk is
377 : : nothrow, fprintf_chk is not. */
378 : 226773 : DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_5)
379 : :
380 : 226773 : DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
381 : 226773 : DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
382 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_0)
383 : 226773 : DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_3)
384 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFTIME,3,3_0)
385 : 226773 : DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFMON,3,3_4)
386 : : #undef DEF_FORMAT_ATTRIBUTE
387 : : #undef DEF_FORMAT_ATTRIBUTE_NOTHROW
388 : : #undef DEF_FORMAT_ATTRIBUTE_BOTH
389 : :
390 : : /* Transactional memory variants of the above. */
391 : :
392 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_LIST,
393 : : ATTR_TM_REGPARM, ATTR_NULL, ATTR_NOTHROW_LIST)
394 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_TMPURE_NOTHROW_LIST,
395 : : ATTR_TM_TMPURE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
396 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_PURE_TMPURE_NOTHROW_LIST,
397 : : ATTR_PURE, ATTR_NULL, ATTR_TM_TMPURE_NOTHROW_LIST)
398 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_NORETURN_NOTHROW_LIST,
399 : : ATTR_TM_REGPARM, ATTR_NULL, ATTR_NORETURN_NOTHROW_LIST)
400 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_CONST_NOTHROW_LIST,
401 : : ATTR_TM_REGPARM, ATTR_NULL, ATTR_CONST_NOTHROW_LIST)
402 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_RT_LIST,
403 : : ATTR_RETURNS_TWICE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
404 : :
405 : : /* Same attributes used for BUILT_IN_MALLOC except with TM_PURE thrown in. */
406 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TMPURE_MALLOC_NOTHROW_LIST,
407 : : ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
408 : : /* Same attributes used for BUILT_IN_FREE except with TM_PURE thrown in. */
409 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LIST,
410 : : ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LIST)
411 : :
412 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LEAF_LIST,
413 : : ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
414 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST,
415 : : ATTR_TM_TMPURE, ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
416 : 226773 : DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_COLD_LIST,
417 : : ATTR_COLD, ATTR_NULL,
418 : : ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
419 : :
420 : : /* Construct a tree for a format_arg attribute. */
421 : : #define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
422 : : DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \
423 : : ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
424 : 226773 : DEF_FORMAT_ARG_ATTRIBUTE(1)
425 : 226773 : DEF_FORMAT_ARG_ATTRIBUTE(2)
426 : : #undef DEF_FORMAT_ARG_ATTRIBUTE
427 : :
|