Annotation of gcc/cp-parse.y, revision 1.1.1.6

1.1       root        1: /* YACC parser for C++ syntax.
1.1.1.5   root        2:    Copyright (C) 1988, 1989, 1993 Free Software Foundation, Inc.
1.1       root        3:    Hacked by Michael Tiemann ([email protected])
                      4: 
                      5: This file is part of GNU CC.
                      6: 
                      7: GNU CC is free software; you can redistribute it and/or modify
                      8: it under the terms of the GNU General Public License as published by
                      9: the Free Software Foundation; either version 2, or (at your option)
                     10: any later version.
                     11: 
                     12: GNU CC is distributed in the hope that it will be useful,
                     13: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: GNU General Public License for more details.
                     16: 
                     17: You should have received a copy of the GNU General Public License
                     18: along with GNU CC; see the file COPYING.  If not, write to
                     19: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     20: 
                     21: 
                     22: /* This grammar is based on the GNU CC grammar.  */
                     23: 
                     24: /* Note: Bison automatically applies a default action of "$$ = $1" for
                     25:    all derivations; this is applied before the explicit action, if one
                     26:    is given.  Keep this in mind when reading the actions.  */
                     27: 
                     28: /* Also note: this version contains experimental exception
                     29:    handling features.  They could break, change, disappear,
                     30:    or otherwise exhibit volatile behavior.  Don't depend on
                     31:    me (Michael Tiemann) to protect you from any negative impact
                     32:    this may have on your professional, personal, or spiritual life.
                     33: 
                     34:    NEWS FLASH:  This version now supports the exception handling
                     35:    syntax of Stroustrup's 2nd edition, if -fansi-exceptions is given.
                     36:    THIS IS WORK IN PROGRESS!!!  The type of the 'throw' and the
                     37:    'catch' much match EXACTLY (no inheritance support or coercions).
                     38:    Also, throw-specifications of functions don't work.
                     39:    Destructors aren't called correctly.  Etc, etc.  --Per Bothner.
                     40:   */
                     41: 
                     42: %{
1.1.1.4   root       43: #if defined(GATHER_STATISTICS) || defined(SPEW_DEBUG)
1.1       root       44: #undef YYDEBUG
                     45: #define YYDEBUG 1
                     46: #endif
                     47: 
                     48: #include "config.h"
                     49: 
                     50: #include <stdio.h>
                     51: #include <errno.h>
                     52: 
                     53: #include "tree.h"
                     54: #include "input.h"
1.1.1.4   root       55: #include "flags.h"
1.1       root       56: #include "cp-lex.h"
                     57: #include "cp-tree.h"
                     58: 
1.1.1.5   root       59: /* Since parsers are distinct for each language, put the language string
                     60:    definition here.  (fnf) */
                     61: char *language_string = "GNU C++";
                     62: 
1.1       root       63: extern tree void_list_node;
1.1.1.4   root       64: extern struct obstack permanent_obstack;
1.1       root       65: 
                     66: #ifndef errno
                     67: extern int errno;
                     68: #endif
                     69: 
                     70: extern int end_of_file;
                     71: 
                     72: void yyerror ();
                     73: 
                     74: /* Like YYERROR but do call yyerror.  */
                     75: #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
                     76: 
                     77: static void position_after_white_space ();
                     78: 
1.1.1.5   root       79: /* Contains the statement keyword (if/while/do) to include in an
                     80:    error message if the user supplies an empty conditional expression.  */
                     81: static char *cond_stmt_keyword;
1.1       root       82: 
                     83: /* Nonzero if we have an `extern "C"' acting as an extern specifier.  */
1.1.1.4   root       84: int have_extern_spec;
                     85: int used_extern_spec;
1.1       root       86: 
                     87: void yyhook ();
                     88: 
                     89: /* Cons up an empty parameter list.  */
                     90: #ifdef __GNUC__
                     91: __inline
                     92: #endif
                     93: static tree
                     94: empty_parms ()
                     95: {
                     96:   tree parms;
                     97: 
                     98:   if (strict_prototype)
                     99:     parms = void_list_node;
                    100:   else
                    101:     parms = NULL_TREE;
                    102:   return parms;
                    103: }
                    104: %}
                    105: 
                    106: %start program
                    107: 
1.1.1.2   root      108: %union {long itype; tree ttype; char *strtype; enum tree_code code; }
1.1       root      109: 
                    110: /* All identifiers that are not reserved words
                    111:    and are not declared typedefs in the current block */
                    112: %token IDENTIFIER
                    113: 
                    114: /* All identifiers that are declared typedefs in the current block.
                    115:    In some contexts, they are treated just like IDENTIFIER,
                    116:    but they can also serve as typespecs in declarations.  */
                    117: %token TYPENAME
                    118: 
                    119: /* Qualified identifiers that end in a TYPENAME.  */
                    120: %token SCOPED_TYPENAME
                    121: 
                    122: /* Reserved words that specify storage class.
                    123:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                    124: %token SCSPEC
                    125: 
                    126: /* Reserved words that specify type.
                    127:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                    128: %token TYPESPEC
                    129: 
                    130: /* Reserved words that qualify type: "const" or "volatile".
                    131:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                    132: %token TYPE_QUAL
                    133: 
                    134: /* Character or numeric constants.
                    135:    yylval is the node for the constant.  */
                    136: %token CONSTANT
                    137: 
                    138: /* String constants in raw form.
                    139:    yylval is a STRING_CST node.  */
                    140: %token STRING
                    141: 
                    142: /* "...", used for functions with variable arglists.  */
                    143: %token ELLIPSIS
                    144: 
                    145: /* the reserved words */
1.1.1.2   root      146: /* SCO include files test "ASM", so use something else. */
1.1       root      147: %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
1.1.1.5   root      148: %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
                    149: %token HEADOF CLASSOF
1.1.1.2   root      150: %token ATTRIBUTE EXTENSION LABEL
1.1       root      151: 
                    152: /* the reserved words... C++ extensions */
                    153: %token <ttype> AGGR
                    154: %token <itype> VISSPEC
                    155: %token DELETE NEW OVERLOAD THIS OPERATOR
1.1.1.6 ! root      156: %token LEFT_RIGHT TEMPLATE
        !           157: %token TYPEID DYNAMIC_CAST
1.1       root      158: %token <itype> SCOPE
                    159: 
                    160: /* Special token created by the lexer to separate TYPENAME
                    161:    from an ABSDCL.  This allows us to parse `foo (*pf)()'.  */
                    162: 
                    163: %token START_DECLARATOR
                    164: 
                    165: /* Define the operator tokens and their precedences.
                    166:    The value is an integer because, if used, it is the tree code
                    167:    to use in the expression made from the operator.  */
                    168: 
                    169: %left EMPTY                    /* used to resolve s/r with epsilon */
                    170: 
                    171: /* Add precedence rules to solve dangling else s/r conflict */
                    172: %nonassoc IF
                    173: %nonassoc ELSE
                    174: 
                    175: %left IDENTIFIER TYPENAME TYPENAME_COLON SCSPEC TYPESPEC TYPE_QUAL ENUM AGGR
                    176: 
                    177: %left '{' ','
                    178: 
                    179: %right <code> ASSIGN '='
                    180: %right <code> '?' ':' RANGE
                    181: %left <code> OROR
                    182: %left <code> ANDAND
                    183: %left <code> '|'
                    184: %left <code> '^'
                    185: %left <code> '&'
                    186: %left <code> MIN_MAX
                    187: %left <code> EQCOMPARE
                    188: %left <code> ARITHCOMPARE '<' '>'
                    189: %left <code> LSHIFT RSHIFT
                    190: %left <code> '+' '-'
                    191: %left <code> '*' '/' '%'
                    192: %right <code> UNARY PLUSPLUS MINUSMINUS
                    193: %left HYPERUNARY
                    194: %left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
                    195: %left <code> POINTSAT POINTSAT_STAR '.' DOT_STAR '(' '['
                    196: 
                    197: %right SCOPE                   /* C++ extension */
                    198: %nonassoc NEW DELETE RAISE RAISES RERAISE TRY EXCEPT CATCH THROW
                    199: %nonassoc ANSI_TRY ANSI_THROW
                    200: 
                    201: %type <code> unop
                    202: 
                    203: %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
1.1.1.5   root      204: %type <ttype> optional_identifier paren_expr_or_null
1.1       root      205: %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
                    206: %type <ttype> typed_declspecs reserved_declspecs
                    207: %type <ttype> typed_typespecs reserved_typespecquals
                    208: %type <ttype> declmods typespec typespecqual_reserved
                    209: %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
                    210: %type <itype> initdecls notype_initdecls initdcl       /* C++ modification */
                    211: %type <ttype> init initlist maybeasm
                    212: %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
                    213: %type <ttype> maybe_attribute attribute_list attrib
                    214: %type <ttype> abs_member_declarator after_type_member_declarator
                    215: 
1.1.1.5   root      216: %type <ttype> compstmt except_stmts ansi_except_stmts implicitly_scoped_stmt
1.1       root      217: 
                    218: %type <ttype> declarator notype_declarator after_type_declarator
                    219: 
1.1.1.5   root      220: %type <ttype> structsp opt.component_decl_list component_decl_list
                    221: %type <ttype> component_decl components component_declarator
1.1       root      222: %type <ttype> enumlist enumerator
                    223: %type <ttype> typename absdcl absdcl1 type_quals abs_or_notype_decl
                    224: %type <ttype> xexpr see_typename parmlist parms parm bad_parm
1.1.1.3   root      225: %type <ttype> identifiers_or_typenames
1.1       root      226: 
                    227: /* C++ extensions */
1.1.1.3   root      228: %type <ttype> typename_scope
1.1       root      229: %token <ttype> TYPENAME_COLON TYPENAME_ELLIPSIS
                    230: %token <ttype> PTYPENAME SCOPED_TYPENAME
                    231: %token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
                    232: %token <ttype> PRE_PARSED_CLASS_DECL
                    233: %type <ttype> fn.def1 /* Not really! */
                    234: %type <ttype> fn.def2 return_id
                    235: %type <ttype> named_class_head named_class_head_sans_basetype
                    236: %type <ttype> unnamed_class_head
                    237: %type <ttype> class_head base_class_list
                    238: %type <itype> base_class_visibility_list
                    239: %type <ttype> base_class maybe_base_class_list base_class.1
                    240: %type <ttype> after_type_declarator_no_typename
                    241: %type <ttype> maybe_raises raise_identifier raise_identifiers ansi_raise_identifier ansi_raise_identifiers
1.1.1.6 ! root      242: %type <ttype> component_declarator0 id_scope scoped_typename scoped_base_class
1.1       root      243: %type <ttype> forhead.1 identifier_or_opname operator_name
                    244: %type <ttype> new delete object object_star aggr
                    245: /* %type <ttype> primary_no_id */
                    246: %type <ttype> nonmomentary_expr
1.1.1.4   root      247: %type <itype> forhead.2 initdcl0 notype_initdcl0 member_init_list
1.1       root      248: %type <itype> .scope try ansi_try
                    249: %type <ttype> template_header template_parm_list template_parm
                    250: %type <ttype> template_type template_arg_list template_arg
                    251: %type <ttype> template_instantiation template_type_name tmpl.1 tmpl.2
                    252: %type <ttype> template_instantiate_once template_instantiate_some
1.1.1.4   root      253: %type <itype> fn_tmpl_end
                    254: /* %type <itype> try_for_typename */
1.1.1.6 ! root      255: %type <ttype> condition partially_scoped_stmt xcond paren_cond_or_null
        !           256: %type <strtype> .kindof_pushlevel
1.1       root      257: 
                    258: /* in order to recognize aggr tags as defining and thus shadowing. */
                    259: %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
                    260: %type <ttype> named_class_head_sans_basetype_defn 
                    261: %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
                    262: 
1.1.1.2   root      263: %type <strtype> .pushlevel
                    264: 
1.1       root      265: /* cp-spew.c depends on this being the last token.  Define
                    266:    any new tokens before this one!  */
                    267: %token END_OF_SAVED_INPUT
                    268: 
                    269: %{
                    270: /* List of types and structure classes of the current declaration.  */
1.1.1.4   root      271: static tree current_declspecs;
1.1       root      272: 
                    273: /* When defining an aggregate, this is the most recent one being defined.  */
                    274: static tree current_aggr;
                    275: 
1.1.1.4   root      276: /* Tell yyparse how to print a token's value, if yydebug is set.  */
1.1       root      277: 
                    278: #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
1.1.1.4   root      279: extern void yyprint ();
1.1.1.5   root      280: extern tree combine_strings            PROTO((tree));
                    281: extern tree truthvalue_conversion      PROTO((tree));
1.1       root      282: %}
                    283: 
                    284: %%
                    285: program: /* empty */
                    286:        | extdefs
1.1.1.6 ! root      287:                {
        !           288:                  /* In case there were missing closebraces,
        !           289:                     get us back to the global binding level.  */
        !           290:                  while (! global_bindings_p ())
        !           291:                    poplevel (0, 0, 0);
        !           292:                  finish_file ();
        !           293:                }
1.1       root      294:        ;
                    295: 
                    296: /* the reason for the strange actions in this rule
                    297:  is so that notype_initdecls when reached via datadef
                    298:  can find a valid list of type and sc specs in $0. */
                    299: 
                    300: extdefs:
                    301:          { $<ttype>$ = NULL_TREE; } extdef
                    302:                {$<ttype>$ = NULL_TREE; }
                    303:        | extdefs extdef
                    304:                {$<ttype>$ = NULL_TREE; }
                    305:        ;
                    306: 
                    307: .hush_warning:
                    308:                { have_extern_spec = 1;
1.1.1.4   root      309:                  used_extern_spec = 0;
1.1       root      310:                  $<ttype>$ = NULL_TREE; }
                    311:        ;
                    312: .warning_ok:
                    313:                { have_extern_spec = 0; }
                    314:        ;
                    315: 
1.1.1.5   root      316: asm_keyword:
                    317:        ASM_KEYWORD { if (pedantic)
                    318:                      pedwarn ("ANSI C++ forbids use of `asm' keyword"); }
                    319:        | GCC_ASM_KEYWORD
                    320:        ;
                    321: 
1.1       root      322: extdef:
                    323:          fndef
                    324:                { if (pending_inlines) do_pending_inlines (); }
                    325:        | datadef
                    326:                { if (pending_inlines) do_pending_inlines (); }
                    327:        | template_def
                    328:                { if (pending_inlines) do_pending_inlines (); }
                    329:        | overloaddef
1.1.1.5   root      330:        | asm_keyword '(' string ')' ';'
                    331:                { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
1.1       root      332:                  assemble_asm ($3); }
                    333:        | extern_lang_string '{' extdefs '}'
                    334:                { pop_lang_context (); }
                    335:        | extern_lang_string '{' '}'
                    336:                { pop_lang_context (); }
                    337:        | extern_lang_string .hush_warning fndef .warning_ok
                    338:                { if (pending_inlines) do_pending_inlines ();
                    339:                  pop_lang_context (); }
                    340:        | extern_lang_string .hush_warning datadef .warning_ok
                    341:                { if (pending_inlines) do_pending_inlines ();
                    342:                  pop_lang_context (); }
                    343:        ;
                    344: 
                    345: extern_lang_string:
                    346:          EXTERN_LANG_STRING
                    347:                { push_lang_context ($1); }
                    348:        ;
                    349: 
                    350: template_header:
                    351:          TEMPLATE '<'
                    352:                { begin_template_parm_list (); }
                    353:          template_parm_list '>'
                    354:                { $$ = end_template_parm_list ($4); }
                    355:        ;
                    356: 
                    357: template_parm_list:
                    358:          template_parm
1.1.1.5   root      359:                { $$ = process_template_parm (NULL_TREE, $1); }
1.1       root      360:        | template_parm_list ',' template_parm
                    361:                { $$ = process_template_parm ($1, $3); }
                    362:        ;
                    363: 
                    364: template_parm:
                    365:        /* The following rules introduce a new reduce/reduce
                    366:           conflict: they are valid prefixes for a `structsp',
                    367:           which means they could match a nameless parameter.
                    368:           By putting them before the `parm' rule, we get
                    369:           their match before considering them nameless parameter
                    370:           declarations.  */
                    371:          aggr identifier
                    372:                {
1.1.1.2   root      373:                  if ($1 != class_type_node)
1.1       root      374:                    error ("template type parameter must use keyword `class'");
                    375:                  $$ = build_tree_list ($2, NULL_TREE);
                    376:                }
                    377:        | aggr identifier_defn ':' base_class.1
                    378:                {
1.1.1.2   root      379:                  if ($1 != class_type_node)
1.1       root      380:                    error ("template type parameter must use keyword `class'");
                    381:                  warning ("restricted template type parameters not yet implemented");
                    382:                  $$ = build_tree_list ($2, $4);
                    383:                }
                    384:        | aggr TYPENAME_COLON base_class.1
                    385:                {
1.1.1.2   root      386:                  if ($1 != class_type_node)
1.1       root      387:                    error ("template type parameter must use keyword `class'");
                    388:                  warning ("restricted template type parameters not yet implemented");
                    389:                  $$ = build_tree_list ($2, $3);
                    390:                }
                    391:        | parm
                    392:        ;
                    393: 
                    394: overloaddef:
                    395:          OVERLOAD ov_identifiers ';'
1.1.1.5   root      396:                { warning ("use of `overload' is an anachronism"); }
                    397:        ;
1.1       root      398: 
                    399: ov_identifiers: IDENTIFIER
                    400:                { declare_overloaded ($1); }
                    401:        | ov_identifiers ',' IDENTIFIER
                    402:                { declare_overloaded ($3); }
                    403:        ;
                    404:          
                    405: template_def:
                    406:        /* Class template declarations go here; they aren't normal class
                    407:           declarations, because we can't process the bodies yet.  */
                    408:          template_header named_class_head_sans_basetype '{'
                    409:                { yychar = '{'; goto template1; }
                    410:         ';'
                    411:        | template_header named_class_head_sans_basetype_defn '{'
                    412:                { yychar = '{'; goto template1; }
                    413:         ';'
                    414:        | template_header named_class_head_sans_basetype ':'
                    415:                { yychar = ':'; goto template1; }
                    416:         ';'
                    417:        | template_header named_class_head_sans_basetype_defn ':'
                    418:                {
                    419:                  yychar = ':';
                    420:                template1:
                    421:                  if (current_aggr == exception_type_node)
                    422:                    error ("template type must define an aggregate or union");
                    423:                  /* Maybe pedantic warning for union?
                    424:                     How about an enum? :-)  */
                    425:                  end_template_decl ($1, $2, current_aggr);
                    426:                  reinit_parse_for_template (yychar, $1, $2);
                    427:                  yychar = YYEMPTY;
                    428:                }
                    429:          ';'
                    430:        | template_header named_class_head_sans_basetype ';'
                    431:                {
                    432:                  end_template_decl ($1, $2, current_aggr);
                    433:                  /* declare $2 as template name with $1 parm list */
                    434:                }
                    435:        | template_header named_class_head_sans_basetype_defn ';'
                    436:                {
                    437:                  end_template_decl ($1, $2, current_aggr);
                    438:                  /* declare $2 as template name with $1 parm list */
                    439:                }
                    440:        | template_header /* notype_initdcl0 ';' */
                    441:          notype_declarator maybe_raises maybeasm maybe_attribute
                    442:          fn_tmpl_end
                    443:                {
                    444:                  tree d;
                    445:                  int momentary;
                    446:                  momentary = suspend_momentary ();
1.1.1.5   root      447:                  d = start_decl ($<ttype>2, /*current_declspecs*/NULL_TREE, 0, $3);
1.1.1.4   root      448:                  cplus_decl_attributes (d, $5);
1.1.1.3   root      449:                  finish_decl (d, NULL_TREE, $4, 0);
1.1       root      450:                  end_template_decl ($1, d, 0);
                    451:                  if ($6 != ';')
1.1.1.5   root      452:                    reinit_parse_for_template ((int) $6, $1, d);
1.1       root      453:                  resume_momentary (momentary);
                    454:                }
                    455:        | template_header typed_declspecs /*initdcl0*/
                    456:          declarator maybe_raises maybeasm maybe_attribute
                    457:          fn_tmpl_end
                    458:                {
                    459:                  tree d;
                    460:                  int momentary;
                    461: 
                    462:                  current_declspecs = $2;
                    463:                  momentary = suspend_momentary ();
1.1.1.5   root      464:                  d = start_decl ($<ttype>3, current_declspecs,
                    465:                                  0, $<ttype>4);
1.1.1.4   root      466:                  cplus_decl_attributes (d, $6);
1.1.1.3   root      467:                  finish_decl (d, NULL_TREE, $5, 0);
1.1       root      468:                  end_exception_decls ();
                    469:                  end_template_decl ($1, d, 0);
                    470:                  if ($7 != ';')
                    471:                    {
1.1.1.5   root      472:                      reinit_parse_for_template ((int) $7, $1, d);
1.1       root      473:                      yychar = YYEMPTY;
                    474:                    }
                    475:                  note_list_got_semicolon ($<ttype>2);
                    476:                  resume_momentary (momentary);
                    477:                }
                    478:        | template_header declmods declarator fn_tmpl_end
                    479:                {
1.1.1.5   root      480:                  tree d = start_decl ($<ttype>3, $<ttype>2, 0, NULL_TREE);
1.1.1.3   root      481:                  finish_decl (d, NULL_TREE, NULL_TREE, 0);
1.1       root      482:                  end_template_decl ($1, d, 0);
                    483:                  if ($4 != ';')
1.1.1.5   root      484:                    reinit_parse_for_template ((int) $4, $1, d);
1.1       root      485:                }
1.1.1.2   root      486:        /* Try to recover from syntax errors in templates.  */
                    487:        | template_header error '}'     { end_template_decl ($1, 0, 0); }
                    488:        | template_header error ';'     { end_template_decl ($1, 0, 0); }
1.1       root      489:        ;
                    490: 
                    491: fn_tmpl_end: '{'               { $$ = '{'; }
                    492:        | ':'                   { $$ = ':'; }
                    493:        | ';'                   { $$ = ';'; }
                    494:        | '='                   { $$ = '='; }
                    495:        | RETURN                { $$ = RETURN; }
                    496:        ;
                    497: 
                    498: datadef:
                    499:          notype_initdecls ';'
                    500:                { if (pedantic)
1.1.1.4   root      501:                    pedwarn ("ANSI C++ forbids data definition with no type or storage class");
1.1       root      502:                  else if (! flag_traditional && ! have_extern_spec)
                    503:                    warning ("data definition has no type or storage class"); }
                    504:        | declmods notype_initdecls ';'
                    505:                {}
                    506:        /* Normal case to make fast: "int i;".  */
                    507:        | declmods declarator ';'
                    508:                { tree d;
1.1.1.5   root      509:                  d = start_decl ($<ttype>2, $<ttype>$, 0, NULL_TREE);
1.1.1.3   root      510:                  finish_decl (d, NULL_TREE, NULL_TREE, 0);
1.1       root      511:                }
                    512:        | typed_declspecs initdecls ';'
                    513:                {
                    514:                  end_exception_decls ();
                    515:                  note_list_got_semicolon ($<ttype>$);
                    516:                }
                    517:        /* Normal case: make this fast.  */
                    518:        | typed_declspecs declarator ';'
                    519:                { tree d;
1.1.1.5   root      520:                  d = start_decl ($<ttype>2, $<ttype>$, 0, NULL_TREE);
1.1.1.3   root      521:                  finish_decl (d, NULL_TREE, NULL_TREE, 0);
1.1       root      522:                  end_exception_decls ();
                    523:                  note_list_got_semicolon ($<ttype>$);
                    524:                }
                    525:         | declmods ';'
1.1.1.4   root      526:          { pedwarn ("empty declaration"); }
1.1       root      527:        | typed_declspecs ';'
                    528:          {
                    529:            tree t = $<ttype>$;
                    530:            shadow_tag (t);
                    531:            if (TREE_CODE (t) == TREE_LIST
                    532:                && TREE_PURPOSE (t) == NULL_TREE)
                    533:              {
                    534:                t = TREE_VALUE (t);
1.1.1.6 ! root      535:                if (TREE_CODE (t) == RECORD_TYPE
        !           536:                    && TYPE_SIZE (t)
        !           537:                    && CLASSTYPE_USE_TEMPLATE (t) == 0)
        !           538:                  CLASSTYPE_USE_TEMPLATE (t) = 2;
        !           539:                else if (TREE_CODE (t) == ENUMERAL_TYPE
        !           540:                         && !TYPE_SIZE (t))
        !           541:                  cp_error ("forward declaration of `%#T'", t);
1.1       root      542:              }
                    543:            note_list_got_semicolon ($<ttype>$);
                    544:          }
                    545:        | error ';'
                    546:        | error '}'
                    547:        | ';'
                    548:        ;
                    549: 
                    550: fndef:
                    551:          fn.def1 base_init compstmt_or_error
                    552:                {
                    553:                  finish_function (lineno, 1);
                    554:                  /* finish_function performs these three statements:
                    555: 
                    556:                     expand_end_bindings (getdecls (), 1, 0);
                    557:                     poplevel (1, 1, 0);
                    558: 
                    559:                     expand_end_bindings (0, 0, 0);
                    560:                     poplevel (0, 0, 1);
                    561:                     */
                    562:                  if ($<ttype>$) process_next_inline ($<ttype>$);
                    563:                }
                    564:        | fn.def1 return_init base_init compstmt_or_error
                    565:                {
                    566:                  finish_function (lineno, 1);
                    567:                  /* finish_function performs these three statements:
                    568: 
                    569:                     expand_end_bindings (getdecls (), 1, 0);
                    570:                     poplevel (1, 1, 0);
                    571: 
                    572:                     expand_end_bindings (0, 0, 0);
                    573:                     poplevel (0, 0, 1);
                    574:                     */
                    575:                  if ($<ttype>$) process_next_inline ($<ttype>$);
                    576:                }
                    577:        | fn.def1 nodecls compstmt_or_error
                    578:                { finish_function (lineno, 0);
                    579:                  if ($<ttype>$) process_next_inline ($<ttype>$); }
                    580:        | fn.def1 return_init ';' nodecls compstmt_or_error
                    581:                { finish_function (lineno, 0);
                    582:                  if ($<ttype>$) process_next_inline ($<ttype>$); }
                    583:        | fn.def1 return_init nodecls compstmt_or_error
                    584:                { finish_function (lineno, 0);
                    585:                  if ($<ttype>$) process_next_inline ($<ttype>$); }
                    586:        | typed_declspecs declarator error
                    587:                {}
                    588:        | declmods notype_declarator error
                    589:                {}
                    590:        | notype_declarator error
                    591:                {}
                    592:        ;
                    593: 
                    594: fn.def1:
                    595:          typed_declspecs declarator maybe_raises
                    596:                { if (! start_function ($$, $2, $3, 0))
                    597:                    YYERROR1;
                    598:                  reinit_parse_for_function ();
                    599:                  $$ = NULL_TREE; }
                    600:        | declmods notype_declarator maybe_raises
                    601:                { if (! start_function ($$, $2, $3, 0))
                    602:                    YYERROR1;
                    603:                  reinit_parse_for_function ();
                    604:                  $$ = NULL_TREE; }
                    605:        | notype_declarator maybe_raises
                    606:                { if (! start_function (NULL_TREE, $$, $2, 0))
                    607:                    YYERROR1;
                    608:                  reinit_parse_for_function ();
                    609:                  $$ = NULL_TREE; }
                    610:        | TYPENAME '(' parmlist ')' type_quals maybe_raises
                    611:                { if (! start_function (NULL_TREE, build_parse_node (CALL_EXPR, $$, $3, $5), $6, 0))
                    612:                    YYERROR1;
                    613:                  reinit_parse_for_function ();
                    614:                  $$ = NULL_TREE; }
                    615:        | scoped_typename '(' parmlist ')' type_quals maybe_raises
                    616:                { if (! start_function (NULL_TREE, build_parse_node (CALL_EXPR, $$, $3, $5), $6, 0))
                    617:                    YYERROR1;
                    618:                  reinit_parse_for_function ();
                    619:                  $$ = NULL_TREE; }
                    620:        | TYPENAME LEFT_RIGHT type_quals maybe_raises
                    621:                { if (! start_function (NULL_TREE, build_parse_node (CALL_EXPR, $$, empty_parms (), $3), $4, 0))
                    622:                    YYERROR1;
                    623:                  reinit_parse_for_function ();
                    624:                  $$ = NULL_TREE; }
                    625:        | scoped_typename LEFT_RIGHT type_quals maybe_raises
                    626:                { if (! start_function (NULL_TREE, build_parse_node (CALL_EXPR, $$, empty_parms (), $3), $4, 0))
                    627:                    YYERROR1;
                    628:                  reinit_parse_for_function ();
                    629:                  $$ = NULL_TREE; }
                    630:        | PRE_PARSED_FUNCTION_DECL
                    631:                { start_function (NULL_TREE, TREE_VALUE ($$), NULL_TREE, 1);
                    632:                  reinit_parse_for_function (); }
                    633:        ;
                    634: 
                    635: /* more C++ complexity */
                    636: fn.def2:
                    637:          typed_declspecs '(' parmlist ')' type_quals maybe_raises
                    638:                {
                    639:                  tree decl = build_parse_node (CALL_EXPR, TREE_VALUE ($$), $3, $5);
                    640:                  $$ = start_method (TREE_CHAIN ($$), decl, $6);
                    641:                  if (! $$)
                    642:                    YYERROR1;
                    643:                  if (yychar == YYEMPTY)
                    644:                    yychar = YYLEX;
                    645:                  reinit_parse_for_method (yychar, $$); }
                    646:        | typed_declspecs LEFT_RIGHT type_quals maybe_raises
                    647:                {
                    648:                  tree decl = build_parse_node (CALL_EXPR, TREE_VALUE ($$), empty_parms (), $3);
                    649:                  $$ = start_method (TREE_CHAIN ($$), decl, $4);
                    650:                  if (! $$)
                    651:                    YYERROR1;
                    652:                  if (yychar == YYEMPTY)
                    653:                    yychar = YYLEX;
                    654:                  reinit_parse_for_method (yychar, $$); }
                    655:        | typed_declspecs declarator maybe_raises
                    656:                { $$ = start_method ($$, $2, $3);
                    657:                  if (! $$)
                    658:                    YYERROR1;
                    659:                  if (yychar == YYEMPTY)
                    660:                    yychar = YYLEX;
                    661:                  reinit_parse_for_method (yychar, $$); }
                    662:        | declmods '(' parmlist ')' type_quals maybe_raises
                    663:                {
                    664:                  tree decl = build_parse_node (CALL_EXPR, TREE_VALUE ($$), $3, $5);
                    665:                  $$ = start_method (TREE_CHAIN ($$), decl, $6);
                    666:                  if (! $$)
                    667:                    YYERROR1;
                    668:                  if (yychar == YYEMPTY)
                    669:                    yychar = YYLEX;
                    670:                  reinit_parse_for_method (yychar, $$); }
                    671:        | declmods LEFT_RIGHT type_quals maybe_raises
                    672:                {
                    673:                  tree decl = build_parse_node (CALL_EXPR, TREE_VALUE ($$), empty_parms (), $3);
                    674:                  $$ = start_method (TREE_CHAIN ($$), decl, $4);
                    675:                  if (! $$)
                    676:                    YYERROR1;
                    677:                  if (yychar == YYEMPTY)
                    678:                    yychar = YYLEX;
                    679:                  reinit_parse_for_method (yychar, $$); }
                    680:        | declmods declarator maybe_raises
                    681:                { $$ = start_method ($$, $2, $3);
                    682:                  if (! $$)
                    683:                    YYERROR1;
                    684:                  if (yychar == YYEMPTY)
                    685:                    yychar = YYLEX;
                    686:                  reinit_parse_for_method (yychar, $$); }
                    687:        | notype_declarator maybe_raises
                    688:                { $$ = start_method (NULL_TREE, $$, $2);
                    689:                  if (! $$)
                    690:                    YYERROR1;
                    691:                  if (yychar == YYEMPTY)
                    692:                    yychar = YYLEX;
                    693:                  reinit_parse_for_method (yychar, $$); }
                    694:        ;
                    695: 
                    696: return_id: RETURN IDENTIFIER
                    697:                {
                    698:                  if (! current_function_parms_stored)
                    699:                    store_parm_decls ();
                    700:                  $$ = $2;
                    701:                }
                    702:        ;
                    703: 
                    704: return_init: return_id
                    705:                { store_return_init ($<ttype>$, NULL_TREE); }
                    706:        | return_id '=' init
1.1.1.4   root      707:                { store_return_init ($<ttype>$, $3); }
1.1       root      708:        | return_id '(' nonnull_exprlist ')'
                    709:                { store_return_init ($<ttype>$, $3); }
                    710:        | return_id LEFT_RIGHT
                    711:                { store_return_init ($<ttype>$, NULL_TREE); }
                    712:        ;
                    713: 
                    714: base_init:
                    715:          ':' .set_base_init member_init_list
                    716:                {
                    717:                  if ($3 == 0)
                    718:                    error ("no base initializers given following ':'");
                    719:                  setup_vtbl_ptr ();
1.1.1.6 ! root      720:                  /* Always keep the BLOCK node associated with the outermost
        !           721:                     pair of curley braces of a function.  These are needed
        !           722:                     for correct operation of dwarfout.c.  */
        !           723:                  keep_next_level ();
1.1       root      724:                }
                    725:        ;
                    726: 
                    727: .set_base_init:
                    728:        /* empty */
                    729:                {
                    730:                  if (! current_function_parms_stored)
                    731:                    store_parm_decls ();
                    732: 
                    733:                  /* Flag that we are processing base and member initializers.  */
                    734:                  current_vtable_decl = error_mark_node;
                    735: 
                    736:                  if (DECL_CONSTRUCTOR_P (current_function_decl))
                    737:                    {
                    738:                      /* Make a contour for the initializer list.  */
                    739:                      pushlevel (0);
                    740:                      clear_last_expr ();
                    741:                      expand_start_bindings (0);
                    742:                    }
                    743:                  else if (current_class_type == NULL_TREE)
                    744:                    error ("base initializers not allowed for non-member functions");
                    745:                  else if (! DECL_CONSTRUCTOR_P (current_function_decl))
                    746:                    error ("only constructors take base initializers");
                    747:                }
                    748:        ;
                    749: 
                    750: member_init_list:
                    751:          /* empty */
                    752:                { $$ = 0; }
                    753:        | member_init
                    754:                { $$ = 1; }
                    755:        | member_init_list ',' member_init
                    756:        | member_init_list error
                    757:        ;
                    758: 
                    759: member_init: '(' nonnull_exprlist ')'
                    760:                {
1.1.1.4   root      761:                  if (current_class_name && !flag_traditional)
                    762:                    pedwarn ("ANSI C++ forbids old style base class initialization",
1.1       root      763:                             IDENTIFIER_POINTER (current_class_name));
                    764:                  expand_member_init (C_C_D, NULL_TREE, $2);
                    765:                }
                    766:        | LEFT_RIGHT
                    767:                {
1.1.1.4   root      768:                  if (current_class_name && !flag_traditional)
                    769:                    pedwarn ("ANSI C++ forbids old style base class initialization",
1.1       root      770:                             IDENTIFIER_POINTER (current_class_name));
                    771:                  expand_member_init (C_C_D, NULL_TREE, void_type_node);
                    772:                }
                    773:        | identifier '(' nonnull_exprlist ')'
                    774:                {
                    775:                  expand_member_init (C_C_D, $<ttype>$, $3);
                    776:                }
                    777:        | identifier LEFT_RIGHT
                    778:                { expand_member_init (C_C_D, $<ttype>$, void_type_node); }
1.1.1.2   root      779:        | template_type_name '(' nonnull_exprlist ')'
                    780:                { expand_member_init (C_C_D, $<ttype>$, $3); }
                    781:        | template_type_name LEFT_RIGHT
                    782:                { expand_member_init (C_C_D, $<ttype>$, void_type_node); }
1.1.1.4   root      783:        | scoped_typename '(' nonnull_exprlist ')'
                    784:                { expand_member_init (C_C_D, $<ttype>$, $3); }
                    785:        | scoped_typename LEFT_RIGHT
                    786:                { expand_member_init (C_C_D, $<ttype>$, void_type_node); }
1.1.1.6 ! root      787:        | id_scope identifier '(' nonnull_exprlist ')'
1.1       root      788:                {
                    789:                  do_member_init ($<ttype>$, $2, $4);
                    790:                }
1.1.1.6 ! root      791:        | id_scope identifier LEFT_RIGHT
1.1       root      792:                {
                    793:                  do_member_init ($<ttype>$, $2, void_type_node);
                    794:                }
                    795:        ;
                    796: 
                    797: identifier:
                    798:          IDENTIFIER
                    799:        | TYPENAME
                    800:        | PTYPENAME
                    801:        ;
                    802: 
                    803: identifier_defn:
                    804:          IDENTIFIER_DEFN
                    805:        | TYPENAME_DEFN
                    806:        | PTYPENAME_DEFN
                    807:        ;
                    808: 
                    809: identifier_or_opname:
                    810:          IDENTIFIER
                    811:        | TYPENAME
                    812:        | PTYPENAME
                    813: /*     | '~' TYPENAME
                    814:                { $$ = build_parse_node (BIT_NOT_EXPR, $2); }*/
                    815:        /* get rid of the next line, replace it with the above */
                    816:        | '~' identifier { $$ = build_parse_node (BIT_NOT_EXPR,$2);}
                    817:        | operator_name
                    818:        ;
                    819: 
                    820: template_type:
                    821:          template_type_name tmpl.1 template_instantiation
                    822:                {
1.1.1.4   root      823:                  extern tree template_type_seen_before_scope;
                    824: 
1.1       root      825:                  if ($3) 
                    826:                    $$ = $3;
                    827:                  else if ($$ != error_mark_node)
                    828:                    $$ = IDENTIFIER_TYPE_VALUE ($$);
1.1.1.4   root      829:                  /* This is a kludge: In order to detect nested types inside
                    830:                   * template classes, we have to tell the lexer that it should
                    831:                   * try to replace a following SCOPE token with the correct
                    832:                   * SCOPED_TYPENAME for the nested type.  This SCOPED_TYPENAME
                    833:                   * token will be handled in the rule "scoped_typename".
                    834:                   * - [email protected] */
1.1.1.5   root      835:                  if (yychar == SCOPE)
                    836:                    {
                    837:                      /* We set template_type_seen_before_scope to be
                    838:                         an error_mark_node so we can avoid meaningless
                    839:                         and unhelpful syntax errors later.  */
                    840:                      if ($$ != error_mark_node)
                    841:                        template_type_seen_before_scope = TYPE_IDENTIFIER ($$);
                    842:                      else
                    843:                        template_type_seen_before_scope = error_mark_node;
                    844:                      yychar = YYLEX;
                    845:                    }
1.1       root      846:                }
                    847:        ;
                    848: 
                    849: template_type_name:
                    850:          PTYPENAME '<' template_arg_list '>'
1.1.1.5   root      851:                { $$ = lookup_template_class ($$, $3, NULL_TREE); }
1.1.1.4   root      852:        | TYPENAME  '<' template_arg_list '>'
1.1.1.5   root      853:                { $$ = lookup_template_class ($$, $3, NULL_TREE); }
1.1       root      854:        ;
                    855: 
                    856: tmpl.1:
                    857:        /* Expansion of template may be required, unless we're followed by
                    858:           a class definition.  */
                    859:          '{'   { yyungetc ('{', 1); $$ = 0; }
                    860:        | ':'   { yyungetc (':', 1); $$ = 0; }
                    861:        | /* empty */ %prec EMPTY
                    862:                 { $$ = instantiate_class_template ($<ttype>0, 1); }
                    863:        ;
                    864: 
                    865: tmpl.2:
                    866:        /* Always do expansion if it hasn't been done already. */
                    867:                { $$ = instantiate_class_template ($<ttype>0, 1); }
                    868:        ;
                    869: 
                    870: template_arg_list:
                    871:          template_arg
                    872:                { $$ = build_tree_list (NULL_TREE, $$); }
                    873:        | template_arg_list ',' template_arg
                    874:                { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
                    875:        ;
                    876: 
                    877: template_arg:
                    878:          typename
                    879:                { $$ = groktypename ($$); }
                    880:        | expr_no_commas  %prec UNARY
                    881:        ;
                    882: 
                    883: template_instantiate_once:
                    884:          PRE_PARSED_CLASS_DECL maybe_base_class_list
                    885:                {
                    886:                  tree t, decl, id, tmpl;
                    887: 
                    888:                  id = TREE_VALUE ($1);
                    889:                  tmpl = TREE_PURPOSE (IDENTIFIER_TEMPLATE (id));
                    890:                  t = xref_tag (DECL_TEMPLATE_INFO (tmpl)->aggr, id, $2);
                    891:                  set_current_level_tags_transparency (1);
1.1.1.6 ! root      892:                  my_friendly_assert (TREE_CODE (t) == RECORD_TYPE
        !           893:                                      || TREE_CODE (t) == UNION_TYPE, 257);
1.1       root      894:                  $<ttype>$ = t;
                    895: 
                    896:                  /* Now, put a copy of the decl in global scope, to avoid
                    897:                     recursive expansion.  */
                    898:                  decl = IDENTIFIER_LOCAL_VALUE (id);
                    899:                  if (!decl)
                    900:                    decl = IDENTIFIER_CLASS_VALUE (id);
                    901:                  /* Now, put a copy of the decl in global scope, to avoid
                    902:                     recursive expansion.  */
                    903:                   if (decl)
                    904:                     {
                    905:                      /* Need to copy it to clear the chain pointer,
                    906:                         and need to get it into permanent storage.  */
1.1.1.4   root      907:                       my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 258);
1.1       root      908:                      push_obstacks (&permanent_obstack, &permanent_obstack);
                    909:                       decl = copy_node (decl);
                    910:                      if (DECL_LANG_SPECIFIC (decl))
                    911:                        copy_lang_decl (decl);
                    912:                      pop_obstacks ();
                    913:                      pushdecl_top_level (decl);
                    914:                    }
                    915:                }
1.1.1.3   root      916:          left_curly opt.component_decl_list '}'
1.1       root      917:                {
1.1.1.5   root      918:                  $$ = finish_struct ($<ttype>3, $5, 0);
1.1       root      919: 
                    920:                  pop_obstacks ();
                    921:                  end_template_instantiation ($1, $<ttype>3);
                    922: 
                    923:                   /* Now go after the methods & class data.  */
                    924:                   instantiate_member_templates ($1);
1.1.1.6 ! root      925: 
        !           926:                  pop_tinst_level();
        !           927: 
1.1.1.4   root      928:                  CLASSTYPE_GOT_SEMICOLON ($$) = 1;
1.1       root      929:                }
                    930:        ;
                    931: 
                    932: template_instantiation:
                    933:           /* empty */
                    934:                 { $$ = NULL_TREE; }
                    935:         | template_instantiate_once
                    936:                 { $$ = $1; }
                    937:         ;
                    938: 
                    939: template_instantiate_some:
                    940:           /* empty */
                    941:                 { $$ = NULL_TREE; /* never used from here... */}
                    942:         | template_instantiate_once template_instantiate_some
                    943:                 { $$ = $1; /*???*/ }
                    944:         ;
                    945: 
                    946: unop:     '-'
                    947:                { $$ = NEGATE_EXPR; }
                    948:        | '+'
                    949:                { $$ = CONVERT_EXPR; }
                    950:        | PLUSPLUS
                    951:                { $$ = PREINCREMENT_EXPR; }
                    952:        | MINUSMINUS
                    953:                { $$ = PREDECREMENT_EXPR; }
                    954:        | '!'
                    955:                { $$ = TRUTH_NOT_EXPR; }
                    956:        ;
                    957: 
                    958: expr:    nonnull_exprlist
                    959:                { $$ = build_x_compound_expr ($$); }
                    960:        /* Ugly, but faster.  */
                    961:        | expr_no_commas
                    962:        ;
                    963: 
1.1.1.5   root      964: paren_expr_or_null:
                    965:        LEFT_RIGHT
                    966:                { error ("ANSI C++ forbids an empty condition for `%s'",
                    967:                         cond_stmt_keyword);
                    968:                  $$ = integer_zero_node; }
                    969:        | '(' expr ')'
                    970:                { $$ = $2; }
                    971:        ;
                    972: 
1.1.1.6 ! root      973: paren_cond_or_null:
        !           974:        LEFT_RIGHT
        !           975:                { error ("ANSI C++ forbids an empty condition for `%s'",
        !           976:                         cond_stmt_keyword);
        !           977:                  $$ = integer_zero_node; }
        !           978:        | '(' condition ')'
        !           979:                { $$ = $2; }
        !           980:        ;
        !           981: 
        !           982: xcond:
        !           983:        /* empty */
        !           984:                { $$ = NULL_TREE; }
        !           985:        | condition
        !           986:        | error
        !           987:                { $$ = NULL_TREE; }
        !           988:        ;
        !           989: 
        !           990: condition:
        !           991:        typed_typespecs declarator maybe_raises maybeasm maybe_attribute '='
        !           992:                { {
        !           993:                  tree d;
        !           994:                  for (d = getdecls (); d; d = TREE_CHAIN (d))
        !           995:                    if (TREE_CODE (d) == TYPE_DECL) {
        !           996:                      tree s = TREE_TYPE (d);
        !           997:                      if (TREE_CODE (s) == RECORD_TYPE)
        !           998:                        cp_error ("definition of class `%T' in condition", s);
        !           999:                      else if (TREE_CODE (s) == ENUMERAL_TYPE)
        !          1000:                        cp_error ("definition of enum `%T' in condition", s);
        !          1001:                    }
        !          1002:                  }
        !          1003:                  current_declspecs = $1;
        !          1004:                  $<itype>6 = suspend_momentary ();
        !          1005:                  $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1, $3);
        !          1006:                  cplus_decl_attributes ($<ttype>$, $5);
        !          1007:                }
        !          1008:        init
        !          1009:                { 
        !          1010:                  finish_decl ($<ttype>7, $8, $5, 0);
        !          1011:                  resume_momentary ($<itype>6);
        !          1012:                  $$ = $<ttype>7; 
        !          1013:                  if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
        !          1014:                    cp_error ("definition of array `%#D' in condition", $$); 
        !          1015:                }
        !          1016:        | expr
        !          1017:        ;
        !          1018: 
        !          1019: /* Used for the blocks controlled by a condition, to add any DECLs in
        !          1020:    the condition to the controlled block.  */
        !          1021: .kindof_pushlevel: /* empty */
        !          1022:                { tree d = getdecls ();
        !          1023:                  emit_line_note (input_filename, lineno);
        !          1024:                  pushlevel (0);
        !          1025:                  clear_last_expr ();
        !          1026:                  push_momentary ();
        !          1027:                  expand_start_bindings (0);
        !          1028:                  if (d) pushdecl (d);
        !          1029:                }    
        !          1030:        ;
        !          1031: 
        !          1032: /* Like implicitly_scoped_stmt, but uses .kindof_pushlevel */
        !          1033: partially_scoped_stmt:
        !          1034:            '{' .kindof_pushlevel '}'
        !          1035:                { pop_implicit_try_blocks (NULL_TREE);
        !          1036:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          1037:                  $$ = poplevel (kept_level_p (), 1, 0);
        !          1038:                  pop_momentary (); 
        !          1039:                  finish_stmt (); }
        !          1040:        | '{' .kindof_pushlevel maybe_label_decls stmts '}'
        !          1041:                { pop_implicit_try_blocks (NULL_TREE);
        !          1042:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          1043:                  $$ = poplevel (kept_level_p (), 1, 0);
        !          1044:                  pop_momentary (); 
        !          1045:                  finish_stmt (); }
        !          1046:        | '{' .kindof_pushlevel maybe_label_decls error '}'
        !          1047:                { pop_implicit_try_blocks (NULL_TREE);
        !          1048:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          1049:                  $$ = poplevel (kept_level_p (), 0, 0);
        !          1050:                  pop_momentary (); 
        !          1051:                  finish_stmt (); }
        !          1052:        | .kindof_pushlevel simple_stmt
        !          1053:                { pop_implicit_try_blocks (NULL_TREE);
        !          1054:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          1055:                  $$ = poplevel (kept_level_p (), 1, 0);
        !          1056:                  pop_momentary (); }
        !          1057:        ;
        !          1058: 
        !          1059: already_scoped_stmt:
        !          1060:           '{' '}'
        !          1061:                { finish_stmt (); }
        !          1062:        | '{' maybe_label_decls stmts '}'
        !          1063:                { finish_stmt (); }
        !          1064:        | '{' maybe_label_decls error '}'
        !          1065:                { finish_stmt (); }
        !          1066:        | simple_stmt
        !          1067:        ;
        !          1068: 
1.1       root     1069: nonnull_exprlist:
                   1070:          expr_no_commas
                   1071:                { $$ = build_tree_list (NULL_TREE, $$); }
                   1072:        | nonnull_exprlist ',' expr_no_commas
                   1073:                { chainon ($$, build_tree_list (NULL_TREE, $3)); }
                   1074:        | nonnull_exprlist ',' error
                   1075:                { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
                   1076:        ;
                   1077: 
                   1078: unary_expr:
                   1079:          primary %prec UNARY
                   1080:                {
                   1081:                  if (TREE_CODE ($$) == TYPE_EXPR)
                   1082:                    $$ = build_component_type_expr (C_C_D, $$, NULL_TREE, 1);
                   1083:                }
1.1.1.2   root     1084:        /* __extension__ turns off -pedantic for following primary.  */
                   1085:        | EXTENSION
                   1086:                { $<itype>1 = pedantic;
                   1087:                  pedantic = 0; }
                   1088:          cast_expr       %prec UNARY
                   1089:                { $$ = $3;
                   1090:                  pedantic = $<itype>1; }
1.1       root     1091:        | '*' cast_expr   %prec UNARY
                   1092:                { $$ = build_x_indirect_ref ($2, "unary *"); }
                   1093:        | '&' cast_expr   %prec UNARY
                   1094:                { $$ = build_x_unary_op (ADDR_EXPR, $2); }
                   1095:        | '~' cast_expr   %prec UNARY
                   1096:                { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
                   1097:        | unop cast_expr  %prec UNARY
1.1.1.5   root     1098:                { $$ = build_x_unary_op ((enum tree_code) $$, $2);
1.1       root     1099:                  if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
                   1100:                    TREE_NEGATED_INT ($$) = 1;
1.1.1.6 ! root     1101:                  overflow_warning ($$);
1.1       root     1102:                }
1.1.1.4   root     1103:        /* Refer to the address of a label as a pointer.  */
                   1104:        | ANDAND identifier
                   1105:                { tree label = lookup_label ($2);
1.1.1.6 ! root     1106:                  if (label == NULL_TREE)
        !          1107:                    $$ = null_pointer_node;
        !          1108:                  else
        !          1109:                    {
        !          1110:                      TREE_USED (label) = 1;
        !          1111:                      $$ = build1 (ADDR_EXPR, ptr_type_node, label);
        !          1112:                      TREE_CONSTANT ($$) = 1;
        !          1113:                    }
        !          1114:                }
1.1       root     1115:        | SIZEOF unary_expr  %prec UNARY
                   1116:                { if (TREE_CODE ($2) == COMPONENT_REF
                   1117:                      && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
                   1118:                    error ("sizeof applied to a bit-field");
                   1119:                  /* ANSI says arrays and functions are converted inside comma.
                   1120:                     But we can't really convert them in build_compound_expr
                   1121:                     because that would break commas in lvalues.
                   1122:                     So do the conversion here if operand was a comma.  */
                   1123:                  if (TREE_CODE ($2) == COMPOUND_EXPR
                   1124:                      && (TREE_CODE (TREE_TYPE ($2)) == ARRAY_TYPE
                   1125:                          || TREE_CODE (TREE_TYPE ($2)) == FUNCTION_TYPE))
                   1126:                    $2 = default_conversion ($2);
1.1.1.5   root     1127:                  else if (TREE_CODE ($2) == TREE_LIST)
                   1128:                    {
                   1129:                      tree t = TREE_VALUE ($2);
                   1130:                      if (t != NULL_TREE
                   1131:                          && TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
                   1132:                        pedwarn ("ANSI C++ forbids using sizeof() on a function");
                   1133:                    }
1.1       root     1134:                  $$ = c_sizeof (TREE_TYPE ($2)); }
                   1135:        | SIZEOF '(' typename ')'  %prec HYPERUNARY
                   1136:                { $$ = c_sizeof (groktypename ($3)); }
                   1137:        | ALIGNOF unary_expr  %prec UNARY
1.1.1.6 ! root     1138:                { $$ = grok_alignof ($2); }
1.1       root     1139:        | ALIGNOF '(' typename ')'  %prec HYPERUNARY
                   1140:                { $$ = c_alignof (groktypename ($3)); }
                   1141: 
                   1142:        | .scope new typename %prec '='
1.1.1.5   root     1143:                { $$ = build_new ($2, $3, NULL_TREE, $$ != NULL_TREE); }
1.1.1.4   root     1144:        | .scope new '(' nonnull_exprlist ')' typename %prec '='
1.1.1.5   root     1145:                { $$ = build_new ($4, $6, NULL_TREE, $$ != NULL_TREE); }
1.1       root     1146:        | .scope new typespec '(' nonnull_exprlist ')'
1.1.1.5   root     1147:                { $$ = build_new ($2, $3, $5, $$ != NULL_TREE); }
1.1.1.6 ! root     1148:        | .scope new typespec '(' typespec ')'
        !          1149:                { cp_error ("`%T' is not a valid expression", $5);
        !          1150:                  $$ = error_mark_node; }
1.1.1.4   root     1151:        | .scope new '(' nonnull_exprlist ')' typespec '(' nonnull_exprlist ')'
1.1.1.5   root     1152:                { $$ = build_new ($4, $6, $8, $$ != NULL_TREE); }
1.1       root     1153:        | .scope new typespec LEFT_RIGHT
1.1.1.5   root     1154:                { $$ = build_new ($2, $3, NULL_TREE, $$ != NULL_TREE); }
1.1.1.4   root     1155:        | .scope new '(' nonnull_exprlist ')' typespec LEFT_RIGHT
1.1.1.5   root     1156:                { $$ = build_new ($4, $6, NULL_TREE, $$ != NULL_TREE); }
1.1       root     1157:        | .scope new typename '=' init %prec '='
1.1.1.5   root     1158:                { $$ = build_new ($2, $3, $5, $$ != NULL_TREE); }
1.1.1.4   root     1159:        | .scope new '(' nonnull_exprlist ')' typename '=' init %prec '='
1.1.1.5   root     1160:                { $$ = build_new ($4, $6, $8, $$ != NULL_TREE); }
1.1       root     1161: 
1.1.1.4   root     1162:        /* I am not going to add placement syntax to the below complex rules
                   1163:           because Ken says the syntax is illegal. (mrs) */
1.1       root     1164:        /* I'm not sure why this is disallowed.  But since it is, and it
                   1165:           doesn't seem difficult to catch it, let's give a message, so
                   1166:           the programmer can fix it.  --Ken Raeburn  */
                   1167:        | .scope new '(' typed_typespecs absdcl ')' '[' nonmomentary_expr ']'
                   1168:                {
                   1169:                  tree absdcl, typename;
                   1170: 
                   1171:                illegal_new_array:
                   1172:                  absdcl = build_parse_node (ARRAY_REF, $5, $8);
                   1173:                  typename = build_decl_list ($4, absdcl);
1.1.1.4   root     1174:                  pedwarn ("ANSI C++ forbids array dimensions with parenthesized type");
1.1.1.5   root     1175:                  $$ = build_new ($2, typename, NULL_TREE, $$ != NULL_TREE);
1.1       root     1176:                }
                   1177:        | .scope new '(' nonempty_type_quals absdcl ')' '[' nonmomentary_expr ']'
                   1178:                { goto illegal_new_array; }
                   1179: 
                   1180:        | .scope new '(' typed_typespecs absdcl ')'
1.1.1.5   root     1181:                { $$ = build_new ($2, build_decl_list ($4, $5), NULL_TREE, $$ != NULL_TREE); }
1.1.1.4   root     1182:        | .scope new '(' nonnull_exprlist ')' '(' typed_typespecs absdcl ')'
1.1.1.5   root     1183:                { $$ = build_new ($4, build_decl_list ($7, $8), NULL_TREE, $$ != NULL_TREE); }
1.1       root     1184:        | .scope new '(' nonempty_type_quals absdcl ')'
1.1.1.5   root     1185:                { $$ = build_new ($2, build_decl_list ($4, $5), NULL_TREE, $$ != NULL_TREE); }
1.1.1.4   root     1186:        | .scope new '(' nonnull_exprlist ')' '(' nonempty_type_quals absdcl ')'
1.1.1.5   root     1187:                { $$ = build_new ($4, build_decl_list ($7, $8), NULL_TREE, $$ != NULL_TREE); }
1.1       root     1188:        /* Unswallow a ':' which is probably meant for ?: expression.  */
                   1189:        | .scope new TYPENAME_COLON
1.1.1.5   root     1190:                { yyungetc (':', 1); $$ = build_new ($2, $3, NULL_TREE, $$ != NULL_TREE); }
1.1.1.4   root     1191:        | .scope new '(' nonnull_exprlist ')' TYPENAME_COLON
1.1.1.5   root     1192:                { yyungetc (':', 1); $$ = build_new ($4, $6, NULL_TREE, $$ != NULL_TREE); }
1.1       root     1193: 
                   1194:        | delete cast_expr  %prec UNARY
1.1.1.6 ! root     1195:                { $$ = delete_sanity ($2, NULL_TREE, 0); }
1.1       root     1196:        | delete '[' ']' cast_expr  %prec UNARY
1.1.1.6 ! root     1197:                { $$ = delete_sanity ($4, NULL_TREE, 1);
1.1       root     1198:                  if (yychar == YYEMPTY)
1.1.1.6 ! root     1199:                    yychar = YYLEX; }
1.1       root     1200:        | delete '[' expr ']' cast_expr %prec UNARY
1.1.1.6 ! root     1201:                { $$ = delete_sanity ($5, $3, 2);
1.1       root     1202:                  if (yychar == YYEMPTY)
1.1.1.6 ! root     1203:                    yychar = YYLEX; }
1.1       root     1204:        ;
                   1205: 
                   1206: cast_expr:
                   1207:          unary_expr
                   1208:        | '(' typename ')' expr_no_commas  %prec UNARY
                   1209:                { tree type = groktypename ($2);
                   1210:                  $$ = build_c_cast (type, $4); }
                   1211:        | '(' typename ')' '{' initlist maybecomma '}'  %prec UNARY
                   1212:                { tree type = groktypename ($2);
                   1213:                  tree init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($5));
                   1214:                  if (pedantic)
1.1.1.4   root     1215:                    pedwarn ("ANSI C++ forbids constructor-expressions");
1.1       root     1216:                  /* Indicate that this was a GNU C constructor expression.  */
                   1217:                  TREE_HAS_CONSTRUCTOR (init) = 1;
1.1.1.5   root     1218:                  $$ = digest_init (type, init, (tree *) 0);
1.1       root     1219:                  if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
                   1220:                    {
                   1221:                      int failure = complete_array_type (type, $$, 1);
                   1222:                      if (failure)
1.1.1.3   root     1223:                        my_friendly_abort (78);
1.1       root     1224:                    }
                   1225:                }
                   1226:        | HEADOF '(' expr ')'
                   1227:                { $$ = build_headof ($3); }
                   1228:        | CLASSOF '(' expr ')'
                   1229:                { $$ = build_classof ($3); }
                   1230:        | CLASSOF '(' TYPENAME ')'
                   1231:                { if (is_aggr_typedef ($3, 1))
                   1232:                    {
                   1233:                      tree type = IDENTIFIER_TYPE_VALUE ($3);
                   1234:                      $$ = CLASSTYPE_DOSSIER (type);
                   1235:                    }
                   1236:                  else
                   1237:                    $$ = error_mark_node;
                   1238:                }
                   1239:        ;
                   1240: 
                   1241: expr_no_commas:
                   1242:          cast_expr
                   1243:        | expr_no_commas '+' expr_no_commas
                   1244:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1245:        | expr_no_commas '-' expr_no_commas
                   1246:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1247:        | expr_no_commas '*' expr_no_commas
                   1248:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1249:        | expr_no_commas '/' expr_no_commas
                   1250:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1251:        | expr_no_commas '%' expr_no_commas
                   1252:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1253:        | expr_no_commas LSHIFT expr_no_commas
                   1254:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1255:        | expr_no_commas RSHIFT expr_no_commas
                   1256:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1257:        | expr_no_commas ARITHCOMPARE expr_no_commas
                   1258:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1259:        | expr_no_commas '<' expr_no_commas
                   1260:                { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
                   1261:        | expr_no_commas '>' expr_no_commas
                   1262:                { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
                   1263:        | expr_no_commas EQCOMPARE expr_no_commas
                   1264:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1265:        | expr_no_commas MIN_MAX expr_no_commas
                   1266:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1267:        | expr_no_commas '&' expr_no_commas
                   1268:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1269:        | expr_no_commas '|' expr_no_commas
                   1270:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1271:        | expr_no_commas '^' expr_no_commas
                   1272:                { $$ = build_x_binary_op ($2, $$, $3); }
                   1273:        | expr_no_commas ANDAND expr_no_commas
                   1274:                { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
                   1275:        | expr_no_commas OROR expr_no_commas
                   1276:                { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
                   1277:        | expr_no_commas '?' xexpr ':' expr_no_commas
                   1278:                { $$ = build_x_conditional_expr ($$, $3, $5); }
                   1279:        | expr_no_commas '=' expr_no_commas
                   1280:                { $$ = build_modify_expr ($$, NOP_EXPR, $3); }
                   1281:        | expr_no_commas ASSIGN expr_no_commas
                   1282:                { register tree rval;
1.1.1.4   root     1283:                  if (rval = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL, $$, $3,
1.1.1.5   root     1284:                                             make_node ($2)))
1.1       root     1285:                    $$ = rval;
                   1286:                  else
                   1287:                    $$ = build_modify_expr ($$, $2, $3); }
                   1288:        | primary DOT_STAR expr_no_commas %prec UNARY
1.1.1.6 ! root     1289:                { $$ = build_m_component_ref ($$, $3); }
1.1       root     1290:        /* Handle general members.  */
                   1291:        | object_star expr_no_commas   %prec UNARY
                   1292:                { $$ = build_x_binary_op (MEMBER_REF, $$, $2); }
1.1.1.6 ! root     1293: /* These extensions are not defined.  The second arg to build_m_component_ref
        !          1294:    is old, build_m_component_ref now does an implicit
        !          1295:    build_indirect_ref (x, NULL_PTR) on the second argument.
1.1       root     1296:        | object '&' expr_no_commas   %prec UNARY
                   1297:                { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
                   1298:        | object unop expr_no_commas  %prec UNARY
                   1299:                { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
                   1300:        | object '(' typename ')' expr_no_commas  %prec UNARY
                   1301:                { tree type = groktypename ($3);
                   1302:                  $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
                   1303:        | object primary_no_id  %prec UNARY
                   1304:                { $$ = build_m_component_ref ($$, $2); }
                   1305: */
                   1306:        ;
                   1307: 
                   1308: primary:
                   1309:        IDENTIFIER
                   1310:                { $$ = do_identifier ($$); }
                   1311:        | operator_name
                   1312:                {
                   1313:                  tree op = $$;
                   1314:                  if (TREE_CODE (op) != IDENTIFIER_NODE)
                   1315:                    $$ = op;
                   1316:                  else
                   1317:                    {
1.1.1.4   root     1318:                      $$ = lookup_name (op, 0);
1.1       root     1319:                      if ($$ == NULL_TREE)
                   1320:                        {
1.1.1.6 ! root     1321:                          if (op != ansi_opname[ERROR_MARK])
        !          1322:                            error ("operator %s not defined",
        !          1323:                                   operator_name_string (op));
1.1       root     1324:                          $$ = error_mark_node;
                   1325:                        }
                   1326:                    }
                   1327:                }
                   1328:        | CONSTANT
                   1329:        | string
                   1330:                { $$ = combine_strings ($$); }
                   1331:        | '(' expr ')'
                   1332:                { $$ = $2; }
                   1333:        | '(' error ')'
                   1334:                { $$ = error_mark_node; }
                   1335:        | '('
                   1336:                { if (current_function_decl == 0)
                   1337:                    {
                   1338:                      error ("braced-group within expression allowed only inside a function");
                   1339:                      YYERROR;
                   1340:                    }
                   1341:                  keep_next_level ();
                   1342:                  $<ttype>$ = expand_start_stmt_expr (); }
                   1343:          compstmt ')'
                   1344:                { tree rtl_exp;
                   1345:                  if (pedantic)
1.1.1.4   root     1346:                    pedwarn ("ANSI C++ forbids braced-groups within expressions");
1.1       root     1347:                  rtl_exp = expand_end_stmt_expr ($<ttype>2);
                   1348:                  /* The statements have side effects, so the group does.  */
                   1349:                  TREE_SIDE_EFFECTS (rtl_exp) = 1;
                   1350:                  /* Make a BIND_EXPR for the BLOCK already made.  */
                   1351:                  $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
                   1352:                              NULL_TREE, rtl_exp, $3);
1.1.1.4   root     1353:                  /* Remove the block from the tree at this point.
                   1354:                     It gets put back at the proper place
                   1355:                     when the BIND_EXPR is expanded.  */
                   1356:                  delete_block ($3);
1.1       root     1357:                }
                   1358:        | primary '(' nonnull_exprlist ')'
                   1359:                 { /* [eichin:19911016.1902EST] */
                   1360:                   $<ttype>$ = build_x_function_call ($1, $3, current_class_decl); 
                   1361:                   /* here we instantiate_class_template as needed... */
1.1.1.4   root     1362:                   do_pending_templates ();
1.1       root     1363:                 } template_instantiate_some {
                   1364:                   if (TREE_CODE ($<ttype>5) == CALL_EXPR
                   1365:                       && TREE_TYPE ($<ttype>5) != void_type_node)
                   1366:                    $$ = require_complete_type ($<ttype>5);
                   1367:                   else
                   1368:                     $$ = $<ttype>5;
                   1369:                 }
                   1370:        | primary LEFT_RIGHT
1.1.1.5   root     1371:                 {
1.1.1.6 ! root     1372:                  $$ = build_x_function_call ($$, NULL_TREE, current_class_decl);
        !          1373:                  if (TREE_CODE ($$) == CALL_EXPR
        !          1374:                      && TREE_TYPE ($$) != void_type_node)
        !          1375:                    $$ = require_complete_type ($$);
1.1       root     1376:                 }
                   1377:        | primary '[' expr ']'
1.1.1.6 ! root     1378:                { do_array:
        !          1379:                    $$ = grok_array_decl ($$, $3); }
1.1       root     1380:        | object identifier_or_opname  %prec UNARY
                   1381:                { $$ = build_component_ref ($$, $2, NULL_TREE, 1); }
1.1.1.6 ! root     1382:        | object id_scope identifier_or_opname %prec UNARY
        !          1383:                { $$ = build_object_ref ($$, $2, $3); }
1.1       root     1384:        | primary PLUSPLUS
1.1.1.6 ! root     1385:                { /* If we get an OFFSET_REF, turn it into what it really
        !          1386:                     means (e.g., a COMPONENT_REF).  This way if we've got,
        !          1387:                     say, a reference to a static member that's being operated
        !          1388:                     on, we don't end up trying to find a member operator for
        !          1389:                     the class it's in.  */
        !          1390:                  if (TREE_CODE ($$) == OFFSET_REF)
        !          1391:                    $$ = resolve_offset_ref ($$);
        !          1392:                  $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1.1       root     1393:        | primary MINUSMINUS
1.1.1.6 ! root     1394:                { if (TREE_CODE ($$) == OFFSET_REF)
        !          1395:                    $$ = resolve_offset_ref ($$);
        !          1396:                  $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1.1       root     1397:        /* C++ extensions */
                   1398:        | THIS
                   1399:                { if (current_class_decl)
                   1400:                    {
                   1401: #ifdef WARNING_ABOUT_CCD
                   1402:                      TREE_USED (current_class_decl) = 1;
                   1403: #endif
                   1404:                      $$ = current_class_decl;
                   1405:                    }
                   1406:                  else if (current_function_decl
                   1407:                           && DECL_STATIC_FUNCTION_P (current_function_decl))
                   1408:                    {
                   1409:                      error ("`this' is unavailable for static member functions");
                   1410:                      $$ = error_mark_node;
                   1411:                    }
                   1412:                  else
                   1413:                    {
                   1414:                      if (current_function_decl)
                   1415:                        error ("invalid use of `this' in non-member function");
                   1416:                      else
                   1417:                        error ("invalid use of `this' at top level");
                   1418:                      $$ = error_mark_node;
                   1419:                    }
                   1420:                }
                   1421:        | TYPE_QUAL '(' nonnull_exprlist ')'
                   1422:                {
                   1423:                  tree type;
                   1424:                  tree id = $$;
                   1425: 
                   1426:                  /* This is a C cast in C++'s `functional' notation.  */
                   1427:                  if ($3 == error_mark_node)
                   1428:                    {
                   1429:                      $$ = error_mark_node;
                   1430:                      break;
                   1431:                    }
                   1432: #if 0
                   1433:                  if ($3 == NULL_TREE)
                   1434:                    {
                   1435:                      error ("cannot cast null list to type `%s'",
                   1436:                             IDENTIFIER_POINTER (TYPE_NAME (id)));
                   1437:                      $$ = error_mark_node;
                   1438:                      break;
                   1439:                    }
                   1440: #endif
1.1.1.4   root     1441: #if 0
                   1442:                  /* type is not set! (mrs) */
1.1       root     1443:                  if (type == error_mark_node)
                   1444:                    $$ = error_mark_node;
                   1445:                  else
1.1.1.4   root     1446: #endif
1.1       root     1447:                    {
                   1448:                      if (id == ridpointers[(int) RID_CONST])
                   1449:                        type = build_type_variant (integer_type_node, 1, 0);
                   1450:                      else if (id == ridpointers[(int) RID_VOLATILE])
                   1451:                        type = build_type_variant (integer_type_node, 0, 1);
1.1.1.4   root     1452: #if 0
                   1453:                      /* should not be able to get here (mrs) */
1.1       root     1454:                      else if (id == ridpointers[(int) RID_FRIEND])
                   1455:                        {
                   1456:                          error ("cannot cast expression to `friend' type");
                   1457:                          $$ = error_mark_node;
                   1458:                          break;
                   1459:                        }
1.1.1.4   root     1460: #endif
1.1.1.3   root     1461:                      else my_friendly_abort (79);
1.1       root     1462:                      $$ = build_c_cast (type, build_compound_expr ($3));
                   1463:                    }
                   1464:                }
                   1465:        | typespec '(' nonnull_exprlist ')'
                   1466:                { $$ = build_functional_cast ($$, $3); }
                   1467:        | typespec LEFT_RIGHT
                   1468:                { $$ = build_functional_cast ($$, NULL_TREE); }
1.1.1.6 ! root     1469:        /* Stroustrup RTTI */
        !          1470:        | DYNAMIC_CAST '<' typename '>' '(' expr ')'
        !          1471:                { tree type = groktypename ($3);
        !          1472:                  $$ = build_dynamic_cast (type, $6); }
        !          1473:        | TYPEID '(' expr ')'
        !          1474:                { $$ = build_typeid ($3); }
        !          1475:        | TYPEID '(' typename ')'
        !          1476:                { tree type = groktypename ($3);
        !          1477:                  $$ = get_typeid (type); }
1.1.1.4   root     1478:        | SCOPE typespec '(' nonnull_exprlist ')'
                   1479:                { $$ = build_functional_cast ($2, $4); }
                   1480:        | SCOPE typespec LEFT_RIGHT
                   1481:                { $$ = build_functional_cast ($2, NULL_TREE); }
1.1       root     1482:        | SCOPE IDENTIFIER
                   1483:                {
                   1484:                do_scoped_id:
                   1485:                  $$ = IDENTIFIER_GLOBAL_VALUE ($2);
                   1486:                  if (yychar == YYEMPTY)
                   1487:                    yychar = YYLEX;
                   1488:                  if (! $$)
                   1489:                    {
                   1490:                      if (yychar == '(' || yychar == LEFT_RIGHT)
                   1491:                        $$ = implicitly_declare ($2);
                   1492:                      else
                   1493:                        {
                   1494:                          if (IDENTIFIER_GLOBAL_VALUE ($2) != error_mark_node)
                   1495:                            error ("undeclared variable `%s' (first use here)",
                   1496:                                   IDENTIFIER_POINTER ($2));
                   1497:                          $$ = error_mark_node;
                   1498:                          /* Prevent repeated error messages.  */
                   1499:                          IDENTIFIER_GLOBAL_VALUE ($2) = error_mark_node;
                   1500:                        }
                   1501:                    }
                   1502:                  else
                   1503:                    {
1.1.1.5   root     1504:                      if (TREE_CODE ($$) == ADDR_EXPR)
                   1505:                        assemble_external (TREE_OPERAND ($$, 0));
                   1506:                      else
                   1507:                        assemble_external ($$);
1.1       root     1508:                      TREE_USED ($$) = 1;
                   1509:                    }
                   1510:                  if (TREE_CODE ($$) == CONST_DECL)
1.1.1.4   root     1511:                    {
                   1512:                      /* XXX CHS - should we set TREE_USED of the constant? */
                   1513:                      $$ = DECL_INITIAL ($$);
                   1514:                      /* This is to prevent an enum whose value is 0
                   1515:                         from being considered a null pointer constant.  */
                   1516:                      $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$);
                   1517:                      TREE_CONSTANT ($$) = 1;
                   1518:                    }
                   1519: 
1.1       root     1520:                }
                   1521:        | SCOPE operator_name
                   1522:                {
                   1523:                  if (TREE_CODE ($2) == IDENTIFIER_NODE)
                   1524:                    goto do_scoped_id;
                   1525:                do_scoped_operator:
                   1526:                  $$ = $2;
                   1527:                }
1.1.1.6 ! root     1528:        | id_scope identifier_or_opname  %prec HYPERUNARY
1.1       root     1529:                { $$ = build_offset_ref ($$, $2); }
1.1.1.6 ! root     1530:        | id_scope identifier_or_opname '(' nonnull_exprlist ')'
1.1       root     1531:                { $$ = build_member_call ($$, $2, $4); }
1.1.1.6 ! root     1532:        | id_scope identifier_or_opname LEFT_RIGHT
1.1       root     1533:                { $$ = build_member_call ($$, $2, NULL_TREE); }
                   1534:        | object identifier_or_opname '(' nonnull_exprlist ')'
1.1.1.6 ! root     1535:                {
        !          1536: #if 0
        !          1537:                  /* This is a future direction of this code, but because
        !          1538:                     build_x_function_call cannot always undo what is done
        !          1539:                     in build_component_ref entirely yet, we cannot do this. */
        !          1540:                  $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, $$);
        !          1541:                  if (TREE_CODE ($$) == CALL_EXPR
        !          1542:                      && TREE_TYPE ($$) != void_type_node)
        !          1543:                    $$ = require_complete_type ($$);
        !          1544: #else
        !          1545:                  $$ = build_method_call ($$, $2, $4, NULL_TREE,
        !          1546:                                          (LOOKUP_NORMAL|LOOKUP_AGGR));
        !          1547: #endif
        !          1548:                }
1.1       root     1549:        | object identifier_or_opname LEFT_RIGHT
1.1.1.6 ! root     1550:                {
        !          1551: #if 0
        !          1552:                  /* This is a future direction of this code, but because
        !          1553:                     build_x_function_call cannot always undo what is done
        !          1554:                     in build_component_ref entirely yet, we cannot do this. */
        !          1555:                  $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, $$);
        !          1556:                  if (TREE_CODE ($$) == CALL_EXPR
        !          1557:                      && TREE_TYPE ($$) != void_type_node)
        !          1558:                    $$ = require_complete_type ($$);
        !          1559: #else
        !          1560:                  $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
        !          1561:                                          (LOOKUP_NORMAL|LOOKUP_AGGR));
        !          1562: #endif
        !          1563:                }
        !          1564:        | object id_scope identifier_or_opname '(' nonnull_exprlist ')'
1.1       root     1565:                { $$ = build_scoped_method_call ($$, $2, $3, $5); }
1.1.1.6 ! root     1566:        | object id_scope identifier_or_opname LEFT_RIGHT
1.1       root     1567:                { $$ = build_scoped_method_call ($$, $2, $3, NULL_TREE); }
1.1.1.6 ! root     1568:        /* p->int::~int() is valid -- 12.4 */
        !          1569:        | object '~' TYPESPEC LEFT_RIGHT
        !          1570:                { 
        !          1571:                  if (TREE_CODE (TREE_TYPE ($1)) 
        !          1572:                      != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3))))
        !          1573:                    cp_error ("`%E' is not of type `%T'", $1, $3);
        !          1574:                  $$ = void_zero_node;
        !          1575:                }
        !          1576:        | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
        !          1577:                { 
        !          1578:                  if ($2 != $5)
        !          1579:                    cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
        !          1580:                  if (TREE_CODE (TREE_TYPE ($1))
        !          1581:                      != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
        !          1582:                    cp_error ("`%E' is not of type `%T'", $1, $2);
        !          1583:                  $$ = void_zero_node; 
        !          1584:                }
1.1       root     1585:        ;
                   1586: 
                   1587: /* Not needed for now.
                   1588: 
                   1589: primary_no_id:
                   1590:          '(' expr ')'
                   1591:                { $$ = $2; }
                   1592:        | '(' error ')'
                   1593:                { $$ = error_mark_node; }
                   1594:        | '('
                   1595:                { if (current_function_decl == 0)
                   1596:                    {
                   1597:                      error ("braced-group within expression allowed only inside a function");
                   1598:                      YYERROR;
                   1599:                    }
                   1600:                  $<ttype>$ = expand_start_stmt_expr (); }
                   1601:          compstmt ')'
                   1602:                { if (pedantic)
1.1.1.4   root     1603:                    pedwarn ("ANSI C++ forbids braced-groups within expressions");
1.1       root     1604:                  $$ = expand_end_stmt_expr ($<ttype>2); }
                   1605:        | primary_no_id '(' nonnull_exprlist ')'
                   1606:                { $$ = build_x_function_call ($$, $3, current_class_decl); }
                   1607:        | primary_no_id LEFT_RIGHT
                   1608:                { $$ = build_x_function_call ($$, NULL_TREE, current_class_decl); }
                   1609:        | primary_no_id '[' expr ']'
                   1610:                { goto do_array; }
                   1611:        | primary_no_id PLUSPLUS
                   1612:                { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
                   1613:        | primary_no_id MINUSMINUS
                   1614:                { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
                   1615:        | SCOPE IDENTIFIER
                   1616:                { goto do_scoped_id; }
                   1617:        | SCOPE operator_name
                   1618:                { if (TREE_CODE ($2) == IDENTIFIER_NODE)
                   1619:                    goto do_scoped_id;
                   1620:                  goto do_scoped_operator;
                   1621:                }
                   1622:        ;
                   1623: */
                   1624: 
                   1625: new:     NEW
                   1626:                { $$ = NULL_TREE; }
                   1627:        | NEW '{' nonnull_exprlist '}'
1.1.1.4   root     1628:                {
                   1629:                  $$ = $3;
                   1630:                  pedwarn ("old style placement syntax, use () instead");
                   1631:                }
1.1       root     1632:        ;
                   1633: 
                   1634: .scope:
                   1635:        /* empty  */
                   1636:                { $$ = 0; }
                   1637:        | SCOPE
                   1638:                { $$ = 1; }
                   1639:        ;
                   1640: 
                   1641: delete:          DELETE
                   1642:                { $$ = NULL_TREE; }
                   1643:        | SCOPE delete
                   1644:                { if ($2)
                   1645:                    error ("extra `::' before `delete' ignored");
                   1646:                  $$ = error_mark_node;
                   1647:                }
                   1648:        ;
                   1649: 
                   1650: /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it.  */
                   1651: string:
                   1652:          STRING
                   1653:        | string STRING
                   1654:                { $$ = chainon ($$, $2); }
                   1655:        ;
                   1656: 
                   1657: nodecls:
                   1658:          /* empty */
                   1659:                {
                   1660:                  if (! current_function_parms_stored)
                   1661:                    store_parm_decls ();
                   1662:                  setup_vtbl_ptr ();
1.1.1.6 ! root     1663:                  /* Always keep the BLOCK node associated with the outermost
        !          1664:                     pair of curley braces of a function.  These are needed
        !          1665:                     for correct operation of dwarfout.c.  */
        !          1666:                  keep_next_level ();
1.1       root     1667:                }
                   1668:        ;
                   1669: 
                   1670: object:          primary '.'
                   1671:        | primary POINTSAT
                   1672:                {
1.1.1.4   root     1673:                  $$ = build_x_arrow ($$);
1.1       root     1674:                }
                   1675:        ;
                   1676: 
                   1677: object_star: primary POINTSAT_STAR
                   1678:        ;
                   1679: 
                   1680: decl:
                   1681:          typed_declspecs initdecls ';'
                   1682:                {
                   1683:                  resume_momentary ($2);
                   1684:                  note_list_got_semicolon ($<ttype>$);
                   1685:                }
                   1686:        /* Normal case: make this fast.  */
                   1687:        | typed_declspecs declarator ';'
                   1688:                { tree d;
                   1689:                  int yes = suspend_momentary ();
1.1.1.5   root     1690:                  d = start_decl ($<ttype>2, $<ttype>$, 0, NULL_TREE);
1.1.1.3   root     1691:                  finish_decl (d, NULL_TREE, NULL_TREE, 0);
1.1       root     1692:                  resume_momentary (yes);
                   1693:                  note_list_got_semicolon ($<ttype>$);
                   1694:                }
                   1695:        | declmods notype_initdecls ';'
1.1.1.6 ! root     1696:                { resume_momentary ((int) $<itype>2); }
1.1       root     1697:        /* Normal case: make this fast.  */
                   1698:        | declmods declarator ';'
                   1699:                { tree d;
                   1700:                  int yes = suspend_momentary ();
1.1.1.5   root     1701:                  d = start_decl ($<ttype>2, $<ttype>$, 0, NULL_TREE);
1.1.1.3   root     1702:                  finish_decl (d, NULL_TREE, NULL_TREE, 0);
1.1       root     1703:                  resume_momentary (yes);
                   1704:                }
                   1705:        | typed_declspecs ';'
                   1706:                {
                   1707:                  shadow_tag ($<ttype>$);
                   1708:                  note_list_got_semicolon ($<ttype>$);
                   1709:                }
                   1710:        | declmods ';'
                   1711:                { warning ("empty declaration"); }
                   1712:        ;
                   1713: 
                   1714: /* Any kind of declarator (thus, all declarators allowed
                   1715:    after an explicit typespec).  */
                   1716: 
                   1717: declarator:
                   1718:          after_type_declarator
                   1719:        | notype_declarator
                   1720:        | START_DECLARATOR after_type_declarator
                   1721:                { $$ = $2; }
                   1722:        | START_DECLARATOR notype_declarator
                   1723:                { $$ = $2; }
                   1724:        ;
                   1725: 
                   1726: /* Declspecs which contain at least one type specifier or typedef name.
                   1727:    (Just `const' or `volatile' is not enough.)
                   1728:    A typedef'd name following these is taken as a name to be declared.  */
                   1729: 
                   1730: typed_declspecs:
                   1731:          typespec      %prec HYPERUNARY
1.1.1.6 ! root     1732:                { if ($$) $$ = list_hash_lookup_or_cons ($$); }
1.1       root     1733:        | declmods typespec
                   1734:                { $$ = hash_tree_chain ($2, $$); }
                   1735:        | typespec reserved_declspecs   %prec HYPERUNARY
                   1736:                { $$ = hash_tree_chain ($$, $2); }
                   1737:        | declmods typespec reserved_declspecs
                   1738:                { $$ = hash_tree_chain ($2, hash_chainon ($3, $$)); }
                   1739:        ;
                   1740: 
                   1741: reserved_declspecs:  /* empty
                   1742:                { $$ = NULL_TREE; } */
                   1743:          typespecqual_reserved
                   1744:                { $$ = build_decl_list (NULL_TREE, $$); }
                   1745:        | SCSPEC
1.1.1.4   root     1746:                { if (extra_warnings)
                   1747:                    warning ("`%s' is not at beginning of declaration",
                   1748:                             IDENTIFIER_POINTER ($$));
                   1749:                  $$ = build_decl_list (NULL_TREE, $$); }
1.1       root     1750:        | reserved_declspecs typespecqual_reserved
                   1751:                { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
                   1752:        | reserved_declspecs SCSPEC
1.1.1.4   root     1753:                { if (extra_warnings)
                   1754:                    warning ("`%s' is not at beginning of declaration",
                   1755:                             IDENTIFIER_POINTER ($2));
                   1756:                  $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1.1       root     1757:        ;
                   1758: 
                   1759: /* List of just storage classes and type modifiers.
                   1760:    A declaration can start with just this, but then it cannot be used
                   1761:    to redeclare a typedef-name.  */
                   1762: 
                   1763: declmods:
                   1764:          TYPE_QUAL
1.1.1.4   root     1765:                { $$ = IDENTIFIER_AS_LIST ($$);
                   1766:                  TREE_STATIC ($$) = 1; }
1.1       root     1767:        | SCSPEC
                   1768:                { $$ = IDENTIFIER_AS_LIST ($$); }
                   1769:        | declmods TYPE_QUAL
1.1.1.4   root     1770:                { $$ = hash_tree_chain ($2, $$);
                   1771:                  TREE_STATIC ($$) = 1; }
1.1       root     1772:        | declmods SCSPEC
1.1.1.4   root     1773:                { if (extra_warnings && TREE_STATIC ($$))
                   1774:                    warning ("`%s' is not at beginning of declaration",
                   1775:                             IDENTIFIER_POINTER ($2));
                   1776:                  $$ = hash_tree_chain ($2, $$);
                   1777:                  TREE_STATIC ($$) = TREE_STATIC ($1); }
1.1       root     1778:        ;
                   1779: 
                   1780: 
                   1781: /* Used instead of declspecs where storage classes are not allowed
                   1782:    (that is, for typenames and structure components).
                   1783: 
                   1784:    C++ can takes storage classes for structure components.
                   1785:    Don't accept a typedef-name if anything but a modifier precedes it.  */
                   1786: 
                   1787: typed_typespecs:
                   1788:          typespec  %prec EMPTY
                   1789:                { $$ = get_decl_list ($$); }
                   1790:        | nonempty_type_quals typespec
                   1791:                { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
                   1792:        | typespec reserved_typespecquals
                   1793:                { $$ = decl_tree_cons (NULL_TREE, $$, $2); }
                   1794:        | nonempty_type_quals typespec reserved_typespecquals
                   1795:                { $$ = decl_tree_cons (NULL_TREE, $2, hash_chainon ($3, $$)); }
                   1796:        ;
                   1797: 
                   1798: reserved_typespecquals:
                   1799:          typespecqual_reserved
                   1800:                { $$ = get_decl_list ($$); }
                   1801:        | reserved_typespecquals typespecqual_reserved
                   1802:                { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
                   1803:        ;
                   1804: 
                   1805: /* A typespec (but not a type qualifier).
                   1806:    Once we have seen one of these in a declaration,
                   1807:    if a typedef name appears then it is being redeclared.  */
                   1808: 
                   1809: typespec: structsp
                   1810:        | TYPESPEC  %prec EMPTY
                   1811:        | TYPENAME  %prec EMPTY
                   1812:        | scoped_typename
                   1813:        | TYPEOF '(' expr ')'
                   1814:                { $$ = TREE_TYPE ($3);
                   1815:                  if (pedantic)
1.1.1.4   root     1816:                    pedwarn ("ANSI C++ forbids `typeof'"); }
1.1       root     1817:        | TYPEOF '(' typename ')'
                   1818:                { $$ = groktypename ($3);
                   1819:                  if (pedantic)
1.1.1.4   root     1820:                    pedwarn ("ANSI C++ forbids `typeof'"); }
1.1       root     1821:        | template_type
                   1822:        ;
                   1823: 
                   1824: /* A typespec that is a reserved word, or a type qualifier.  */
                   1825: 
                   1826: typespecqual_reserved: TYPESPEC
                   1827:        | TYPE_QUAL
                   1828:        | structsp
                   1829:        ;
                   1830: 
                   1831: initdecls:
                   1832:          initdcl0
                   1833:        | initdecls ',' initdcl
                   1834:        ;
                   1835: 
                   1836: notype_initdecls:
                   1837:          notype_initdcl0
                   1838:        | notype_initdecls ',' initdcl
                   1839:        ;
                   1840: 
                   1841: maybeasm:
                   1842:          /* empty */
                   1843:                { $$ = NULL_TREE; }
1.1.1.5   root     1844:        | asm_keyword '(' string ')'
                   1845:                { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1.1       root     1846:        ;
                   1847: 
                   1848: initdcl0:
                   1849:          declarator maybe_raises maybeasm maybe_attribute '='
                   1850:                { current_declspecs = $<ttype>0;
                   1851:                  $<itype>5 = suspend_momentary ();
1.1.1.5   root     1852:                  $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
1.1.1.4   root     1853:                  cplus_decl_attributes ($<ttype>$, $4); }
1.1       root     1854:          init
                   1855: /* Note how the declaration of the variable is in effect while its init is parsed! */
1.1.1.3   root     1856:                { finish_decl ($<ttype>6, $7, $3, 0);
1.1       root     1857:                  $$ = $<itype>5; }
                   1858:        | declarator maybe_raises maybeasm maybe_attribute
                   1859:                { tree d;
                   1860:                  current_declspecs = $<ttype>0;
                   1861:                  $$ = suspend_momentary ();
1.1.1.5   root     1862:                  d = start_decl ($<ttype>1, current_declspecs, 0, $2);
1.1.1.4   root     1863:                  cplus_decl_attributes (d, $4);
1.1.1.3   root     1864:                  finish_decl (d, NULL_TREE, $3, 0); }
1.1       root     1865:        ;
                   1866: 
                   1867: initdcl:
                   1868:          declarator maybe_raises maybeasm maybe_attribute '='
1.1.1.5   root     1869:                { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
1.1.1.4   root     1870:                  cplus_decl_attributes ($<ttype>$, $4); }
1.1       root     1871:          init
                   1872: /* Note how the declaration of the variable is in effect while its init is parsed! */
1.1.1.3   root     1873:                { finish_decl ($<ttype>6, $7, $3, 0); }
1.1       root     1874:        | declarator maybe_raises maybeasm maybe_attribute
1.1.1.5   root     1875:                { tree d = start_decl ($<ttype>1, current_declspecs, 0, $2);
1.1.1.4   root     1876:                  cplus_decl_attributes ($<ttype>$, $4);
1.1.1.3   root     1877:                  finish_decl (d, NULL_TREE, $3, 0); }
1.1       root     1878:        ;
                   1879: 
                   1880: notype_initdcl0:
                   1881:          notype_declarator maybe_raises maybeasm maybe_attribute '='
                   1882:                { current_declspecs = $<ttype>0;
                   1883:                  $<itype>5 = suspend_momentary ();
1.1.1.5   root     1884:                  $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
1.1.1.4   root     1885:                  cplus_decl_attributes ($<ttype>$, $4); }
1.1       root     1886:          init
                   1887: /* Note how the declaration of the variable is in effect while its init is parsed! */
1.1.1.3   root     1888:                { finish_decl ($<ttype>6, $7, $3, 0);
1.1       root     1889:                  $$ = $<itype>5; }
                   1890:        | notype_declarator maybe_raises maybeasm maybe_attribute
                   1891:                { tree d;
                   1892:                  current_declspecs = $<ttype>0;
                   1893:                  $$ = suspend_momentary ();
1.1.1.5   root     1894:                  d = start_decl ($<ttype>1, current_declspecs, 0, $2);
1.1.1.4   root     1895:                  cplus_decl_attributes (d, $4);
1.1.1.3   root     1896:                  finish_decl (d, NULL_TREE, $3, 0); }
1.1       root     1897:        ;
                   1898: 
                   1899: /* the * rules are dummies to accept the Apollo extended syntax
                   1900:    so that the header files compile. */
                   1901: maybe_attribute:
                   1902:     /* empty */
                   1903:        { $$ = NULL_TREE; }
                   1904:     | ATTRIBUTE '(' '(' attribute_list ')' ')'
                   1905:         { $$ = $4; }
                   1906:     ;
                   1907: 
                   1908: attribute_list
                   1909:     : attrib
1.1.1.3   root     1910:        { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
1.1       root     1911:     | attribute_list ',' attrib
1.1.1.3   root     1912:        { $$ = tree_cons (NULL_TREE, $3, $1); }
1.1       root     1913:     ;
                   1914: 
                   1915: attrib
                   1916:     : IDENTIFIER
1.1.1.6 ! root     1917:        { if (strcmp (IDENTIFIER_POINTER ($1), "packed")
        !          1918:              && strcmp (IDENTIFIER_POINTER ($1), "noreturn"))
1.1       root     1919:            warning ("`%s' attribute directive ignored",
1.1.1.3   root     1920:                     IDENTIFIER_POINTER ($1));
                   1921:          $$ = $1; }
                   1922:     | IDENTIFIER '(' CONSTANT ')'
                   1923:        { /* if not "aligned(n)", then issue warning */
                   1924:          if (strcmp (IDENTIFIER_POINTER ($1), "aligned") != 0
                   1925:              || TREE_CODE ($3) != INTEGER_CST)
                   1926:            {
                   1927:              warning ("`%s' attribute directive ignored",
                   1928:                       IDENTIFIER_POINTER ($1));
                   1929:              $$ = $1;
                   1930:            }
                   1931:          else
1.1.1.4   root     1932:            $$ = tree_cons ($1, $3, NULL_TREE); }
1.1.1.3   root     1933:     | IDENTIFIER '(' IDENTIFIER ',' CONSTANT ',' CONSTANT ')'
                   1934:        { /* if not "format(...)", then issue warning */
                   1935:          if (strcmp (IDENTIFIER_POINTER ($1), "format") != 0
                   1936:              || TREE_CODE ($5) != INTEGER_CST
                   1937:              || TREE_CODE ($7) != INTEGER_CST)
                   1938:            {
                   1939:              warning ("`%s' attribute directive ignored",
                   1940:                       IDENTIFIER_POINTER ($1));
                   1941:              $$ = $1;
                   1942:            }
                   1943:          else
1.1.1.4   root     1944:            $$ = tree_cons ($1, tree_cons ($3, tree_cons ($5, $7, NULL_TREE), NULL_TREE), NULL_TREE); }
1.1       root     1945:     ;
                   1946: 
1.1.1.2   root     1947: /* A nonempty list of identifiers, including typenames.  */
                   1948: identifiers_or_typenames:
                   1949:        identifier
                   1950:                { $$ = build_tree_list (NULL_TREE, $1); }
                   1951:        | identifiers_or_typenames ',' identifier
                   1952:                { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
1.1       root     1953:        ;
                   1954: 
                   1955: init:
                   1956:          expr_no_commas %prec '='
                   1957:        | '{' '}'
                   1958:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
                   1959:                  TREE_HAS_CONSTRUCTOR ($$) = 1;
                   1960:                  if (pedantic)
1.1.1.4   root     1961:                    pedwarn ("ANSI C++ forbids empty initializer braces"); }
1.1       root     1962:        | '{' initlist '}'
                   1963:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
                   1964:                  TREE_HAS_CONSTRUCTOR ($$) = 1; }
                   1965:        | '{' initlist ',' '}'
                   1966:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
                   1967:                  TREE_HAS_CONSTRUCTOR ($$) = 1; }
                   1968:        | error
                   1969:                { $$ = NULL_TREE; }
                   1970:        ;
                   1971: 
                   1972: /* This chain is built in reverse order,
                   1973:    and put in forward order where initlist is used.  */
                   1974: initlist:
                   1975:          init
                   1976:                { $$ = build_tree_list (NULL_TREE, $$); }
                   1977:        | initlist ',' init
                   1978:                { $$ = tree_cons (NULL_TREE, $3, $$); }
                   1979:        /* These are for labeled elements.  */
                   1980:        | '[' expr_no_commas ']' init
                   1981:                { $$ = build_tree_list ($2, $4); }
                   1982:        | initlist ',' CASE expr_no_commas ':' init
                   1983:                { $$ = tree_cons ($4, $6, $$); }
                   1984:        | identifier ':' init
                   1985:                { $$ = build_tree_list ($$, $3); }
                   1986:        | initlist ',' identifier ':' init
                   1987:                { $$ = tree_cons ($3, $5, $$); }
                   1988:        ;
                   1989: 
                   1990: structsp:
                   1991:          ENUM identifier '{'
                   1992:                { $<itype>3 = suspend_momentary ();
                   1993:                  $$ = start_enum ($2); }
                   1994:          enumlist maybecomma_warn '}'
                   1995:                { $$ = finish_enum ($<ttype>4, $5);
1.1.1.5   root     1996:                  resume_momentary ((int) $<itype>3);
1.1       root     1997:                  check_for_missing_semicolon ($<ttype>4); }
                   1998:        | ENUM identifier '{' '}'
                   1999:                { $$ = finish_enum (start_enum ($2), NULL_TREE);
                   2000:                  check_for_missing_semicolon ($$); }
                   2001:        | ENUM '{'
                   2002:                { $<itype>2 = suspend_momentary ();
                   2003:                  $$ = start_enum (make_anon_name ()); }
                   2004:          enumlist maybecomma_warn '}'
                   2005:                { $$ = finish_enum ($<ttype>3, $4);
1.1.1.5   root     2006:                  resume_momentary ((int) $<itype>1);
1.1       root     2007:                  check_for_missing_semicolon ($<ttype>3); }
                   2008:        | ENUM '{' '}'
                   2009:                { $$ = finish_enum (start_enum (make_anon_name()), NULL_TREE);
                   2010:                  check_for_missing_semicolon ($$); }
                   2011:        | ENUM identifier
                   2012:                { $$ = xref_tag (enum_type_node, $2, NULL_TREE); }
                   2013: 
                   2014:        /* C++ extensions, merged with C to avoid shift/reduce conflicts */
1.1.1.3   root     2015:        | class_head left_curly opt.component_decl_list '}'
1.1       root     2016:                {
                   2017:                  int semi;
1.1.1.4   root     2018:                  tree id;
                   2019: 
1.1       root     2020: #if 0
                   2021:                  /* Need to rework class nesting in the
                   2022:                     presence of nested classes, etc.  */
                   2023:                  shadow_tag (CLASSTYPE_AS_LIST ($$)); */
                   2024: #endif
1.1.1.4   root     2025:                  if (yychar == YYEMPTY)
                   2026:                    yychar = YYLEX;
1.1       root     2027:                  semi = yychar == ';';
1.1.1.4   root     2028:                  /* finish_struct nukes this anyway; if
                   2029:                     finish_exception does too, then it can go. */
1.1       root     2030:                  if (semi)
                   2031:                    note_got_semicolon ($$);
1.1.1.4   root     2032: 
1.1       root     2033:                  if (TREE_CODE ($$) == ENUMERAL_TYPE)
                   2034:                    /* $$ = $1 from default rule.  */;
                   2035:                  else if (CLASSTYPE_DECLARED_EXCEPTION ($$))
                   2036:                    {
                   2037:                      if (! semi)
                   2038:                        $$ = finish_exception ($$, $3);
                   2039:                      else
                   2040:                        warning ("empty exception declaration\n");
                   2041:                    }
                   2042:                  else
1.1.1.4   root     2043:                    {
1.1.1.5   root     2044:                      $$ = finish_struct ($$, $3, semi);
1.1.1.4   root     2045:                      if (semi) note_got_semicolon ($$);
                   2046:                    }
1.1       root     2047: 
                   2048:                  pop_obstacks ();
1.1.1.4   root     2049: 
                   2050:                  id = TYPE_IDENTIFIER ($$);
1.1.1.6 ! root     2051:                  if (id && IDENTIFIER_TEMPLATE (id))
1.1.1.4   root     2052:                    {
                   2053:                      tree decl;
                   2054: 
                   2055:                      /* I don't know if the copying of this TYPE_DECL is
                   2056:                       * really needed.  However, it's such a small per-
                   2057:                       * formance penalty that the extra safety is a bargain.
                   2058:                       * - [email protected]
                   2059:                       */
                   2060:                      push_obstacks (&permanent_obstack, &permanent_obstack);
1.1.1.5   root     2061:                      decl = copy_node (lookup_name (id, 0));
1.1.1.4   root     2062:                      if (DECL_LANG_SPECIFIC (decl))
                   2063:                        copy_lang_decl (decl);
                   2064:                      pop_obstacks ();
                   2065:                      undo_template_name_overload (id, 0);
                   2066:                      pushdecl_top_level (decl);
                   2067:                    }
1.1       root     2068:                  if (! semi)
                   2069:                    check_for_missing_semicolon ($$); }
                   2070:        | class_head  %prec EMPTY
                   2071:                {
                   2072: #if 0
                   2073:   /* It's no longer clear what the following error is supposed to
                   2074:      accomplish.  If it turns out to be needed, add a comment why.  */
                   2075:                  if (TYPE_BINFO_BASETYPES ($$) && !TYPE_SIZE ($$))
                   2076:                    {
                   2077:                      error ("incomplete definition of type `%s'",
                   2078:                             TYPE_NAME_STRING ($$));
                   2079:                      $$ = error_mark_node;
                   2080:                    }
                   2081: #endif
                   2082:                }
                   2083:        ;
                   2084: 
                   2085: maybecomma:
                   2086:          /* empty */
                   2087:        | ','
                   2088:        ;
                   2089: 
                   2090: maybecomma_warn:
                   2091:          /* empty */
                   2092:        | ','
1.1.1.6 ! root     2093:                { if (pedantic) pedwarn ("comma at end of enumerator list"); }
1.1       root     2094:        ;
                   2095: 
                   2096: aggr:    AGGR
                   2097:        | aggr SCSPEC
1.1.1.6 ! root     2098:                { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
1.1       root     2099:        | aggr TYPESPEC
1.1.1.6 ! root     2100:                { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
1.1       root     2101:        | aggr TYPE_QUAL
1.1.1.6 ! root     2102:                { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
1.1       root     2103:        | aggr AGGR
1.1.1.6 ! root     2104:                { error ("no body nor ';' separates two class, struct or union declarations"); }
1.1       root     2105:        ;
                   2106: 
                   2107: named_class_head_sans_basetype:
                   2108:          aggr identifier
                   2109:                { aggr1: current_aggr = $$; $$ = $2; }
                   2110:        | aggr template_type_name  %prec EMPTY
                   2111:                { current_aggr = $$; $$ = $2; }
                   2112:        | aggr TYPENAME_COLON
                   2113:                { yyungetc (':', 1); goto aggr1; }
                   2114:        | aggr template_type_name '{'
                   2115:                { yyungetc ('{', 1);
                   2116:                aggr2:
                   2117:                  current_aggr = $$;
1.1.1.4   root     2118:                  $$ = $2;
                   2119:                  overload_template_name ($$, 0); }
1.1       root     2120:        | aggr template_type_name ':'
                   2121:                { yyungetc (':', 1); goto aggr2; }
                   2122:        ;
                   2123: 
                   2124: named_class_head_sans_basetype_defn:
                   2125:          aggr identifier_defn
                   2126:                { current_aggr = $$; $$ = $2; }
                   2127:        ;
                   2128: 
                   2129: named_class_head:
                   2130:          named_class_head_sans_basetype
                   2131:                {
                   2132:                  $<ttype>$ = xref_tag (current_aggr, $1, NULL_TREE);
                   2133:                }
                   2134:          maybe_base_class_list %prec EMPTY
                   2135:                {
                   2136:                  if ($3)
                   2137:                    $$ = xref_tag (current_aggr, $1, $3);
                   2138:                  else
                   2139:                    $$ = $<ttype>2;
                   2140:                }
                   2141:        |
                   2142:          named_class_head_sans_basetype_defn
                   2143:                {
                   2144:                  $<ttype>$ = xref_defn_tag (current_aggr, $1, NULL_TREE);
                   2145:                }
                   2146:          maybe_base_class_list %prec EMPTY
                   2147:                {
                   2148:                  if ($3)
                   2149:                    $$ = xref_defn_tag (current_aggr, $1, $3);
                   2150:                  else
                   2151:                    $$ = $<ttype>2;
                   2152:                }
                   2153:        ;
                   2154: 
                   2155: unnamed_class_head: aggr '{'
                   2156:                { $$ = xref_tag ($$, make_anon_name (), NULL_TREE);
                   2157:                  yyungetc ('{', 1); }
                   2158:        ;
                   2159: 
                   2160: class_head: unnamed_class_head | named_class_head ;
                   2161: 
                   2162: maybe_base_class_list:
                   2163:          /* empty */
                   2164:                { $$ = NULL_TREE; }
                   2165:        | ':'  %prec EMPTY
                   2166:                { yyungetc(':', 1); $$ = NULL_TREE; }
                   2167:        | ':' base_class_list  %prec EMPTY
                   2168:                { $$ = $2; }
                   2169:        ;
                   2170: 
                   2171: base_class_list:
                   2172:          base_class
                   2173:        | base_class_list ',' base_class
                   2174:                { $$ = chainon ($$, $3); }
                   2175:        ;
                   2176: 
                   2177: base_class:
                   2178:          base_class.1
                   2179:                { if (! is_aggr_typedef ($$, 1))
                   2180:                    $$ = NULL_TREE;
                   2181:                  else $$ = build_tree_list ((tree)visibility_default, $$); }
1.1.1.4   root     2182:        | scoped_base_class
                   2183:                { if (! is_aggr_typedef ($$, 1))
                   2184:                    $$ = NULL_TREE;
                   2185:                  else $$ = build_tree_list ((tree)visibility_default, $$); }
1.1       root     2186:        | base_class_visibility_list base_class.1
                   2187:                { if (! is_aggr_typedef ($2, 1))
                   2188:                    $$ = NULL_TREE;
                   2189:                  else $$ = build_tree_list ((tree) $$, $2); }
1.1.1.4   root     2190:        | base_class_visibility_list scoped_base_class
                   2191:                { if (! is_aggr_typedef ($2, 1))
                   2192:                    $$ = NULL_TREE;
                   2193:                  else $$ = build_tree_list ((tree) $$, $2); }
1.1       root     2194:        ;
                   2195: 
1.1.1.4   root     2196: scoped_base_class:
                   2197:          base_class.1 SCOPED_TYPENAME
                   2198:                {
                   2199:                  /* Kludge!!! See rule "template_type" and the code
                   2200:                   * dealing with "template_type_seen_before_scope" in
                   2201:                   * yylex(). */
                   2202:                  $$ = $2;
                   2203:                }
                   2204:        ;
1.1       root     2205: base_class.1:
                   2206:          template_type_name tmpl.2 template_instantiation
1.1.1.4   root     2207:                {
                   2208:                  extern tree template_type_seen_before_scope;
                   2209:                  tree id = $3 ? TYPE_IDENTIFIER ($3) : $1;
                   2210: 
                   2211:                  /* Check the rule template_type to get this... */
                   2212:                  if (yychar == YYEMPTY)
                   2213:                    yychar = YYLEX;
                   2214:                  if (yychar == SCOPE) {
                   2215:                    template_type_seen_before_scope = id;
                   2216:                    yychar = YYLEX;
                   2217:                  }
                   2218:                }
1.1       root     2219:        | identifier
                   2220:        ;
                   2221: 
                   2222: base_class_visibility_list:
                   2223:          VISSPEC
                   2224:        | SCSPEC
                   2225:                { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
                   2226:                    sorry ("non-virtual visibility");
                   2227:                  $$ = visibility_default_virtual; }
                   2228:        | base_class_visibility_list VISSPEC
                   2229:                { int err = 0;
                   2230:                  if ($2 == visibility_protected)
                   2231:                    {
                   2232:                      warning ("`protected' visibility not implemented");
                   2233:                      $2 = visibility_public;
                   2234:                      err++;
                   2235:                    }
                   2236:                  else if ($2 == visibility_public)
                   2237:                    {
                   2238:                      if ($1 == visibility_private)
                   2239:                        {
                   2240:                        mixed:
                   2241:                          error ("base class cannot be public and private");
                   2242:                        }
                   2243:                      else if ($1 == visibility_default_virtual)
                   2244:                        $$ = visibility_public_virtual;
                   2245:                    }
1.1.1.2   root     2246:                  else /* $2 == visibility_private */
1.1       root     2247:                    {
                   2248:                      if ($1 == visibility_public)
                   2249:                        goto mixed;
                   2250:                      else if ($1 == visibility_default_virtual)
                   2251:                        $$ = visibility_private_virtual;
                   2252:                    }
                   2253:                }
                   2254:        | base_class_visibility_list SCSPEC
                   2255:                { if ($2 != ridpointers[(int)RID_VIRTUAL])
                   2256:                    sorry ("non-virtual visibility");
                   2257:                  if ($$ == visibility_public)
                   2258:                    $$ = visibility_public_virtual;
                   2259:                  else if ($$ == visibility_private)
                   2260:                    $$ = visibility_private_virtual; }
                   2261:        ;
                   2262: 
1.1.1.3   root     2263: left_curly: '{'
1.1       root     2264:                { tree t;
                   2265:                  push_obstacks_nochange ();
                   2266:                  end_temporary_allocation ();
                   2267: 
                   2268:                  if (! IS_AGGR_TYPE ($<ttype>0))
                   2269:                    {
                   2270:                      $<ttype>0 = make_lang_type (RECORD_TYPE);
                   2271:                      TYPE_NAME ($<ttype>0) = get_identifier ("erroneous type");
                   2272:                    }
                   2273:                  if (TYPE_SIZE ($<ttype>0))
                   2274:                    duplicate_tag_error ($<ttype>0);
                   2275:                   if (TYPE_SIZE ($<ttype>0) || TYPE_BEING_DEFINED ($<ttype>0))
                   2276:                     {
                   2277:                       t = make_lang_type (TREE_CODE ($<ttype>0));
1.1.1.3   root     2278:                       pushtag (TYPE_IDENTIFIER ($<ttype>0), t);
1.1       root     2279:                       $<ttype>0 = t;
                   2280:                     }
                   2281:                  pushclass ($<ttype>0, 0);
                   2282:                  TYPE_BEING_DEFINED ($<ttype>0) = 1;
1.1.1.3   root     2283:                  t = TYPE_IDENTIFIER ($<ttype>0);
1.1.1.6 ! root     2284:                  if (t && IDENTIFIER_TEMPLATE (t))
1.1       root     2285:                    overload_template_name (t, 1);
                   2286:                }
                   2287:        ;
                   2288: 
                   2289: opt.component_decl_list:
                   2290:        /* empty */
                   2291:                { $$ = NULL_TREE; }
                   2292:        | component_decl_list
                   2293:                { $$ = build_tree_list ((tree)visibility_default, $$); }
                   2294:        | opt.component_decl_list VISSPEC ':' component_decl_list
                   2295:                { $$ = chainon ($$, build_tree_list ((tree) $2, $4)); }
                   2296:        | opt.component_decl_list VISSPEC ':'
                   2297:        ;
                   2298: 
1.1.1.6 ! root     2299: /* Note: we no longer warn about the semicolon after a component_decl_list.
        !          2300:    ARM $9.2 says that the semicolon is optional, and therefore allowed.  */
1.1       root     2301: component_decl_list:
                   2302:          component_decl
                   2303:                { if ($$ == void_type_node) $$ = NULL_TREE; }
                   2304:        | component_decl_list component_decl
1.1.1.6 ! root     2305:                { /* In pushdecl, we created a reverse list of names
        !          2306:                     in this binding level.  Make sure that the chain
        !          2307:                     of what we're trying to add isn't the item itself
        !          2308:                     (which can happen with what pushdecl's doing).  */
        !          2309:                  if ($2 != NULL_TREE && $2 != void_type_node)
        !          2310:                    {
        !          2311:                      if (TREE_CHAIN ($2) != $$)
        !          2312:                        $$ = chainon ($$, $2);
        !          2313:                      else
        !          2314:                        $$ = $2;
        !          2315:                    }
        !          2316:                }
1.1       root     2317:        | component_decl_list ';'
                   2318:        ;
                   2319: 
                   2320: component_decl:
                   2321:          typed_declspecs components ';'
1.1.1.6 ! root     2322:                { do_components:
        !          2323:                  $$ = grok_x_components ($$, $2);
1.1       root     2324:                  end_exception_decls ();
                   2325:                }
                   2326:        | typed_declspecs '(' parmlist ')' ';'
                   2327:                { $$ = groktypefield ($$, $3); }
                   2328:        | typed_declspecs '(' parmlist ')' '}'
                   2329:                { error ("missing ';' before right brace");
                   2330:                  yyungetc ('}', 0);
                   2331:                  $$ = groktypefield ($$, $3); }
                   2332:        | typed_declspecs LEFT_RIGHT ';'
                   2333:                { $$ = groktypefield ($$, empty_parms ()); }
                   2334:        | typed_declspecs LEFT_RIGHT '}'
                   2335:                { error ("missing ';' before right brace");
                   2336:                  yyungetc ('}', 0);
                   2337:                  $$ = groktypefield ($$, empty_parms ()); }
                   2338:        | declmods components ';'
                   2339:                { goto do_components; }
                   2340:        /* Normal case: make this fast.  */
                   2341:        | declmods declarator ';'
1.1.1.5   root     2342:                { $$ = grokfield ($<ttype>2, $<ttype>$,
                   2343:                                  NULL_TREE, NULL_TREE, NULL_TREE); }
1.1       root     2344:        | declmods components '}'
                   2345:                { error ("missing ';' before right brace");
                   2346:                  yyungetc ('}', 0);
                   2347:                  goto do_components; }
                   2348:        | declmods '(' parmlist ')' ';'
                   2349:                { $$ = groktypefield ($$, $3); }
                   2350:        | declmods '(' parmlist ')' '}'
                   2351:                { error ("missing ';' before right brace");
                   2352:                  yyungetc ('}', 0);
                   2353:                  $$ = groktypefield ($$, $3); }
                   2354:        | declmods LEFT_RIGHT ';'
                   2355:                { $$ = groktypefield ($$, empty_parms ()); }
                   2356:        | declmods LEFT_RIGHT '}'
                   2357:                { error ("missing ';' before right brace");
                   2358:                  yyungetc ('}', 0);
                   2359:                  $$ = groktypefield ($$, empty_parms ()); }
                   2360:        | ':' expr_no_commas ';'
                   2361:                { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
                   2362:        | ':' expr_no_commas '}'
                   2363:                { error ("missing ';' before right brace");
                   2364:                  yyungetc ('}', 0);
                   2365:                  $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
                   2366:        | error
                   2367:                { $$ = NULL_TREE; }
                   2368: 
                   2369:        /* C++: handle constructors, destructors and inline functions */
                   2370:        /* note that INLINE is like a TYPESPEC */
                   2371:        | fn.def2 ':' /* base_init compstmt */
                   2372:                { $$ = finish_method ($$); }
                   2373:        | fn.def2 '{' /* nodecls compstmt */
                   2374:                { $$ = finish_method ($$); }
                   2375:        | notype_declarator maybe_raises ';'
                   2376:                { $$ = grokfield ($$, NULL_TREE, $2, NULL_TREE, NULL_TREE); }
                   2377:        | notype_declarator maybe_raises '}'
                   2378:                { error ("missing ';' before right brace");
                   2379:                  yyungetc ('}', 0);
                   2380:                  $$ = grokfield ($$, NULL_TREE, $2, NULL_TREE, NULL_TREE); }
                   2381:        ;
                   2382: 
                   2383: components:
                   2384:          /* empty: possibly anonymous */
                   2385:                { $$ = NULL_TREE; }
                   2386:        | component_declarator0
                   2387:        | components ',' component_declarator
                   2388:                {
                   2389:                  /* In this context, void_type_node encodes
                   2390:                     friends.  They have been recorded elsewhere.  */
                   2391:                  if ($$ == void_type_node)
                   2392:                    $$ = $3;
                   2393:                  else
                   2394:                    $$ = chainon ($$, $3);
                   2395:                }
                   2396:        ;
                   2397: 
                   2398: component_declarator0:
1.1.1.3   root     2399:          declarator maybe_raises maybeasm maybe_attribute
1.1       root     2400:                { current_declspecs = $<ttype>0;
1.1.1.3   root     2401:                  $$ = grokfield ($$, current_declspecs, $2, NULL_TREE, $3);
1.1.1.4   root     2402:                  cplus_decl_attributes ($$, $4); }
1.1.1.3   root     2403:        | declarator maybe_raises maybeasm maybe_attribute '=' init
1.1       root     2404:                { current_declspecs = $<ttype>0;
1.1.1.3   root     2405:                  $$ = grokfield ($$, current_declspecs, $2, $6, $3);
1.1.1.4   root     2406:                  cplus_decl_attributes ($$, $4); }
1.1.1.3   root     2407:        | IDENTIFIER ':' expr_no_commas maybe_attribute
1.1       root     2408:                { current_declspecs = $<ttype>0;
1.1.1.3   root     2409:                  $$ = grokbitfield ($$, current_declspecs, $3);
1.1.1.4   root     2410:                  cplus_decl_attributes ($$, $4); }
1.1.1.6 ! root     2411:        | TYPENAME ':' expr_no_commas maybe_attribute
1.1       root     2412:                { current_declspecs = $<ttype>0;
1.1.1.6 ! root     2413:                  $$ = grokbitfield ($$, current_declspecs, $3);
        !          2414:                  cplus_decl_attributes ($$, $4); }
        !          2415:        | ':' expr_no_commas maybe_attribute
1.1       root     2416:                { current_declspecs = $<ttype>0;
1.1.1.6 ! root     2417:                  $$ = grokbitfield (NULL_TREE, NULL_TREE, $2);
        !          2418:                  cplus_decl_attributes ($$, $3); }
1.1       root     2419:        ;
                   2420: 
                   2421: component_declarator:
1.1.1.3   root     2422:          declarator maybe_raises maybeasm maybe_attribute
                   2423:                { $$ = grokfield ($$, current_declspecs, $2, NULL_TREE, $3);
1.1.1.4   root     2424:                  cplus_decl_attributes ($$, $4); }
1.1.1.3   root     2425:        | declarator maybe_raises maybeasm maybe_attribute '=' init
                   2426:                { $$ = grokfield ($$, current_declspecs, $2, $6, $3);
1.1.1.4   root     2427:                  cplus_decl_attributes ($$, $4); }
1.1.1.3   root     2428:        | IDENTIFIER ':' expr_no_commas maybe_attribute
                   2429:                { $$ = grokbitfield ($$, current_declspecs, $3);
1.1.1.4   root     2430:                  cplus_decl_attributes ($$, $4); }
1.1.1.6 ! root     2431:        | TYPENAME ':' expr_no_commas maybe_attribute
        !          2432:                { $$ = grokbitfield ($$, current_declspecs, $3);
        !          2433:                  cplus_decl_attributes ($$, $4); }
        !          2434:        | ':' expr_no_commas maybe_attribute
        !          2435:                { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2);
1.1.1.4   root     2436:                  cplus_decl_attributes ($$, $3); }
1.1       root     2437:        ;
                   2438: 
                   2439: /* We chain the enumerators in reverse order.
                   2440:    Because of the way enums are built, the order is
                   2441:    insignificant.  Take advantage of this fact.  */
                   2442: 
                   2443: enumlist:
                   2444:          enumerator
                   2445:        | enumlist ',' enumerator
                   2446:                { TREE_CHAIN ($3) = $$; $$ = $3; }
                   2447:        ;
                   2448: 
                   2449: enumerator:
                   2450:          identifier
                   2451:                { $$ = build_enumerator ($$, NULL_TREE); }
                   2452:        | identifier '=' expr_no_commas
                   2453:                { $$ = build_enumerator ($$, $3); }
                   2454:        ;
                   2455: 
1.1.1.6 ! root     2456: /* ANSI type-id (8.1) */
1.1       root     2457: typename:
                   2458:          typed_typespecs absdcl
                   2459:                { $$ = build_decl_list ($$, $2); }
                   2460:        | nonempty_type_quals absdcl
                   2461:                { $$ = build_decl_list ($$, $2); }
                   2462:        ;
                   2463: 
1.1.1.6 ! root     2464: /* ANSI abstract-declarator (8.1) */
1.1       root     2465: absdcl:   /* an abstract declarator */
                   2466:        /* empty */ %prec EMPTY
                   2467:                { $$ = NULL_TREE; }
                   2468:        | absdcl1  %prec EMPTY
                   2469:        | START_DECLARATOR absdcl1  %prec EMPTY
                   2470:                { $$ = $2; }
                   2471:        ;
                   2472: 
                   2473: nonempty_type_quals:
                   2474:          TYPE_QUAL
                   2475:                { $$ = IDENTIFIER_AS_LIST ($$); }
                   2476:        | nonempty_type_quals TYPE_QUAL
                   2477:                { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
                   2478:        ;
                   2479: 
                   2480: type_quals:
                   2481:          /* empty */
                   2482:                { $$ = NULL_TREE; }
                   2483:        | type_quals TYPE_QUAL
                   2484:                { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
                   2485:        ;
                   2486: 
                   2487: /* These rules must follow the rules for function declarations
1.1.1.2   root     2488:    and component declarations.  That way, longer rules are preferred.  */
1.1       root     2489: 
                   2490: /* An expression which will not live on the momentary obstack.  */
                   2491: nonmomentary_expr:
                   2492:        { $<itype>$ = suspend_momentary (); } expr
1.1.1.5   root     2493:        { resume_momentary ((int) $<itype>1); $$ = $2; }
1.1       root     2494: 
                   2495: /* A declarator that is allowed only after an explicit typespec.  */
                   2496: /* may all be followed by prec '.' */
                   2497: after_type_declarator:
                   2498:          after_type_declarator '(' nonnull_exprlist ')' type_quals  %prec '.'
                   2499:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2500:        | after_type_declarator '(' parmlist ')' type_quals  %prec '.'
                   2501:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2502:        | after_type_declarator LEFT_RIGHT type_quals  %prec '.'
                   2503:                { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
                   2504:        | after_type_declarator '(' error ')' type_quals  %prec '.'
                   2505:                { $$ = build_parse_node (CALL_EXPR, $$, NULL_TREE, NULL_TREE); }
                   2506:        | after_type_declarator '[' nonmomentary_expr ']'
                   2507:                { $$ = build_parse_node (ARRAY_REF, $$, $3); }
                   2508:        | after_type_declarator '[' ']'
                   2509:                { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
                   2510:        | '(' after_type_declarator_no_typename ')'
                   2511:                { $$ = $2; }
                   2512:        | '(' '*' type_quals after_type_declarator ')'
                   2513:                { $$ = make_pointer_declarator ($3, $4); }
                   2514:        | PAREN_STAR_PAREN
                   2515:                { see_typename (); }
                   2516:        | after_type_member_declarator
                   2517:        | '(' '&' type_quals after_type_declarator ')'
                   2518:                { $$ = make_reference_declarator ($3, $4); }
                   2519:        | '*' type_quals after_type_declarator  %prec UNARY
                   2520:                { $$ = make_pointer_declarator ($2, $3); }
                   2521:        | '&' type_quals after_type_declarator  %prec UNARY
                   2522:                { $$ = make_reference_declarator ($2, $3); }
                   2523:        | TYPENAME
                   2524:        ;
                   2525: 
                   2526: after_type_declarator_no_typename:
                   2527:          after_type_declarator_no_typename '(' nonnull_exprlist ')' type_quals  %prec '.'
                   2528:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2529:        | after_type_declarator_no_typename '(' parmlist ')' type_quals  %prec '.'
                   2530:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2531:        | after_type_declarator_no_typename LEFT_RIGHT type_quals  %prec '.'
                   2532:                { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
                   2533:        | after_type_declarator_no_typename '(' error ')' type_quals  %prec '.'
                   2534:                { $$ = build_parse_node (CALL_EXPR, $$, NULL_TREE, NULL_TREE); }
                   2535:        | after_type_declarator_no_typename '[' nonmomentary_expr ']'
                   2536:                { $$ = build_parse_node (ARRAY_REF, $$, $3); }
                   2537:        | after_type_declarator_no_typename '[' ']'
                   2538:                { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
                   2539:        | '(' after_type_declarator_no_typename ')'
                   2540:                { $$ = $2; }
                   2541:        | PAREN_STAR_PAREN
                   2542:                { see_typename (); }
                   2543:        | after_type_member_declarator
                   2544:        | '*' type_quals after_type_declarator  %prec UNARY
                   2545:                { $$ = make_pointer_declarator ($2, $3); }
                   2546:        | '&' type_quals after_type_declarator  %prec UNARY
                   2547:                { $$ = make_reference_declarator ($2, $3); }
                   2548:        ;
                   2549: 
                   2550: /* A declarator allowed whether or not there has been
                   2551:    an explicit typespec.  These cannot redeclare a typedef-name.  */
                   2552: 
                   2553: notype_declarator:
                   2554:          notype_declarator '(' nonnull_exprlist ')' type_quals  %prec '.'
                   2555:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2556:        | notype_declarator '(' parmlist ')' type_quals  %prec '.'
                   2557:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2558:        | notype_declarator LEFT_RIGHT type_quals  %prec '.'
                   2559:                { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
                   2560:        | notype_declarator '(' error ')' type_quals  %prec '.'
                   2561:                { $$ = build_parse_node (CALL_EXPR, $$, NULL_TREE, NULL_TREE); }
                   2562:        | '(' notype_declarator ')'
                   2563:                { $$ = $2; }
                   2564:        | '*' type_quals notype_declarator  %prec UNARY
                   2565:                { $$ = make_pointer_declarator ($2, $3); }
                   2566:        | '&' type_quals notype_declarator  %prec UNARY
                   2567:                { $$ = make_reference_declarator ($2, $3); }
                   2568:        | notype_declarator '[' nonmomentary_expr ']'
                   2569:                { $$ = build_parse_node (ARRAY_REF, $$, $3); }
                   2570:        | notype_declarator '[' ']'
                   2571:                { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
                   2572:        | IDENTIFIER
                   2573:                { see_typename (); }
                   2574: 
                   2575:        /* C++ extensions.  */
                   2576:        | operator_name
                   2577:                { see_typename (); }
                   2578: 
                   2579:        | '~' TYPENAME
                   2580:                {
                   2581:                destructor_name:
                   2582:                  see_typename ();
                   2583:                  $$ = build_parse_node (BIT_NOT_EXPR, $2);
                   2584:                }
                   2585:        | '~' IDENTIFIER
                   2586:                { goto destructor_name; }
                   2587:         | '~' PTYPENAME
                   2588:                 { goto destructor_name; }
1.1.1.6 ! root     2589:        | id_scope see_typename notype_declarator  %prec '('
1.1       root     2590:                { see_typename ();
                   2591:                  if (TREE_CODE ($$) != SCOPE_REF)
                   2592:                    $$ = build_push_scope ($$, $3);
                   2593:                  else if (TREE_OPERAND ($$, 1) == NULL_TREE)
                   2594:                    TREE_OPERAND ($$, 1) = $3;
                   2595:                  else
                   2596:                    $$ = build_parse_node (SCOPE_REF, $$, $3);
                   2597:                }
1.1.1.6 ! root     2598:        | id_scope see_typename TYPENAME  %prec '('
1.1       root     2599:                { $$ = build_push_scope ($$, $3); }
1.1.1.6 ! root     2600:        | id_scope see_typename TYPENAME '(' nonnull_exprlist ')' type_quals  %prec '.'
1.1       root     2601:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, $5, $7)); }
1.1.1.6 ! root     2602:        | id_scope see_typename TYPENAME '(' parmlist ')' type_quals  %prec '.'
1.1       root     2603:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, $5, $7)); }
1.1.1.6 ! root     2604:        | id_scope see_typename TYPENAME LEFT_RIGHT type_quals  %prec '.'
1.1       root     2605:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, empty_parms (), $5)); }
1.1.1.6 ! root     2606:        | id_scope see_typename TYPENAME '(' error ')' type_quals  %prec '.'
1.1       root     2607:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, NULL_TREE, NULL_TREE)); }
                   2608:        /* For constructor templates.  */
1.1.1.6 ! root     2609:        | id_scope see_typename PTYPENAME  %prec '('
1.1       root     2610:                { $$ = build_push_scope ($$, $3); }
1.1.1.6 ! root     2611:        | id_scope see_typename PTYPENAME '(' nonnull_exprlist ')' type_quals  %prec '.'
1.1       root     2612:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, $5, $7)); }
1.1.1.6 ! root     2613:        | id_scope see_typename PTYPENAME '(' parmlist ')' type_quals  %prec '.'
1.1       root     2614:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, $5, $7)); }
1.1.1.6 ! root     2615:        | id_scope see_typename PTYPENAME LEFT_RIGHT type_quals  %prec '.'
1.1       root     2616:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, empty_parms (), $5)); }
1.1.1.6 ! root     2617:        | id_scope see_typename PTYPENAME '(' error ')' type_quals  %prec '.'
1.1       root     2618:                { $$ = build_push_scope ($$, build_parse_node (CALL_EXPR, $3, NULL_TREE, NULL_TREE)); }
                   2619:        | SCOPE see_typename notype_declarator
                   2620:                { $$ = build_parse_node (SCOPE_REF, NULL_TREE, $3); }
                   2621:        ;
                   2622: 
1.1.1.6 ! root     2623: id_scope:      typename_scope
        !          2624:                { tree t;
        !          2625:                   do_id_scope:
        !          2626: 
        !          2627:                  t = resolve_scope_to_name (NULL_TREE, $$);
        !          2628:                  if (t == NULL_TREE)
1.1.1.2   root     2629:                    {
1.1.1.6 ! root     2630:                      cp_error ("`%T' is not a valid scope", $$);
1.1.1.2   root     2631:                      $$ = error_mark_node; 
                   2632:                    }
1.1.1.6 ! root     2633:                  else
        !          2634:                    $$ = t;
1.1.1.2   root     2635:                }
1.1.1.6 ! root     2636:        | IDENTIFIER SCOPE
        !          2637:                { goto do_id_scope; }
1.1.1.4   root     2638:        | template_type SCOPE /* try_for_typename %prec EMPTY */
1.1       root     2639:                {
                   2640:                   if ($$ == error_mark_node)
                   2641:                     /* leave it alone */;
                   2642:                   else
                   2643:                    {
                   2644:                      $$ = resolve_scope_to_name (NULL_TREE, TYPE_IDENTIFIER ($$));
1.1.1.2   root     2645:                      if ($$ == NULL_TREE)
                   2646:                        {
                   2647:                          error ("undefined explicitly scoped type");
                   2648:                          $$ = error_mark_node; 
                   2649:                        }
1.1       root     2650:                    }
1.1.1.4   root     2651: /*                  if ($3) popclass (1); */
1.1       root     2652:                }
                   2653:        ;
                   2654: 
1.1.1.3   root     2655: typename_scope:
1.1       root     2656:        TYPENAME SCOPE;
                   2657: 
                   2658: scoped_typename: SCOPED_TYPENAME
1.1.1.4   root     2659:        | template_type SCOPED_TYPENAME
                   2660:                {
                   2661:                  /* Kludge!!! See rule "template_type" and the code
                   2662:                   * dealing with "template_type_seen_before_scope" in
                   2663:                   * yylex(). */
                   2664:                  $$ = $2;
                   2665:                }
1.1       root     2666: /*     | template_type SCOPE try_for_typename TYPENAME
                   2667:                {
                   2668:                   if ($$ == error_mark_node)
                   2669:                     ;
                   2670:                  else
                   2671:                    {
                   2672:                       $$ = build_parse_node (SCOPE_REF,
1.1.1.3   root     2673:                                              TYPE_IDENTIFIER ($$),
1.1       root     2674:                                              $4);
                   2675:                     }
                   2676:                  if ($3) popclass (1);
                   2677:                } */
                   2678:        ;
                   2679: 
                   2680: absdcl1:  /* a nonempty abstract declarator */
                   2681:          '(' absdcl1 ')'
                   2682:                { see_typename ();
                   2683:                  $$ = $2; }
                   2684:          /* `(typedef)1' is `int'.  */
                   2685:        | '*' type_quals absdcl1  %prec EMPTY
                   2686:                { $$ = make_pointer_declarator ($2, $3); }
                   2687:        | '*' type_quals  %prec EMPTY
                   2688:                { $$ = make_pointer_declarator ($2, NULL_TREE); }
                   2689:        | PAREN_STAR_PAREN
                   2690:                { see_typename (); }
                   2691:        | '(' abs_member_declarator ')'
                   2692:                { $$ = $2; }
                   2693:        | '&' type_quals absdcl1 %prec EMPTY
                   2694:                { $$ = make_reference_declarator ($2, $3); }
                   2695:        | '&' type_quals %prec EMPTY
                   2696:                { $$ = make_reference_declarator ($2, NULL_TREE); }
                   2697:        | absdcl1 '(' parmlist ')' type_quals  %prec '.'
                   2698:                { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
                   2699:        | absdcl1 LEFT_RIGHT type_quals  %prec '.'
                   2700:                { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
                   2701:        | absdcl1 '[' nonmomentary_expr ']'  %prec '.'
                   2702:                { $$ = build_parse_node (ARRAY_REF, $$, $3); }
                   2703:        | absdcl1 '[' ']'  %prec '.'
                   2704:                { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
                   2705:        | '(' parmlist ')' type_quals  %prec '.'
                   2706:                { $$ = build_parse_node (CALL_EXPR, NULL_TREE, $2, $4); }
                   2707:        | LEFT_RIGHT type_quals  %prec '.'
                   2708:                { $$ = build_parse_node (CALL_EXPR, NULL_TREE, empty_parms (), $2); }
                   2709:        | '[' nonmomentary_expr ']'  %prec '.'
                   2710:                { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
                   2711:        | '[' ']'  %prec '.'
                   2712:                { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
                   2713:        ;
                   2714: 
                   2715: abs_member_declarator:
1.1.1.6 ! root     2716:          id_scope see_typename '*' type_quals
1.1       root     2717:                { tree t;
                   2718:                  t = $$;
                   2719:                  while (TREE_OPERAND (t, 1))
                   2720:                    t = TREE_OPERAND (t, 1);
                   2721:                  TREE_OPERAND (t, 1) = build_parse_node (INDIRECT_REF, 0);
                   2722:                }
1.1.1.6 ! root     2723:        | id_scope see_typename '*' type_quals absdcl1
1.1       root     2724:                { tree t;
                   2725:                  t = $$;
                   2726:                  while (TREE_OPERAND (t, 1))
                   2727:                    t = TREE_OPERAND (t, 1);
1.1.1.6 ! root     2728:                  TREE_OPERAND (t, 1) = build_parse_node (INDIRECT_REF, $5);
1.1       root     2729:                }
1.1.1.6 ! root     2730:        | id_scope see_typename '&' type_quals
1.1       root     2731:                { tree t;
                   2732:                  t = $$;
                   2733:                  while (TREE_OPERAND (t, 1))
                   2734:                    t = TREE_OPERAND (t, 1);
                   2735:                  TREE_OPERAND (t, 1) = build_parse_node (ADDR_EXPR, 0);
                   2736:                }
1.1.1.6 ! root     2737:        | id_scope see_typename '&' type_quals absdcl1
1.1       root     2738:                { tree t;
                   2739:                  t = $$;
                   2740:                  while (TREE_OPERAND (t, 1))
                   2741:                    t = TREE_OPERAND (t, 1);
1.1.1.6 ! root     2742:                  TREE_OPERAND (t, 1) = build_parse_node (ADDR_EXPR, $5);
1.1       root     2743:                }
                   2744:        ;
                   2745: 
                   2746: after_type_member_declarator:
1.1.1.6 ! root     2747:          id_scope see_typename '*' type_quals after_type_declarator
1.1       root     2748:                { tree t;
                   2749:                  t = $$;
                   2750:                  while (TREE_OPERAND (t, 1))
                   2751:                    t = TREE_OPERAND (t, 1);
                   2752:                  TREE_OPERAND (t, 1) = build_parse_node (INDIRECT_REF, $5);
                   2753:                }
1.1.1.6 ! root     2754:        | id_scope see_typename '&' type_quals after_type_declarator
1.1       root     2755:                { tree t;
                   2756:                  t = $$;
                   2757:                  while (TREE_OPERAND (t, 1))
                   2758:                    t = TREE_OPERAND (t, 1);
                   2759:                  TREE_OPERAND (t, 1) = build_parse_node (ADDR_EXPR, $5);
                   2760:                }
                   2761:        ;
                   2762: 
                   2763: /* For C++, decls and stmts can be intermixed, so we don't need to
                   2764:    have a special rule that won't start parsing the stmt section
                   2765:    until we have a stmt that parses without errors.  */
                   2766: 
                   2767: stmts:
                   2768:          stmt
                   2769:        | errstmt
                   2770:        | stmts stmt
                   2771:        | stmts errstmt
                   2772:        ;
                   2773: 
                   2774: errstmt:  error ';'
                   2775:        ;
                   2776: 
                   2777: /* build the LET_STMT node before parsing its contents,
                   2778:   so that any LET_STMTs within the context can have their display pointers
                   2779:   set up to point at this one.  */
                   2780: 
                   2781: .pushlevel:  /* empty */
1.1.1.2   root     2782:                { emit_line_note (input_filename, lineno);
1.1       root     2783:                  pushlevel (0);
                   2784:                  clear_last_expr ();
                   2785:                  push_momentary ();
1.1.1.5   root     2786:                  expand_start_bindings (0); }
1.1.1.2   root     2787:        ;
                   2788: 
                   2789: /* Read zero or more forward-declarations for labels
                   2790:    that nested functions can jump to.  */
                   2791: maybe_label_decls:
                   2792:          /* empty */
                   2793:        | label_decls
                   2794:                { if (pedantic)
1.1.1.4   root     2795:                    pedwarn ("ANSI C++ forbids label declarations"); }
1.1.1.2   root     2796:        ;
                   2797: 
                   2798: label_decls:
                   2799:          label_decl
                   2800:        | label_decls label_decl
                   2801:        ;
                   2802: 
                   2803: label_decl:
                   2804:          LABEL identifiers_or_typenames ';'
                   2805:                { tree link;
                   2806:                  for (link = $2; link; link = TREE_CHAIN (link))
                   2807:                    {
                   2808:                      tree label = shadow_label (TREE_VALUE (link));
                   2809:                      C_DECLARED_LABEL_FLAG (label) = 1;
                   2810:                      declare_nonlocal_label (label);
                   2811:                    }
1.1       root     2812:                }
                   2813:        ;
                   2814: 
                   2815: /* This is the body of a function definition.
                   2816:    It causes syntax errors to ignore to the next openbrace.  */
                   2817: compstmt_or_error:
                   2818:          compstmt
                   2819:                {}
                   2820:        | error compstmt
                   2821:        ;
                   2822: 
1.1.1.6 ! root     2823: compstmt: '{' .pushlevel '}'
        !          2824:                { pop_implicit_try_blocks (NULL_TREE);
        !          2825:                  expand_end_bindings (getdecls (), kept_level_p(), 1);
        !          2826:                  $$ = poplevel (kept_level_p (), 1, 0);
        !          2827:                  pop_momentary (); }
1.1.1.2   root     2828:        | '{' .pushlevel maybe_label_decls stmts '}'
1.1       root     2829:                { pop_implicit_try_blocks (NULL_TREE);
1.1.1.6 ! root     2830:                  expand_end_bindings (getdecls (), kept_level_p(), 1);
1.1       root     2831:                  $$ = poplevel (kept_level_p (), 1, 0);
                   2832:                  pop_momentary (); }
1.1.1.2   root     2833:        | '{' .pushlevel maybe_label_decls error '}'
1.1       root     2834:                { pop_implicit_try_blocks (NULL_TREE);
1.1.1.6 ! root     2835:                  expand_end_bindings (getdecls (), kept_level_p(), 1);
1.1       root     2836:                  $$ = poplevel (kept_level_p (), 0, 0);
                   2837:                  pop_momentary (); }
                   2838:        ;
                   2839: 
                   2840: simple_if:
1.1.1.5   root     2841:          IF
                   2842:                { cond_stmt_keyword = "if"; }
1.1.1.6 ! root     2843:          .pushlevel paren_cond_or_null
1.1       root     2844:                { emit_line_note (input_filename, lineno);
1.1.1.6 ! root     2845:                  expand_start_cond (truthvalue_conversion ($4), 0); }
        !          2846:          partially_scoped_stmt
1.1.1.5   root     2847:        ;
                   2848: 
                   2849: implicitly_scoped_stmt:
                   2850:          compstmt
                   2851:                { finish_stmt (); }
                   2852:        | .pushlevel simple_stmt
                   2853:                { pop_implicit_try_blocks (NULL_TREE);
1.1.1.6 ! root     2854:                  expand_end_bindings (getdecls (), getdecls() != NULL_TREE, 1);
1.1.1.5   root     2855:                  $$ = poplevel (kept_level_p (), 1, 0);
                   2856:                  pop_momentary (); }
1.1       root     2857:        ;
                   2858: 
                   2859: stmt:
                   2860:          compstmt
                   2861:                { finish_stmt (); }
1.1.1.5   root     2862:        | simple_stmt
                   2863:        ;
                   2864: 
                   2865: simple_stmt:
                   2866:          decl
                   2867:                { finish_stmt (); }
1.1       root     2868:        | expr ';'
                   2869:                {
                   2870:                  tree expr = $1;
                   2871:                  emit_line_note (input_filename, lineno);
                   2872:                  /* Do default conversion if safe and possibly important,
                   2873:                     in case within ({...}).  */
                   2874:                  if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
                   2875:                       && lvalue_p (expr))
                   2876:                      || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
                   2877:                    expr = default_conversion (expr);
                   2878:                  cplus_expand_expr_stmt (expr);
                   2879:                  clear_momentary ();
                   2880:                  finish_stmt (); }
                   2881:        | simple_if ELSE
1.1.1.5   root     2882:                { expand_start_else (); }
1.1.1.6 ! root     2883:          partially_scoped_stmt
1.1       root     2884:                { expand_end_cond ();
1.1.1.6 ! root     2885:                  pop_implicit_try_blocks (NULL_TREE);
        !          2886:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2887:                  poplevel (kept_level_p (), 1, 0);
        !          2888:                  pop_momentary ();
1.1       root     2889:                  finish_stmt (); }
                   2890:        | simple_if %prec IF
                   2891:                { expand_end_cond ();
1.1.1.6 ! root     2892:                  pop_implicit_try_blocks (NULL_TREE);
        !          2893:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2894:                  poplevel (kept_level_p (), 1, 0);
        !          2895:                  pop_momentary ();
1.1       root     2896:                  finish_stmt (); }
                   2897:        | WHILE
                   2898:                { emit_nop ();
                   2899:                  emit_line_note (input_filename, lineno);
1.1.1.5   root     2900:                  expand_start_loop (1);
                   2901:                  cond_stmt_keyword = "while"; }
1.1.1.6 ! root     2902:          .pushlevel paren_cond_or_null
        !          2903:                { expand_exit_loop_if_false (0, truthvalue_conversion ($4)); }
        !          2904:          already_scoped_stmt
        !          2905:                { pop_implicit_try_blocks (NULL_TREE);
        !          2906:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2907:                  poplevel (kept_level_p (), 1, 0);
        !          2908:                  pop_momentary ();
        !          2909:                  expand_end_loop ();
1.1       root     2910:                  finish_stmt (); }
                   2911:        | DO
                   2912:                { emit_nop ();
                   2913:                  emit_line_note (input_filename, lineno);
1.1.1.5   root     2914:                  expand_start_loop_continue_elsewhere (1); }
                   2915:          implicitly_scoped_stmt WHILE
                   2916:                { expand_loop_continue_here ();
                   2917:                  cond_stmt_keyword = "do"; }
                   2918:          paren_expr_or_null ';'
1.1       root     2919:                { emit_line_note (input_filename, lineno);
1.1.1.5   root     2920:                  expand_exit_loop_if_false (0, truthvalue_conversion ($6));
1.1       root     2921:                  expand_end_loop ();
                   2922:                  clear_momentary ();
                   2923:                  finish_stmt (); }
                   2924:        | forhead.1
                   2925:                { emit_nop ();
                   2926:                  emit_line_note (input_filename, lineno);
                   2927:                  if ($1) cplus_expand_expr_stmt ($1);
                   2928:                  expand_start_loop_continue_elsewhere (1); }
1.1.1.6 ! root     2929:          .pushlevel xcond ';'
1.1       root     2930:                { emit_line_note (input_filename, lineno);
1.1.1.6 ! root     2931:                  if ($4) expand_exit_loop_if_false (0, truthvalue_conversion ($4)); }
1.1       root     2932:          xexpr ')'
1.1.1.6 ! root     2933:                /* Don't let the tree nodes for $7 be discarded
1.1       root     2934:                   by clear_momentary during the parsing of the next stmt.  */
1.1.1.5   root     2935:                { push_momentary (); }
1.1.1.6 ! root     2936:          already_scoped_stmt
1.1       root     2937:                { emit_line_note (input_filename, lineno);
                   2938:                  expand_loop_continue_here ();
1.1.1.6 ! root     2939:                  if ($7) cplus_expand_expr_stmt ($7);
        !          2940:                  pop_momentary ();
        !          2941:                  pop_implicit_try_blocks (NULL_TREE);
        !          2942:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2943:                  poplevel (kept_level_p (), 1, 0);
1.1       root     2944:                  pop_momentary ();
                   2945:                  expand_end_loop ();
                   2946:                  finish_stmt (); }
                   2947:        | forhead.2
                   2948:                { emit_nop ();
                   2949:                  emit_line_note (input_filename, lineno);
                   2950:                  expand_start_loop_continue_elsewhere (1); }
1.1.1.6 ! root     2951:          .pushlevel xcond ';'
1.1       root     2952:                { emit_line_note (input_filename, lineno);
1.1.1.6 ! root     2953:                  if ($4) expand_exit_loop_if_false (0, truthvalue_conversion ($4)); }
1.1       root     2954:          xexpr ')'
1.1.1.6 ! root     2955:                /* Don't let the tree nodes for $7 be discarded
1.1       root     2956:                   by clear_momentary during the parsing of the next stmt.  */
                   2957:                { push_momentary ();
1.1.1.6 ! root     2958:                  $<itype>8 = lineno; }
        !          2959:          already_scoped_stmt
        !          2960:                { emit_line_note (input_filename, (int) $<itype>8);
1.1       root     2961:                  expand_loop_continue_here ();
1.1.1.6 ! root     2962:                  if ($7) cplus_expand_expr_stmt ($7);
1.1       root     2963:                  pop_momentary ();
                   2964:                  pop_implicit_try_blocks (NULL_TREE);
1.1.1.6 ! root     2965:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2966:                  poplevel (kept_level_p (), 1, 0);
        !          2967:                  pop_momentary ();
        !          2968:                  expand_end_loop ();
1.1       root     2969:                  finish_stmt ();
                   2970:                }
1.1.1.6 ! root     2971:        | SWITCH .pushlevel '(' condition ')'
1.1       root     2972:                { emit_line_note (input_filename, lineno);
1.1.1.6 ! root     2973:                  c_expand_start_case ($4); 
        !          2974:                  /* Don't let the tree nodes for $4 be discarded by
1.1       root     2975:                     clear_momentary during the parsing of the next stmt.  */
1.1.1.5   root     2976:                  push_momentary (); }
1.1.1.6 ! root     2977:          partially_scoped_stmt
        !          2978:                { expand_end_case ($4);
        !          2979:                  pop_momentary ();
        !          2980:                  pop_implicit_try_blocks (NULL_TREE);
        !          2981:                  expand_end_bindings (getdecls (), kept_level_p (), 1);
        !          2982:                  poplevel (kept_level_p (), 1, 0);
1.1       root     2983:                  pop_momentary ();
                   2984:                  finish_stmt (); }
1.1.1.6 ! root     2985:        | CASE expr_no_commas ':'
1.1       root     2986:                { register tree value = $2;
                   2987:                  register tree label
                   2988:                    = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
                   2989: 
                   2990:                  /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   2991:                     Strip such NOP_EXPRs.  */
                   2992:                  if (TREE_CODE (value) == NOP_EXPR
                   2993:                      && TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
                   2994:                    value = TREE_OPERAND (value, 0);
                   2995: 
                   2996:                  if (TREE_READONLY_DECL_P (value))
                   2997:                    {
                   2998:                      value = decl_constant_value (value);
                   2999:                      /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   3000:                         Strip such NOP_EXPRs.  */
                   3001:                      if (TREE_CODE (value) == NOP_EXPR
                   3002:                          && TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
                   3003:                        value = TREE_OPERAND (value, 0);
                   3004:                    }
                   3005:                  value = fold (value);
                   3006: 
                   3007:                  if (TREE_CODE (value) != INTEGER_CST
                   3008:                      && value != error_mark_node)
                   3009:                    {
1.1.1.6 ! root     3010:                      cp_error ("case label `%E' does not reduce to an integer constant", $2);
1.1       root     3011:                      value = error_mark_node;
                   3012:                    }
                   3013:                  else
                   3014:                    /* Promote char or short to int.  */
                   3015:                    value = default_conversion (value);
                   3016:                  if (value != error_mark_node)
                   3017:                    {
                   3018:                      tree duplicate;
1.1.1.6 ! root     3019:                      int success = pushcase (value, convert_and_check,
        !          3020:                                              label, &duplicate);
1.1       root     3021:                      if (success == 1)
1.1.1.6 ! root     3022:                        cp_error ("case label `%E' not within a switch statement", $2);
1.1       root     3023:                      else if (success == 2)
                   3024:                        {
1.1.1.6 ! root     3025:                          cp_error ("duplicate case value `%E'", $2);
        !          3026:                          cp_error_at ("`%E' previously used here", duplicate);
1.1       root     3027:                        }
                   3028:                      else if (success == 3)
                   3029:                        warning ("case value out of range");
                   3030:                      else if (success == 5)
1.1.1.6 ! root     3031:                        cp_error ("case label `%E' within scope of cleanup or variable array", $2);
1.1       root     3032:                    }
                   3033:                  define_case_label (label);
                   3034:                }
                   3035:          stmt
1.1.1.6 ! root     3036:        | CASE expr_no_commas RANGE expr_no_commas ':'
1.1       root     3037:                { register tree value1 = $2;
                   3038:                  register tree value2 = $4;
                   3039:                  register tree label
                   3040:                    = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
                   3041: 
                   3042:                  if (pedantic)
1.1.1.4   root     3043:                    pedwarn ("ANSI C++ forbids range expressions in switch statement");
                   3044: 
1.1       root     3045:                  /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   3046:                     Strip such NOP_EXPRs.  */
                   3047:                  if (TREE_CODE (value1) == NOP_EXPR
                   3048:                      && TREE_TYPE (value1) == TREE_TYPE (TREE_OPERAND (value1, 0)))
                   3049:                    value1 = TREE_OPERAND (value1, 0);
                   3050: 
                   3051:                  if (TREE_READONLY_DECL_P (value1))
                   3052:                    {
                   3053:                      value1 = decl_constant_value (value1);
                   3054:                      /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   3055:                         Strip such NOP_EXPRs.  */
                   3056:                      if (TREE_CODE (value1) == NOP_EXPR
                   3057:                          && TREE_TYPE (value1) == TREE_TYPE (TREE_OPERAND (value1, 0)))
                   3058:                        value1 = TREE_OPERAND (value1, 0);
                   3059:                    }
                   3060:                  value1 = fold (value1);
                   3061: 
                   3062:                  /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   3063:                     Strip such NOP_EXPRs.  */
                   3064:                  if (TREE_CODE (value2) == NOP_EXPR
                   3065:                      && TREE_TYPE (value2) == TREE_TYPE (TREE_OPERAND (value2, 0)))
                   3066:                    value2 = TREE_OPERAND (value2, 0);
                   3067: 
                   3068:                  if (TREE_READONLY_DECL_P (value2))
                   3069:                    {
                   3070:                      value2 = decl_constant_value (value2);
                   3071:                      /* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
                   3072:                         Strip such NOP_EXPRs.  */
                   3073:                      if (TREE_CODE (value2) == NOP_EXPR
                   3074:                          && TREE_TYPE (value2) == TREE_TYPE (TREE_OPERAND (value2, 0)))
                   3075:                        value2 = TREE_OPERAND (value2, 0);
                   3076:                    }
                   3077:                  value2 = fold (value2);
                   3078: 
                   3079: 
                   3080:                  if (TREE_CODE (value1) != INTEGER_CST
                   3081:                      && value1 != error_mark_node)
                   3082:                    {
                   3083:                      error ("case label does not reduce to an integer constant");
                   3084:                      value1 = error_mark_node;
                   3085:                    }
                   3086:                  if (TREE_CODE (value2) != INTEGER_CST
                   3087:                      && value2 != error_mark_node)
                   3088:                    {
                   3089:                      error ("case label does not reduce to an integer constant");
                   3090:                      value2 = error_mark_node;
                   3091:                    }
                   3092:                  if (value1 != error_mark_node
                   3093:                      && value2 != error_mark_node)
                   3094:                    {
                   3095:                      tree duplicate;
1.1.1.6 ! root     3096:                      int success = pushcase_range (value1, value2,
        !          3097:                                                    convert_and_check, label,
1.1       root     3098:                                                    &duplicate);
                   3099:                      if (success == 1)
                   3100:                        error ("case label not within a switch statement");
                   3101:                      else if (success == 2)
                   3102:                        {
                   3103:                          error ("duplicate (or overlapping) case value");
                   3104:                          error_with_decl (duplicate, "this is the first entry overlapping that value");
                   3105:                        }
                   3106:                      else if (success == 3)
                   3107:                        warning ("case value out of range");
                   3108:                      else if (success == 4)
                   3109:                        warning ("empty range specified");
                   3110:                      else if (success == 5)
                   3111:                        error ("case label within scope of cleanup or variable array");
                   3112:                    }
                   3113:                  define_case_label (label);
                   3114:                }
                   3115:          stmt
                   3116:        | DEFAULT ':'
                   3117:                {
                   3118:                  tree duplicate;
                   3119:                  register tree label
                   3120:                    = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
1.1.1.6 ! root     3121:                  int success = pushcase (NULL_TREE, 0, label, &duplicate);
1.1       root     3122:                  if (success == 1)
                   3123:                    error ("default label not within a switch statement");
                   3124:                  else if (success == 2)
                   3125:                    {
                   3126:                      error ("multiple default labels in one switch");
                   3127:                      error_with_decl (duplicate, "this is the first default label");
                   3128:                    }
                   3129:                  define_case_label (NULL_TREE);
                   3130:                }
                   3131:          stmt
                   3132:        | BREAK ';'
                   3133:                { emit_line_note (input_filename, lineno);
                   3134:                  if ( ! expand_exit_something ())
                   3135:                    error ("break statement not within loop or switch"); }
                   3136:        | CONTINUE ';'
                   3137:                { emit_line_note (input_filename, lineno);
                   3138:                  if (! expand_continue_loop (0))
                   3139:                    error ("continue statement not within a loop"); }
                   3140:        | RETURN ';'
                   3141:                { emit_line_note (input_filename, lineno);
                   3142:                  c_expand_return (NULL_TREE); }
                   3143:        | RETURN expr ';'
                   3144:                { emit_line_note (input_filename, lineno);
                   3145:                  c_expand_return ($2);
                   3146:                  finish_stmt ();
                   3147:                }
1.1.1.5   root     3148:        | asm_keyword maybe_type_qual '(' string ')' ';'
1.1       root     3149:                { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                   3150:                  emit_line_note (input_filename, lineno);
                   3151:                  expand_asm ($4);
                   3152:                  finish_stmt ();
                   3153:                }
                   3154:        /* This is the case with just output operands.  */
1.1.1.5   root     3155:        | asm_keyword maybe_type_qual '(' string ':' asm_operands ')' ';'
1.1       root     3156:                { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                   3157:                  emit_line_note (input_filename, lineno);
                   3158:                  c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
                   3159:                                         $2 == ridpointers[(int)RID_VOLATILE],
                   3160:                                         input_filename, lineno);
                   3161:                  finish_stmt ();
                   3162:                }
                   3163:        /* This is the case with input operands as well.  */
1.1.1.5   root     3164:        | asm_keyword maybe_type_qual '(' string ':' asm_operands ':' asm_operands ')' ';'
1.1       root     3165:                { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                   3166:                  emit_line_note (input_filename, lineno);
                   3167:                  c_expand_asm_operands ($4, $6, $8, NULL_TREE,
                   3168:                                         $2 == ridpointers[(int)RID_VOLATILE],
                   3169:                                         input_filename, lineno);
                   3170:                  finish_stmt ();
                   3171:                }
                   3172:        /* This is the case with clobbered registers as well.  */
1.1.1.5   root     3173:        | asm_keyword maybe_type_qual '(' string ':' asm_operands ':'
1.1       root     3174:          asm_operands ':' asm_clobbers ')' ';'
                   3175:                { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                   3176:                  emit_line_note (input_filename, lineno);
                   3177:                  c_expand_asm_operands ($4, $6, $8, $10,
                   3178:                                         $2 == ridpointers[(int)RID_VOLATILE],
                   3179:                                         input_filename, lineno);
                   3180:                  finish_stmt ();
                   3181:                }
1.1.1.4   root     3182:        | GOTO '*' expr ';'
                   3183:                { emit_line_note (input_filename, lineno);
                   3184:                  expand_computed_goto ($3); }
1.1       root     3185:        | GOTO identifier ';'
                   3186:                { tree decl;
                   3187:                  emit_line_note (input_filename, lineno);
                   3188:                  decl = lookup_label ($2);
                   3189:                  TREE_USED (decl) = 1;
                   3190:                  expand_goto (decl); }
                   3191:        | label_colon stmt
                   3192:                { finish_stmt (); }
                   3193:        | label_colon '}'
                   3194:                { error ("label must be followed by statement");
                   3195:                  yyungetc ('}', 0);
                   3196:                  finish_stmt (); }
                   3197:        | ';'
                   3198:                { finish_stmt (); }
                   3199: 
1.1.1.2   root     3200:        /* Exception handling extensions.  */
1.1       root     3201:        | ANSI_THROW ';' { cplus_expand_throw (NULL_TREE); }
                   3202:        | ANSI_THROW expr ';' { cplus_expand_throw ($2); }
                   3203:        | THROW raise_identifier '(' nonnull_exprlist ')' ';'
                   3204:                { cplus_expand_raise ($2, $4, NULL_TREE, 0);
                   3205:                  finish_stmt (); }
                   3206:        | THROW raise_identifier LEFT_RIGHT ';'
                   3207:                { cplus_expand_raise ($2, NULL_TREE, NULL_TREE, 0);
                   3208:                  finish_stmt (); }
                   3209:        | RAISE raise_identifier '(' nonnull_exprlist ')' ';'
                   3210:                { cplus_expand_raise ($2, $4, NULL_TREE, 0);
                   3211:                  finish_stmt (); }
                   3212:        | RAISE raise_identifier LEFT_RIGHT ';'
                   3213:                { cplus_expand_raise ($2, NULL_TREE, NULL_TREE, 0);
                   3214:                  finish_stmt (); }
                   3215:        | RAISE identifier ';'
                   3216:                { cplus_expand_reraise ($2);
                   3217:                  finish_stmt (); }
                   3218:        | try EXCEPT identifier '{'
                   3219:                {
                   3220:                  tree decl = cplus_expand_end_try ($1);
                   3221:                  $<ttype>2 = current_exception_type;
                   3222:                  $<ttype>4 = current_exception_decl;
                   3223:                  $<ttype>$ = current_exception_object;
                   3224:                  cplus_expand_start_except ($3, decl);
                   3225:                  pushlevel (0);
                   3226:                  clear_last_expr ();
                   3227:                  push_momentary ();
                   3228:                  expand_start_bindings (0);
                   3229:                }
                   3230:          except_stmts '}'
                   3231:                {
                   3232:                  tree decls = getdecls ();
                   3233:                  /* If there is a default exception to handle,
                   3234:                     handle it here.  */
                   3235:                  if ($6)
                   3236:                    {
                   3237:                      tree decl = build_decl (CPLUS_CATCH_DECL, NULL_TREE, 0);
                   3238:                      tree block;
                   3239: 
                   3240:                      pushlevel (1);
                   3241:                      expand_start_bindings (0);
                   3242:                      expand_expr ($6, 0, 0, 0);
                   3243:                      expand_end_bindings (0, 1, 0);
                   3244:                      block = poplevel (1, 0, 0);
                   3245: 
                   3246:                      /* This is a catch block.  */
                   3247:                      TREE_LANG_FLAG_2 (block) = 1;
                   3248:                      BLOCK_VARS (block) = decl;
                   3249:                    }
                   3250: 
                   3251:                  expand_end_bindings (decls, decls != 0, 1);
                   3252:                  poplevel (decls != 0, 1, 0);
                   3253:                  pop_momentary ();
                   3254:                  current_exception_type = $<ttype>2;
                   3255:                  current_exception_decl = $<ttype>4;
                   3256:                  current_exception_object = $<ttype>5;
                   3257:                  cplus_expand_end_except ($6);
                   3258:                }
                   3259:        | try error
                   3260:                {
                   3261:                  cplus_expand_end_try ($1);
                   3262:                  /* These are the important actions of
                   3263:                     `cplus_expand_end_except' which we must emulate.  */
                   3264:                  if (expand_escape_except ())
                   3265:                    expand_end_except ();
                   3266:                  expand_end_bindings (0, 0, 1);
                   3267:                  poplevel (0, 0, 0);
                   3268:                }
                   3269:        | ansi_try ansi_dummy ansi_dummy
                   3270:                {
                   3271:                  tree decl = cplus_expand_end_try ($1);
                   3272:                  $<ttype>2 = current_exception_type;
                   3273:                  $<ttype>3 = current_exception_decl;
                   3274:                  $<ttype>$ = current_exception_object;
                   3275:                  cplus_expand_start_except (NULL, decl);
                   3276:                  pushlevel (0);
                   3277:                  clear_last_expr ();
                   3278:                  push_momentary ();
                   3279:                  expand_start_bindings (0);
                   3280:                }
                   3281:          ansi_except_stmts
                   3282:                {
                   3283:                  tree decls = getdecls ();
                   3284:                  /* If there is a default exception to handle,
                   3285:                     handle it here.  */
                   3286:                  if ($5)
                   3287:                    {
                   3288:                      tree decl = build_decl (CPLUS_CATCH_DECL, NULL_TREE, 0);
                   3289:                      tree block;
                   3290: 
                   3291:                      pushlevel (1);
                   3292:                      expand_start_bindings (0);
                   3293:                      expand_expr ($5, 0, 0, 0);
                   3294:                      expand_end_bindings (0, 1, 0);
                   3295:                      block = poplevel (1, 0, 0);
                   3296: 
                   3297:                      /* This is a catch block.  */
                   3298:                      TREE_LANG_FLAG_2 (block) = 1;
                   3299:                      BLOCK_VARS (block) = decl;
                   3300:                    }
                   3301: 
                   3302:                  expand_end_bindings (decls, decls != 0, 1);
                   3303:                  poplevel (decls != 0, 1, 0);
                   3304:                  pop_momentary ();
                   3305:                  current_exception_type = $<ttype>2;
                   3306:                  current_exception_decl = $<ttype>3;
                   3307:                  current_exception_object = $<ttype>4;
                   3308:                  cplus_expand_end_except ($5);
                   3309:                }
                   3310:        | try RERAISE raise_identifiers /* ';' checked for at bottom.  */
                   3311:                { tree name = get_identifier ("(compiler error)");
                   3312:                  tree orig_ex_type = current_exception_type;
                   3313:                  tree orig_ex_decl = current_exception_decl;
                   3314:                  tree orig_ex_obj = current_exception_object;
                   3315:                  tree decl = cplus_expand_end_try ($1), decls;
                   3316: 
                   3317:                  /* Start hidden EXCEPT.  */
                   3318:                  cplus_expand_start_except (name, decl);
                   3319:                  pushlevel (0);
                   3320:                  clear_last_expr ();
                   3321:                  push_momentary ();
                   3322:                  expand_start_bindings (0);
                   3323: 
                   3324:                  /* This sets up the reraise.  */
                   3325:                  cplus_expand_reraise ($3);
                   3326: 
                   3327:                  decls = getdecls ();
                   3328:                  expand_end_bindings (decls, decls != 0, 1);
                   3329:                  poplevel (decls != 0, 1, 0);
                   3330:                  pop_momentary ();
                   3331:                  current_exception_type = orig_ex_type;
                   3332:                  current_exception_decl = orig_ex_decl;
                   3333:                  current_exception_object = orig_ex_obj;
                   3334:                  /* This will reraise for us.  */
                   3335:                  cplus_expand_end_except (error_mark_node);
                   3336:                  if (yychar == YYEMPTY)
                   3337:                    yychar = YYLEX;
                   3338:                  if (yychar != ';')
                   3339:                    error ("missing ';' after reraise statement");
                   3340:                }
                   3341:        | try  %prec EMPTY
                   3342:                { yyerror ("`except' missing after `try' statement");
                   3343:                  /* Terminate the binding contour started by special
                   3344:                     code in `.pushlevel'.  Automagically pops off
                   3345:                     the conditional we started for `try' stmt.  */
                   3346:                  cplus_expand_end_try ($1);
                   3347:                  expand_end_bindings (0, 0, 1);
                   3348:                  poplevel (0, 0, 0);
                   3349:                  pop_momentary ();
                   3350:                  YYERROR; }
                   3351:        ;
                   3352: 
                   3353: try:     try_head '}'
                   3354:                /* An empty try block is degenerate, but it's better to
                   3355:                   do extra work here than to do all the special-case work
                   3356:                   everywhere else.  */
                   3357:                {
                   3358:                  $$ = 1;
                   3359:                  pop_implicit_try_blocks (NULL_TREE);
                   3360:                }
                   3361:        | try_head stmts '}'
                   3362:                {
                   3363:                  $$ = 1;
                   3364:                  pop_implicit_try_blocks (NULL_TREE);
                   3365:                }
                   3366:        | try_head error '}'
                   3367:                {
                   3368:                  $$ = 0;
                   3369:                  pop_implicit_try_blocks (NULL_TREE);
                   3370:                }
                   3371:        ;
                   3372: 
                   3373: label_colon:
                   3374:          IDENTIFIER ':'
                   3375:                { tree label;
                   3376:                do_label:
                   3377:                  label = define_label (input_filename, lineno, $1);
                   3378:                  if (label)
                   3379:                    expand_label (label);
                   3380:                }
                   3381:        | PTYPENAME ':'
                   3382:                { goto do_label; }
                   3383:        | TYPENAME_COLON
                   3384:                { tree label = define_label (input_filename, lineno, $1);
                   3385:                  if (label)
                   3386:                    expand_label (label);
                   3387:                }
                   3388:        ;
                   3389: 
                   3390: try_head: TRY '{' { cplus_expand_start_try (0); } .pushlevel
                   3391: 
                   3392: ansi_try:        ansi_try_head '}'
                   3393:                /* An empty try block is degenerate, but it's better to
                   3394:                   do extra work here than to do all the special-case work
                   3395:                   everywhere else.  */
                   3396:                {
                   3397:                  $$ = 1;
                   3398:                  pop_implicit_try_blocks (NULL_TREE);
                   3399:                }
                   3400:        | ansi_try_head stmts '}'
                   3401:                {
                   3402:                  $$ = 1;
                   3403:                  pop_implicit_try_blocks (NULL_TREE);
                   3404:                }
                   3405:        | ansi_try_head error '}'
                   3406:                {
                   3407:                  $$ = 0;
                   3408:                  pop_implicit_try_blocks (NULL_TREE);
                   3409:                }
                   3410:        ;
                   3411: 
                   3412: ansi_dummy: ; /* Temporary place-holder. */
                   3413: ansi_try_head: ANSI_TRY '{' { cplus_expand_start_try (0); } .pushlevel
                   3414: 
                   3415: except_stmts:
                   3416:          /* empty */
                   3417:                { $$ = NULL_TREE; }
                   3418:        | except_stmts raise_identifier
                   3419:                {
                   3420:                  tree type = lookup_exception_type (current_class_type, current_class_name, $2);
                   3421:                  if (type == NULL_TREE)
                   3422:                    {
                   3423:                      error ("`%s' is not an exception type",
                   3424:                             IDENTIFIER_POINTER (TREE_VALUE ($2)));
                   3425:                      current_exception_type = NULL_TREE;
                   3426:                      TREE_TYPE (current_exception_object) = error_mark_node;
                   3427:                    }
                   3428:                  else
                   3429:                    {
                   3430:                      current_exception_type = type;
                   3431:                      /* In-place union.  */
                   3432:                      TREE_TYPE (current_exception_object) = type;
                   3433:                    }
                   3434:                  $2 = cplus_expand_start_catch ($2);
                   3435:                  pushlevel (1);
                   3436:                  expand_start_bindings (0);
                   3437:                }
                   3438:          compstmt
                   3439:                {
                   3440:                  expand_end_bindings (0, 1, 0);
                   3441:                  $4 = poplevel (1, 0, 0);
                   3442: 
                   3443:                  cplus_expand_end_catch (0);
                   3444: 
                   3445:                  /* Mark this as a catch block.  */
                   3446:                  TREE_LANG_FLAG_2 ($4) = 1;
                   3447:                  if ($2 != error_mark_node)
                   3448:                    {
                   3449:                      tree decl = build_decl (CPLUS_CATCH_DECL, DECL_NAME ($2), 0);
                   3450:                      DECL_RTL (decl) = DECL_RTL ($2);
                   3451:                      TREE_CHAIN (decl) = BLOCK_VARS ($4);
                   3452:                      BLOCK_VARS ($4) = decl;
                   3453:                    }
                   3454:                }
                   3455:        | except_stmts DEFAULT
                   3456:                {
                   3457:                  if ($1)
                   3458:                    error ("duplicate default in exception handler");
                   3459:                  current_exception_type = NULL_TREE;
                   3460:                  /* Takes it right out of scope.  */
                   3461:                  TREE_TYPE (current_exception_object) = error_mark_node;
                   3462: 
                   3463:                  if (! expand_catch_default ())
                   3464:                    compiler_error ("default catch botch");
                   3465: 
                   3466:                  /* The default exception is handled as the
                   3467:                     last in the chain of exceptions handled.  */
                   3468:                  do_pending_stack_adjust ();
                   3469:                  $1 = make_node (RTL_EXPR);
                   3470:                  TREE_TYPE ($1) = void_type_node;
1.1.1.6 ! root     3471:                  start_sequence_for_rtl_expr ($1);
1.1       root     3472:                }
                   3473:          compstmt
                   3474:                {
1.1.1.4   root     3475:                  extern struct rtx_def *get_insns ();
1.1       root     3476:                  do_pending_stack_adjust ();
                   3477:                  if (! expand_catch (NULL_TREE))
                   3478:                    compiler_error ("except nesting botch");
                   3479:                  if (! expand_end_catch ())
                   3480:                    compiler_error ("except nesting botch");
1.1.1.4   root     3481:                  RTL_EXPR_SEQUENCE ($1) = get_insns ();
1.1       root     3482:                  if ($4)
                   3483:                    {
                   3484:                      /* Mark this block as the default catch block.  */
                   3485:                      TREE_LANG_FLAG_1 ($4) = 1;
                   3486:                      TREE_LANG_FLAG_2 ($4) = 1;
                   3487:                    }
                   3488:                  end_sequence ();
                   3489:                }
                   3490:        ;
                   3491: 
                   3492: optional_identifier:
                   3493:          /* empty */
                   3494:                { $$ = NULL_TREE; }
                   3495:        | identifier ;
                   3496: 
                   3497: ansi_except_stmts:
                   3498:          /* empty */
                   3499:                { $$ = NULL_TREE; }
                   3500:        | ansi_except_stmts CATCH '(' typename optional_identifier ')'
                   3501:                {
                   3502:                  tree type = groktypename ($4);
                   3503:                  current_exception_type = type;
                   3504:                  /* In-place union.  */
                   3505:                  if ($5)
                   3506:                    {
                   3507:                      tree tmp;
                   3508:                      tmp = pushdecl (build_decl (VAR_DECL, $5, type));
                   3509:                      current_exception_object =
                   3510:                          build1 (INDIRECT_REF, type, tmp);
                   3511:                     }
                   3512:                  $4 = ansi_expand_start_catch(type);
                   3513:                  pushlevel (1);
                   3514:                  expand_start_bindings (0);
                   3515:                }
                   3516:          compstmt
                   3517:                {
                   3518:                  expand_end_bindings (0, 1, 0);
                   3519:                  $8 = poplevel (1, 0, 0);
                   3520: 
                   3521:                  cplus_expand_end_catch (0);
                   3522: 
                   3523:                  /* Mark this as a catch block.  */
                   3524:                  TREE_LANG_FLAG_2 ($8) = 1;
                   3525:                  if ($4 != error_mark_node)
                   3526:                    {
                   3527:                      tree decl = build_decl (CPLUS_CATCH_DECL, DECL_NAME ($4), 0);
                   3528:                      DECL_RTL (decl) = DECL_RTL ($4);
                   3529:                      TREE_CHAIN (decl) = BLOCK_VARS ($8);
                   3530:                      BLOCK_VARS ($8) = decl;
                   3531:                    }
                   3532:                }
                   3533:        ;
                   3534: 
                   3535: forhead.1:
                   3536:          FOR '(' ';'
                   3537:                { $$ = NULL_TREE; }
                   3538:        | FOR '(' expr ';'
                   3539:                { $$ = $3; }
                   3540:        | FOR '(' '{' '}'
                   3541:                { $$ = NULL_TREE; }
                   3542:        ;
                   3543: 
                   3544: forhead.2:
                   3545:          FOR '(' decl
                   3546:                { $$ = 0; }
                   3547:        | FOR '(' error ';'
                   3548:                { $$ = 0; }
                   3549:        | FOR '(' '{' .pushlevel stmts '}'
                   3550:                { $$ = 1; }
                   3551:        | FOR '(' '{' .pushlevel error '}'
                   3552:                { $$ = -1; }
                   3553:        ;
                   3554: 
                   3555: /* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
                   3556: 
                   3557: maybe_type_qual:
                   3558:        /* empty */
1.1.1.5   root     3559:                { emit_line_note (input_filename, lineno); }
1.1       root     3560:        | TYPE_QUAL
1.1.1.5   root     3561:                { emit_line_note (input_filename, lineno); }
1.1       root     3562:        ;
                   3563: 
                   3564: xexpr:
                   3565:        /* empty */
                   3566:                { $$ = NULL_TREE; }
                   3567:        | expr
                   3568:        | error
                   3569:                { $$ = NULL_TREE; }
                   3570:        ;
                   3571: 
                   3572: /* These are the operands other than the first string and colon
                   3573:    in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
                   3574: asm_operands: /* empty */
                   3575:                { $$ = NULL_TREE; }
                   3576:        | nonnull_asm_operands
                   3577:        ;
                   3578: 
                   3579: nonnull_asm_operands:
                   3580:          asm_operand
                   3581:        | nonnull_asm_operands ',' asm_operand
                   3582:                { $$ = chainon ($$, $3); }
                   3583:        ;
                   3584: 
                   3585: asm_operand:
                   3586:          STRING '(' expr ')'
                   3587:                { $$ = build_tree_list ($$, $3); }
                   3588:        ;
                   3589: 
                   3590: asm_clobbers:
                   3591:          STRING
                   3592:                { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
                   3593:        | asm_clobbers ',' STRING
                   3594:                { $$ = tree_cons (NULL_TREE, $3, $$); }
                   3595:        ;
                   3596: 
                   3597: /* This is what appears inside the parens in a function declarator.
                   3598:    Its value is represented in the format that grokdeclarator expects.
                   3599: 
                   3600:    In C++, declaring a function with no parameters
                   3601:    means that that function takes *no* parameters.  */
                   3602: parmlist:  /* empty */
                   3603:                {
                   3604:                  if (strict_prototype)
                   3605:                    $$ = void_list_node;
                   3606:                  else
                   3607:                    $$ = NULL_TREE;
                   3608:                }
                   3609:        | parms
                   3610:                {
                   3611:                  $$ = chainon ($$, void_list_node);
                   3612:                  TREE_PARMLIST ($$) = 1;
                   3613:                }
                   3614:        | parms ',' ELLIPSIS
                   3615:                {
                   3616:                  TREE_PARMLIST ($$) = 1;
                   3617:                }
                   3618:        /* C++ allows an ellipsis without a separating ',' */
                   3619:        | parms ELLIPSIS
                   3620:                {
                   3621:                  TREE_PARMLIST ($$) = 1;
                   3622:                }
                   3623:        | ELLIPSIS
                   3624:                {
1.1.1.4   root     3625:                  /* ARM $8.2.5 has this as a boxed-off comment.  */
                   3626:                  if (pedantic)
                   3627:                    warning ("use of `...' without a first argument is non-portable");
1.1       root     3628:                  $$ = NULL_TREE;
                   3629:                }
                   3630:        | TYPENAME_ELLIPSIS
                   3631:                {
                   3632:                  TREE_PARMLIST ($$) = 1;
                   3633:                }
                   3634:        | parms TYPENAME_ELLIPSIS
                   3635:                {
                   3636:                  TREE_PARMLIST ($$) = 1;
                   3637:                }
                   3638:        | parms ':'
                   3639:                {
                   3640:                  /* This helps us recover from really nasty
                   3641:                     parse errors, for example, a missing right
                   3642:                     parenthesis.  */
                   3643:                  yyerror ("possibly missing ')'");
                   3644:                  $$ = chainon ($$, void_list_node);
                   3645:                  TREE_PARMLIST ($$) = 1;
                   3646:                  yyungetc (':', 0);
                   3647:                  yychar = ')';
                   3648:                }
                   3649:        ;
                   3650: 
                   3651: /* A nonempty list of parameter declarations or type names.  */
                   3652: parms:
                   3653:          parm
                   3654:                { $$ = build_tree_list (NULL_TREE, $$); }
                   3655:        | parm '=' init
                   3656:                { $$ = build_tree_list ($3, $$); }
                   3657:        | parms ',' parm
                   3658:                { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
                   3659:        | parms ',' parm '=' init
                   3660:                { $$ = chainon ($$, build_tree_list ($5, $3)); }
                   3661:        | parms ',' bad_parm
                   3662:                { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
                   3663:        | parms ',' bad_parm '=' init
                   3664:                { $$ = chainon ($$, build_tree_list ($5, $3)); }
                   3665:        ;
                   3666: 
                   3667: /* A single parameter declaration or parameter type name,
                   3668:    as found in a parmlist.  The first four cases make up for 10%
                   3669:    of the time spent parsing C++.  We cannot use them because
                   3670:    of `int id[]' which won't get parsed properly.  */
                   3671: parm:
                   3672: /*
                   3673:          typed_declspecs dont_see_typename '*' IDENTIFIER
                   3674:                { $$ = build_tree_list ($$, build_parse_node (INDIRECT_REF, $4));
                   3675:                  see_typename (); }
                   3676:        | typed_declspecs dont_see_typename '&' IDENTIFIER
                   3677:                { $$ = build_tree_list ($$, build_parse_node (ADDR_EXPR, $4));
                   3678:                  see_typename (); }
                   3679:        | TYPENAME IDENTIFIER
                   3680:                { $$ = build_tree_list (list_hash_lookup_or_cons ($$), $2);  }
                   3681:        | TYPESPEC IDENTIFIER
                   3682:                { $$ = build_tree_list (list_hash_lookup_or_cons ($$), $2); }
                   3683:        | */
                   3684:          typed_declspecs dont_see_typename abs_or_notype_decl
                   3685:                { $$ = build_tree_list ($$, $3);
                   3686:                  see_typename (); }
                   3687:        | declmods dont_see_typename abs_or_notype_decl
                   3688:                { $$ = build_tree_list ($$, $3);
                   3689:                  see_typename (); }
                   3690:        ;
                   3691: 
                   3692: abs_or_notype_decl: absdcl
                   3693:        | notype_declarator
                   3694:        | START_DECLARATOR notype_declarator
                   3695:                { $$ = $2; }
                   3696:        ;
                   3697: 
                   3698: see_typename: type_quals
                   3699:        { see_typename (); }
                   3700:        ;
                   3701: 
                   3702: dont_see_typename: /* empty */
                   3703:        { dont_see_typename (); }
                   3704:        ;
                   3705: 
1.1.1.4   root     3706: /*
1.1       root     3707: try_for_typename:
                   3708:         {
                   3709:          if ($<ttype>-1 == error_mark_node)
                   3710:             $$ = 0;
                   3711:           else
                   3712:             {
                   3713:               $$ = 1;
                   3714:               pushclass ($<ttype>-1, 1);
                   3715:             }
                   3716:         }
                   3717:        ;
1.1.1.4   root     3718: */
1.1       root     3719: 
                   3720: bad_parm:
                   3721:          abs_or_notype_decl
                   3722:                {
                   3723:                  warning ("type specifier omitted for parameter");
                   3724:                  $$ = build_tree_list (TREE_PURPOSE (TREE_VALUE ($<ttype>-1)), $$);
                   3725:                }
                   3726:        ;
                   3727: 
                   3728: maybe_raises:
                   3729:          /* empty */
                   3730:                { $$ = NULL_TREE; }
                   3731:        | RAISES raise_identifiers  %prec EMPTY
                   3732:                { $$ = $2; }
                   3733:        | ANSI_THROW '(' ansi_raise_identifiers  ')' %prec EMPTY
                   3734:                { $$ = $3; }
                   3735:        ;
                   3736: 
                   3737: raise_identifier:
                   3738:          ALL
                   3739:                { $$ = void_list_node; }
                   3740:        | IDENTIFIER
                   3741:                { $$ = build_decl_list (NULL_TREE, $$); }
                   3742:        | TYPENAME
                   3743:                { $$ = build_decl_list (NULL_TREE, $$); }
                   3744:        | SCOPE IDENTIFIER
                   3745:                { $$ = build_decl_list (void_type_node, $2); }
                   3746:        | SCOPE TYPENAME
                   3747:                { $$ = build_decl_list (void_type_node, $2); }
1.1.1.6 ! root     3748:        | id_scope IDENTIFIER
1.1       root     3749:                { $$ = build_decl_list ($$, $2); }
                   3750:        | scoped_typename
                   3751:        ;
                   3752: 
                   3753: ansi_raise_identifier:
                   3754:          typename
                   3755:                { $$ = build_decl_list (NULL_TREE, $$); }
                   3756:        ;
                   3757: 
                   3758: raise_identifiers:
                   3759:          raise_identifier
                   3760:        | raise_identifiers ',' raise_identifier
                   3761:                {
                   3762:                  TREE_CHAIN ($3) = $$;
                   3763:                  $$ = $3;
                   3764:                }
                   3765:        ;
                   3766: 
                   3767: ansi_raise_identifiers:
                   3768:          ansi_raise_identifier
                   3769:        | ansi_raise_identifiers ',' ansi_raise_identifier
                   3770:                {
                   3771:                  TREE_CHAIN ($3) = $$;
                   3772:                  $$ = $3;
                   3773:                }
                   3774:        ;
                   3775: 
                   3776: operator_name:
                   3777:          OPERATOR '*'
                   3778:                { $$ = ansi_opname[MULT_EXPR]; }
                   3779:        | OPERATOR '/'
                   3780:                { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
                   3781:        | OPERATOR '%'
                   3782:                { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
                   3783:        | OPERATOR '+'
                   3784:                { $$ = ansi_opname[PLUS_EXPR]; }
                   3785:        | OPERATOR '-'
                   3786:                { $$ = ansi_opname[MINUS_EXPR]; }
                   3787:        | OPERATOR '&'
                   3788:                { $$ = ansi_opname[BIT_AND_EXPR]; }
                   3789:        | OPERATOR '|'
                   3790:                { $$ = ansi_opname[BIT_IOR_EXPR]; }
                   3791:        | OPERATOR '^'
                   3792:                { $$ = ansi_opname[BIT_XOR_EXPR]; }
                   3793:        | OPERATOR '~'
                   3794:                { $$ = ansi_opname[BIT_NOT_EXPR]; }
                   3795:        | OPERATOR ','
                   3796:                { $$ = ansi_opname[COMPOUND_EXPR]; }
                   3797:        | OPERATOR ARITHCOMPARE
                   3798:                { $$ = ansi_opname[$2]; }
                   3799:        | OPERATOR '<'
                   3800:                { $$ = ansi_opname[LT_EXPR]; }
                   3801:        | OPERATOR '>'
                   3802:                { $$ = ansi_opname[GT_EXPR]; }
                   3803:        | OPERATOR EQCOMPARE
                   3804:                { $$ = ansi_opname[$2]; }
                   3805:        | OPERATOR ASSIGN
                   3806:                { $$ = ansi_assopname[$2]; }
                   3807:        | OPERATOR '='
                   3808:                {
                   3809:                  $$ = ansi_opname [MODIFY_EXPR];
                   3810:                  if (current_class_type)
                   3811:                    {
                   3812:                      TYPE_HAS_ASSIGNMENT (current_class_type) = 1;
                   3813:                      TYPE_GETS_ASSIGNMENT (current_class_type) = 1;
                   3814:                    }
                   3815:                }
                   3816:        | OPERATOR LSHIFT
                   3817:                { $$ = ansi_opname[$2]; }
                   3818:        | OPERATOR RSHIFT
                   3819:                { $$ = ansi_opname[$2]; }
                   3820:        | OPERATOR PLUSPLUS
                   3821:                { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
                   3822:        | OPERATOR MINUSMINUS
                   3823:                { $$ = ansi_opname[PREDECREMENT_EXPR]; }
                   3824:        | OPERATOR ANDAND
                   3825:                { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
                   3826:        | OPERATOR OROR
                   3827:                { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
                   3828:        | OPERATOR '!'
                   3829:                { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
                   3830:        | OPERATOR '?' ':'
                   3831:                { $$ = ansi_opname[COND_EXPR]; }
                   3832:        | OPERATOR MIN_MAX
                   3833:                { $$ = ansi_opname[$2]; }
                   3834:        | OPERATOR POINTSAT  %prec EMPTY
                   3835:                { $$ = ansi_opname[COMPONENT_REF];
                   3836:                  if (current_class_type)
                   3837:                    {
                   3838:                      tree t = current_class_type;
                   3839:                      while (t)
                   3840:                        {
                   3841:                          TYPE_OVERLOADS_ARROW (t) = 1;
                   3842:                          t = TYPE_NEXT_VARIANT (t);
                   3843:                        }
                   3844:                    }
                   3845:                }
                   3846:        | OPERATOR POINTSAT_STAR  %prec EMPTY
                   3847:                { $$ = ansi_opname[MEMBER_REF];
                   3848:                  if (current_class_type)
                   3849:                    {
                   3850:                      tree t = current_class_type;
                   3851:                      while (t)
                   3852:                        {
                   3853:                          TYPE_OVERLOADS_ARROW (t) = 1;
                   3854:                          t = TYPE_NEXT_VARIANT (t);
                   3855:                        }
                   3856:                    }
                   3857:                }
                   3858:        | OPERATOR LEFT_RIGHT
                   3859:                { $$ = ansi_opname[CALL_EXPR];
                   3860:                  if (current_class_type)
                   3861:                    {
                   3862:                      tree t = current_class_type;
                   3863:                      while (t)
                   3864:                        {
                   3865:                          TYPE_OVERLOADS_CALL_EXPR (t) = 1;
                   3866:                          t = TYPE_NEXT_VARIANT (t);
                   3867:                        }
                   3868:                    }
                   3869:                }
                   3870:        | OPERATOR '[' ']'
                   3871:                { $$ = ansi_opname[ARRAY_REF];
                   3872:                  if (current_class_type)
                   3873:                    {
                   3874:                      tree t = current_class_type;
                   3875:                      while (t)
                   3876:                        {
                   3877:                          TYPE_OVERLOADS_ARRAY_REF (t) = 1;
                   3878:                          t = TYPE_NEXT_VARIANT (t);
                   3879:                        }
                   3880:                    }
                   3881:                }
                   3882:        | OPERATOR NEW
                   3883:                {
                   3884:                  $$ = ansi_opname[NEW_EXPR];
                   3885:                  if (current_class_type)
                   3886:                    {
                   3887:                      tree t = current_class_type;
                   3888:                      while (t)
                   3889:                        {
                   3890:                          TREE_GETS_NEW (t) = 1;
                   3891:                          t = TYPE_NEXT_VARIANT (t);
                   3892:                        }
                   3893:                    }
                   3894:                }
1.1.1.6 ! root     3895: /*
        !          3896:        | OPERATOR NEW '[' ']'
        !          3897:                {
        !          3898:                  $$ = ansi_opname[VEC_NEW_EXPR];
        !          3899:                  if (current_class_type)
        !          3900:                    {
        !          3901:                      tree t = current_class_type;
        !          3902:                      while (t)
        !          3903:                        {
        !          3904:                          TREE_GETS_VEC_NEW (t) = 1;
        !          3905:                          t = TYPE_NEXT_VARIANT (t);
        !          3906:                        }
        !          3907:                    }
        !          3908:                }
        !          3909: */
1.1       root     3910:        | OPERATOR DELETE
                   3911:                {
                   3912:                  $$ = ansi_opname[DELETE_EXPR];
                   3913:                  if (current_class_type)
                   3914:                    {
                   3915:                      tree t = current_class_type;
                   3916:                      while (t)
                   3917:                        {
                   3918:                          TREE_GETS_DELETE (t) = 1;
                   3919:                          t = TYPE_NEXT_VARIANT (t);
                   3920:                        }
                   3921:                    }
                   3922:                }
1.1.1.6 ! root     3923: /*
        !          3924:        | OPERATOR DELETE '[' ']'
        !          3925:                {
        !          3926:                  $$ = ansi_opname[VEC_DELETE_EXPR];
        !          3927:                  if (current_class_type)
        !          3928:                    {
        !          3929:                      tree t = current_class_type;
        !          3930:                      while (t)
        !          3931:                        {
        !          3932:                          TREE_GETS_VEC_DELETE (t) = 1;
        !          3933:                          t = TYPE_NEXT_VARIANT (t);
        !          3934:                        }
        !          3935:                    }
        !          3936:                }
        !          3937: */
1.1       root     3938: 
                   3939:        /* These should do `groktypename' and set up TREE_HAS_X_CONVERSION
                   3940:           here, rather than doing it in class.c .  */
                   3941:        | OPERATOR typed_typespecs absdcl
1.1.1.4   root     3942:                { $$ = build1 (TYPE_EXPR, $2, $3); }
1.1       root     3943:        | OPERATOR error
                   3944:                { $$ = ansi_opname[ERROR_MARK]; }
                   3945:        ;
                   3946: 
                   3947: %%

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.