* config/sparc/sparc.c (struct_value_alias_set): New global variable.
[official-gcc.git] / gcc / builtin-attrs.def
blobbfb70521bf2f935aac1173caddb9de44e1908499
1 /* Copyright (C) 2001, 2002, 2004, 2005 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 2, 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 COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
21 /* This header provides a declarative way of describing the attributes
22 that are applied to some functions by default.
24 Before including this header, you must define the following macros.
25 In each case where there is an ENUM, it is an identifier used to
26 reference the tree in subsequent definitions.
28 DEF_ATTR_NULL_TREE (ENUM)
30 Constructs a NULL_TREE.
32 DEF_ATTR_INT (ENUM, VALUE)
34 Constructs an INTEGER_CST with value VALUE (an integer representable
35 in HOST_WIDE_INT).
37 DEF_ATTR_IDENT (ENUM, STRING)
39 Constructs an IDENTIFIER_NODE for STRING.
41 DEF_ATTR_TREE_LIST (ENUM, PURPOSE, VALUE, CHAIN)
43 Constructs a TREE_LIST with given PURPOSE, VALUE and CHAIN (given
44 as previous ENUM names). */
46 DEF_ATTR_NULL_TREE (ATTR_NULL)
48 /* Construct a tree for a given integer and a list containing it. */
49 #define DEF_ATTR_FOR_INT(VALUE) \
50 DEF_ATTR_INT (ATTR_##VALUE, VALUE) \
51 DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE, ATTR_NULL, \
52 ATTR_##VALUE, ATTR_NULL)
53 DEF_ATTR_FOR_INT (0)
54 DEF_ATTR_FOR_INT (1)
55 DEF_ATTR_FOR_INT (2)
56 DEF_ATTR_FOR_INT (3)
57 DEF_ATTR_FOR_INT (4)
58 #undef DEF_ATTR_FOR_INT
60 /* Construct a tree for a list of two integers. */
61 #define DEF_LIST_INT_INT(VALUE1, VALUE2) \
62 DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE1##_##VALUE2, ATTR_NULL, \
63 ATTR_##VALUE1, ATTR_LIST_##VALUE2)
64 DEF_LIST_INT_INT (1,0)
65 DEF_LIST_INT_INT (1,2)
66 DEF_LIST_INT_INT (2,0)
67 DEF_LIST_INT_INT (2,3)
68 DEF_LIST_INT_INT (3,0)
69 DEF_LIST_INT_INT (3,4)
70 #undef DEF_LIST_INT_INT
72 /* Construct trees for identifiers. */
73 DEF_ATTR_IDENT (ATTR_CONST, "const")
74 DEF_ATTR_IDENT (ATTR_FORMAT, "format")
75 DEF_ATTR_IDENT (ATTR_FORMAT_ARG, "format_arg")
76 DEF_ATTR_IDENT (ATTR_MALLOC, "malloc")
77 DEF_ATTR_IDENT (ATTR_NONNULL, "nonnull")
78 DEF_ATTR_IDENT (ATTR_NORETURN, "noreturn")
79 DEF_ATTR_IDENT (ATTR_NOTHROW, "nothrow")
80 DEF_ATTR_IDENT (ATTR_PRINTF, "printf")
81 DEF_ATTR_IDENT (ATTR_ASM_FPRINTF, "asm_fprintf")
82 DEF_ATTR_IDENT (ATTR_GCC_DIAG, "gcc_diag")
83 DEF_ATTR_IDENT (ATTR_GCC_CDIAG, "gcc_cdiag")
84 DEF_ATTR_IDENT (ATTR_GCC_CXXDIAG, "gcc_cxxdiag")
85 DEF_ATTR_IDENT (ATTR_PURE, "pure")
86 DEF_ATTR_IDENT (ATTR_SCANF, "scanf")
87 DEF_ATTR_IDENT (ATTR_SENTINEL, "sentinel")
88 DEF_ATTR_IDENT (ATTR_STRFMON, "strfmon")
89 DEF_ATTR_IDENT (ATTR_STRFTIME, "strftime")
91 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LIST, ATTR_NOTHROW, ATTR_NULL, ATTR_NULL)
93 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LIST, ATTR_CONST, \
94 ATTR_NULL, ATTR_NOTHROW_LIST)
95 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LIST, ATTR_PURE, \
96 ATTR_NULL, ATTR_NOTHROW_LIST)
97 DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LIST, ATTR_NORETURN, \
98 ATTR_NULL, ATTR_NOTHROW_LIST)
99 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_LIST, ATTR_MALLOC, \
100 ATTR_NULL, ATTR_NOTHROW_LIST)
101 DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
102 ATTR_NULL, ATTR_NOTHROW_LIST)
104 /* Functions whose pointer parameter(s) are all nonnull. */
105 DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
106 /* Functions whose first parameter is a nonnull pointer. */
107 DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
108 /* Functions whose second parameter is a nonnull pointer. */
109 DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
110 /* Nothrow functions with the sentinel(1) attribute. */
111 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
112 ATTR_NOTHROW_LIST)
113 /* Nothrow functions whose pointer parameter(s) are all nonnull. */
114 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL, ATTR_NONNULL, ATTR_NULL, \
115 ATTR_NOTHROW_LIST)
116 /* Nothrow functions whose first parameter is a nonnull pointer. */
117 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, \
118 ATTR_NOTHROW_LIST)
119 /* Nothrow functions whose second parameter is a nonnull pointer. */
120 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, \
121 ATTR_NOTHROW_LIST)
122 /* Nothrow functions whose third parameter is a nonnull pointer. */
123 DEF_ATTR_TREE_LIST (ATTR_NOTHROW_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
124 ATTR_NOTHROW_LIST)
125 /* Nothrow const functions whose pointer parameter(s) are all nonnull. */
126 DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_NONNULL, ATTR_CONST, ATTR_NULL, \
127 ATTR_NOTHROW_NONNULL)
128 /* Nothrow pure functions whose pointer parameter(s) are all nonnull. */
129 DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_NONNULL, ATTR_PURE, ATTR_NULL, \
130 ATTR_NOTHROW_NONNULL)
131 /* Nothrow malloc functions whose pointer parameter(s) are all nonnull. */
132 DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_NONNULL, ATTR_MALLOC, ATTR_NULL, \
133 ATTR_NOTHROW_NONNULL)
135 /* Construct a tree for a format attribute. */
136 #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES) \
137 DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
138 ATTR_##TYPE, ATTR_LIST_##VALUES) \
139 DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
140 ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
141 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
142 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
143 DEF_FORMAT_ATTRIBUTE(PRINTF,2,2_0)
144 DEF_FORMAT_ATTRIBUTE(PRINTF,2,2_3)
145 DEF_FORMAT_ATTRIBUTE(PRINTF,3,3_0)
146 DEF_FORMAT_ATTRIBUTE(PRINTF,3,3_4)
147 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
148 DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
149 DEF_FORMAT_ATTRIBUTE(SCANF,2,2_0)
150 DEF_FORMAT_ATTRIBUTE(SCANF,2,2_3)
151 DEF_FORMAT_ATTRIBUTE(STRFTIME,3,3_0)
152 DEF_FORMAT_ATTRIBUTE(STRFMON,3,3_4)
153 #undef DEF_FORMAT_ATTRIBUTE
155 /* Construct a tree for a format_arg attribute. */
156 #define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
157 DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \
158 ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
159 DEF_FORMAT_ARG_ATTRIBUTE(1)
160 DEF_FORMAT_ARG_ATTRIBUTE(2)
161 #undef DEF_FORMAT_ARG_ATTRIBUTE