1 /* Separate lexical analyzer for GNU C++.
2 Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* This file is the lexical analyzer for GNU C++. */
26 /* Cause the `yydebug' variable to be defined. */
45 #include "diagnostic.h"
47 #ifdef MULTIBYTE_CHARS
52 extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
54 static int interface_strcmp PARAMS ((const char *));
55 static int *init_cpp_parse PARAMS ((void));
56 static void init_cp_pragma PARAMS ((void));
58 static tree parse_strconst_pragma PARAMS ((const char *, int));
59 static void handle_pragma_vtable PARAMS ((cpp_reader *));
60 static void handle_pragma_unit PARAMS ((cpp_reader *));
61 static void handle_pragma_interface PARAMS ((cpp_reader *));
62 static void handle_pragma_implementation PARAMS ((cpp_reader *));
63 static void handle_pragma_java_exceptions PARAMS ((cpp_reader *));
65 #ifdef GATHER_STATISTICS
67 static int reduce_cmp PARAMS ((int *, int *));
68 static int token_cmp PARAMS ((int *, int *));
71 static int is_global PARAMS ((tree));
72 static void init_operators PARAMS ((void));
73 static void copy_lang_type PARAMS ((tree));
75 /* A constraint that can be tested at compile time. */
77 #define CONSTRAINT(name, expr) extern int constraint_##name [(expr) ? 1 : -1]
79 #define CONSTRAINT(name, expr) extern int constraint_/**/name [(expr) ? 1 : -1]
84 extern int yychar; /* the lookahead symbol */
85 extern YYSTYPE yylval; /* the semantic value of the */
86 /* lookahead symbol */
88 /* These flags are used by c-lex.c. In C++, they're always off and on,
90 int warn_traditional = 0;
91 int flag_digraphs = 1;
93 /* the declaration found for the last IDENTIFIER token read in.
94 yylex must look this up to detect typedefs, which get token type TYPENAME,
95 so it is left around in case the identifier is not a typedef but is
96 used in a context which makes it a reference to a variable. */
99 /* Array for holding counts of the numbers of tokens seen. */
100 extern int *token_count;
102 /* Functions and data structures for #pragma interface.
104 `#pragma implementation' means that the main file being compiled
105 is considered to implement (provide) the classes that appear in
106 its main body. I.e., if this is file "foo.cc", and class `bar'
107 is defined in "foo.cc", then we say that "foo.cc implements bar".
109 All main input files "implement" themselves automagically.
111 `#pragma interface' means that unless this file (of the form "foo.h"
112 is not presently being included by file "foo.cc", the
113 CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
114 of the vtables nor any of the inline functions defined in foo.h
117 There are cases when we want to link files such as "defs.h" and
118 "main.cc". In this case, we give "defs.h" a `#pragma interface',
119 and "main.cc" has `#pragma implementation "defs.h"'. */
123 const char *filename;
124 struct impl_files *next;
127 static struct impl_files *impl_file_chain;
130 /* Return something to represent absolute declarators containing a *.
131 TARGET is the absolute declarator that the * contains.
132 CV_QUALIFIERS is a list of modifiers such as const or volatile
133 to apply to the pointer type, represented as identifiers.
135 We return an INDIRECT_REF whose "contents" are TARGET
136 and whose type is the modifier list. */
139 make_pointer_declarator (cv_qualifiers, target)
140 tree cv_qualifiers, target;
142 if (target && TREE_CODE (target) == IDENTIFIER_NODE
143 && ANON_AGGRNAME_P (target))
144 error ("type name expected before `*'");
145 target = build_nt (INDIRECT_REF, target);
146 TREE_TYPE (target) = cv_qualifiers;
150 /* Return something to represent absolute declarators containing a &.
151 TARGET is the absolute declarator that the & contains.
152 CV_QUALIFIERS is a list of modifiers such as const or volatile
153 to apply to the reference type, represented as identifiers.
155 We return an ADDR_EXPR whose "contents" are TARGET
156 and whose type is the modifier list. */
159 make_reference_declarator (cv_qualifiers, target)
160 tree cv_qualifiers, target;
164 if (TREE_CODE (target) == ADDR_EXPR)
166 error ("cannot declare references to references");
169 if (TREE_CODE (target) == INDIRECT_REF)
171 error ("cannot declare pointers to references");
174 if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
175 error ("type name expected before `&'");
177 target = build_nt (ADDR_EXPR, target);
178 TREE_TYPE (target) = cv_qualifiers;
183 make_call_declarator (target, parms, cv_qualifiers, exception_specification)
184 tree target, parms, cv_qualifiers, exception_specification;
186 target = build_nt (CALL_EXPR, target,
187 tree_cons (parms, cv_qualifiers, NULL_TREE),
188 /* The third operand is really RTL. We
189 shouldn't put anything there. */
191 CALL_DECLARATOR_EXCEPTION_SPEC (target) = exception_specification;
196 set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification)
197 tree call_declarator, cv_qualifiers, exception_specification;
199 CALL_DECLARATOR_QUALS (call_declarator) = cv_qualifiers;
200 CALL_DECLARATOR_EXCEPTION_SPEC (call_declarator) = exception_specification;
203 int interface_only; /* whether or not current file is only for
204 interface definitions. */
205 int interface_unknown; /* whether or not we know this class
206 to behave according to #pragma interface. */
208 /* Tree code classes. */
210 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
212 static const char cplus_tree_code_type[] = {
214 #include "cp-tree.def"
218 /* Table indexed by tree code giving number of expression
219 operands beyond the fixed part of the node structure.
220 Not used for types or decls. */
222 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
224 static const int cplus_tree_code_length[] = {
226 #include "cp-tree.def"
230 /* Names of tree components.
231 Used for printing out the tree and error messages. */
232 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
234 static const char *const cplus_tree_code_name[] = {
236 #include "cp-tree.def"
240 /* Post-switch processing. */
244 cpp_post_options (parse_in);
250 parse_in = cpp_create_reader (CLK_GNUCXX);
252 /* Default exceptions on. */
254 /* Mark as "unspecified". */
255 flag_bounds_check = -1;
256 /* By default wrap lines at 80 characters. Is getenv ("COLUMNS")
258 diagnostic_line_cutoff (global_dc) = 80;
259 /* By default, emit location information once for every
260 diagnostic message. */
261 diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
268 GNU_xref_end (errorcount+sorrycount);
274 #ifdef GATHER_STATISTICS
276 reduce_count = (int *) xcalloc (sizeof (int), (REDUCE_LENGTH + 1));
278 token_count = (int *) xcalloc (sizeof (int), (TOKEN_LENGTH + 1));
285 /* A mapping from tree codes to operator name information. */
286 operator_name_info_t operator_name_info[(int) LAST_CPLUS_TREE_CODE];
287 /* Similar, but for assignment operators. */
288 operator_name_info_t assignment_operator_name_info[(int) LAST_CPLUS_TREE_CODE];
290 /* Initialize data structures that keep track of operator names. */
292 #define DEF_OPERATOR(NAME, C, M, AR, AP) \
293 CONSTRAINT (C, sizeof "operator " + sizeof NAME <= 256);
294 #include "operators.def"
302 struct operator_name_info_t *oni;
304 #define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \
305 sprintf (buffer, ISALPHA (NAME[0]) ? "operator %s" : "operator%s", NAME); \
306 identifier = get_identifier (buffer); \
307 IDENTIFIER_OPNAME_P (identifier) = 1; \
310 ? &assignment_operator_name_info[(int) CODE] \
311 : &operator_name_info[(int) CODE]); \
312 oni->identifier = identifier; \
314 oni->mangled_name = MANGLING;
316 #include "operators.def"
319 operator_name_info[(int) ERROR_MARK].identifier
320 = get_identifier ("<invalid operator>");
322 /* Handle some special cases. These operators are not defined in
323 the language, but can be produced internally. We may need them
324 for error-reporting. (Eventually, we should ensure that this
325 does not happen. Error messages involving these operators will
326 be confusing to users.) */
328 operator_name_info [(int) INIT_EXPR].name
329 = operator_name_info [(int) MODIFY_EXPR].name;
330 operator_name_info [(int) EXACT_DIV_EXPR].name = "(ceiling /)";
331 operator_name_info [(int) CEIL_DIV_EXPR].name = "(ceiling /)";
332 operator_name_info [(int) FLOOR_DIV_EXPR].name = "(floor /)";
333 operator_name_info [(int) ROUND_DIV_EXPR].name = "(round /)";
334 operator_name_info [(int) CEIL_MOD_EXPR].name = "(ceiling %)";
335 operator_name_info [(int) FLOOR_MOD_EXPR].name = "(floor %)";
336 operator_name_info [(int) ROUND_MOD_EXPR].name = "(round %)";
337 operator_name_info [(int) ABS_EXPR].name = "abs";
338 operator_name_info [(int) FFS_EXPR].name = "ffs";
339 operator_name_info [(int) BIT_ANDTC_EXPR].name = "&~";
340 operator_name_info [(int) TRUTH_AND_EXPR].name = "strict &&";
341 operator_name_info [(int) TRUTH_OR_EXPR].name = "strict ||";
342 operator_name_info [(int) IN_EXPR].name = "in";
343 operator_name_info [(int) RANGE_EXPR].name = "...";
344 operator_name_info [(int) CONVERT_EXPR].name = "+";
346 assignment_operator_name_info [(int) EXACT_DIV_EXPR].name
348 assignment_operator_name_info [(int) CEIL_DIV_EXPR].name
350 assignment_operator_name_info [(int) FLOOR_DIV_EXPR].name
352 assignment_operator_name_info [(int) ROUND_DIV_EXPR].name
354 assignment_operator_name_info [(int) CEIL_MOD_EXPR].name
356 assignment_operator_name_info [(int) FLOOR_MOD_EXPR].name
358 assignment_operator_name_info [(int) ROUND_MOD_EXPR].name
362 /* The reserved keyword table. */
365 const char *const word;
366 const ENUM_BITFIELD(rid) rid : 16;
367 const unsigned int disable : 16;
370 /* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
372 #define D_EXT 0x01 /* GCC extension */
373 #define D_ASM 0x02 /* in C99, but has a switch to turn it off */
374 #define D_OPNAME 0x04 /* operator names */
376 CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
378 static const struct resword reswords[] =
380 { "_Complex", RID_COMPLEX, 0 },
381 { "__FUNCTION__", RID_FUNCTION_NAME, 0 },
382 { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
383 { "__alignof", RID_ALIGNOF, 0 },
384 { "__alignof__", RID_ALIGNOF, 0 },
385 { "__asm", RID_ASM, 0 },
386 { "__asm__", RID_ASM, 0 },
387 { "__attribute", RID_ATTRIBUTE, 0 },
388 { "__attribute__", RID_ATTRIBUTE, 0 },
389 { "__builtin_va_arg", RID_VA_ARG, 0 },
390 { "__complex", RID_COMPLEX, 0 },
391 { "__complex__", RID_COMPLEX, 0 },
392 { "__const", RID_CONST, 0 },
393 { "__const__", RID_CONST, 0 },
394 { "__extension__", RID_EXTENSION, 0 },
395 { "__func__", RID_C99_FUNCTION_NAME, 0 },
396 { "__imag", RID_IMAGPART, 0 },
397 { "__imag__", RID_IMAGPART, 0 },
398 { "__inline", RID_INLINE, 0 },
399 { "__inline__", RID_INLINE, 0 },
400 { "__label__", RID_LABEL, 0 },
401 { "__null", RID_NULL, 0 },
402 { "__real", RID_REALPART, 0 },
403 { "__real__", RID_REALPART, 0 },
404 { "__restrict", RID_RESTRICT, 0 },
405 { "__restrict__", RID_RESTRICT, 0 },
406 { "__signed", RID_SIGNED, 0 },
407 { "__signed__", RID_SIGNED, 0 },
408 { "__typeof", RID_TYPEOF, 0 },
409 { "__typeof__", RID_TYPEOF, 0 },
410 { "__volatile", RID_VOLATILE, 0 },
411 { "__volatile__", RID_VOLATILE, 0 },
412 { "asm", RID_ASM, D_ASM },
413 { "and", RID_AND, D_OPNAME },
414 { "and_eq", RID_AND_EQ, D_OPNAME },
415 { "auto", RID_AUTO, 0 },
416 { "bitand", RID_BITAND, D_OPNAME },
417 { "bitor", RID_BITOR, D_OPNAME },
418 { "bool", RID_BOOL, 0 },
419 { "break", RID_BREAK, 0 },
420 { "case", RID_CASE, 0 },
421 { "catch", RID_CATCH, 0 },
422 { "char", RID_CHAR, 0 },
423 { "class", RID_CLASS, 0 },
424 { "compl", RID_COMPL, D_OPNAME },
425 { "const", RID_CONST, 0 },
426 { "const_cast", RID_CONSTCAST, 0 },
427 { "continue", RID_CONTINUE, 0 },
428 { "default", RID_DEFAULT, 0 },
429 { "delete", RID_DELETE, 0 },
431 { "double", RID_DOUBLE, 0 },
432 { "dynamic_cast", RID_DYNCAST, 0 },
433 { "else", RID_ELSE, 0 },
434 { "enum", RID_ENUM, 0 },
435 { "explicit", RID_EXPLICIT, 0 },
436 { "export", RID_EXPORT, 0 },
437 { "extern", RID_EXTERN, 0 },
438 { "false", RID_FALSE, 0 },
439 { "float", RID_FLOAT, 0 },
440 { "for", RID_FOR, 0 },
441 { "friend", RID_FRIEND, 0 },
442 { "goto", RID_GOTO, 0 },
444 { "inline", RID_INLINE, 0 },
445 { "int", RID_INT, 0 },
446 { "long", RID_LONG, 0 },
447 { "mutable", RID_MUTABLE, 0 },
448 { "namespace", RID_NAMESPACE, 0 },
449 { "new", RID_NEW, 0 },
450 { "not", RID_NOT, D_OPNAME },
451 { "not_eq", RID_NOT_EQ, D_OPNAME },
452 { "operator", RID_OPERATOR, 0 },
453 { "or", RID_OR, D_OPNAME },
454 { "or_eq", RID_OR_EQ, D_OPNAME },
455 { "private", RID_PRIVATE, 0 },
456 { "protected", RID_PROTECTED, 0 },
457 { "public", RID_PUBLIC, 0 },
458 { "register", RID_REGISTER, 0 },
459 { "reinterpret_cast", RID_REINTCAST, 0 },
460 { "return", RID_RETURN, 0 },
461 { "short", RID_SHORT, 0 },
462 { "signed", RID_SIGNED, 0 },
463 { "sizeof", RID_SIZEOF, 0 },
464 { "static", RID_STATIC, 0 },
465 { "static_cast", RID_STATCAST, 0 },
466 { "struct", RID_STRUCT, 0 },
467 { "switch", RID_SWITCH, 0 },
468 { "template", RID_TEMPLATE, 0 },
469 { "this", RID_THIS, 0 },
470 { "throw", RID_THROW, 0 },
471 { "true", RID_TRUE, 0 },
472 { "try", RID_TRY, 0 },
473 { "typedef", RID_TYPEDEF, 0 },
474 { "typename", RID_TYPENAME, 0 },
475 { "typeid", RID_TYPEID, 0 },
476 { "typeof", RID_TYPEOF, D_ASM|D_EXT },
477 { "union", RID_UNION, 0 },
478 { "unsigned", RID_UNSIGNED, 0 },
479 { "using", RID_USING, 0 },
480 { "virtual", RID_VIRTUAL, 0 },
481 { "void", RID_VOID, 0 },
482 { "volatile", RID_VOLATILE, 0 },
483 { "wchar_t", RID_WCHAR, 0 },
484 { "while", RID_WHILE, 0 },
485 { "xor", RID_XOR, D_OPNAME },
486 { "xor_eq", RID_XOR_EQ, D_OPNAME },
489 #define N_reswords (sizeof reswords / sizeof (struct resword))
491 /* Table mapping from RID_* constants to yacc token numbers.
492 Unfortunately we have to have entries for all the keywords in all
494 const short rid_to_yy[RID_MAX] =
496 /* RID_STATIC */ SCSPEC,
497 /* RID_UNSIGNED */ TYPESPEC,
498 /* RID_LONG */ TYPESPEC,
499 /* RID_CONST */ CV_QUALIFIER,
500 /* RID_EXTERN */ SCSPEC,
501 /* RID_REGISTER */ SCSPEC,
502 /* RID_TYPEDEF */ SCSPEC,
503 /* RID_SHORT */ TYPESPEC,
504 /* RID_INLINE */ SCSPEC,
505 /* RID_VOLATILE */ CV_QUALIFIER,
506 /* RID_SIGNED */ TYPESPEC,
507 /* RID_AUTO */ SCSPEC,
508 /* RID_RESTRICT */ CV_QUALIFIER,
510 /* C extensions. Bounded pointers are not yet in C++ */
512 /* RID_UNBOUNDED */ 0,
513 /* RID_COMPLEX */ TYPESPEC,
516 /* RID_FRIEND */ SCSPEC,
517 /* RID_VIRTUAL */ SCSPEC,
518 /* RID_EXPLICIT */ SCSPEC,
519 /* RID_EXPORT */ EXPORT,
520 /* RID_MUTABLE */ SCSPEC,
531 /* RID_INT */ TYPESPEC,
532 /* RID_CHAR */ TYPESPEC,
533 /* RID_FLOAT */ TYPESPEC,
534 /* RID_DOUBLE */ TYPESPEC,
535 /* RID_VOID */ TYPESPEC,
537 /* RID_STRUCT */ AGGR,
538 /* RID_UNION */ AGGR,
541 /* RID_WHILE */ WHILE,
544 /* RID_SWITCH */ SWITCH,
546 /* RID_DEFAULT */ DEFAULT,
547 /* RID_BREAK */ BREAK,
548 /* RID_CONTINUE */ CONTINUE,
549 /* RID_RETURN */ RETURN_KEYWORD,
551 /* RID_SIZEOF */ SIZEOF,
554 /* RID_ASM */ ASM_KEYWORD,
555 /* RID_TYPEOF */ TYPEOF,
556 /* RID_ALIGNOF */ ALIGNOF,
557 /* RID_ATTRIBUTE */ ATTRIBUTE,
558 /* RID_VA_ARG */ VA_ARG,
559 /* RID_EXTENSION */ EXTENSION,
560 /* RID_IMAGPART */ IMAGPART,
561 /* RID_REALPART */ REALPART,
562 /* RID_LABEL */ LABEL,
564 /* RID_PTREXTENT */ 0,
565 /* RID_PTRVALUE */ 0,
567 /* RID_FUNCTION_NAME */ VAR_FUNC_NAME,
568 /* RID_PRETTY_FUNCTION_NAME */ VAR_FUNC_NAME,
569 /* RID_c99_FUNCTION_NAME */ VAR_FUNC_NAME,
572 /* RID_BOOL */ TYPESPEC,
573 /* RID_WCHAR */ TYPESPEC,
574 /* RID_CLASS */ AGGR,
575 /* RID_PUBLIC */ VISSPEC,
576 /* RID_PRIVATE */ VISSPEC,
577 /* RID_PROTECTED */ VISSPEC,
578 /* RID_TEMPLATE */ TEMPLATE,
579 /* RID_NULL */ CONSTANT,
580 /* RID_CATCH */ CATCH,
581 /* RID_DELETE */ DELETE,
582 /* RID_FALSE */ CXX_FALSE,
583 /* RID_NAMESPACE */ NAMESPACE,
585 /* RID_OPERATOR */ OPERATOR,
587 /* RID_THROW */ THROW,
588 /* RID_TRUE */ CXX_TRUE,
590 /* RID_TYPENAME */ TYPENAME_KEYWORD,
591 /* RID_TYPEID */ TYPEID,
592 /* RID_USING */ USING,
595 /* RID_CONSTCAST */ CONST_CAST,
596 /* RID_DYNCAST */ DYNAMIC_CAST,
597 /* RID_REINTCAST */ REINTERPRET_CAST,
598 /* RID_STATCAST */ STATIC_CAST,
600 /* alternate spellings */
601 /* RID_AND */ ANDAND,
602 /* RID_AND_EQ */ ASSIGN,
604 /* RID_NOT_EQ */ EQCOMPARE,
606 /* RID_OR_EQ */ ASSIGN,
608 /* RID_XOR_EQ */ ASSIGN,
609 /* RID_BITAND */ '&',
615 /* RID_AT_ENCODE */ 0,
617 /* RID_AT_CLASS */ 0,
618 /* RID_AT_ALIAS */ 0,
620 /* RID_AT_PRIVATE */ 0,
621 /* RID_AT_PROTECTED */ 0,
622 /* RID_AT_PUBLIC */ 0,
623 /* RID_AT_PROTOCOL */ 0,
624 /* RID_AT_SELECTOR */ 0,
625 /* RID_AT_INTERFACE */ 0,
626 /* RID_AT_IMPLEMENTATION */ 0
634 int mask = ((flag_operator_names ? 0 : D_OPNAME)
635 | (flag_no_asm ? D_ASM : 0)
636 | (flag_no_gnu_keywords ? D_EXT : 0));
638 /* It is not necessary to register ridpointers as a GC root, because
639 all the trees it points to are permanently interned in the
640 get_identifier hash anyway. */
641 ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
642 for (i = 0; i < N_reswords; i++)
644 id = get_identifier (reswords[i].word);
645 C_RID_CODE (id) = reswords[i].rid;
646 ridpointers [(int) reswords[i].rid] = id;
647 if (! (reswords[i].disable & mask))
648 C_IS_RESERVED_WORD (id) = 1;
655 cpp_register_pragma (parse_in, 0, "vtable", handle_pragma_vtable);
656 cpp_register_pragma (parse_in, 0, "unit", handle_pragma_unit);
658 cpp_register_pragma (parse_in, 0, "interface", handle_pragma_interface);
659 cpp_register_pragma (parse_in, 0, "implementation",
660 handle_pragma_implementation);
662 cpp_register_pragma (parse_in, "GCC", "interface", handle_pragma_interface);
663 cpp_register_pragma (parse_in, "GCC", "implementation",
664 handle_pragma_implementation);
665 cpp_register_pragma (parse_in, "GCC", "java_exceptions",
666 handle_pragma_java_exceptions);
669 /* Initialize the C++ front end. This function is very sensitive to
670 the exact order that things are done here. It would be nice if the
671 initialization done by this routine were moved to its subroutines,
672 and the ordering dependencies clarified and reduced. */
675 const char *filename;
677 decl_printable_name = lang_printable_name;
678 input_filename = "<internal>";
683 init_cplus_expand ();
684 init_cp_semantics ();
688 memcpy (tree_code_type + (int) LAST_C_TREE_CODE,
689 cplus_tree_code_type,
690 (int)LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE);
691 memcpy (tree_code_length + (int) LAST_C_TREE_CODE,
692 cplus_tree_code_length,
693 (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (int));
694 memcpy (tree_code_name + (int) LAST_C_TREE_CODE,
695 cplus_tree_code_name,
696 (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (char *));
702 current_function_decl = NULL;
704 class_type_node = build_int_2 (class_type, 0);
705 TREE_TYPE (class_type_node) = class_type_node;
706 ridpointers[(int) RID_CLASS] = class_type_node;
708 record_type_node = build_int_2 (record_type, 0);
709 TREE_TYPE (record_type_node) = record_type_node;
710 ridpointers[(int) RID_STRUCT] = record_type_node;
712 union_type_node = build_int_2 (union_type, 0);
713 TREE_TYPE (union_type_node) = union_type_node;
714 ridpointers[(int) RID_UNION] = union_type_node;
716 enum_type_node = build_int_2 (enum_type, 0);
717 TREE_TYPE (enum_type_node) = enum_type_node;
718 ridpointers[(int) RID_ENUM] = enum_type_node;
720 cxx_init_decl_processing ();
722 /* Create the built-in __null node. Note that we can't yet call for
723 type_for_size here because integer_type_node and so forth are not
724 set up. Therefore, we don't set the type of these nodes until
725 cxx_init_decl_processing. */
726 null_node = build_int_2 (0, 0);
727 TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
728 ridpointers[RID_NULL] = null_node;
730 token_count = init_cpp_parse ();
731 interface_unknown = 1;
733 filename = c_common_lang_init (filename);
738 GNU_xref_begin (filename);
739 init_repo (filename);
747 cpp_finish (parse_in);
748 /* Call to cpp_destroy () omitted for performance reasons. */
749 errorcount += cpp_errors (parse_in);
753 yyprint (file, yychar, yylval)
766 case IDENTIFIER_DEFN:
770 case PRE_PARSED_CLASS_DECL:
772 if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == TEMPLATE_DECL)
774 fprintf (file, " `%s'", IDENTIFIER_POINTER (DECL_NAME (t)));
777 my_friendly_assert (TREE_CODE (t) == IDENTIFIER_NODE, 224);
778 if (IDENTIFIER_POINTER (t))
779 fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
783 if (yylval.ttype == class_type_node)
784 fprintf (file, " `class'");
785 else if (yylval.ttype == record_type_node)
786 fprintf (file, " `struct'");
787 else if (yylval.ttype == union_type_node)
788 fprintf (file, " `union'");
789 else if (yylval.ttype == enum_type_node)
790 fprintf (file, " `enum'");
792 my_friendly_abort (80);
797 if (TREE_CODE (t) == INTEGER_CST)
799 #if HOST_BITS_PER_WIDE_INT == 64
800 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
803 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
810 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
816 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
821 #if defined(GATHER_STATISTICS) && defined(REDUCE_LENGTH)
822 static int *reduce_count;
828 #define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0]))
829 #define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0]))
832 #ifdef GATHER_STATISTICS
838 reduce_count[yyn] += 1;
845 return reduce_count[*q] - reduce_count[*p];
852 return token_count[*q] - token_count[*p];
858 print_parse_statistics ()
860 #ifdef GATHER_STATISTICS
864 int maxlen = REDUCE_LENGTH;
867 if (reduce_count[-1] == 0)
870 if (TOKEN_LENGTH > REDUCE_LENGTH)
871 maxlen = TOKEN_LENGTH;
872 sorted = (unsigned *) alloca (sizeof (int) * maxlen);
874 for (i = 0; i < TOKEN_LENGTH; i++)
876 qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp);
877 for (i = 0; i < TOKEN_LENGTH; i++)
880 if (token_count[idx] == 0)
882 if (token_count[idx] < token_count[-1])
884 fprintf (stderr, "token %d, `%s', count = %d\n",
885 idx, yytname[YYTRANSLATE (idx)], token_count[idx]);
887 fprintf (stderr, "\n");
888 for (i = 0; i < REDUCE_LENGTH; i++)
890 qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp);
891 for (i = 0; i < REDUCE_LENGTH; i++)
894 if (reduce_count[idx] == 0)
896 if (reduce_count[idx] < reduce_count[-1])
898 fprintf (stderr, "rule %d, line %d, count = %d\n",
899 idx, yyrline[idx], reduce_count[idx]);
901 fprintf (stderr, "\n");
907 /* Sets the value of the 'yydebug' variable to VALUE.
908 This is a function so we don't have to have YYDEBUG defined
909 in order to build the compiler. */
912 cxx_set_yydebug (value)
919 warning ("YYDEBUG not defined.");
923 /* Helper function to load global variables with interface
927 extract_interface_info ()
929 struct c_fileinfo *finfo = 0;
931 if (flag_alt_external_templates)
933 tree til = tinst_for_decl ();
936 finfo = get_fileinfo (TINST_FILE (til));
939 finfo = get_fileinfo (input_filename);
941 interface_only = finfo->interface_only;
942 interface_unknown = finfo->interface_unknown;
944 /* This happens to be a convenient place to put this. */
945 if (flag_gnu_xref) GNU_xref_file (input_filename);
948 /* Return nonzero if S is not considered part of an
949 INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */
955 /* Set the interface/implementation bits for this scope. */
956 struct impl_files *ifiles;
959 for (ifiles = impl_file_chain; ifiles; ifiles = ifiles->next)
961 const char *t1 = ifiles->filename;
964 if (*s1 != *t1 || *s1 == 0)
967 while (*s1 == *t1 && *s1 != 0)
974 /* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
975 if (strchr (s1, '.') || strchr (t1, '.'))
978 if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
989 /* Heuristic to tell whether the user is missing a semicolon
990 after a struct or enum declaration. Emit an error message
991 if we know the user has blown it. */
994 check_for_missing_semicolon (type)
1002 && yychar != IDENTIFIER
1003 && yychar != TYPENAME
1004 && yychar != CV_QUALIFIER
1005 && yychar != SELFNAME)
1006 || yychar == 0 /* EOF */)
1008 if (TYPE_ANONYMOUS_P (type))
1009 error ("semicolon missing after %s declaration",
1010 TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
1012 cp_error ("semicolon missing after declaration of `%T'", type);
1013 shadow_tag (build_tree_list (0, type));
1015 /* Could probably also hack cases where class { ... } f (); appears. */
1020 note_got_semicolon (type)
1024 my_friendly_abort (60);
1025 if (CLASS_TYPE_P (type))
1026 CLASSTYPE_GOT_SEMICOLON (type) = 1;
1030 note_list_got_semicolon (declspecs)
1035 for (link = declspecs; link; link = TREE_CHAIN (link))
1037 tree type = TREE_VALUE (link);
1039 note_got_semicolon (type);
1045 /* Parse a #pragma whose sole argument is a string constant.
1046 If OPT is true, the argument is optional. */
1048 parse_strconst_pragma (name, opt)
1056 if (t == CPP_STRING)
1059 if (c_lex (&x) != CPP_EOF)
1060 warning ("junk at end of #pragma %s", name);
1064 if (t == CPP_EOF && opt)
1067 error ("invalid #pragma %s", name);
1072 handle_pragma_vtable (dfile)
1073 cpp_reader *dfile ATTRIBUTE_UNUSED;
1075 parse_strconst_pragma ("vtable", 0);
1076 sorry ("#pragma vtable no longer supported");
1080 handle_pragma_unit (dfile)
1081 cpp_reader *dfile ATTRIBUTE_UNUSED;
1083 /* Validate syntax, but don't do anything. */
1084 parse_strconst_pragma ("unit", 0);
1088 handle_pragma_interface (dfile)
1089 cpp_reader *dfile ATTRIBUTE_UNUSED;
1091 tree fname = parse_strconst_pragma ("interface", 1);
1092 struct c_fileinfo *finfo;
1093 const char *main_filename;
1095 if (fname == (tree)-1)
1097 else if (fname == 0)
1098 main_filename = lbasename (input_filename);
1100 main_filename = TREE_STRING_POINTER (fname);
1102 finfo = get_fileinfo (input_filename);
1104 if (impl_file_chain == 0)
1106 /* If this is zero at this point, then we are
1107 auto-implementing. */
1108 if (main_input_filename == 0)
1109 main_input_filename = input_filename;
1112 interface_only = interface_strcmp (main_filename);
1113 #ifdef MULTIPLE_SYMBOL_SPACES
1114 if (! interface_only)
1116 interface_unknown = 0;
1118 finfo->interface_only = interface_only;
1119 finfo->interface_unknown = interface_unknown;
1122 /* Note that we have seen a #pragma implementation for the key MAIN_FILENAME.
1123 We used to only allow this at toplevel, but that restriction was buggy
1124 in older compilers and it seems reasonable to allow it in the headers
1125 themselves, too. It only needs to precede the matching #p interface.
1127 We don't touch interface_only or interface_unknown; the user must specify
1128 a matching #p interface for this to have any effect. */
1131 handle_pragma_implementation (dfile)
1132 cpp_reader *dfile ATTRIBUTE_UNUSED;
1134 tree fname = parse_strconst_pragma ("implementation", 1);
1135 const char *main_filename;
1136 struct impl_files *ifiles = impl_file_chain;
1138 if (fname == (tree)-1)
1143 if (main_input_filename)
1144 main_filename = main_input_filename;
1146 main_filename = input_filename;
1147 main_filename = lbasename (main_filename);
1151 main_filename = TREE_STRING_POINTER (fname);
1152 if (cpp_included (parse_in, main_filename))
1153 warning ("#pragma implementation for %s appears after file is included",
1157 for (; ifiles; ifiles = ifiles->next)
1159 if (! strcmp (ifiles->filename, main_filename))
1164 ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
1165 ifiles->filename = main_filename;
1166 ifiles->next = impl_file_chain;
1167 impl_file_chain = ifiles;
1171 /* Indicate that this file uses Java-personality exception handling. */
1173 handle_pragma_java_exceptions (dfile)
1174 cpp_reader *dfile ATTRIBUTE_UNUSED;
1177 if (c_lex (&x) != CPP_EOF)
1178 warning ("junk at end of #pragma GCC java_exceptions");
1180 choose_personality_routine (lang_java);
1184 do_pending_lang_change ()
1186 for (; pending_lang_change > 0; --pending_lang_change)
1187 push_lang_context (lang_name_c);
1188 for (; pending_lang_change < 0; ++pending_lang_change)
1189 pop_lang_context ();
1192 /* Return true if d is in a global scope. */
1199 switch (TREE_CODE (d))
1204 case OVERLOAD: d = OVL_FUNCTION (d); continue;
1205 case TREE_LIST: d = TREE_VALUE (d); continue;
1207 my_friendly_assert (DECL_P (d), 980629);
1209 return DECL_NAMESPACE_SCOPE_P (d);
1214 do_identifier (token, parsing, args)
1215 register tree token;
1220 int lexing = (parsing == 1);
1223 id = lookup_name (token, 0);
1227 /* Do Koenig lookup if appropriate (inside templates we build lookup
1228 expressions instead).
1230 [basic.lookup.koenig]: If the ordinary unqualified lookup of the name
1231 finds the declaration of a class member function, the associated
1232 namespaces and classes are not considered. */
1234 if (args && !current_template_parms && (!id || is_global (id)))
1235 id = lookup_arg_dependent (token, id, args);
1237 /* Remember that this name has been used in the class definition, as per
1240 maybe_note_name_used_in_class (token, id);
1242 if (id == error_mark_node)
1244 /* lookup_name quietly returns error_mark_node if we're parsing,
1245 as we don't want to complain about an identifier that ends up
1246 being used as a declarator. So we call it again to get the error
1248 id = lookup_name (token, 0);
1249 return error_mark_node;
1252 if (!id || (TREE_CODE (id) == FUNCTION_DECL
1253 && DECL_ANTICIPATED (id)))
1255 if (current_template_parms)
1256 return build_min_nt (LOOKUP_EXPR, token);
1257 else if (IDENTIFIER_OPNAME_P (token))
1259 if (token != ansi_opname (ERROR_MARK))
1260 cp_error ("`%D' not defined", token);
1261 id = error_mark_node;
1263 else if (current_function_decl == 0)
1265 cp_error ("`%D' was not declared in this scope", token);
1266 id = error_mark_node;
1270 if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node
1271 || IDENTIFIER_ERROR_LOCUS (token) != current_function_decl)
1273 static int undeclared_variable_notice;
1275 cp_error ("`%D' undeclared (first use this function)", token);
1277 if (! undeclared_variable_notice)
1279 error ("(Each undeclared identifier is reported only once for each function it appears in.)");
1280 undeclared_variable_notice = 1;
1283 id = error_mark_node;
1284 /* Prevent repeated error messages. */
1285 SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
1286 SET_IDENTIFIER_ERROR_LOCUS (token, current_function_decl);
1290 if (TREE_CODE (id) == VAR_DECL && DECL_DEAD_FOR_LOCAL (id))
1292 tree shadowed = DECL_SHADOWED_FOR_VAR (id);
1293 while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
1294 && DECL_DEAD_FOR_LOCAL (shadowed))
1295 shadowed = DECL_SHADOWED_FOR_VAR (shadowed);
1297 shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (id));
1300 if (!DECL_ERROR_REPORTED (id))
1302 warning ("name lookup of `%s' changed",
1303 IDENTIFIER_POINTER (token));
1304 cp_warning_at (" matches this `%D' under ISO standard rules",
1306 cp_warning_at (" matches this `%D' under old rules", id);
1307 DECL_ERROR_REPORTED (id) = 1;
1311 else if (!DECL_ERROR_REPORTED (id))
1313 DECL_ERROR_REPORTED (id) = 1;
1314 if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (id)))
1316 error ("name lookup of `%s' changed for new ISO `for' scoping",
1317 IDENTIFIER_POINTER (token));
1318 cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
1319 id = error_mark_node;
1323 pedwarn ("name lookup of `%s' changed for new ISO `for' scoping",
1324 IDENTIFIER_POINTER (token));
1325 cp_pedwarn_at (" using obsolete binding at `%D'", id);
1329 /* TREE_USED is set in `hack_identifier'. */
1330 if (TREE_CODE (id) == CONST_DECL)
1333 if (IDENTIFIER_CLASS_VALUE (token) == id)
1334 enforce_access (CP_DECL_CONTEXT(id), id);
1335 if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id))
1336 id = DECL_INITIAL (id);
1339 id = hack_identifier (id, token);
1341 /* We must look up dependent names when the template is
1342 instantiated, not while parsing it. For now, we don't
1343 distinguish between dependent and independent names. So, for
1344 example, we look up all overloaded functions at
1345 instantiation-time, even though in some cases we should just use
1346 the DECL we have here. We also use LOOKUP_EXPRs to find things
1347 like local variables, rather than creating TEMPLATE_DECLs for the
1348 local variables and then finding matching instantiations. */
1349 if (current_template_parms
1350 && (is_overloaded_fn (id)
1351 || (TREE_CODE (id) == VAR_DECL
1352 && CP_DECL_CONTEXT (id)
1353 && TREE_CODE (CP_DECL_CONTEXT (id)) == FUNCTION_DECL)
1354 || TREE_CODE (id) == PARM_DECL
1355 || TREE_CODE (id) == RESULT_DECL
1356 || TREE_CODE (id) == USING_DECL))
1357 id = build_min_nt (LOOKUP_EXPR, token);
1363 do_scoped_id (token, parsing)
1368 /* during parsing, this is ::name. Otherwise, it is black magic. */
1371 id = make_node (CPLUS_BINDING);
1372 if (!qualified_lookup_using_namespace (token, global_namespace, id, 0))
1375 id = BINDING_VALUE (id);
1378 id = IDENTIFIER_GLOBAL_VALUE (token);
1379 if (parsing && yychar == YYEMPTY)
1383 if (processing_template_decl)
1385 id = build_min_nt (LOOKUP_EXPR, token);
1386 LOOKUP_EXPR_GLOBAL (id) = 1;
1389 if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
1390 cp_error ("`::%D' undeclared (first use here)", token);
1391 id = error_mark_node;
1392 /* Prevent repeated error messages. */
1393 SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
1397 if (TREE_CODE (id) == ADDR_EXPR)
1398 mark_used (TREE_OPERAND (id, 0));
1399 else if (TREE_CODE (id) != OVERLOAD)
1402 if (TREE_CODE (id) == CONST_DECL && ! processing_template_decl)
1404 /* XXX CHS - should we set TREE_USED of the constant? */
1405 id = DECL_INITIAL (id);
1406 /* This is to prevent an enum whose value is 0
1407 from being considered a null pointer constant. */
1408 id = build1 (NOP_EXPR, TREE_TYPE (id), id);
1409 TREE_CONSTANT (id) = 1;
1412 if (processing_template_decl)
1414 if (is_overloaded_fn (id))
1416 id = build_min_nt (LOOKUP_EXPR, token);
1417 LOOKUP_EXPR_GLOBAL (id) = 1;
1420 /* else just use the decl */
1422 return convert_from_reference (id);
1426 identifier_typedecl_value (node)
1430 type = IDENTIFIER_TYPE_VALUE (node);
1431 if (type == NULL_TREE)
1434 if (IDENTIFIER_BINDING (node))
1436 t = IDENTIFIER_VALUE (node);
1437 if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type)
1440 if (IDENTIFIER_NAMESPACE_VALUE (node))
1442 t = IDENTIFIER_NAMESPACE_VALUE (node);
1443 if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type)
1447 /* Will this one ever happen? */
1448 if (TYPE_MAIN_DECL (type))
1449 return TYPE_MAIN_DECL (type);
1451 /* We used to do an internal error of 62 here, but instead we will
1452 handle the return of a null appropriately in the callers. */
1456 #ifdef GATHER_STATISTICS
1457 /* The original for tree_node_kind is in the toplevel tree.c; changes there
1458 need to be brought into here, unless this were actually put into a header
1460 /* Statistics-gathering stuff. */
1481 extern int tree_node_counts[];
1482 extern int tree_node_sizes[];
1486 build_lang_decl (code, name, type)
1487 enum tree_code code;
1493 t = build_decl (code, name, type);
1494 retrofit_lang_decl (t);
1499 /* Add DECL_LANG_SPECIFIC info to T. Called from build_lang_decl
1500 and pushdecl (for functions generated by the backend). */
1503 retrofit_lang_decl (t)
1506 struct lang_decl *ld;
1509 if (CAN_HAVE_FULL_LANG_DECL_P (t))
1510 size = sizeof (struct lang_decl);
1512 size = sizeof (struct lang_decl_flags);
1514 ld = (struct lang_decl *) ggc_alloc_cleared (size);
1516 DECL_LANG_SPECIFIC (t) = ld;
1517 if (current_lang_name == lang_name_cplusplus)
1518 SET_DECL_LANGUAGE (t, lang_cplusplus);
1519 else if (current_lang_name == lang_name_c)
1520 SET_DECL_LANGUAGE (t, lang_c);
1521 else if (current_lang_name == lang_name_java)
1522 SET_DECL_LANGUAGE (t, lang_java);
1523 else my_friendly_abort (64);
1525 #ifdef GATHER_STATISTICS
1526 tree_node_counts[(int)lang_decl] += 1;
1527 tree_node_sizes[(int)lang_decl] += size;
1532 copy_lang_decl (node)
1536 struct lang_decl *ld;
1538 if (! DECL_LANG_SPECIFIC (node))
1541 if (!CAN_HAVE_FULL_LANG_DECL_P (node))
1542 size = sizeof (struct lang_decl_flags);
1544 size = sizeof (struct lang_decl);
1545 ld = (struct lang_decl *) ggc_alloc (size);
1546 memcpy (ld, DECL_LANG_SPECIFIC (node), size);
1547 DECL_LANG_SPECIFIC (node) = ld;
1549 #ifdef GATHER_STATISTICS
1550 tree_node_counts[(int)lang_decl] += 1;
1551 tree_node_sizes[(int)lang_decl] += size;
1555 /* Copy DECL, including any language-specific parts. */
1563 copy = copy_node (decl);
1564 copy_lang_decl (copy);
1568 /* Replace the shared language-specific parts of NODE with a new copy. */
1571 copy_lang_type (node)
1575 struct lang_type *lt;
1577 if (! TYPE_LANG_SPECIFIC (node))
1580 size = sizeof (struct lang_type);
1581 lt = (struct lang_type *) ggc_alloc (size);
1582 memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
1583 TYPE_LANG_SPECIFIC (node) = lt;
1585 #ifdef GATHER_STATISTICS
1586 tree_node_counts[(int)lang_type] += 1;
1587 tree_node_sizes[(int)lang_type] += size;
1591 /* Copy TYPE, including any language-specific parts. */
1599 copy = copy_node (type);
1600 copy_lang_type (copy);
1605 cp_make_lang_type (code)
1606 enum tree_code code;
1608 register tree t = make_node (code);
1610 /* Create lang_type structure. */
1611 if (IS_AGGR_TYPE_CODE (code)
1612 || code == BOUND_TEMPLATE_TEMPLATE_PARM)
1614 struct lang_type *pi;
1616 pi = ((struct lang_type *)
1617 ggc_alloc_cleared (sizeof (struct lang_type)));
1619 TYPE_LANG_SPECIFIC (t) = pi;
1621 #ifdef GATHER_STATISTICS
1622 tree_node_counts[(int)lang_type] += 1;
1623 tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
1627 /* Set up some flags that give proper default behavior. */
1628 if (IS_AGGR_TYPE_CODE (code))
1630 SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
1631 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
1633 /* Make sure this is laid out, for ease of use later. In the
1634 presence of parse errors, the normal was of assuring this
1635 might not ever get executed, so we lay it out *immediately*. */
1636 build_pointer_type (t);
1639 /* We use TYPE_ALIAS_SET for the CLASSTYPE_MARKED bits. But,
1640 TYPE_ALIAS_SET is initialized to -1 by default, so we must
1642 TYPE_ALIAS_SET (t) = 0;
1644 /* We need to allocate a TYPE_BINFO even for TEMPLATE_TYPE_PARMs
1645 since they can be virtual base types, and we then need a
1646 canonical binfo for them. Ideally, this would be done lazily for
1648 if (IS_AGGR_TYPE_CODE (code) || code == TEMPLATE_TYPE_PARM
1649 || code == BOUND_TEMPLATE_TEMPLATE_PARM
1650 || code == TYPENAME_TYPE)
1651 TYPE_BINFO (t) = make_binfo (size_zero_node, t, NULL_TREE, NULL_TREE);
1657 make_aggr_type (code)
1658 enum tree_code code;
1660 tree t = cp_make_lang_type (code);
1662 if (IS_AGGR_TYPE_CODE (code))
1663 SET_IS_AGGR_TYPE (t, 1);
1669 compiler_error VPARAMS ((const char *msg, ...))
1674 VA_FIXEDARG (ap, const char *, msg);
1676 vsprintf (buf, msg, ap);
1679 error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf);
1682 /* Return the type-qualifier corresponding to the identifier given by
1686 cp_type_qual_from_rid (rid)
1689 if (rid == ridpointers[(int) RID_CONST])
1690 return TYPE_QUAL_CONST;
1691 else if (rid == ridpointers[(int) RID_VOLATILE])
1692 return TYPE_QUAL_VOLATILE;
1693 else if (rid == ridpointers[(int) RID_RESTRICT])
1694 return TYPE_QUAL_RESTRICT;
1696 my_friendly_abort (0);
1697 return TYPE_UNQUALIFIED;