]> gcc.gnu.org Git - gcc.git/blame - gcc/c-tree.h
*** empty log message ***
[gcc.git] / gcc / c-tree.h
CommitLineData
40754343
RS
1/* Definitions for C parsing and type checking.
2 Copyright (C) 1987 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/* Language-dependent contents of an identifier. */
21
22struct lang_identifier
23{
24 struct tree_identifier ignore;
25 tree global_value, local_value, label_value, implicit_decl;
26 tree error_locus;
27};
28
29/* Macros for access to language-specific slots in an identifier. */
30
31#define IDENTIFIER_GLOBAL_VALUE(NODE) \
32 (((struct lang_identifier *)(NODE))->global_value)
33#define IDENTIFIER_LOCAL_VALUE(NODE) \
34 (((struct lang_identifier *)(NODE))->local_value)
35#define IDENTIFIER_LABEL_VALUE(NODE) \
36 (((struct lang_identifier *)(NODE))->label_value)
37#define IDENTIFIER_IMPLICIT_DECL(NODE) \
38 (((struct lang_identifier *)(NODE))->implicit_decl)
39#define IDENTIFIER_ERROR_LOCUS(NODE) \
40 (((struct lang_identifier *)(NODE))->error_locus)
41
42/* In identifiers, C uses the following fields in a special way:
43 TREE_PUBLIC to record that there was a previous local extern decl.
44 TREE_USED to record that such a decl was used.
45 TREE_ADDRESSABLE to record that the address of such a decl was used. */
46
47/* Nonzero means reject anything that ANSI standard C forbids. */
48extern int pedantic;
49
50/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
51#define C_TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type)
52
53/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */
54#define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type)
55
56/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
57 nonzero if the definition of the type has already started. */
58#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
59
60/* In a RECORD_TYPE, a sorted array of the fields of the type. */
61struct lang_type
62{
63 int len;
64 tree elts[1];
65};
66
67/* Mark which labels are explicitly declared.
68 These may be shadowed, and may be referenced from nested functions. */
69#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
70
71/* Record whether a type or decl was written with nonconstant size.
72 Note that TYPE_SIZE may have simplified to a constant. */
73#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)
74#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type)
75
76/* Record in each node resulting from a binary operator
77 what operator was specified for it. */
78#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
79
80#if 0 /* Not used. */
81/* Record whether a decl for a function or function pointer has
82 already been mentioned (in a warning) because it was called
83 but didn't have a prototype. */
84#define C_MISSING_PROTOTYPE_WARNED(decl) DECL_LANG_FLAG_2(decl)
85#endif
86
87/* Store a value in that field. */
88#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
89 (TREE_COMPLEXITY (exp) = (int)(code))
90
91/* Record whether a typedef for type `int' was actually `signed int'. */
92#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
93
94/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
95 TYPE_ARG_TYPES for functions with prototypes, but created for functions
96 without prototypes. */
97#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE)
98\f
99/* in c-typecheck.c */
100extern tree build_component_ref (), build_conditional_expr (), build_compound_expr ();
101extern tree build_unary_op (), build_binary_op (), build_function_call ();
102extern tree parser_build_binary_op ();
103extern tree build_indirect_ref (), build_array_ref (), build_c_cast ();
104extern tree build_modify_expr ();
105extern tree c_sizeof (), c_alignof (), c_alignof_expr ();
106extern void store_init_value ();
107extern tree digest_init ();
108extern tree c_expand_start_case ();
109extern tree default_conversion ();
110
111/* Given two integer or real types, return the type for their sum.
112 Given two compatible ANSI C types, returns the merged type. */
113
114extern tree common_type ();
115
116/* in c-decl.c */
117extern tree build_label ();
118
119extern int start_function ();
120extern void finish_function ();
121extern void store_parm_decls ();
122extern tree get_parm_info ();
123extern tree combine_parm_decls ();
124
125extern void pushlevel ();
126extern tree poplevel ();
127
128extern tree groktypename (), lookup_name ();
129
130extern tree lookup_label (), define_label (), shadow_label ();
131
132extern tree implicitly_declare (), getdecls (), gettags ();
133
134extern tree start_decl ();
135extern void finish_decl ();
136
137extern tree start_struct (), finish_struct (), xref_tag ();
138extern tree grokfield ();
139
140extern tree start_enum (), finish_enum ();
141extern tree build_enumerator ();
142
143extern tree make_index_type ();
144
145/* Add qualifiers to a type, in the fashion for C. */
146extern tree c_build_type_variant ();
147
3cfd4ab5
RS
148/* Declare a predefined function. Return the declaration. */
149extern tree builtin_function ();
150
40754343
RS
151/* Functions in c-common.c: */
152
153/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
154extern tree combine_strings ();
155
156/* Validate the expression after `case' and apply default promotions. */
157extern tree check_case_value ();
158
159/* Print an error message for invalid operands to arith operation CODE.
160 NOP_EXPR is used as a special case (see truthvalue_conversion). */
161
162extern void binary_op_error ();
163
164/* Subroutine of build_binary_op, used for comparison operations.
165 See if the operands have both been converted from subword integer types
166 and, if so, perhaps change them both back to their original type. */
167
168extern tree shorten_compare ();
169
170/* Read the rest of the current #-directive line. */
171extern char *get_directive_line ();
172
173extern int maybe_objc_comptypes ();
174extern tree maybe_building_objc_message_expr ();
175\f
176/* Standard named or nameless data types of the C compiler. */
177
178extern tree short_integer_type_node, integer_type_node;
179extern tree long_integer_type_node, long_long_integer_type_node;
180extern tree short_unsigned_type_node, unsigned_type_node;
181extern tree long_unsigned_type_node, long_long_unsigned_type_node;
182extern tree ptrdiff_type_node;
183extern tree unsigned_char_type_node, signed_char_type_node, char_type_node;
184extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
185extern tree float_type_node, double_type_node, long_double_type_node;
186extern tree void_type_node, ptr_type_node, const_ptr_type_node;
187extern tree string_type_node, const_string_type_node;
188extern tree char_array_type_node, int_array_type_node, wchar_array_type_node;
189extern tree default_function_type;
190extern tree double_ftype_double, double_ftype_double_double;
191extern tree int_ftype_int, long_ftype_long;
192extern tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int;
193extern tree void_ftype_ptr_int_int, string_ftype_ptr_ptr;
194extern tree int_ftype_string_string, int_ftype_cptr_cptr_sizet;
195
196/* Set to 0 at beginning of a function definition, set to 1 if
197 a return statement that specifies a return value is seen. */
198
199extern int current_function_returns_value;
200
201/* Set to 0 at beginning of a function definition, set to 1 if
202 a return statement with no argument is seen. */
203
204extern int current_function_returns_null;
205
206/* Nonzero means `$' can be in an identifier. */
207
208extern int dollars_in_ident;
209
210/* Nonzero means allow type mismatches in conditional expressions;
211 just make their values `void'. */
212
213extern int flag_cond_mismatch;
214
215/* Nonzero means don't recognize the keyword `asm'. */
216
217extern int flag_no_asm;
218
219/* Nonzero means ignore `#ident' directives. */
220
221extern int flag_no_ident;
222
223/* Nonzero means warn about implicit declarations. */
224
225extern int warn_implicit;
226
227/* Nonzero means give string constants the type `const char *'
228 to get extra warnings from them. These warnings will be too numerous
229 to be useful, except in thoroughly ANSIfied programs. */
230
231extern int warn_write_strings;
232
233/* Nonzero means warn about sizeof (function) or addition/subtraction
234 of function pointers. */
235
236extern int warn_pointer_arith;
237
238/* Nonzero means warn for all old-style non-prototype function decls. */
239
240extern int warn_strict_prototypes;
241
242/* Nonzero means warn about multiple (redundant) decls for the same single
243 variable or function. */
244
245extern int warn_redundant_decls;
246
247/* Nonzero means warn about extern declarations of objects not at
248 file-scope level and about *all* declarations of functions (whether
249 extern or static) not at file-scope level. Note that we exclude
250 implicit function declarations. To get warnings about those, use
251 -Wimplicit. */
252
253extern int warn_nested_externs;
254
255/* Nonzero means warn about pointer casts that can drop a type qualifier
256 from the pointer target type. */
257
258extern int warn_cast_qual;
259
260/* Warn about traditional constructs whose meanings changed in ANSI C. */
261
262extern int warn_traditional;
263
264/* Warn about *printf or *scanf format/argument anomalies. */
265
266extern int warn_format;
267
268/* Warn about a subscript that has type char. */
269
270extern int warn_char_subscripts;
271
272/* Warn if a type conversion is done that might have confusing results. */
273
274extern int warn_conversion;
275
276/* Nonzero means do some things the same way PCC does. */
277
278extern int flag_traditional;
279
280/* Nonzero means warn about suggesting putting in ()'s. */
281
282extern int warn_parentheses;
283
284/* Nonzero means this is a function to call to perform comptypes
285 on two record types. */
286
287extern int (*comptypes_record_hook) ();
288
289/* Nonzero means we are reading code that came from a system header file. */
290
291extern int system_header_p;
This page took 0.070089 seconds and 5 git commands to generate.