Small ChangeLog tweak.
[official-gcc.git] / gcc / builtin-attrs.def
blob38fb1bb88102fb7b3877732afe051b1ec8c3fbc7
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_RT_NOTHROW_LEAF_LIST, ATTR_RETURNS_TWICE,\
140 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
141 DEF_ATTR_TREE_LIST (ATTR_COLD_NOTHROW_LEAF_LIST, ATTR_COLD,\
142 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
143 DEF_ATTR_TREE_LIST (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST, ATTR_COLD,\
144 ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
145 DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
146 ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
147 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LIST, ATTR_MALLOC, \
148 ATTR_NULL, ATTR_NOTHROW_LIST)
149 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LEAF_LIST, ATTR_MALLOC, \
150 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
151 DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
152 ATTR_NULL, ATTR_NOTHROW_LIST)
153 DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_SENTINEL, \
154 ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
155 DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
156 ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
158 /* Allocation functions like malloc and realloc whose first argument
159 with _SIZE_1, or second argument with _SIZE_2, specifies the size
160 of the allocated object. */
161 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
162 ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LIST)
163 DEF_ATTR_TREE_LIST (ATTR_ALLOC_SIZE_2_NOTHROW_LIST, ATTR_ALLOC_SIZE, \
164 ATTR_LIST_2, ATTR_MALLOC_NOTHROW_LIST)
165 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
166 ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LEAF_LIST)
167 /* Alloca is just like malloc except that it never returns null. */
168 DEF_ATTR_TREE_LIST (ATTR_ALLOCA_SIZE_1_NOTHROW_LEAF_LIST, ATTR_RETURNS_NONNULL,
169 ATTR_NULL, ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST)
171 /* Allocation functions like calloc the product of whose first two arguments
172 specifies the size of the allocated object. */
173 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
174 ATTR_LIST_1_2, ATTR_MALLOC_NOTHROW_LEAF_LIST)
176 /* Allocation functions like realloc whose second argument specifies
177 the size of the allocated object. */
178 DEF_ATTR_TREE_LIST (ATTR_ALLOC_SIZE_2_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
179 ATTR_LIST_2, ATTR_NOTHROW_LEAF_LIST)
181 /* Functions whose pointer parameter(s) are all nonnull. */
182 DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
183 /* Functions whose first parameter is a nonnull pointer. */
184 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
185 /* Functions whose second parameter is a nonnull pointer. */
186 DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
187 /* Functions whose third parameter is a nonnull pointer. */
188 DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, ATTR_NULL)
189 /* Nothrow functions with the sentinel(1) attribute. */
190 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
191 ATTR_NOTHROW_LIST)
192 /* Nothrow functions whose pointer parameter(s) are all nonnull. */
193 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \
194 ATTR_NOTHROW_LIST)
195 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull. */
196 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF, ATTR_NONNULL, ATTR_NULL, \
197 ATTR_NOTHROW_LEAF_LIST)
198 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_LEAF_LIST, ATTR_LEAF, ATTR_NULL, ATTR_NOTHROW_NONNULL_LEAF)
199 /* Nothrow functions whose first parameter is a nonnull pointer. */
200 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \
201 ATTR_NOTHROW_LIST)
202 /* Nothrow functions whose second parameter is a nonnull pointer. */
203 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, \
204 ATTR_NOTHROW_LIST)
205 /* Nothrow functions whose third parameter is a nonnull pointer. */
206 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
207 ATTR_NOTHROW_LIST)
208 /* Nothrow functions whose fourth parameter is a nonnull pointer. */
209 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_4, ATTR_NONNULL, ATTR_LIST_4, \
210 ATTR_NOTHROW_LIST)
211 /* Nothrow functions whose fifth parameter is a nonnull pointer. */
212 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_5, ATTR_NONNULL, ATTR_LIST_5, \
213 ATTR_NOTHROW_LIST)
215 /* Same as ATTR_NONNULL_1. */
216 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
217 /* Functions like {v,}fprintf whose first and second parameters are
218 nonnull pointers. As cancellation points the functions are not
219 nothrow. */
220 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, ATTR_NULL)
221 /* The following don't have {v,}fprintf forms. They exist only to
222 make it possible to declare {v,}{f,s}printf attributes using
223 the same macro. */
224 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, ATTR_NULL)
225 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, ATTR_NULL)
226 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, ATTR_NULL)
228 /* Same as ATTR_NOTHROW_NONNULL_1. */
229 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_1, ATTR_NONNULL, ATTR_LIST_1,
230 ATTR_NOTHROW_LIST)
231 /* Nothrow functions like {v,}sprintf whose first and second parameters
232 are nonnull pointers. */
233 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_1_2, \
234 ATTR_NOTHROW_LIST)
235 /* Nothrow functions like {v,}snprintf whose first and third parameters
236 are nonnull pointers. */
237 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_3, ATTR_NONNULL, ATTR_LIST_1_3, \
238 ATTR_NOTHROW_LIST)
239 /* Nothrow functions like {v,}sprintf_chk whose first and fourth parameters
240 are nonnull pointers. */
241 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_1_4, \
242 ATTR_NOTHROW_LIST)
243 /* Nothrow functions like {v,}snprintf_chk whose first and fifth parameters
244 are nonnull pointers. */
245 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_5, ATTR_NONNULL, ATTR_LIST_1_5, \
246 ATTR_NOTHROW_LIST)
248 /* Nothrow leaf functions which are type-generic. */
249 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
250 ATTR_NOTHROW_LEAF_LIST)
251 /* Nothrow nonnull leaf functions that are type-generic. */
252 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF,
253 ATTR_TYPEGENERIC, ATTR_NULL,
254 ATTR_NOTHROW_NONNULL_LEAF)
255 /* Nothrow const functions whose pointer parameter(s) are all nonnull. */
256 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \
257 ATTR_NOTHROW_NONNULL)
258 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
259 and which return their first argument. */
260 DEF_ATTR_TREE_LIST (ATTR_RET1_NOTHROW_NONNULL_LEAF, ATTR_FNSPEC, ATTR_LIST_STR1, \
261 ATTR_NOTHROW_NONNULL_LEAF)
262 /* Nothrow leaf functions whose pointer parameter(s) are all nonnull,
263 and return value is also nonnull. */
264 DEF_ATTR_TREE_LIST (ATTR_RETNONNULL_NOTHROW_LEAF, ATTR_RETURNS_NONNULL, ATTR_NULL, \
265 ATTR_NOTHROW_NONNULL_LEAF)
266 /* Nothrow const leaf functions whose pointer parameter(s) are all nonnull. */
267 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL_LEAF, ATTR_CONST, ATTR_NULL, \
268 ATTR_NOTHROW_NONNULL_LEAF)
269 /* Nothrow const functions which are type-generic. */
270 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC, ATTR_TYPEGENERIC, ATTR_NULL, \
271 ATTR_CONST_NOTHROW_LIST)
272 /* Nothrow const leaf functions which are type-generic. */
273 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_TYPEGENERIC, ATTR_NULL, \
274 ATTR_CONST_NOTHROW_LEAF_LIST)
275 /* Nothrow pure functions whose pointer parameter(s) are all nonnull. */
276 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL, ATTR_PURE, ATTR_NULL, \
277 ATTR_NOTHROW_NONNULL)
278 /* Nothrow pure leaf functions whose pointer parameter(s) are all nonnull. */
279 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL_LEAF, ATTR_PURE, ATTR_NULL, \
280 ATTR_NOTHROW_NONNULL_LEAF)
281 /* Nothrow malloc functions whose pointer parameter(s) are all nonnull. */
282 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_NONNULL, ATTR_MALLOC, ATTR_NULL, \
283 ATTR_NOTHROW_NONNULL)
284 /* Nothrow malloc leaf functions whose pointer parameter(s) are all nonnull. */
285 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_NONNULL_LEAF, ATTR_MALLOC, ATTR_NULL, \
286 ATTR_NOTHROW_NONNULL_LEAF)
288 /* Construct a tree for the format attribute (and implicitly nonnull). */
289 #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES) \
290 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
291 ATTR_##TYPE, ATTR_LIST_##VALUES) \
292 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
293 ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA)
295 /* Construct a tree for the format and nothrow attributes (format
296 implies nonnull). */
297 #define DEF_FORMAT_ATTRIBUTE_NOTHROW(TYPE, FA, VALUES) \
298 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
299 ATTR_##TYPE, ATTR_LIST_##VALUES) \
300 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
301 ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
303 /* Construct one tree for the format attribute and another for the format
304 and nothrow attributes (in both cases format implies nonnull). */
305 #define DEF_FORMAT_ATTRIBUTE_BOTH(TYPE, FA, VALUES) \
306 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
307 ATTR_##TYPE, ATTR_LIST_##VALUES) \
308 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
309 ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA) \
310 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
311 ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
313 /* Construct a pair of trees for the nonnull attribute for the first
314 argument, plus format printf attribute (format implies nonnull):
315 the first ordinary and the second nothrow. */
316 #define DEF_FORMAT_ATTRIBUTE_NONNULL(TYPE, FA, VALUES) \
317 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
318 ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
319 ATTR_NONNULL_1_##FA) \
320 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1_FORMAT_##TYPE##_##VALUES, \
321 ATTR_FORMAT, ATTR_##TYPE##_##VALUES, \
322 ATTR_NOTHROW_NONNULL_1_##FA)
324 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
325 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
326 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_0)
327 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_3)
328 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_0)
329 DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_4)
330 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_0)
331 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_5)
332 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_0)
333 DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_6)
335 /* Attributes for fprintf(f, f, va). */
336 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,1,1_2)
337 /* Attributes for v{f,s}printf(d, f, va). vsprintf is nothrow, vfprintf
338 is not. */
339 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_0)
340 /* Attributes for {f,s}printf(d, f, ...). sprintf is nothrow, fprintf
341 is not. */
342 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,2,2_3)
343 /* Attributes for vprintf_chk. */
344 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_0)
345 /* Attributes for printf_chk. */
346 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,3,3_4)
347 /* Attributes for v{f,s}printf_chk(d, t, bos, f, va). vsprintf_chk is
348 nothrow, vfprintf_chk is not. */
349 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_0)
350 /* Attributes for {f,s}printf_chk(d, t, bos, f, ...). sprintf_chk is
351 nothrow, fprintf_chk is not. */
352 DEF_FORMAT_ATTRIBUTE_NONNULL(PRINTF,4,4_5)
354 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
355 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
356 DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_0)
357 DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_3)
358 DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFTIME,3,3_0)
359 DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFMON,3,3_4)
360 #undef DEF_FORMAT_ATTRIBUTE
361 #undef DEF_FORMAT_ATTRIBUTE_NOTHROW
362 #undef DEF_FORMAT_ATTRIBUTE_BOTH
364 /* Transactional memory variants of the above. */
366 DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_LIST,
367 ATTR_TM_REGPARM, ATTR_NULL, ATTR_NOTHROW_LIST)
368 DEF_ATTR_TREE_LIST (ATTR_TM_TMPURE_NOTHROW_LIST,
369 ATTR_TM_TMPURE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
370 DEF_ATTR_TREE_LIST (ATTR_TM_PURE_TMPURE_NOTHROW_LIST,
371 ATTR_PURE, ATTR_NULL, ATTR_TM_TMPURE_NOTHROW_LIST)
372 DEF_ATTR_TREE_LIST (ATTR_TM_NORETURN_NOTHROW_LIST,
373 ATTR_TM_REGPARM, ATTR_NULL, ATTR_NORETURN_NOTHROW_LIST)
374 DEF_ATTR_TREE_LIST (ATTR_TM_CONST_NOTHROW_LIST,
375 ATTR_TM_REGPARM, ATTR_NULL, ATTR_CONST_NOTHROW_LIST)
376 DEF_ATTR_TREE_LIST (ATTR_TM_NOTHROW_RT_LIST,
377 ATTR_RETURNS_TWICE, ATTR_NULL, ATTR_TM_NOTHROW_LIST)
379 /* Same attributes used for BUILT_IN_MALLOC except with TM_PURE thrown in. */
380 DEF_ATTR_TREE_LIST (ATTR_TMPURE_MALLOC_NOTHROW_LIST,
381 ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST)
382 /* Same attributes used for BUILT_IN_FREE except with TM_PURE thrown in. */
383 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LIST,
384 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LIST)
386 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LEAF_LIST,
387 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
388 DEF_ATTR_TREE_LIST (ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST,
389 ATTR_TM_TMPURE, ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
391 /* Construct a tree for a format_arg attribute. */
392 #define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
393 DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \
394 ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
395 DEF_FORMAT_ARG_ATTRIBUTE(1)
396 DEF_FORMAT_ARG_ATTRIBUTE(2)
397 #undef DEF_FORMAT_ARG_ATTRIBUTE