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