c-tree.h revision 103453
1/* Definitions for C parsing and type checking. 2 Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998, 3 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free 9Software Foundation; either version 2, or (at your option) any later 10version. 11 12GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13WARRANTY; without even the implied warranty of MERCHANTABILITY or 14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15for more details. 16 17You should have received a copy of the GNU General Public License 18along with GCC; see the file COPYING. If not, write to the Free 19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2002111-1307, USA. */ 21 22/* $FreeBSD: head/contrib/gcc/c-tree.h 103453 2002-09-17 04:14:38Z kan $ */ 23 24#ifndef GCC_C_TREE_H 25#define GCC_C_TREE_H 26 27#include "c-common.h" 28 29/* Language-dependent contents of an identifier. */ 30 31/* The limbo_value is used for block level extern declarations, which need 32 to be type checked against subsequent extern declarations. They can't 33 be referenced after they fall out of scope, so they can't be global. 34 35 The rid_code field is used for keywords. It is in all 36 lang_identifier nodes, because some keywords are only special in a 37 particular context. */ 38 39struct lang_identifier 40{ 41 struct c_common_identifier ignore; 42 tree global_value, local_value, label_value, implicit_decl; 43 tree error_locus, limbo_value; 44}; 45 46/* Language-specific declaration information. */ 47 48struct lang_decl 49{ 50 struct c_lang_decl base; 51 /* The return types and parameter types may have variable size. 52 This is a list of any SAVE_EXPRs that need to be evaluated to 53 compute those sizes. */ 54 tree pending_sizes; 55}; 56 57/* Macros for access to language-specific slots in an identifier. */ 58/* Each of these slots contains a DECL node or null. */ 59 60/* This represents the value which the identifier has in the 61 file-scope namespace. */ 62#define IDENTIFIER_GLOBAL_VALUE(NODE) \ 63 (((struct lang_identifier *) (NODE))->global_value) 64/* This represents the value which the identifier has in the current 65 scope. */ 66#define IDENTIFIER_LOCAL_VALUE(NODE) \ 67 (((struct lang_identifier *) (NODE))->local_value) 68/* This represents the value which the identifier has as a label in 69 the current label scope. */ 70#define IDENTIFIER_LABEL_VALUE(NODE) \ 71 (((struct lang_identifier *) (NODE))->label_value) 72/* This records the extern decl of this identifier, if it has had one 73 at any point in this compilation. */ 74#define IDENTIFIER_LIMBO_VALUE(NODE) \ 75 (((struct lang_identifier *) (NODE))->limbo_value) 76/* This records the implicit function decl of this identifier, if it 77 has had one at any point in this compilation. */ 78#define IDENTIFIER_IMPLICIT_DECL(NODE) \ 79 (((struct lang_identifier *) (NODE))->implicit_decl) 80/* This is the last function in which we printed an "undefined variable" 81 message for this identifier. Value is a FUNCTION_DECL or null. */ 82#define IDENTIFIER_ERROR_LOCUS(NODE) \ 83 (((struct lang_identifier *) (NODE))->error_locus) 84 85/* In identifiers, C uses the following fields in a special way: 86 TREE_PUBLIC to record that there was a previous local extern decl. 87 TREE_USED to record that such a decl was used. 88 TREE_ADDRESSABLE to record that the address of such a decl was used. */ 89 90/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ 91#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE) 92 93/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */ 94#define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE) 95 96/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE 97 nonzero if the definition of the type has already started. */ 98#define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE) 99 100/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a 101 keyword. C_RID_CODE (node) is then the RID_* value of the keyword, 102 and C_RID_YYCODE is the token number wanted by Yacc. */ 103#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID) 104 105/* This function was declared inline. This flag controls the linkage 106 semantics of 'inline'; whether or not the function is inlined is 107 controlled by DECL_INLINE. */ 108#define DECL_DECLARED_INLINE_P(NODE) \ 109 (DECL_LANG_SPECIFIC (NODE)->base.declared_inline) 110 111/* In a RECORD_TYPE, a sorted array of the fields of the type. */ 112struct lang_type 113{ 114 int len; 115 tree elts[1]; 116}; 117 118/* Record whether a type or decl was written with nonconstant size. 119 Note that TYPE_SIZE may have simplified to a constant. */ 120#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE) 121#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE) 122 123#if 0 /* Not used. */ 124/* Record whether a decl for a function or function pointer has 125 already been mentioned (in a warning) because it was called 126 but didn't have a prototype. */ 127#define C_MISSING_PROTOTYPE_WARNED(DECL) DECL_LANG_FLAG_2 (DECL) 128#endif 129 130/* Store a value in that field. */ 131#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \ 132 (TREE_COMPLEXITY (EXP) = (int) (CODE)) 133 134/* Record whether a typedef for type `int' was actually `signed int'. */ 135#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) 136 137/* For a FUNCTION_DECL, nonzero if it was defined without an explicit 138 return type. */ 139#define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP) 140 141/* Nonzero for a declaration of a built in function if there has been no 142 occasion that would declare the function in ordinary C. 143 Using the function draws a pedantic warning in this case. */ 144#define C_DECL_ANTICIPATED(EXP) DECL_LANG_FLAG_3 (EXP) 145 146/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as 147 TYPE_ARG_TYPES for functions with prototypes, but created for functions 148 without prototypes. */ 149#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE) 150 151 152/* in c-lang.c and objc-act.c */ 153extern tree lookup_interface PARAMS ((tree)); 154extern tree is_class_name PARAMS ((tree)); 155extern void maybe_objc_check_decl PARAMS ((tree)); 156extern void finish_file PARAMS ((void)); 157extern int maybe_objc_comptypes PARAMS ((tree, tree, int)); 158extern tree maybe_building_objc_message_expr PARAMS ((void)); 159extern int recognize_objc_keyword PARAMS ((void)); 160extern tree lookup_objc_ivar PARAMS ((tree)); 161 162 163/* in c-parse.in */ 164extern void c_parse_init PARAMS ((void)); 165extern void c_set_yydebug PARAMS ((int)); 166extern int yyparse_1 PARAMS ((void)); 167 168/* in c-aux-info.c */ 169extern void gen_aux_info_record PARAMS ((tree, int, int, int)); 170 171/* in c-decl.c */ 172extern void c_init_decl_processing PARAMS ((void)); 173extern void c_print_identifier PARAMS ((FILE *, tree, int)); 174extern tree build_array_declarator PARAMS ((tree, tree, int, int)); 175extern tree build_enumerator PARAMS ((tree, tree)); 176extern int c_decode_option PARAMS ((int, char **)); 177extern void c_mark_varargs PARAMS ((void)); 178extern void check_for_loop_decls PARAMS ((void)); 179extern void clear_parm_order PARAMS ((void)); 180extern int complete_array_type PARAMS ((tree, tree, int)); 181extern void declare_parm_level PARAMS ((int)); 182extern tree define_label PARAMS ((const char *, int, 183 tree)); 184extern void finish_decl PARAMS ((tree, tree, tree)); 185extern tree finish_enum PARAMS ((tree, tree, tree)); 186extern void finish_function PARAMS ((int, int)); 187extern tree finish_struct PARAMS ((tree, tree, tree)); 188extern tree get_parm_info PARAMS ((int)); 189extern tree grokfield PARAMS ((const char *, int, tree, tree, tree)); 190extern tree groktypename PARAMS ((tree)); 191extern tree groktypename_in_parm_context PARAMS ((tree)); 192extern tree implicitly_declare PARAMS ((tree)); 193extern void implicit_decl_warning PARAMS ((tree)); 194extern int in_parm_level_p PARAMS ((void)); 195extern void keep_next_level PARAMS ((void)); 196extern int kept_level_p PARAMS ((void)); 197extern tree lookup_name PARAMS ((tree)); 198extern tree lookup_name_current_level PARAMS ((tree)); 199extern void parmlist_tags_warning PARAMS ((void)); 200extern void pending_xref_error PARAMS ((void)); 201extern void mark_c_function_context PARAMS ((struct function *)); 202extern void push_c_function_context PARAMS ((struct function *)); 203extern void pop_c_function_context PARAMS ((struct function *)); 204extern void pop_label_level PARAMS ((void)); 205extern void push_label_level PARAMS ((void)); 206extern void push_parm_decl PARAMS ((tree)); 207extern tree pushdecl_top_level PARAMS ((tree)); 208extern void pushtag PARAMS ((tree, tree)); 209extern tree set_array_declarator_type PARAMS ((tree, tree, int)); 210extern tree shadow_label PARAMS ((tree)); 211extern void shadow_tag PARAMS ((tree)); 212extern void shadow_tag_warned PARAMS ((tree, int)); 213extern tree start_enum PARAMS ((tree)); 214extern int start_function PARAMS ((tree, tree, tree)); 215extern tree start_decl PARAMS ((tree, tree, int, 216 tree)); 217extern tree start_struct PARAMS ((enum tree_code, tree)); 218extern void store_parm_decls PARAMS ((void)); 219extern tree xref_tag PARAMS ((enum tree_code, tree)); 220extern tree c_begin_compound_stmt PARAMS ((void)); 221extern void c_expand_deferred_function PARAMS ((tree)); 222extern void c_expand_decl_stmt PARAMS ((tree)); 223 224 225/* in c-objc-common.c */ 226extern int c_disregard_inline_limits PARAMS ((tree)); 227extern int c_cannot_inline_tree_fn PARAMS ((tree *)); 228extern const char *c_objc_common_init PARAMS ((const char *)); 229extern int c_missing_noreturn_ok_p PARAMS ((tree)); 230extern void c_objc_common_finish_file PARAMS ((void)); 231extern int defer_fn PARAMS ((tree)); 232 233#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \ 234 c_build_qualified_type ((TYPE), \ 235 ((CONST_P) ? TYPE_QUAL_CONST : 0) | \ 236 ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0)) 237 238/* in c-typeck.c */ 239extern tree require_complete_type PARAMS ((tree)); 240extern int comptypes PARAMS ((tree, tree)); 241extern tree c_sizeof_nowarn PARAMS ((tree)); 242extern tree c_size_in_bytes PARAMS ((tree)); 243extern tree build_component_ref PARAMS ((tree, tree)); 244extern tree build_indirect_ref PARAMS ((tree, const char *)); 245extern tree build_array_ref PARAMS ((tree, tree)); 246extern tree build_external_ref PARAMS ((tree, int)); 247extern tree parser_build_binary_op PARAMS ((enum tree_code, 248 tree, tree)); 249extern void readonly_warning PARAMS ((tree, const char *)); 250extern tree build_conditional_expr PARAMS ((tree, tree, tree)); 251extern tree build_compound_expr PARAMS ((tree)); 252extern tree c_cast_expr PARAMS ((tree, tree)); 253extern tree build_c_cast PARAMS ((tree, tree)); 254extern tree build_modify_expr PARAMS ((tree, enum tree_code, 255 tree)); 256extern void store_init_value PARAMS ((tree, tree)); 257extern void error_init PARAMS ((const char *)); 258extern void pedwarn_init PARAMS ((const char *)); 259extern void start_init PARAMS ((tree, tree, int)); 260extern void finish_init PARAMS ((void)); 261extern void really_start_incremental_init PARAMS ((tree)); 262extern void push_init_level PARAMS ((int)); 263extern tree pop_init_level PARAMS ((int)); 264extern void set_init_index PARAMS ((tree, tree)); 265extern void set_init_label PARAMS ((tree)); 266extern void process_init_element PARAMS ((tree)); 267extern tree build_compound_literal PARAMS ((tree, tree)); 268extern void pedwarn_c99 PARAMS ((const char *, ...)) 269 ATTRIBUTE_PRINTF_1; 270extern tree c_start_case PARAMS ((tree)); 271extern void c_finish_case PARAMS ((void)); 272extern tree simple_asm_stmt PARAMS ((tree)); 273extern tree build_asm_stmt PARAMS ((tree, tree, tree, 274 tree, tree)); 275extern tree c_convert_parm_for_inlining PARAMS ((tree, tree, tree)); 276 277/* Set to 0 at beginning of a function definition, set to 1 if 278 a return statement that specifies a return value is seen. */ 279 280extern int current_function_returns_value; 281 282/* Set to 0 at beginning of a function definition, set to 1 if 283 a return statement with no argument is seen. */ 284 285extern int current_function_returns_null; 286 287/* Set to 0 at beginning of a function definition, set to 1 if 288 a call to a noreturn function is seen. */ 289 290extern int current_function_returns_abnormally; 291 292/* Nonzero means `$' can be in an identifier. */ 293 294extern int dollars_in_ident; 295 296/* Nonzero means allow type mismatches in conditional expressions; 297 just make their values `void'. */ 298 299extern int flag_cond_mismatch; 300 301/* Nonzero means don't recognize the keyword `asm'. */ 302 303extern int flag_no_asm; 304 305/* Nonzero means warn about implicit declarations. */ 306 307extern int warn_implicit; 308 309/* Nonzero means warn for all old-style non-prototype function decls. */ 310 311extern int warn_strict_prototypes; 312 313/* Nonzero means warn about multiple (redundant) decls for the same single 314 variable or function. */ 315 316extern int warn_redundant_decls; 317 318/* Nonzero means warn about extern declarations of objects not at 319 file-scope level and about *all* declarations of functions (whether 320 extern or static) not at file-scope level. Note that we exclude 321 implicit function declarations. To get warnings about those, use 322 -Wimplicit. */ 323 324extern int warn_nested_externs; 325 326/* Nonzero means warn about pointer casts that can drop a type qualifier 327 from the pointer target type. */ 328 329extern int warn_cast_qual; 330 331/* Nonzero means warn when casting a function call to a type that does 332 not match the return type (e.g. (float)sqrt() or (anything*)malloc() 333 when there is no previous declaration of sqrt or malloc. */ 334 335extern int warn_bad_function_cast; 336 337/* Warn about traditional constructs whose meanings changed in ANSI C. */ 338 339extern int warn_traditional; 340 341/* Warn about a subscript that has type char. */ 342 343extern int warn_char_subscripts; 344 345/* Warn if main is suspicious. */ 346 347extern int warn_main; 348 349/* Nonzero means to allow single precision math even if we're generally 350 being traditional. */ 351extern int flag_allow_single_precision; 352 353/* Warn if initializer is not completely bracketed. */ 354 355extern int warn_missing_braces; 356 357/* Warn about comparison of signed and unsigned values. */ 358 359extern int warn_sign_compare; 360 361/* Warn about testing equality of floating point numbers. */ 362 363extern int warn_float_equal; 364 365/* Warn about multicharacter constants. */ 366 367extern int warn_multichar; 368 369/* Nonzero means we are reading code that came from a system header file. */ 370 371extern int system_header_p; 372 373/* Warn about implicit declarations. 1 = warning, 2 = error. */ 374extern int mesg_implicit_function_declaration; 375 376/* In c-decl.c */ 377extern void finish_incomplete_decl PARAMS ((tree)); 378 379extern tree static_ctors; 380extern tree static_dtors; 381 382#endif /* ! GCC_C_TREE_H */ 383