libgo: add misc/cgo files
[official-gcc.git] / gcc / builtin-attrs.def
blob53e67e62844af99fa5f8460e771277b286294119
1 /* Copyright (C) 2001-2017 Free Software Foundation, Inc.
2 Contributed by Joseph Myers <jsm28@cam.ac.uk>.
4 This file is part of GCC.
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.
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.
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/>. */
20 /* This header provides a declarative way of describing the attributes
21 that are applied to some functions by default.
23 Before including this header, you must define the following macros.
24 In each case where there is an ENUM, it is an identifier used to
25 reference the tree in subsequent definitions.
27 DEF_ATTR_NULL_TREE (ENUM)
29 Constructs a NULL_TREE.
31 DEF_ATTR_INT (ENUM, VALUE)
33 Constructs an INTEGER_CST with value VALUE (an integer representable
34 in HOST_WIDE_INT).
36 DEF_ATTR_IDENT (ENUM, STRING)
38 Constructs an IDENTIFIER_NODE for STRING.
40 DEF_ATTR_TREE_LIST (ENUM, PURPOSE, VALUE, CHAIN)
42 Constructs a TREE_LIST with given PURPOSE, VALUE and CHAIN (given
43 as previous ENUM names). */
45 DEF_ATTR_NULL_TREE (ATTR_NULL)
47 /* Construct a tree for a given integer and a list containing it. */
48 #define DEF_ATTR_FOR_INT(VALUE) \
49 DEF_ATTR_INT (ATTR_##VALUE, VALUE) \
50 DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE, ATTR_NULL, \
51 ATTR_##VALUE, ATTR_NULL)
52 DEF_ATTR_FOR_INT (0)
53 DEF_ATTR_FOR_INT (1)
54 DEF_ATTR_FOR_INT (2)
55 DEF_ATTR_FOR_INT (3)
56 DEF_ATTR_FOR_INT (4)
57 DEF_ATTR_FOR_INT (5)
58 DEF_ATTR_FOR_INT (6)
59 #undef DEF_ATTR_FOR_INT
61 /* Construct a tree for a given string and a list containing it. */
62 #define DEF_ATTR_FOR_STRING(ENUM, VALUE) \
63 DEF_ATTR_STRING (ATTR_##ENUM, VALUE) \
64 DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL, \
65 ATTR_##ENUM, ATTR_NULL)
66 DEF_ATTR_FOR_STRING (STR1, "1")
67 #undef DEF_ATTR_FOR_STRING
69 /* Construct a tree for a list of two integers. */
70 #define DEF_LIST_INT_INT(VALUE1, VALUE2) \
71 DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE1##_##VALUE2, ATTR_NULL, \
72 ATTR_##VALUE1, ATTR_LIST_##VALUE2)
73 DEF_LIST_INT_INT (1,0)
74 DEF_LIST_INT_INT (1,2)
75 DEF_LIST_INT_INT (1,3)
76 DEF_LIST_INT_INT (1,4)
77 DEF_LIST_INT_INT (1,5)
78 DEF_LIST_INT_INT (2,0)
79 DEF_LIST_INT_INT (2,3)
80 DEF_LIST_INT_INT (3,0)
81 DEF_LIST_INT_INT (3,4)
82 DEF_LIST_INT_INT (4,0)
83 DEF_LIST_INT_INT (4,5)
84 DEF_LIST_INT_INT (5,0)
85 DEF_LIST_INT_INT (5,6)
86 #undef DEF_LIST_INT_INT
88 /* Construct trees for identifiers. */
89 DEF_ATTR_IDENT (ATTR_ALLOC_SIZE, "alloc_size")
90 DEF_ATTR_IDENT (ATTR_COLD, "cold")
91 DEF_ATTR_IDENT (ATTR_CONST, "const")
92 DEF_ATTR_IDENT (ATTR_FORMAT, "format")
93 DEF_ATTR_IDENT (ATTR_FORMAT_ARG, "format_arg")
94 DEF_ATTR_IDENT (ATTR_MALLOC, "malloc")
95 DEF_ATTR_IDENT (ATTR_NONNULL, "nonnull")
96 DEF_ATTR_IDENT (ATTR_NORETURN, "noreturn")
97 DEF_ATTR_IDENT (ATTR_NOTHROW, "nothrow")
98 DEF_ATTR_IDENT (ATTR_LEAF, "leaf")
99 DEF_ATTR_IDENT (ATTR_FNSPEC, "fn spec")
100 DEF_ATTR_IDENT (ATTR_PRINTF, "printf")
101 DEF_ATTR_IDENT (ATTR_ASM_FPRINTF, "asm_fprintf")
102 DEF_ATTR_IDENT (ATTR_GCC_DIAG, "gcc_diag")
103 DEF_ATTR_IDENT (ATTR_GCC_CDIAG, "gcc_cdiag")
104 DEF_ATTR_IDENT (ATTR_GCC_CXXDIAG, "gcc_cxxdiag")
105 DEF_ATTR_IDENT (ATTR_PURE, "pure")
106 DEF_ATTR_IDENT (ATTR_NOVOPS, "no vops")
107 DEF_ATTR_IDENT (ATTR_SCANF, "scanf")
108 DEF_ATTR_IDENT (ATTR_SENTINEL, "sentinel")
109 DEF_ATTR_IDENT (ATTR_STRFMON, "strfmon")
110 DEF_ATTR_IDENT (ATTR_STRFTIME, "strftime")
111 DEF_ATTR_IDENT (ATTR_TYPEGENERIC, "type generic")
112 DEF_ATTR_IDENT (ATTR_TM_REGPARM, "*tm regparm")
113 DEF_ATTR_IDENT (ATTR_TM_TMPURE, "transaction_pure")
114 DEF_ATTR_IDENT (ATTR_RETURNS_TWICE, "returns_twice")
115 DEF_ATTR_IDENT (ATTR_RETURNS_NONNULL, "returns_nonnull")
117 DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LIST, ATTR_NOVOPS, ATTR_NULL, ATTR_NULL)
119 DEF_ATTR_TREE_LIST (ATTR_NOVOPS_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOVOPS_LIST)
121 DEF_ATTR_TREE_LIST (ATTR_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NULL)
123 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LIST, ATTR_NOTHROW, ATTR_NULL, ATTR_NULL)
125 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_LIST)
127 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LIST, ATTR_CONST, \
128 ATTR_NULL, ATTR_NOTHROW_LIST)
129 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_CONST, \
130 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
131 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LIST, ATTR_PURE, \
132 ATTR_NULL, ATTR_NOTHROW_LIST)
133 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LEAF_LIST, ATTR_PURE, \
134 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
135 DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LIST, ATTR_NORETURN, \
136 ATTR_NULL, ATTR_NOTHROW_LIST)
137 DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_LIST, ATTR_NORETURN,\
138 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
139 DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
140 ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
141 DEF_ATTR_TREE_LIST (ATTR_RT_NOTHROW_LEAF_LIST, ATTR_RETURNS_TWICE,\
142 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
143 DEF_ATTR_TREE_LIST (ATTR_COLD_NOTHROW_LEAF_LIST, ATTR_COLD,\
144 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
145 DEF_ATTR_TREE_LIST (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST, ATTR_COLD,\
146 ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
147 DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
148 ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
149 DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_COLD_LIST, ATTR_COLD,\
150 ATTR_NULL, ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST)
151 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LIST, ATTR_MALLOC, \
152 ATTR_NULL, ATTR_NOTHROW_LIST)
153 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LEAF_LIST, ATTR_MALLOC, \
154 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
155 DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
156 ATTR_NULL, ATTR_NOTHROW_LIST)
157 DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_SENTINEL, \
158 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
159 DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
160 ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
162 /* Allocation functions like malloc and realloc whose first argument
163 with _SIZE_1, or second argument with _SIZE_2, specifies the size
164 of the allocated object. */
165 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
166 ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LIST)
167 DEF_ATTR_TREE_LIST (ATTR_ALLOC_SIZE_2_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
168 ATTR_LIST_2, ATTR_MALLOC_NOTHROW_LIST)
169 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
170 ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LEAF_LIST)
171 /* Alloca is just like malloc except that it never returns null. */
172 DEF_ATTR_TREE_LIST (ATTR_ALLOCA_SIZE_1_NOTHROW_LEAF_LIST, ATTR_RETURNS_NONNULL,
173 ATTR_NULL, ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST)
175 /* Allocation functions like calloc the product of whose first two arguments
176 specifies the size of the allocated object. */
177 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
178 ATTR_LIST_1_2, ATTR_MALLOC_NOTHROW_LEAF_LIST)
180 /* Allocation functions like realloc whose second argument specifies
181 the size of the allocated object. */
182 DEF_ATTR_TREE_LIST (ATTR_ALLOC_SIZE_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
183 ATTR_LIST_2, ATTR_NOTHROW_LEAF_LIST)
185 /* Functions whose pointer parameter(s) are all nonnull. */
186 DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
187 /* Functions whose first parameter is a nonnull pointer. */
188 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
189 /* Functions whose second parameter is a nonnull pointer. */
190 DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
191 /* Functions whose third parameter is a nonnull pointer. */
192 DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, ATTR_NULL)
193 /* Nothrow functions with the sentinel(1) attribute. */
194 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
195 ATTR_NOTHROW_LIST)
196 /* Nothrow functions whose pointer parameter(s) are all nonnull. */
197 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \
198 ATTR_NOTHROW_LIST)
199 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull. */
200 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF, ATTR_NONNULL, ATTR_NULL, \
201 ATTR_NOTHROW_LEAF_LIST)
202 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_NONNULL_LEAF)
203 /* Nothrow functions whose first parameter is a nonnull pointer. */
204 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \
205 ATTR_NOTHROW_LIST)
206 /* Nothrow functions whose second parameter is a nonnull pointer. */
207 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, \
208 ATTR_NOTHROW_LIST)
209 /* Nothrow functions whose third parameter is a nonnull pointer. */
210 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
211 ATTR_NOTHROW_LIST)
212 /* Nothrow functions whose fourth parameter is a nonnull pointer. */
213 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_4, ATTR_NONNULL, ATTR_LIST_4, \
214 ATTR_NOTHROW_LIST)
215 /* Nothrow functions whose fifth parameter is a nonnull pointer. */
216 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_5, ATTR_NONNULL, ATTR_LIST_5, \
217 ATTR_NOTHROW_LIST)
219 /* Same as ATTR_NONNULL_1. */
220 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
221 /* Functions like {v,}fprintf whose first and second parameters are
222 nonnull pointers. As cancellation points the functions are not
223 nothrow. */
224 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, ATTR_NULL)
225 /* The following don't have {v,}fprintf forms. They exist only to
226 make it possible to declare {v,}{f,s}printf attributes using
227 the same macro. */
228 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, ATTR_NULL)
229 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, ATTR_NULL)
230 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, ATTR_NULL)
232 /* Same as ATTR_NOTHROW_NONNULL_1. */
233 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1,
234 ATTR_NOTHROW_LIST)
235 /* Nothrow functions like {v,}sprintf whose first and second parameters
236 are nonnull pointers. */
237 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, \
238 ATTR_NOTHROW_LIST)
239 /* Nothrow functions like {v,}snprintf whose first and third parameters
240 are nonnull pointers. */
241 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, \
242 ATTR_NOTHROW_LIST)
243 /* Nothrow functions like {v,}sprintf_chk whose first and fourth parameters
244 are nonnull pointers. */
245 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, \
246 ATTR_NOTHROW_LIST)
247 /* Nothrow functions like {v,}snprintf_chk whose first and fifth parameters
248 are nonnull pointers. */
249 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, \
250 ATTR_NOTHROW_LIST)
252 /* Nothrow leaf functions which are type-generic. */
253 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
254 ATTR_NOTHROW_LEAF_LIST)
255 /* Nothrow nonnull leaf functions that are type-generic. */
256 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF,
257 ATTR_TYPEGENERIC, ATTR_NULL,
258 ATTR_NOTHROW_NONNULL_LEAF)
259 /* Nothrow const functions whose pointer parameter(s) are all nonnull. */
260 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \
261 ATTR_NOTHROW_NONNULL)
262 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
263 and which return their first argument. */
264 DEF_ATTR_TREE_LIST (ATTR_RET1_NOTHROW_NONNULL_LEAF, ATTR_FNSPEC, ATTR_LIST_STR1, \
265 ATTR_NOTHROW_NONNULL_LEAF)
266 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
267 and return value is also nonnull. */
268 DEF_ATTR_TREE_LIST (ATTR_RETNONNULL_NOTHROW_LEAF, ATTR_RETURNS_NONNULL, ATTR_NULL, \
269 ATTR_NOTHROW_NONNULL_LEAF)
270 /* Nothrow const leaf functions whose pointer parameter(s) are all nonnull. */
271 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL_LEAF, ATTR_CONST, ATTR_NULL, \
272 ATTR_NOTHROW_NONNULL_LEAF)
273 /* Nothrow const functions which are type-generic. */
274 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC, ATTR_TYPEGENERIC, ATTR_NULL, \
275 ATTR_CONST_NOTHROW_LIST)
276 /* Nothrow const leaf functions which are type-generic. */
277 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
278 ATTR_CONST_NOTHROW_LEAF_LIST)
279 /* Nothrow pure functions whose pointer parameter(s) are all nonnull. */
280 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL, ATTR_PURE, ATTR_NULL, \
281 ATTR_NOTHROW_NONNULL)
282 /* Nothrow pure leaf functions whose pointer parameter(s) are all nonnull. */
283 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL_LEAF, ATTR_PURE, ATTR_NULL, \
284 ATTR_NOTHROW_NONNULL_LEAF)
285 /* Nothrow malloc functions whose pointer parameter(s) are all nonnull. */
286 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_NONNULL, ATTR_MALLOC, ATTR_NULL, \
287 ATTR_NOTHROW_NONNULL)
288 /* Nothrow malloc leaf functions whose pointer parameter(s) are all nonnull. */
289 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_NONNULL_LEAF, ATTR_MALLOC, ATTR_NULL, \
290 ATTR_NOTHROW_NONNULL_LEAF)
292 /* Construct a tree for the format attribute (and implicitly nonnull). */
293 #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES) \
294 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
295 ATTR_##TYPE, ATTR_LIST_##VALUES) \
296 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
297 ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA)
299 /* Construct a tree for the format and nothrow attributes (format
300 implies nonnull). */
301 #define DEF_FORMAT_ATTRIBUTE_NOTHROW(TYPE, FA, VALUES) \
302 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
303 ATTR_##TYPE, ATTR_LIST_##VALUES) \
304 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
305 ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
307 /* Construct one tree for the format attribute and another for the format
308 and nothrow attributes (in both cases format implies nonnull). */
309 #define DEF_FORMAT_ATTRIBUTE_BOTH(TYPE, FA, VALUES) \
310 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
311 ATTR_##TYPE, ATTR_LIST_##VALUES) \
312 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
313 ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA) \
314 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
315 ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
317 /* Construct a pair of trees for the nonnull attribute for the first
318 argument, plus format printf attribute (format implies nonnull):
319 the first ordinary and the second nothrow. */
320 #define DEF_FORMAT_ATTRIBUTE_NONNULL(TYPE, FA, VALUES) \
321 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
322 ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
323 ATTR_NONNULL_1_##FA) \
324 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
325 ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
326 ATTR_NOTHROW_NONNULL_1_##FA)
328 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
329 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
330 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_0)
331 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_3)
332 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_0)
333 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_4)
334 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_0)
335 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_5)
336 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_0)
337 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_6)
339 /* Attributes for fprintf(f, f, va). */
340 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,1,1_2)
341 /* Attributes for v{f,s}printf(d, f, va). vsprintf is nothrow, vfprintf
342 is not. */
343 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_0)
344 /* Attributes for {f,s}printf(d, f, ...). sprintf is nothrow, fprintf
345 is not. */
346 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_3)
347 /* Attributes for vprintf_chk. */
348 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_0)
349 /* Attributes for printf_chk. */
350 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_4)
351 /* Attributes for v{f,s}printf_chk(d, t, bos, f, va). vsprintf_chk is
352 nothrow, vfprintf_chk is not. */
353 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_0)
354 /* Attributes for {f,s}printf_chk(d, t, bos, f, ...). sprintf_chk is
355 nothrow, fprintf_chk is not. */
356 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_5)
358 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
359 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
360 DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_0)
361 DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_3)
362 DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFTIME,3,3_0)
363 DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFMON,3,3_4)
364 #undef DEF_FORMAT_ATTRIBUTE
365 #undef DEF_FORMAT_ATTRIBUTE_NOTHROW
366 #undef DEF_FORMAT_ATTRIBUTE_BOTH
368 /* Transactional memory variants of the above. */
370 DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_LIST,
371 ATTR_TM_REGPARM, ATTR_NULL, ATTR_NOTHROW_LIST)
372 DEF_ATTR_TREE_LIST (ATTR_TM_TMPURE_NOTHROW_LIST,
373 ATTR_TM_TMPURE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
374 DEF_ATTR_TREE_LIST (ATTR_TM_PURE_TMPURE_NOTHROW_LIST,
375 ATTR_PURE, ATTR_NULL, ATTR_TM_TMPURE_NOTHROW_LIST)
376 DEF_ATTR_TREE_LIST (ATTR_TM_NORETURN_NOTHROW_LIST,
377 ATTR_TM_REGPARM, ATTR_NULL, ATTR_NORETURN_NOTHROW_LIST)
378 DEF_ATTR_TREE_LIST (ATTR_TM_CONST_NOTHROW_LIST,
379 ATTR_TM_REGPARM, ATTR_NULL, ATTR_CONST_NOTHROW_LIST)
380 DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_RT_LIST,
381 ATTR_RETURNS_TWICE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
383 /* Same attributes used for BUILT_IN_MALLOC except with TM_PURE thrown in. */
384 DEF_ATTR_TREE_LIST (ATTR_TMPURE_MALLOC_NOTHROW_LIST,
385 ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
386 /* Same attributes used for BUILT_IN_FREE except with TM_PURE thrown in. */
387 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LIST,
388 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LIST)
390 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LEAF_LIST,
391 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
392 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST,
393 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
394 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_COLD_LIST,
395 ATTR_COLD, ATTR_NULL,
396 ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
398 /* Construct a tree for a format_arg attribute. */
399 #define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
400 DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \
401 ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
402 DEF_FORMAT_ARG_ATTRIBUTE(1)
403 DEF_FORMAT_ARG_ATTRIBUTE(2)
404 #undef DEF_FORMAT_ARG_ATTRIBUTE