1/* Definitions for c-common.c.
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
--- 5 unchanged lines hidden (view full) ---
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-common.h 110622 2003-02-10 05:58:19Z kan $ */
23
24#ifndef GCC_C_COMMON_H
25#define GCC_C_COMMON_H
26
27#include "splay-tree.h"
28#include "cpplib.h"
29
30/* Usage of TREE_LANG_FLAG_?:
31 0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
--- 8 unchanged lines hidden (view full) ---
40 STMT_IS_FULL_EXPR_P (in _STMT)
41 2: STMT_LINENO_FOR_FN_P (in _STMT)
42 3: SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
43 COMPOUND_STMT_BODY_BLOCK (in COMPOUND_STMT)
44 4: SCOPE_PARTIAL_P (in SCOPE_STMT)
45*/
46
47/* Reserved identifiers. This is the union of all the keywords for C,
48 C++, and Objective C. All the type modifiers have to be in one
49 block at the beginning, because they are used as mask bits. There
50 are 27 type modifiers; if we add many more we will have to redesign
51 the mask mechanism. */
52
53enum rid
54{
55 /* Modifiers: */
56 /* C, in empirical order of frequency. */
57 RID_STATIC = 0,
58 RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN,
59 RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
60 RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
61
62 /* C extensions */
63 RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX,
64
65 /* C++ */
66 RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
67
68 /* ObjC */
69 RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
70
71 /* C */
--- 18 unchanged lines hidden (view full) ---
90 RID_DELETE, RID_FALSE, RID_NAMESPACE,
91 RID_NEW, RID_OPERATOR, RID_THIS,
92 RID_THROW, RID_TRUE, RID_TRY,
93 RID_TYPENAME, RID_TYPEID, RID_USING,
94
95 /* casts */
96 RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
97
98 /* alternate spellings */
99 RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ,
100 RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ,
101 RID_BITAND, RID_BITOR, RID_COMPL,
102
103 /* Objective C */
104 RID_ID, RID_AT_ENCODE, RID_AT_END,
105 RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
106 RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
107 RID_AT_PROTOCOL, RID_AT_SELECTOR, RID_AT_INTERFACE,
108 RID_AT_IMPLEMENTATION,
109
110 RID_MAX,
111
--- 64 unchanged lines hidden (view full) ---
176
177 CTI_MAX
178};
179
180#define C_RID_CODE(id) (((struct c_common_identifier *) (id))->node.rid_code)
181
182/* Identifier part common to the C front ends. Inherits from
183 tree_identifier, despite appearances. */
184struct c_common_identifier
185{
186 struct tree_common common;
187 struct cpp_hashnode node;
188};
189
190#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
191#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
192#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
193#define wint_type_node c_global_trees[CTI_WINT_TYPE]
194#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
195#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
--- 27 unchanged lines hidden (view full) ---
223#define function_name_decl_node c_global_trees[CTI_FUNCTION_NAME_DECL]
224#define pretty_function_name_decl_node c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
225#define c99_function_name_decl_node c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
226#define saved_function_name_decls c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
227
228/* A node for `((void) 0)'. */
229#define void_zero_node c_global_trees[CTI_VOID_ZERO]
230
231extern tree c_global_trees[CTI_MAX];
232
233/* Mark which labels are explicitly declared.
234 These may be shadowed, and may be referenced from nested functions. */
235#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
236
237/* Flag strings given by __FUNCTION__ and __PRETTY_FUNCTION__ for a
238 warning if they undergo concatenation. */
239#define C_ARTIFICIAL_STRING_P(NODE) TREE_LANG_FLAG_0 (NODE)
240
241typedef enum c_language_kind
242{
243 clk_c, /* A dialect of C: K&R C, ANSI/ISO C89, C2000,
244 etc. */
245 clk_cplusplus, /* ANSI/ISO C++ */
246 clk_objective_c /* Objective C */
247}
248c_language_kind;
249
250/* Information about a statement tree. */
251
252struct stmt_tree_s {
253 /* The last statement added to the tree. */
254 tree x_last_stmt;
255 /* The type of the last expression statement. (This information is
256 needed to implement the statement-expression extension.) */
257 tree x_last_expr_type;
258 /* The last filename we recorded. */
259 const char *x_last_expr_filename;
260 /* In C++, Non-zero if we should treat statements as full
261 expressions. In particular, this variable is no-zero if at the
262 end of a statement we should destroy any temporaries created
263 during that statement. Similarly, if, at the end of a block, we
264 should destroy any local variables in this block. Normally, this
265 variable is non-zero, since those are the normal semantics of
266 C++.
267
268 However, in order to represent aggregate initialization code as
269 tree structure, we use statement-expressions. The statements
270 within the statement expression should not result in cleanups
271 being run until the entire enclosing statement is complete.
272
273 This flag has no effect in C. */
274 int stmts_are_full_exprs_p;
275};
276
277typedef struct stmt_tree_s *stmt_tree;
278
279/* Global state pertinent to the current function. Some C dialects
280 extend this structure with additional fields. */
281
282struct language_function {
283 /* While we are parsing the function, this contains information
284 about the statement-tree that we are building. */
285 struct stmt_tree_s x_stmt_tree;
286 /* The stack of SCOPE_STMTs for the current function. */
287 tree x_scope_stmt_stack;
288};
289
290/* When building a statement-tree, this is the last statement added to
--- 22 unchanged lines hidden (view full) ---
313 } while (0)
314
315/* Language-specific hooks. */
316
317extern int (*lang_statement_code_p) PARAMS ((enum tree_code));
318extern void (*lang_expand_stmt) PARAMS ((tree));
319extern void (*lang_expand_decl_stmt) PARAMS ((tree));
320extern void (*lang_expand_function_end) PARAMS ((void));
321
322/* Callback that determines if it's ok for a function to have no
323 noreturn attribute. */
324extern int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
325
326
327extern stmt_tree current_stmt_tree PARAMS ((void));
328extern tree *current_scope_stmt_stack PARAMS ((void));
329extern void begin_stmt_tree PARAMS ((tree *));
330extern tree add_stmt PARAMS ((tree));
331extern void add_decl_stmt PARAMS ((tree));
332extern tree add_scope_stmt PARAMS ((int, int));
333extern void finish_stmt_tree PARAMS ((tree *));
334
335extern int statement_code_p PARAMS ((enum tree_code));
336extern tree walk_stmt_tree PARAMS ((tree *,
337 walk_tree_fn,
338 void *));
339extern void prep_stmt PARAMS ((tree));
340extern void expand_stmt PARAMS ((tree));
341extern void mark_stmt_tree PARAMS ((void *));
342extern void shadow_warning PARAMS ((const char *,
343 tree, tree));
344extern tree c_begin_if_stmt PARAMS ((void));
345extern tree c_begin_while_stmt PARAMS ((void));
346extern void c_finish_while_stmt_cond PARAMS ((tree, tree));
347
348
349/* Extra information associated with a DECL. Other C dialects extend
350 this structure in various ways. The C front-end only uses this
351 structure for FUNCTION_DECLs; all other DECLs have a NULL
352 DECL_LANG_SPECIFIC field. */
353
354struct c_lang_decl {
355 unsigned declared_inline : 1;
356};
357
358/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is
359 the approximate number of statements in this function. There is
360 no need for this number to be exact; it is only used in various
361 heuristics regarding optimization. */
362#define DECL_NUM_STMTS(NODE) \
363 (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
364
365extern void c_mark_lang_decl PARAMS ((struct c_lang_decl *));
366
367/* The variant of the C language being processed. Each C language
368 front-end defines this variable. */
369
370extern c_language_kind c_language;
371
372/* Nonzero means give string constants the type `const char *', rather
373 than `char *'. */
374
375extern int flag_const_strings;
376
377/* Nonzero means give `double' the same size as `float'. */
378
379extern int flag_short_double;
380
381/* Nonzero means give `wchar_t' the same size as `short'. */
382
383extern int flag_short_wchar;
384
385/* Warn about *printf or *scanf format/argument anomalies. */
386
387extern int warn_format;
388
389/* Warn about Y2K problems with strftime formats. */
390
391extern int warn_format_y2k;
392
393/* Warn about excess arguments to formats. */
394
395extern int warn_format_extra_args;
396
397/* Warn about non-literal format arguments. */
398
399extern int warn_format_nonliteral;
400
401/* Warn about possible security problems with calls to format functions. */
402
403extern int warn_format_security;
404
405/* Warn about possible violations of sequence point rules. */
406
407extern int warn_sequence_point;
408
409/* Warn about functions which might be candidates for format attributes. */
410
411extern int warn_missing_format_attribute;
412
413/* Nonzero means do not warn that K&R style main() is not a function prototype. */
414
415extern int flag_bsd_no_warn_kr_main;
416
417/* Nonzero means warn about sizeof (function) or addition/subtraction
418 of function pointers. */
419
420extern int warn_pointer_arith;
421
422/* Nonzero means to warn about compile-time division by zero. */
423extern int warn_div_by_zero;
424
425/* Nonzero means do some things the same way PCC does. */
426
427extern int flag_traditional;
428
429/* Nonzero means enable C89 Amendment 1 features. */
430
431extern int flag_isoc94;
432
433/* Nonzero means use the ISO C99 dialect of C. */
434
435extern int flag_isoc99;
436
437/* Nonzero means allow the BSD kernel printf enhancments. */
438
439extern int flag_bsd_format;
440
441/* Nonzero means environment is hosted (i.e., not freestanding) */
442
443extern int flag_hosted;
444
445/* Nonzero means add default format_arg attributes for functions not
446 in ISO C. */
447
448extern int flag_noniso_default_format_attributes;
449
450/* Nonzero means don't recognize any builtin functions. */
451
452extern int flag_no_builtin;
453
454/* Nonzero means don't recognize the non-ANSI builtin functions.
455 -ansi sets this. */
456
457extern int flag_no_nonansi_builtin;
458
459/* Nonzero means warn about suggesting putting in ()'s. */
460
461extern int warn_parentheses;
462
463/* Warn if a type conversion is done that might have confusing results. */
464
465extern int warn_conversion;
466
467/* Nonzero means warn about usage of long long,
468 when `-pedantic' and not C99. */
469
470extern int warn_long_long;
471
472/* Nonzero means the expression being parsed will never be evaluated.
473 This is a count, since unevaluated expressions can nest. */
474
475extern int skip_evaluation;
476
477/* C types are partitioned into three subsets: object, function, and
478 incomplete types. */
479#define C_TYPE_OBJECT_P(type) \
--- 9 unchanged lines hidden (view full) ---
489 object or incomplete types. */
490#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
491 (!C_TYPE_FUNCTION_P (type))
492
493/* Record in each node resulting from a binary operator
494 what operator was specified for it. */
495#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
496
497/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
498 ID is the identifier to use, NAME is the string.
499 TYPE_DEP indicates whether it depends on type of the function or not
500 (i.e. __PRETTY_FUNCTION__). */
501
502extern tree (*make_fname_decl) PARAMS ((tree, int));
503
504extern tree identifier_global_value PARAMS ((tree));
505extern void record_builtin_type PARAMS ((enum rid,
506 const char *, tree));
507extern tree build_void_list_node PARAMS ((void));
508extern void start_fname_decls PARAMS ((void));
509extern void finish_fname_decls PARAMS ((void));
510extern const char *fname_as_string PARAMS ((int));
511extern tree fname_decl PARAMS ((unsigned, tree));
512extern const char *fname_string PARAMS ((unsigned));
513
514extern void check_function_format PARAMS ((int *, tree, tree));
515extern void set_Wformat PARAMS ((int));
516extern tree handle_format_attribute PARAMS ((tree *, tree, tree,
517 int, bool *));
518extern tree handle_format_arg_attribute PARAMS ((tree *, tree, tree,
519 int, bool *));
520extern void c_common_insert_default_attributes PARAMS ((tree));
521extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
522extern tree c_sizeof PARAMS ((tree));
523extern tree c_alignof PARAMS ((tree));
524extern tree c_alignof_expr PARAMS ((tree));
525/* Print an error message for invalid operands to arith operation CODE.
526 NOP_EXPR is used as a special case (see truthvalue_conversion). */
527extern void binary_op_error PARAMS ((enum tree_code));
528extern tree c_expand_expr_stmt PARAMS ((tree));
529extern void c_expand_start_cond PARAMS ((tree, int, tree));
530extern void c_finish_then PARAMS ((void));
531extern void c_expand_start_else PARAMS ((void));
532extern void c_finish_else PARAMS ((void));
533extern void c_expand_end_cond PARAMS ((void));
534/* Validate the expression after `case' and apply default promotions. */
535extern tree check_case_value PARAMS ((tree));
536/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
537extern tree combine_strings PARAMS ((tree));
538extern void constant_expression_warning PARAMS ((tree));
539extern tree convert_and_check PARAMS ((tree, tree));
540extern void overflow_warning PARAMS ((tree));
541extern void unsigned_conversion_warning PARAMS ((tree, tree));
542
543/* Read the rest of the current #-directive line. */
544extern char *get_directive_line PARAMS ((void));
545#define GET_DIRECTIVE_LINE() get_directive_line ()
546
547/* Subroutine of build_binary_op, used for comparison operations.
548 See if the operands have both been converted from subword integer types
549 and, if so, perhaps change them both back to their original type. */
550extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *));
551
552extern tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
553extern unsigned int min_precision PARAMS ((tree, int));
--- 5 unchanged lines hidden (view full) ---
559 frontends. */
560extern void c_common_nodes_and_builtins PARAMS ((void));
561
562extern void disable_builtin_function PARAMS ((const char *));
563
564extern tree build_va_arg PARAMS ((tree, tree));
565
566extern void c_common_init_options PARAMS ((enum c_language_kind));
567extern void c_common_post_options PARAMS ((void));
568extern const char *c_common_init PARAMS ((const char *));
569extern void c_common_finish PARAMS ((void));
570extern HOST_WIDE_INT c_common_get_alias_set PARAMS ((tree));
571extern bool c_promoting_integer_type_p PARAMS ((tree));
572extern int self_promoting_args_p PARAMS ((tree));
573extern tree simple_type_promotes_to PARAMS ((tree));
574extern tree strip_array_types PARAMS ((tree));
575
576/* These macros provide convenient access to the various _STMT nodes. */
577
578/* Nonzero if this statement should be considered a full-expression,
579 i.e., if temporaries created during this statement should have
580 their destructors run at the end of this statement. (In C, this
581 will always be false, since there are no destructors.) */
--- 14 unchanged lines hidden (view full) ---
596/* DO_STMT accessors. These give access to the condition of the do
597 statement and the body of the do statement, respectively. */
598#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
599#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
600
601/* RETURN_STMT accessors. These give the expression associated with a
602 return statement, and whether it should be ignored when expanding
603 (as opposed to inlining). */
604#define RETURN_EXPR(NODE) TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
605
606/* EXPR_STMT accessor. This gives the expression associated with an
607 expression statement. */
608#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
609
610/* FOR_STMT accessors. These give access to the init statement,
611 condition, update expression, and body of the for statement,
612 respectively. */
--- 113 unchanged lines hidden (view full) ---
726 (IDENTIFIER_POINTER (FILE_STMT_FILENAME_NODE (NODE)))
727
728/* The line-number at which a statement began. But if
729 STMT_LINENO_FOR_FN_P does holds, then this macro gives the
730 line number for the end of the current function instead. */
731#define STMT_LINENO(NODE) \
732 (TREE_COMPLEXITY ((NODE)))
733
734/* If non-zero, the STMT_LINENO for NODE is the line at which the
735 function ended. */
736#define STMT_LINENO_FOR_FN_P(NODE) \
737 (TREE_LANG_FLAG_2 ((NODE)))
738
739/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
740 initialization variables. */
741#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
742
--- 6 unchanged lines hidden (view full) ---
749enum c_tree_code {
750 C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
751#include "c-common.def"
752 LAST_C_TREE_CODE
753};
754
755#undef DEFTREECODE
756
757extern void add_c_tree_codes PARAMS ((void));
758extern void genrtl_do_pushlevel PARAMS ((void));
759extern void genrtl_goto_stmt PARAMS ((tree));
760extern void genrtl_expr_stmt PARAMS ((tree));
761extern void genrtl_expr_stmt_value PARAMS ((tree, int, int));
762extern void genrtl_decl_stmt PARAMS ((tree));
763extern void genrtl_if_stmt PARAMS ((tree));
764extern void genrtl_while_stmt PARAMS ((tree));
765extern void genrtl_do_stmt PARAMS ((tree));
--- 69 unchanged lines hidden (view full) ---
835/* Handle increment and decrement of boolean types. */
836extern tree boolean_increment PARAMS ((enum tree_code,
837 tree));
838
839/* Hook currently used only by the C++ front end to reset internal state
840 after entering or leaving a header file. */
841extern void extract_interface_info PARAMS ((void));
842
843extern void mark_c_language_function PARAMS ((struct language_function *));
844
845extern int case_compare PARAMS ((splay_tree_key,
846 splay_tree_key));
847
848extern tree c_add_case_label PARAMS ((splay_tree,
849 tree, tree,
850 tree));
851
852extern tree build_function_call PARAMS ((tree, tree));
853
854extern tree finish_label_address_expr PARAMS ((tree));
855
856/* Same function prototype, but the C and C++ front ends have
857 different implementations. Used in c-common.c. */
858extern tree lookup_label PARAMS ((tree));
859
860/* enum expand_modified is in expr.h, as is the macro below. */
861
862#ifdef QUEUED_VAR
863extern rtx c_expand_expr PARAMS ((tree, rtx, enum machine_mode,
864 enum expand_modifier));
865#endif
866
867extern int c_safe_from_p PARAMS ((rtx, tree));
868
869extern int c_staticp PARAMS ((tree));
870
871extern int c_unsafe_for_reeval PARAMS ((tree));
872
873/* Information recorded about each file examined during compilation. */
874
875struct c_fileinfo
876{
877 int time; /* Time spent in the file. */
878 short interface_only; /* Flags - used only by C++ */
879 short interface_unknown;
880};
881
882struct c_fileinfo *get_fileinfo PARAMS ((const char *));
883extern void dump_time_statistics PARAMS ((void));
884
885#endif /* ! GCC_C_COMMON_H */
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
--- 5 unchanged lines hidden (view full) ---
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-common.h 110622 2003-02-10 05:58:19Z kan $ */
23
24#ifndef GCC_C_COMMON_H
25#define GCC_C_COMMON_H
26
27#include "splay-tree.h"
28#include "cpplib.h"
29
30/* Usage of TREE_LANG_FLAG_?:
31 0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
--- 8 unchanged lines hidden (view full) ---
40 STMT_IS_FULL_EXPR_P (in _STMT)
41 2: STMT_LINENO_FOR_FN_P (in _STMT)
42 3: SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
43 COMPOUND_STMT_BODY_BLOCK (in COMPOUND_STMT)
44 4: SCOPE_PARTIAL_P (in SCOPE_STMT)
45*/
46
47/* Reserved identifiers. This is the union of all the keywords for C,
48 C++, and Objective C. All the type modifiers have to be in one
49 block at the beginning, because they are used as mask bits. There
50 are 27 type modifiers; if we add many more we will have to redesign
51 the mask mechanism. */
52
53enum rid
54{
55 /* Modifiers: */
56 /* C, in empirical order of frequency. */
57 RID_STATIC = 0,
58 RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN,
59 RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
60 RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
61
62 /* C extensions */
63 RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX,
64
65 /* C++ */
66 RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
67
68 /* ObjC */
69 RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
70
71 /* C */
--- 18 unchanged lines hidden (view full) ---
90 RID_DELETE, RID_FALSE, RID_NAMESPACE,
91 RID_NEW, RID_OPERATOR, RID_THIS,
92 RID_THROW, RID_TRUE, RID_TRY,
93 RID_TYPENAME, RID_TYPEID, RID_USING,
94
95 /* casts */
96 RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
97
98 /* alternate spellings */
99 RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ,
100 RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ,
101 RID_BITAND, RID_BITOR, RID_COMPL,
102
103 /* Objective C */
104 RID_ID, RID_AT_ENCODE, RID_AT_END,
105 RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
106 RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
107 RID_AT_PROTOCOL, RID_AT_SELECTOR, RID_AT_INTERFACE,
108 RID_AT_IMPLEMENTATION,
109
110 RID_MAX,
111
--- 64 unchanged lines hidden (view full) ---
176
177 CTI_MAX
178};
179
180#define C_RID_CODE(id) (((struct c_common_identifier *) (id))->node.rid_code)
181
182/* Identifier part common to the C front ends. Inherits from
183 tree_identifier, despite appearances. */
184struct c_common_identifier
185{
186 struct tree_common common;
187 struct cpp_hashnode node;
188};
189
190#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
191#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
192#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
193#define wint_type_node c_global_trees[CTI_WINT_TYPE]
194#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
195#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
--- 27 unchanged lines hidden (view full) ---
223#define function_name_decl_node c_global_trees[CTI_FUNCTION_NAME_DECL]
224#define pretty_function_name_decl_node c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
225#define c99_function_name_decl_node c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
226#define saved_function_name_decls c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
227
228/* A node for `((void) 0)'. */
229#define void_zero_node c_global_trees[CTI_VOID_ZERO]
230
231extern tree c_global_trees[CTI_MAX];
232
233/* Mark which labels are explicitly declared.
234 These may be shadowed, and may be referenced from nested functions. */
235#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
236
237/* Flag strings given by __FUNCTION__ and __PRETTY_FUNCTION__ for a
238 warning if they undergo concatenation. */
239#define C_ARTIFICIAL_STRING_P(NODE) TREE_LANG_FLAG_0 (NODE)
240
241typedef enum c_language_kind
242{
243 clk_c, /* A dialect of C: K&R C, ANSI/ISO C89, C2000,
244 etc. */
245 clk_cplusplus, /* ANSI/ISO C++ */
246 clk_objective_c /* Objective C */
247}
248c_language_kind;
249
250/* Information about a statement tree. */
251
252struct stmt_tree_s {
253 /* The last statement added to the tree. */
254 tree x_last_stmt;
255 /* The type of the last expression statement. (This information is
256 needed to implement the statement-expression extension.) */
257 tree x_last_expr_type;
258 /* The last filename we recorded. */
259 const char *x_last_expr_filename;
260 /* In C++, Non-zero if we should treat statements as full
261 expressions. In particular, this variable is no-zero if at the
262 end of a statement we should destroy any temporaries created
263 during that statement. Similarly, if, at the end of a block, we
264 should destroy any local variables in this block. Normally, this
265 variable is non-zero, since those are the normal semantics of
266 C++.
267
268 However, in order to represent aggregate initialization code as
269 tree structure, we use statement-expressions. The statements
270 within the statement expression should not result in cleanups
271 being run until the entire enclosing statement is complete.
272
273 This flag has no effect in C. */
274 int stmts_are_full_exprs_p;
275};
276
277typedef struct stmt_tree_s *stmt_tree;
278
279/* Global state pertinent to the current function. Some C dialects
280 extend this structure with additional fields. */
281
282struct language_function {
283 /* While we are parsing the function, this contains information
284 about the statement-tree that we are building. */
285 struct stmt_tree_s x_stmt_tree;
286 /* The stack of SCOPE_STMTs for the current function. */
287 tree x_scope_stmt_stack;
288};
289
290/* When building a statement-tree, this is the last statement added to
--- 22 unchanged lines hidden (view full) ---
313 } while (0)
314
315/* Language-specific hooks. */
316
317extern int (*lang_statement_code_p) PARAMS ((enum tree_code));
318extern void (*lang_expand_stmt) PARAMS ((tree));
319extern void (*lang_expand_decl_stmt) PARAMS ((tree));
320extern void (*lang_expand_function_end) PARAMS ((void));
321
322/* Callback that determines if it's ok for a function to have no
323 noreturn attribute. */
324extern int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
325
326
327extern stmt_tree current_stmt_tree PARAMS ((void));
328extern tree *current_scope_stmt_stack PARAMS ((void));
329extern void begin_stmt_tree PARAMS ((tree *));
330extern tree add_stmt PARAMS ((tree));
331extern void add_decl_stmt PARAMS ((tree));
332extern tree add_scope_stmt PARAMS ((int, int));
333extern void finish_stmt_tree PARAMS ((tree *));
334
335extern int statement_code_p PARAMS ((enum tree_code));
336extern tree walk_stmt_tree PARAMS ((tree *,
337 walk_tree_fn,
338 void *));
339extern void prep_stmt PARAMS ((tree));
340extern void expand_stmt PARAMS ((tree));
341extern void mark_stmt_tree PARAMS ((void *));
342extern void shadow_warning PARAMS ((const char *,
343 tree, tree));
344extern tree c_begin_if_stmt PARAMS ((void));
345extern tree c_begin_while_stmt PARAMS ((void));
346extern void c_finish_while_stmt_cond PARAMS ((tree, tree));
347
348
349/* Extra information associated with a DECL. Other C dialects extend
350 this structure in various ways. The C front-end only uses this
351 structure for FUNCTION_DECLs; all other DECLs have a NULL
352 DECL_LANG_SPECIFIC field. */
353
354struct c_lang_decl {
355 unsigned declared_inline : 1;
356};
357
358/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is
359 the approximate number of statements in this function. There is
360 no need for this number to be exact; it is only used in various
361 heuristics regarding optimization. */
362#define DECL_NUM_STMTS(NODE) \
363 (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
364
365extern void c_mark_lang_decl PARAMS ((struct c_lang_decl *));
366
367/* The variant of the C language being processed. Each C language
368 front-end defines this variable. */
369
370extern c_language_kind c_language;
371
372/* Nonzero means give string constants the type `const char *', rather
373 than `char *'. */
374
375extern int flag_const_strings;
376
377/* Nonzero means give `double' the same size as `float'. */
378
379extern int flag_short_double;
380
381/* Nonzero means give `wchar_t' the same size as `short'. */
382
383extern int flag_short_wchar;
384
385/* Warn about *printf or *scanf format/argument anomalies. */
386
387extern int warn_format;
388
389/* Warn about Y2K problems with strftime formats. */
390
391extern int warn_format_y2k;
392
393/* Warn about excess arguments to formats. */
394
395extern int warn_format_extra_args;
396
397/* Warn about non-literal format arguments. */
398
399extern int warn_format_nonliteral;
400
401/* Warn about possible security problems with calls to format functions. */
402
403extern int warn_format_security;
404
405/* Warn about possible violations of sequence point rules. */
406
407extern int warn_sequence_point;
408
409/* Warn about functions which might be candidates for format attributes. */
410
411extern int warn_missing_format_attribute;
412
413/* Nonzero means do not warn that K&R style main() is not a function prototype. */
414
415extern int flag_bsd_no_warn_kr_main;
416
417/* Nonzero means warn about sizeof (function) or addition/subtraction
418 of function pointers. */
419
420extern int warn_pointer_arith;
421
422/* Nonzero means to warn about compile-time division by zero. */
423extern int warn_div_by_zero;
424
425/* Nonzero means do some things the same way PCC does. */
426
427extern int flag_traditional;
428
429/* Nonzero means enable C89 Amendment 1 features. */
430
431extern int flag_isoc94;
432
433/* Nonzero means use the ISO C99 dialect of C. */
434
435extern int flag_isoc99;
436
437/* Nonzero means allow the BSD kernel printf enhancments. */
438
439extern int flag_bsd_format;
440
441/* Nonzero means environment is hosted (i.e., not freestanding) */
442
443extern int flag_hosted;
444
445/* Nonzero means add default format_arg attributes for functions not
446 in ISO C. */
447
448extern int flag_noniso_default_format_attributes;
449
450/* Nonzero means don't recognize any builtin functions. */
451
452extern int flag_no_builtin;
453
454/* Nonzero means don't recognize the non-ANSI builtin functions.
455 -ansi sets this. */
456
457extern int flag_no_nonansi_builtin;
458
459/* Nonzero means warn about suggesting putting in ()'s. */
460
461extern int warn_parentheses;
462
463/* Warn if a type conversion is done that might have confusing results. */
464
465extern int warn_conversion;
466
467/* Nonzero means warn about usage of long long,
468 when `-pedantic' and not C99. */
469
470extern int warn_long_long;
471
472/* Nonzero means the expression being parsed will never be evaluated.
473 This is a count, since unevaluated expressions can nest. */
474
475extern int skip_evaluation;
476
477/* C types are partitioned into three subsets: object, function, and
478 incomplete types. */
479#define C_TYPE_OBJECT_P(type) \
--- 9 unchanged lines hidden (view full) ---
489 object or incomplete types. */
490#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
491 (!C_TYPE_FUNCTION_P (type))
492
493/* Record in each node resulting from a binary operator
494 what operator was specified for it. */
495#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
496
497/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
498 ID is the identifier to use, NAME is the string.
499 TYPE_DEP indicates whether it depends on type of the function or not
500 (i.e. __PRETTY_FUNCTION__). */
501
502extern tree (*make_fname_decl) PARAMS ((tree, int));
503
504extern tree identifier_global_value PARAMS ((tree));
505extern void record_builtin_type PARAMS ((enum rid,
506 const char *, tree));
507extern tree build_void_list_node PARAMS ((void));
508extern void start_fname_decls PARAMS ((void));
509extern void finish_fname_decls PARAMS ((void));
510extern const char *fname_as_string PARAMS ((int));
511extern tree fname_decl PARAMS ((unsigned, tree));
512extern const char *fname_string PARAMS ((unsigned));
513
514extern void check_function_format PARAMS ((int *, tree, tree));
515extern void set_Wformat PARAMS ((int));
516extern tree handle_format_attribute PARAMS ((tree *, tree, tree,
517 int, bool *));
518extern tree handle_format_arg_attribute PARAMS ((tree *, tree, tree,
519 int, bool *));
520extern void c_common_insert_default_attributes PARAMS ((tree));
521extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
522extern tree c_sizeof PARAMS ((tree));
523extern tree c_alignof PARAMS ((tree));
524extern tree c_alignof_expr PARAMS ((tree));
525/* Print an error message for invalid operands to arith operation CODE.
526 NOP_EXPR is used as a special case (see truthvalue_conversion). */
527extern void binary_op_error PARAMS ((enum tree_code));
528extern tree c_expand_expr_stmt PARAMS ((tree));
529extern void c_expand_start_cond PARAMS ((tree, int, tree));
530extern void c_finish_then PARAMS ((void));
531extern void c_expand_start_else PARAMS ((void));
532extern void c_finish_else PARAMS ((void));
533extern void c_expand_end_cond PARAMS ((void));
534/* Validate the expression after `case' and apply default promotions. */
535extern tree check_case_value PARAMS ((tree));
536/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
537extern tree combine_strings PARAMS ((tree));
538extern void constant_expression_warning PARAMS ((tree));
539extern tree convert_and_check PARAMS ((tree, tree));
540extern void overflow_warning PARAMS ((tree));
541extern void unsigned_conversion_warning PARAMS ((tree, tree));
542
543/* Read the rest of the current #-directive line. */
544extern char *get_directive_line PARAMS ((void));
545#define GET_DIRECTIVE_LINE() get_directive_line ()
546
547/* Subroutine of build_binary_op, used for comparison operations.
548 See if the operands have both been converted from subword integer types
549 and, if so, perhaps change them both back to their original type. */
550extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *));
551
552extern tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
553extern unsigned int min_precision PARAMS ((tree, int));
--- 5 unchanged lines hidden (view full) ---
559 frontends. */
560extern void c_common_nodes_and_builtins PARAMS ((void));
561
562extern void disable_builtin_function PARAMS ((const char *));
563
564extern tree build_va_arg PARAMS ((tree, tree));
565
566extern void c_common_init_options PARAMS ((enum c_language_kind));
567extern void c_common_post_options PARAMS ((void));
568extern const char *c_common_init PARAMS ((const char *));
569extern void c_common_finish PARAMS ((void));
570extern HOST_WIDE_INT c_common_get_alias_set PARAMS ((tree));
571extern bool c_promoting_integer_type_p PARAMS ((tree));
572extern int self_promoting_args_p PARAMS ((tree));
573extern tree simple_type_promotes_to PARAMS ((tree));
574extern tree strip_array_types PARAMS ((tree));
575
576/* These macros provide convenient access to the various _STMT nodes. */
577
578/* Nonzero if this statement should be considered a full-expression,
579 i.e., if temporaries created during this statement should have
580 their destructors run at the end of this statement. (In C, this
581 will always be false, since there are no destructors.) */
--- 14 unchanged lines hidden (view full) ---
596/* DO_STMT accessors. These give access to the condition of the do
597 statement and the body of the do statement, respectively. */
598#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
599#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
600
601/* RETURN_STMT accessors. These give the expression associated with a
602 return statement, and whether it should be ignored when expanding
603 (as opposed to inlining). */
604#define RETURN_EXPR(NODE) TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
605
606/* EXPR_STMT accessor. This gives the expression associated with an
607 expression statement. */
608#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
609
610/* FOR_STMT accessors. These give access to the init statement,
611 condition, update expression, and body of the for statement,
612 respectively. */
--- 113 unchanged lines hidden (view full) ---
726 (IDENTIFIER_POINTER (FILE_STMT_FILENAME_NODE (NODE)))
727
728/* The line-number at which a statement began. But if
729 STMT_LINENO_FOR_FN_P does holds, then this macro gives the
730 line number for the end of the current function instead. */
731#define STMT_LINENO(NODE) \
732 (TREE_COMPLEXITY ((NODE)))
733
734/* If non-zero, the STMT_LINENO for NODE is the line at which the
735 function ended. */
736#define STMT_LINENO_FOR_FN_P(NODE) \
737 (TREE_LANG_FLAG_2 ((NODE)))
738
739/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
740 initialization variables. */
741#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
742
--- 6 unchanged lines hidden (view full) ---
749enum c_tree_code {
750 C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
751#include "c-common.def"
752 LAST_C_TREE_CODE
753};
754
755#undef DEFTREECODE
756
757extern void add_c_tree_codes PARAMS ((void));
758extern void genrtl_do_pushlevel PARAMS ((void));
759extern void genrtl_goto_stmt PARAMS ((tree));
760extern void genrtl_expr_stmt PARAMS ((tree));
761extern void genrtl_expr_stmt_value PARAMS ((tree, int, int));
762extern void genrtl_decl_stmt PARAMS ((tree));
763extern void genrtl_if_stmt PARAMS ((tree));
764extern void genrtl_while_stmt PARAMS ((tree));
765extern void genrtl_do_stmt PARAMS ((tree));
--- 69 unchanged lines hidden (view full) ---
835/* Handle increment and decrement of boolean types. */
836extern tree boolean_increment PARAMS ((enum tree_code,
837 tree));
838
839/* Hook currently used only by the C++ front end to reset internal state
840 after entering or leaving a header file. */
841extern void extract_interface_info PARAMS ((void));
842
843extern void mark_c_language_function PARAMS ((struct language_function *));
844
845extern int case_compare PARAMS ((splay_tree_key,
846 splay_tree_key));
847
848extern tree c_add_case_label PARAMS ((splay_tree,
849 tree, tree,
850 tree));
851
852extern tree build_function_call PARAMS ((tree, tree));
853
854extern tree finish_label_address_expr PARAMS ((tree));
855
856/* Same function prototype, but the C and C++ front ends have
857 different implementations. Used in c-common.c. */
858extern tree lookup_label PARAMS ((tree));
859
860/* enum expand_modified is in expr.h, as is the macro below. */
861
862#ifdef QUEUED_VAR
863extern rtx c_expand_expr PARAMS ((tree, rtx, enum machine_mode,
864 enum expand_modifier));
865#endif
866
867extern int c_safe_from_p PARAMS ((rtx, tree));
868
869extern int c_staticp PARAMS ((tree));
870
871extern int c_unsafe_for_reeval PARAMS ((tree));
872
873/* Information recorded about each file examined during compilation. */
874
875struct c_fileinfo
876{
877 int time; /* Time spent in the file. */
878 short interface_only; /* Flags - used only by C++ */
879 short interface_unknown;
880};
881
882struct c_fileinfo *get_fileinfo PARAMS ((const char *));
883extern void dump_time_statistics PARAMS ((void));
884
885#endif /* ! GCC_C_COMMON_H */