Annotation of gcc/c-parse.y, revision 1.1.1.5

1.1       root        1: /* YACC parser for C syntax.
                      2:    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
                      3: 
                      4: This file is part of GNU CC.
                      5: 
                      6: GNU CC is distributed in the hope that it will be useful,
                      7: but WITHOUT ANY WARRANTY.  No author or distributor
                      8: accepts responsibility to anyone for the consequences of using it
                      9: or for whether it serves any particular purpose or works at all,
                     10: unless he says so in writing.  Refer to the GNU CC General Public
                     11: License for full details.
                     12: 
                     13: Everyone is granted permission to copy, modify and redistribute
                     14: GNU CC, but only under the conditions described in the
                     15: GNU CC General Public License.   A copy of this license is
                     16: supposed to have been given to you along with GNU CC so you
                     17: can know your rights and responsibilities.  It should be in a
                     18: file named COPYING.  Among other things, the copyright notice
                     19: and this notice must be preserved on all copies.  */
                     20: 
                     21: 
                     22: /*  To whomever it may concern: I have heard that such a thing was once
                     23:  written by AT&T, but I have never seen it.  */
                     24: 
                     25: %expect 23
                     26: 
                     27: /* These are the 23 conflicts you should get in parse.output;
                     28:    the state numbers may vary if minor changes in the grammar are made.
                     29: 
                     30: State 41 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     31: State 90 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     32: State 97 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     33: State 101 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     34: State 117 contains 1 shift/reduce conflict.  (See comment at component_decl.)
                     35: State 169 contains 2 shift/reduce conflicts.  (make notype_declarator longer.)
                     36: State 181 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     37: State 191 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     38: State 197 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
                     39: State 239 contains 2 shift/reduce conflicts.  (make absdcl1 longer if poss.)
                     40: State 269 contains 2 shift/reduce conflicts.  (same for after_type_declarator).
                     41: State 299 contains 2 shift/reduce conflicts.  (similar for absdcl1 again.)
                     42: State 362 contains 1 shift/reduce conflict.  (dangling else.)
                     43: State 370 contains 2 shift/reduce conflicts.  (like 241, other context.)
                     44: State 373 contains 2 shift/reduce conflicts.  (like 241, other context.)
                     45: State 411 contains 2 shift/reduce conflicts.  (like 166 for parm_declarator)?
                     46: */
                     47: 
                     48: %{
                     49: #include "config.h"
                     50: #include "tree.h"
1.1.1.2   root       51: #include "c-parse.h"
1.1       root       52: #include "c-tree.h"
                     53: 
                     54: #include <stdio.h>
                     55: #include <errno.h>
                     56: 
                     57: #ifndef errno
                     58: extern int errno;
                     59: #endif
                     60: 
                     61: /* Cause the `yydebug' variable to be defined.  */
                     62: #define YYDEBUG
                     63: %}
                     64: 
                     65: %start program
                     66: 
                     67: %union {long itype; tree ttype; enum tree_code code; char *cptr; }
                     68: 
                     69: /* All identifiers that are not reserved words
                     70:    and are not declared typedefs in the current block */
                     71: %token IDENTIFIER
                     72: 
                     73: /* All identifiers that are declared typedefs in the current block.
                     74:    In some contexts, they are treated just like IDENTIFIER,
                     75:    but they can also serve as typespecs in declarations.  */
                     76: %token TYPENAME
                     77: 
                     78: /* Reserved words that specify storage class.
                     79:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                     80: %token SCSPEC
                     81: 
                     82: /* Reserved words that specify type.
                     83:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                     84: %token TYPESPEC
                     85: 
                     86: /* Reserved words that qualify type: "const" or "volatile".
                     87:    yylval contains an IDENTIFIER_NODE which indicates which one.  */
                     88: %token TYPE_QUAL
                     89: 
                     90: /* Character or numeric constants.
                     91:    yylval is the node for the constant.  */
                     92: %token CONSTANT
                     93: 
                     94: /* String constants in raw form.
                     95:    yylval is a STRING_CST node.  */
                     96: %token STRING
                     97: 
                     98: /* "...", used for functions with variable arglists.  */
                     99: %token ELLIPSIS
                    100: 
                    101: /* the reserved words */
                    102: %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
                    103: %token BREAK CONTINUE RETURN GOTO ASM TYPEOF ALIGNOF
                    104: 
                    105: /* Define the operator tokens and their precedences.
                    106:    The value is an integer because, if used, it is the tree code
                    107:    to use in the expression made from the operator.  */
                    108: 
                    109: %right <code> ASSIGN '='
                    110: %right <code> '?' ':'
                    111: %left <code> OROR
                    112: %left <code> ANDAND
                    113: %left <code> '|'
                    114: %left <code> '^'
                    115: %left <code> '&'
                    116: %left <code> EQCOMPARE
                    117: %left <code> ARITHCOMPARE
                    118: %left <code> LSHIFT RSHIFT
                    119: %left <code> '+' '-'
                    120: %left <code> '*' '/' '%'
                    121: %right <code> UNARY PLUSPLUS MINUSMINUS
                    122: %left HYPERUNARY
                    123: %left <code> POINTSAT '.'
                    124: 
                    125: %type <code> unop
                    126: 
                    127: %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
                    128: %type <ttype> expr_no_commas primary string STRING
                    129: %type <ttype> typed_declspecs reserved_declspecs
                    130: %type <ttype> typed_typespecs reserved_typespecquals
                    131: %type <ttype> declmods typespec typespecqual_reserved
                    132: %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
                    133: %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
                    134: %type <ttype> init initlist maybeasm
1.1.1.3   root      135: %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
1.1       root      136: 
                    137: %type <ttype> declarator
                    138: %type <ttype> notype_declarator after_type_declarator
                    139: %type <ttype> parm_declarator
                    140: 
                    141: %type <ttype> structsp component_decl_list component_decl components component_declarator
                    142: %type <ttype> enumlist enumerator
                    143: %type <ttype> typename absdcl absdcl1 type_quals
                    144: %type <ttype> xexpr parms parm identifiers
                    145: 
                    146: %type <ttype> parmlist parmlist_1 parmlist_2
                    147: %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
                    148: 
                    149: %type <itype> setspecs
                    150: 
                    151: %{
                    152: /* the declaration found for the last IDENTIFIER token read in.
                    153:    yylex must look this up to detect typedefs, which get token type TYPENAME,
                    154:    so it is left around in case the identifier is not a typedef but is
                    155:    used in a context which makes it a reference to a variable.  */
                    156: static tree lastiddecl;
                    157: 
                    158: static tree make_pointer_declarator ();
                    159: static tree combine_strings ();
                    160: static void reinit_parse_for_function ();
                    161: 
                    162: extern double atof ();
                    163: 
                    164: /* List of types and structure classes of the current declaration */
                    165: tree current_declspecs;
                    166: 
                    167: char *input_filename;          /* source file current line is coming from */
                    168: char *main_input_filename;     /* top-level source file */
                    169: 
                    170: static int yylex ();
                    171: %}
                    172: 
                    173: %%
                    174: program: /* empty */
                    175:        | extdefs
                    176:        ;
                    177: 
                    178: /* the reason for the strange actions in this rule
                    179:  is so that notype_initdecls when reached via datadef
                    180:  can find a valid list of type and sc specs in $0. */
                    181: 
                    182: extdefs:
                    183:        {$<ttype>$ = NULL_TREE; } extdef
                    184:        | extdefs {$<ttype>$ = NULL_TREE; } extdef
                    185:        ;
                    186: 
                    187: extdef:
                    188:        fndef
                    189:        | datadef
                    190:        | ASM '(' string ')' ';'
                    191:                { if (pedantic)
                    192:                    warning ("ANSI C forbids use of `asm' keyword");
                    193:                  if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
                    194:                  assemble_asm ($3); }
                    195:        ;
                    196: 
                    197: datadef:
                    198:          setspecs notype_initdecls ';'
                    199:                { if (pedantic)
                    200:                    error ("ANSI C forbids data definition lacking type or storage class");
1.1.1.3   root      201:                  else if (!flag_traditional)
1.1       root      202:                    warning ("data definition lacks type or storage class"); }
                    203:         | declmods setspecs notype_initdecls ';'
                    204:          {}
                    205:        | typed_declspecs setspecs initdecls ';'
                    206:          {}
                    207:         | declmods ';'
                    208:          { error ("empty declaration"); }
                    209:        | typed_declspecs ';'
                    210:          { shadow_tag ($1); }
                    211:        | error ';'
                    212:        | error '}'
                    213:        | ';'
                    214:        ;
                    215: 
                    216: fndef:
                    217:          typed_declspecs setspecs declarator
                    218:                { if (! start_function ($1, $3))
1.1.1.4   root      219:                    YYERROR;
1.1       root      220:                  reinit_parse_for_function (); }
                    221:          xdecls
                    222:                { store_parm_decls (); }
                    223:          compstmt_or_error
                    224:                { finish_function (); }
                    225:        | typed_declspecs setspecs declarator error
                    226:                { }
                    227:        | declmods setspecs notype_declarator
                    228:                { if (! start_function ($1, $3))
1.1.1.4   root      229:                    YYERROR;
1.1       root      230:                  reinit_parse_for_function (); }
                    231:          xdecls
                    232:                { store_parm_decls (); }
                    233:          compstmt_or_error
                    234:                { finish_function (); }
                    235:        | declmods setspecs notype_declarator error
                    236:                { }
                    237:        | setspecs notype_declarator
                    238:                { if (! start_function (0, $2))
1.1.1.4   root      239:                    YYERROR;
1.1       root      240:                  reinit_parse_for_function (); }
                    241:          xdecls
                    242:                { store_parm_decls (); }
                    243:          compstmt_or_error
                    244:                { finish_function (); }
                    245:        | setspecs notype_declarator error
                    246:                { }
                    247:        ;
                    248: 
                    249: identifier:
                    250:        IDENTIFIER
                    251:        | TYPENAME
                    252:        ;
                    253: 
                    254: unop:     '&'
                    255:                { $$ = ADDR_EXPR; }
                    256:        | '-'
                    257:                { $$ = NEGATE_EXPR; }
                    258:        | '+'
                    259:                { $$ = CONVERT_EXPR; }
                    260:        | PLUSPLUS
                    261:                { $$ = PREINCREMENT_EXPR; }
                    262:        | MINUSMINUS
                    263:                { $$ = PREDECREMENT_EXPR; }
                    264:        | '~'
                    265:                { $$ = BIT_NOT_EXPR; }
                    266:        | '!'
                    267:                { $$ = TRUTH_NOT_EXPR; }
                    268:        ;
                    269: 
                    270: expr:  nonnull_exprlist
                    271:                { $$ = build_compound_expr ($1); }
                    272:        ;
                    273: 
                    274: exprlist:
                    275:          /* empty */
                    276:                { $$ = NULL_TREE; }
                    277:        | nonnull_exprlist
                    278:        ;
                    279: 
                    280: nonnull_exprlist:
                    281:        expr_no_commas
                    282:                { $$ = build_tree_list (NULL_TREE, $1); }
                    283:        | nonnull_exprlist ',' expr_no_commas
                    284:                { chainon ($1, build_tree_list (NULL_TREE, $3)); }
                    285:        ;
                    286: 
                    287: expr_no_commas:
                    288:        primary
                    289:        | '*' expr_no_commas   %prec UNARY
                    290:                { $$ = build_indirect_ref ($2, "unary *"); }
                    291:        | unop expr_no_commas  %prec UNARY
                    292:                { $$ = build_unary_op ($1, $2, 0); }
                    293:        | '(' typename ')' expr_no_commas  %prec UNARY
                    294:                { tree type = groktypename ($2);
                    295:                  $$ = build_c_cast (type, $4); }
                    296:        | '(' typename ')' '{' initlist maybecomma '}'  %prec UNARY
                    297:                { tree type = groktypename ($2);
                    298:                  if (pedantic)
                    299:                    warning ("ANSI C forbids constructor-expressions");
                    300:                  $$ = digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($5)), 0);
                    301:                  if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
                    302:                    {
                    303:                      int failure = complete_array_type (type, $$, 1);
                    304:                      if (failure)
                    305:                        abort ();
                    306:                    }
                    307:                }
                    308:        | SIZEOF expr_no_commas  %prec UNARY
                    309:                { if (TREE_CODE ($2) == COMPONENT_REF
                    310:                      && TREE_PACKED (TREE_OPERAND ($2, 1)))
                    311:                    error ("sizeof applied to a bit-field");
                    312:                  $$ = c_sizeof (TREE_TYPE ($2)); }
                    313:        | SIZEOF '(' typename ')'  %prec HYPERUNARY
                    314:                { $$ = c_sizeof (groktypename ($3)); }
                    315:        | ALIGNOF expr_no_commas  %prec UNARY
                    316:                { if (TREE_CODE ($2) == COMPONENT_REF
                    317:                      && TREE_PACKED (TREE_OPERAND ($2, 1)))
                    318:                    error ("__alignof applied to a bit-field");
                    319:                  $$ = c_alignof (TREE_TYPE ($2)); }
                    320:        | ALIGNOF '(' typename ')'  %prec HYPERUNARY
                    321:                { $$ = c_alignof (groktypename ($3)); }
                    322:        | expr_no_commas '+' expr_no_commas
                    323:                { $$ = build_binary_op ($2, $1, $3); }
                    324:        | expr_no_commas '-' expr_no_commas
                    325:                { $$ = build_binary_op ($2, $1, $3); }
                    326:        | expr_no_commas '*' expr_no_commas
                    327:                { $$ = build_binary_op ($2, $1, $3); }
                    328:        | expr_no_commas '/' expr_no_commas
                    329:                { $$ = build_binary_op ($2, $1, $3); }
                    330:        | expr_no_commas '%' expr_no_commas
                    331:                { $$ = build_binary_op ($2, $1, $3); }
                    332:        | expr_no_commas LSHIFT expr_no_commas
                    333:                { $$ = build_binary_op ($2, $1, $3); }
                    334:        | expr_no_commas RSHIFT expr_no_commas
                    335:                { $$ = build_binary_op ($2, $1, $3); }
                    336:        | expr_no_commas ARITHCOMPARE expr_no_commas
                    337:                { $$ = build_binary_op ($2, $1, $3); }
                    338:        | expr_no_commas EQCOMPARE expr_no_commas
                    339:                { $$ = build_binary_op ($2, $1, $3); }
                    340:        | expr_no_commas '&' expr_no_commas
                    341:                { $$ = build_binary_op ($2, $1, $3); }
                    342:        | expr_no_commas '|' expr_no_commas
                    343:                { $$ = build_binary_op ($2, $1, $3); }
                    344:        | expr_no_commas '^' expr_no_commas
                    345:                { $$ = build_binary_op ($2, $1, $3); }
                    346:        | expr_no_commas ANDAND expr_no_commas
                    347:                { $$ = build_binary_op (TRUTH_ANDIF_EXPR, $1, $3); }
                    348:        | expr_no_commas OROR expr_no_commas
                    349:                { $$ = build_binary_op (TRUTH_ORIF_EXPR, $1, $3); }
                    350:        | expr_no_commas '?' xexpr ':' expr_no_commas
                    351:                { $$ = build_conditional_expr ($1, $3, $5); }
                    352:        | expr_no_commas '=' expr_no_commas
                    353:                { $$ = build_modify_expr ($1, NOP_EXPR, $3); }
                    354:        | expr_no_commas ASSIGN expr_no_commas
                    355:                { $$ = build_modify_expr ($1, $2, $3); }
                    356:        ;
                    357: 
                    358: primary:
                    359:        IDENTIFIER
                    360:                { $$ = lastiddecl;
                    361:                  if (!$$)
                    362:                    {
                    363:                      if (yychar == YYEMPTY)
                    364:                        yychar = YYLEX;
                    365:                      if (yychar == '(')
                    366:                        $$ = implicitly_declare ($1);
                    367:                      else
                    368:                        {
                    369:                          if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node)
                    370:                            error ("undeclared variable `%s' (first use here)",
                    371:                                   IDENTIFIER_POINTER ($1));
                    372:                          $$ = error_mark_node;
                    373:                          /* Prevent repeated error messages.  */
                    374:                          IDENTIFIER_GLOBAL_VALUE ($1) = error_mark_node;
                    375:                        }
                    376:                    }
1.1.1.5 ! root      377:                  else
        !           378:                    TREE_USED ($$) = 1;
1.1       root      379:                  if (TREE_CODE ($$) == CONST_DECL)
                    380:                    $$ = DECL_INITIAL ($$);
                    381:                }
                    382:        | CONSTANT
                    383:        | string
                    384:                { $$ = combine_strings ($1); }
                    385:        | '(' expr ')'
                    386:                { $$ = $2; }
                    387:        | '(' error ')'
                    388:                { $$ = error_mark_node; }
                    389:        | '(' 
                    390:                { if (current_function_decl == 0)
                    391:                    {
                    392:                      error ("braced-group within expression allowed only inside a function");
1.1.1.4   root      393:                      YYERROR;
1.1       root      394:                    }
1.1.1.2   root      395:                  $<ttype>$ = expand_start_stmt_expr (); }
1.1       root      396:          compstmt ')'
                    397:                { if (pedantic)
                    398:                    warning ("ANSI C forbids braced-groups within expressions");
1.1.1.2   root      399:                  $$ = expand_end_stmt_expr ($<ttype>2); }
1.1       root      400:        | primary '(' exprlist ')'   %prec '.'
                    401:                { $$ = build_function_call ($1, $3); }
                    402:        | primary '[' expr ']'   %prec '.'
                    403:                { $$ = build_array_ref ($1, $3); }
                    404:        | primary '.' identifier
                    405:                { $$ = build_component_ref ($1, $3); }
                    406:        | primary POINTSAT identifier
                    407:                { $$ = build_component_ref (build_indirect_ref ($1, "->"), $3); }
                    408:        | primary PLUSPLUS
                    409:                { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
                    410:        | primary MINUSMINUS
                    411:                { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
                    412:        ;
                    413: 
                    414: /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it.  */
                    415: string:
                    416:          STRING
                    417:        | string STRING
                    418:                { $$ = chainon ($1, $2); }
                    419:        ;
                    420: 
                    421: xdecls:
                    422:        /* empty */
                    423:        | decls
                    424:        ;
                    425: 
                    426: decls:
                    427:        decl
                    428:        | errstmt
                    429:        | decls decl
                    430:        | decl errstmt
                    431:        ;
                    432: 
                    433: /* records the type and storage class specs to use for processing
                    434:    the declarators that follow */
                    435: setspecs: /* empty */
                    436:                { current_declspecs = $<ttype>0;
                    437:                  $$ = suspend_momentary (); }
                    438:        ;
                    439: 
                    440: decl:
                    441:        typed_declspecs setspecs initdecls ';'
                    442:                { resume_momentary ($2); }
                    443:        | declmods setspecs notype_initdecls ';'
                    444:                { resume_momentary ($2); }
                    445:        | typed_declspecs ';'
                    446:                { shadow_tag ($1); }
                    447:        | declmods ';'
                    448:                { warning ("empty declaration"); }
                    449:        ;
                    450: 
                    451: /* Declspecs which contain at least one type specifier or typedef name.
                    452:    (Just `const' or `volatile' is not enough.)
                    453:    A typedef'd name following these is taken as a name to be declared.  */
                    454: 
                    455: typed_declspecs:
                    456:          typespec reserved_declspecs
                    457:                { $$ = tree_cons (NULL_TREE, $1, $2); }
                    458:        | declmods typespec reserved_declspecs
                    459:                { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
                    460:        ;
                    461: 
                    462: reserved_declspecs:  /* empty */
                    463:                { $$ = NULL_TREE; }
                    464:        | reserved_declspecs typespecqual_reserved
                    465:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    466:        | reserved_declspecs SCSPEC
                    467:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    468:        ;
                    469: 
                    470: /* List of just storage classes and type modifiers.
                    471:    A declaration can start with just this, but then it cannot be used
                    472:    to redeclare a typedef-name.  */
                    473: 
                    474: declmods:
                    475:          TYPE_QUAL
                    476:                { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
                    477:        | SCSPEC
                    478:                { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
                    479:        | declmods TYPE_QUAL
                    480:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    481:        | declmods SCSPEC
                    482:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    483:        ;
                    484: 
                    485: 
                    486: /* Used instead of declspecs where storage classes are not allowed
                    487:    (that is, for typenames and structure components).
                    488:    Don't accept a typedef-name if anything but a modifier precedes it.  */
                    489: 
                    490: typed_typespecs:
                    491:          typespec reserved_typespecquals
                    492:                { $$ = tree_cons (NULL_TREE, $1, $2); }
                    493:        | nonempty_type_quals typespec reserved_typespecquals
                    494:                { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
                    495:        ;
                    496: 
                    497: reserved_typespecquals:  /* empty */
                    498:                { $$ = NULL_TREE; }
                    499:        | reserved_typespecquals typespecqual_reserved
                    500:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    501:        ;
                    502: 
                    503: /* A typespec (but not a type qualifier).
                    504:    Once we have seen one of these in a declaration,
                    505:    if a typedef name appears then it is being redeclared.  */
                    506: 
                    507: typespec: TYPESPEC
                    508:        | structsp
                    509:        | TYPENAME
                    510:        | TYPEOF '(' expr ')'
                    511:                { $$ = TREE_TYPE ($3);
                    512:                  if (pedantic)
                    513:                    warning ("ANSI C forbids `typeof'"); }
                    514:        | TYPEOF '(' typename ')'
                    515:                { $$ = groktypename ($3);
                    516:                  if (pedantic)
                    517:                    warning ("ANSI C forbids `typeof'"); }
                    518:        ;
                    519: 
                    520: /* A typespec that is a reserved word, or a type qualifier.  */
                    521: 
                    522: typespecqual_reserved: TYPESPEC
                    523:        | TYPE_QUAL
                    524:        | structsp
                    525:        ;
                    526: 
                    527: initdecls:
                    528:        initdcl
                    529:        | initdecls ',' initdcl
                    530:        ;
                    531: 
                    532: notype_initdecls:
                    533:        notype_initdcl
                    534:        | notype_initdecls ',' initdcl
                    535:        ;
                    536: 
                    537: maybeasm:
                    538:          /* empty */
                    539:                { $$ = NULL_TREE; }
                    540:        | ASM '(' string ')'
                    541:                { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
                    542:                  $$ = $3;
                    543:                  if (pedantic)
                    544:                    warning ("ANSI C forbids use of `asm' keyword");
                    545:                }
                    546:        ;
                    547: 
                    548: initdcl:
                    549:          declarator maybeasm '='
                    550:                { $<ttype>$ = start_decl ($1, current_declspecs, 1); }
                    551:          init
                    552: /* Note how the declaration of the variable is in effect while its init is parsed! */
                    553:                { finish_decl ($<ttype>4, $5, $2); }
                    554:        | declarator maybeasm
                    555:                { tree d = start_decl ($1, current_declspecs, 0);
                    556:                  finish_decl (d, NULL_TREE, $2); }
                    557:        ;
                    558: 
                    559: notype_initdcl:
                    560:          notype_declarator maybeasm '='
                    561:                { $<ttype>$ = start_decl ($1, current_declspecs, 1); }
                    562:          init
                    563: /* Note how the declaration of the variable is in effect while its init is parsed! */
                    564:                { finish_decl ($<ttype>4, $5, $2); }
                    565:        | notype_declarator maybeasm
                    566:                { tree d = start_decl ($1, current_declspecs, 0);
                    567:                  finish_decl (d, NULL_TREE, $2); }
                    568:        ;
                    569: 
                    570: init:
                    571:        expr_no_commas
1.1.1.2   root      572:        | '{' '}'
                    573:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
                    574:                  if (pedantic)
                    575:                    warning ("ANSI C forbids empty initializer braces"); }
1.1       root      576:        | '{' initlist '}'
                    577:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); }
                    578:        | '{' initlist ',' '}'
                    579:                { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); }
                    580:        | error
                    581:                { $$ = NULL_TREE; }
                    582:        ;
                    583: 
                    584: /* This chain is built in reverse order,
                    585:    and put in forward order where initlist is used.  */
                    586: initlist:
1.1.1.2   root      587:          init
1.1       root      588:                { $$ = build_tree_list (NULL_TREE, $1); }
                    589:        | initlist ',' init
                    590:                { $$ = tree_cons (NULL_TREE, $3, $1); }
                    591:        ;
                    592: 
                    593: /* Any kind of declarator (thus, all declarators allowed
                    594:    after an explicit typespec).  */
                    595: 
                    596: declarator:
                    597:          after_type_declarator
                    598:        | notype_declarator
                    599:        ;
                    600: 
                    601: /* A declarator that is allowed only after an explicit typespec.  */
                    602: 
                    603: after_type_declarator:
                    604:          '(' after_type_declarator ')'
                    605:                { $$ = $2; }
                    606:        | after_type_declarator '(' parmlist_or_identifiers  %prec '.'
                    607:                { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
                    608: /*     | after_type_declarator '(' error ')'  %prec '.'
                    609:                { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
                    610:                  poplevel (0, 0, 0); }  */
                    611:        | after_type_declarator '[' expr ']'  %prec '.'
                    612:                { $$ = build_nt (ARRAY_REF, $1, $3); }
                    613:        | after_type_declarator '[' ']'  %prec '.'
                    614:                { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
                    615:        | '*' type_quals after_type_declarator  %prec UNARY
                    616:                { $$ = make_pointer_declarator ($2, $3); }
                    617:        | TYPENAME
                    618:        ;
                    619: 
                    620: /* Kinds of declarator that can appear in a parameter list
                    621:    in addition to notype_declarator.  This is like after_type_declarator
                    622:    but does not allow a typedef name in parentheses as an identifier
                    623:    (because it would conflict with a function with that typedef as arg).  */
                    624: 
                    625: parm_declarator:
                    626:          parm_declarator '(' parmlist_or_identifiers  %prec '.'
                    627:                { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
                    628: /*     | parm_declarator '(' error ')'  %prec '.'
                    629:                { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
                    630:                  poplevel (0, 0, 0); }  */
                    631:        | parm_declarator '[' expr ']'  %prec '.'
                    632:                { $$ = build_nt (ARRAY_REF, $1, $3); }
                    633:        | parm_declarator '[' ']'  %prec '.'
                    634:                { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
                    635:        | '*' type_quals parm_declarator  %prec UNARY
                    636:                { $$ = make_pointer_declarator ($2, $3); }
                    637:        | TYPENAME
                    638:        ;
                    639: 
                    640: /* A declarator allowed whether or not there has been
                    641:    an explicit typespec.  These cannot redeclare a typedef-name.  */
                    642: 
                    643: notype_declarator:
                    644:          notype_declarator '(' parmlist_or_identifiers  %prec '.'
                    645:                { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
                    646: /*     | notype_declarator '(' error ')'  %prec '.'
                    647:                { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
                    648:                  poplevel (0, 0, 0); }  */
                    649:        | '(' notype_declarator ')'
                    650:                { $$ = $2; }
                    651:        | '*' type_quals notype_declarator  %prec UNARY
                    652:                { $$ = make_pointer_declarator ($2, $3); }
                    653:        | notype_declarator '[' expr ']'  %prec '.'
                    654:                { $$ = build_nt (ARRAY_REF, $1, $3); }
                    655:        | notype_declarator '[' ']'  %prec '.'
                    656:                { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
                    657:        | IDENTIFIER
                    658:        ;
                    659: 
                    660: structsp:
                    661:          STRUCT identifier '{'
                    662:                { $$ = start_struct (RECORD_TYPE, $2);
                    663:                  /* Start scope of tag before parsing components.  */
                    664:                }
                    665:          component_decl_list '}'
                    666:                { $$ = finish_struct ($<ttype>4, $5);
                    667:                  /* Really define the structure.  */
                    668:                }
                    669:        | STRUCT '{' component_decl_list '}'
                    670:                { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
                    671:                                      $3); }
                    672:        | STRUCT identifier
                    673:                { $$ = xref_tag (RECORD_TYPE, $2); }
                    674:        | UNION identifier '{'
                    675:                { $$ = start_struct (UNION_TYPE, $2); }
                    676:          component_decl_list '}'
                    677:                { $$ = finish_struct ($<ttype>4, $5); }
                    678:        | UNION '{' component_decl_list '}'
                    679:                { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
                    680:                                      $3); }
                    681:        | UNION identifier
                    682:                { $$ = xref_tag (UNION_TYPE, $2); }
                    683:        | ENUM identifier '{'
                    684:                { $<itype>3 = suspend_momentary ();
                    685:                  $$ = start_enum ($2); }
1.1.1.5 ! root      686:          enumlist maybecomma_warn '}'
1.1       root      687:                { $$ = finish_enum ($<ttype>4, nreverse ($5));
                    688:                  resume_momentary ($<itype>3); }
                    689:        | ENUM '{'
                    690:                { $<itype>2 = suspend_momentary ();
                    691:                  $$ = start_enum (NULL_TREE); }
1.1.1.5 ! root      692:          enumlist maybecomma_warn '}'
1.1       root      693:                { $$ = finish_enum ($<ttype>3, nreverse ($4));
                    694:                  resume_momentary ($<itype>2); }
                    695:        | ENUM identifier
                    696:                { $$ = xref_tag (ENUMERAL_TYPE, $2); }
                    697:        ;
                    698: 
                    699: maybecomma:
                    700:          /* empty */
                    701:        | ','
                    702:        ;
                    703: 
1.1.1.5 ! root      704: maybecomma_warn:
        !           705:          /* empty */
        !           706:        | ','
        !           707:                { if (pedantic) warning ("comma at end of enumerator list"); }
        !           708:        ;
        !           709: 
1.1       root      710: component_decl_list:   /* empty */
                    711:                { $$ = NULL_TREE; }
                    712:        | component_decl_list component_decl ';'
                    713:                { $$ = chainon ($1, $2); }
                    714:        | component_decl_list ';'
                    715:                { if (pedantic) 
                    716:                    warning ("extra semicolon in struct or union specified"); }
                    717:        ;
                    718: 
                    719: /* There is a shift-reduce conflict here, because `components' may
                    720:    start with a `typename'.  It happens that shifting (the default resolution)
                    721:    does the right thing, because it treats the `typename' as part of
                    722:    a `typed_typespecs'.
                    723: 
                    724:    It is possible that this same technique would allow the distinction
                    725:    between `notype_initdecls' and `initdecls' to be eliminated.
                    726:    But I am being cautious and not trying it.  */
                    727: 
                    728: component_decl:
                    729:        typed_typespecs setspecs components
                    730:                { $$ = $3;
                    731:                  resume_momentary ($2); }
                    732:        | nonempty_type_quals setspecs components
                    733:                { $$ = $3;
                    734:                  resume_momentary ($2); }
                    735:        | error
                    736:                { $$ = NULL_TREE; }
                    737:        ;
                    738: 
                    739: components:
                    740:          /* empty */
                    741:                { $$ = NULL_TREE; }
                    742:        | component_declarator
                    743:        | components ',' component_declarator
                    744:                { $$ = chainon ($1, $3); }
                    745:        ;
                    746: 
                    747: component_declarator:
                    748:        declarator
                    749:                { $$ = grokfield (input_filename, lineno, $1, current_declspecs, NULL_TREE); }
                    750:        | declarator ':' expr_no_commas
                    751:                { $$ = grokfield (input_filename, lineno, $1, current_declspecs, $3); }
                    752:        | ':' expr_no_commas
                    753:                { $$ = grokfield (input_filename, lineno, NULL_TREE, current_declspecs, $2); }
                    754:        ;
                    755: 
                    756: /* We chain the enumerators in reverse order.
                    757:    They are put in forward order where enumlist is used.
                    758:    (The order used to be significant, but no longer is so.
                    759:    However, we still maintain the order, just to be clean.)  */
                    760: 
                    761: enumlist:
                    762:          enumerator
                    763:        | enumlist ',' enumerator
                    764:                { $$ = chainon ($3, $1); }
                    765:        ;
                    766: 
                    767: 
                    768: enumerator:
                    769:          identifier
                    770:                { $$ = build_enumerator ($1, NULL_TREE); }
                    771:        | identifier '=' expr_no_commas
                    772:                { $$ = build_enumerator ($1, $3); }
                    773:        ;
                    774: 
                    775: typename:
                    776:        typed_typespecs absdcl
                    777:                { $$ = build_tree_list ($1, $2); }
                    778:        | nonempty_type_quals absdcl
                    779:                { $$ = build_tree_list ($1, $2); }
                    780:        ;
                    781:        
                    782: absdcl:   /* an absolute declarator */
                    783:        /* empty */
                    784:                { $$ = NULL_TREE; }
                    785:        | absdcl1
                    786:        ;
                    787: 
                    788: nonempty_type_quals:
                    789:          TYPE_QUAL
                    790:                { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
                    791:        | nonempty_type_quals TYPE_QUAL
                    792:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    793:        ;
                    794: 
                    795: type_quals:
                    796:          /* empty */
                    797:                { $$ = NULL_TREE; }
                    798:        | type_quals TYPE_QUAL
                    799:                { $$ = tree_cons (NULL_TREE, $2, $1); }
                    800:        ;
                    801: 
                    802: absdcl1:  /* a nonempty absolute declarator */
                    803:          '(' absdcl1 ')'
                    804:                { $$ = $2; }
                    805:          /* `(typedef)1' is `int'.  */
                    806:        | '*' type_quals absdcl1  %prec UNARY
                    807:                { $$ = make_pointer_declarator ($2, $3); }
                    808:        | '*' type_quals  %prec UNARY
                    809:                { $$ = make_pointer_declarator ($2, NULL_TREE); }
                    810:        | absdcl1 '(' parmlist  %prec '.'
                    811:                { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
                    812:        | absdcl1 '[' expr ']'  %prec '.'
                    813:                { $$ = build_nt (ARRAY_REF, $1, $3); }
                    814:        | absdcl1 '[' ']'  %prec '.'
                    815:                { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
                    816:        | '(' parmlist  %prec '.'
                    817:                { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
                    818:        | '[' expr ']'  %prec '.'
                    819:                { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
                    820:        | '[' ']'  %prec '.'
                    821:                { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
                    822:        ;
                    823: 
                    824: /* at least one statement, the first of which parses without error.  */
                    825: /* stmts is used only after decls, so an invalid first statement
                    826:    is actually regarded as an invalid decl and part of the decls.  */
                    827: 
                    828: stmts:
                    829:        stmt
                    830:        | stmts stmt
                    831:        | stmts errstmt
                    832:        ;
                    833: 
                    834: xstmts:
                    835:        /* empty */
                    836:        | stmts
                    837:        ;
                    838: 
                    839: errstmt:  error ';'
                    840:        ;
                    841: 
                    842: pushlevel:  /* empty */
                    843:                { pushlevel (0);
                    844:                  clear_last_expr ();
                    845:                  push_momentary ();
                    846:                  expand_start_bindings (0); }
                    847:        ;
                    848: 
                    849: /* This is the body of a function definition.
                    850:    It causes syntax errors to ignore to the next openbrace.  */
                    851: compstmt_or_error:
                    852:          compstmt
                    853:        | error compstmt
                    854:        ;
                    855: 
                    856: compstmt: '{' '}'
                    857:        | '{' pushlevel decls xstmts '}'
1.1.1.2   root      858:                { expand_end_bindings (getdecls (), 1, 0);
1.1       root      859:                  poplevel (1, 1, 0);
                    860:                  pop_momentary (); }
                    861:        | '{' pushlevel error '}'
1.1.1.2   root      862:                { expand_end_bindings (getdecls (), 0, 0);
1.1       root      863:                  poplevel (0, 0, 0);
                    864:                  pop_momentary (); }
                    865:        | '{' pushlevel stmts '}'
1.1.1.2   root      866:                { expand_end_bindings (getdecls (), 0, 0);
1.1       root      867:                  poplevel (0, 0, 0);
                    868:                  pop_momentary (); }
                    869:        ;
                    870: 
                    871: simple_if:
                    872:          IF '(' expr ')'
                    873:                { emit_note (input_filename, lineno);
                    874:                  expand_start_cond (truthvalue_conversion ($3), 0); }
                    875:          stmt
                    876:        ;
                    877: 
                    878: stmt:
                    879:          compstmt
                    880:        | expr ';'
                    881:                { emit_note (input_filename, lineno);
                    882:                  expand_expr_stmt ($1);
                    883:                  clear_momentary (); }
                    884:        | simple_if ELSE
                    885:                { expand_start_else (); }
                    886:          stmt
                    887:                { expand_end_else (); }
                    888:        | simple_if
                    889:                { expand_end_cond (); }
                    890:        | WHILE
                    891:                { emit_note (input_filename, lineno);
                    892:                  expand_start_loop (1); }
                    893:          '(' expr ')'
                    894:                { emit_note (input_filename, lineno);
                    895:                  expand_exit_loop_if_false (truthvalue_conversion ($4)); }
                    896:          stmt
                    897:                { expand_end_loop (); }
                    898:        | DO
                    899:                { emit_note (input_filename, lineno);
                    900:                  expand_start_loop_continue_elsewhere (1); }
                    901:          stmt WHILE
                    902:                { expand_loop_continue_here (); }
                    903:          '(' expr ')' ';'
                    904:                { emit_note (input_filename, lineno);
                    905:                  expand_exit_loop_if_false (truthvalue_conversion ($7));
                    906:                  expand_end_loop ();
                    907:                  clear_momentary (); }
                    908:        | FOR 
                    909:          '(' xexpr ';'
                    910:                { emit_note (input_filename, lineno);
                    911:                  if ($3) expand_expr_stmt ($3);
                    912:                  expand_start_loop_continue_elsewhere (1); }
                    913:          xexpr ';'
                    914:                { emit_note (input_filename, lineno);
                    915:                  if ($6)
                    916:                    expand_exit_loop_if_false (truthvalue_conversion ($6)); }
                    917:          xexpr ')'
                    918:                /* Don't let the tree nodes for $9 be discarded
                    919:                   by clear_momentary during the parsing of the next stmt.  */
                    920:                { push_momentary ();
                    921:                  $<itype>10 = lineno; }
                    922:          stmt
                    923:                { emit_note (input_filename, $<itype>10);
                    924:                  expand_loop_continue_here ();
                    925:                  if ($9)
                    926:                    expand_expr_stmt ($9);
                    927:                  pop_momentary ();
                    928:                  expand_end_loop (); }
                    929:        | SWITCH '(' expr ')'
                    930:                { emit_note (input_filename, lineno);
                    931:                  c_expand_start_case ($3);
                    932:                  /* Don't let the tree nodes for $3 be discarded by
                    933:                     clear_momentary during the parsing of the next stmt.  */
                    934:                  push_momentary (); }
                    935:          stmt
                    936:                { expand_end_case ();
                    937:                  pop_momentary (); }
                    938:        | CASE expr ':'
                    939:                { register tree value = fold ($2);
                    940:                  register tree label
                    941:                    = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
                    942: 
                    943:                  if (TREE_CODE (value) != INTEGER_CST
                    944:                      && value != error_mark_node)
                    945:                    {
                    946:                      error ("case label does not reduce to an integer constant");
                    947:                      value = error_mark_node;
                    948:                    }
                    949:                  else
                    950:                    /* Promote char or short to int.  */
                    951:                    value = default_conversion (value);
                    952:                  if (value != error_mark_node)
                    953:                    {
                    954:                      int success = pushcase (value, label);
                    955:                      if (success == 1)
                    956:                        error ("case label not within a switch statement");
                    957:                      else if (success == 2)
                    958:                        error ("duplicate case value");
                    959:                      else if (success == 3)
                    960:                        warning ("case value out of range");
                    961:                    }
                    962:                }
                    963:          stmt
                    964:        | DEFAULT ':'
                    965:                {
                    966:                  register tree label
                    967:                    = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
                    968:                  int success = pushcase (NULL_TREE, label);
                    969:                  if (success == 1)
                    970:                    error ("default label not within a switch statement");
                    971:                  else if (success == 2)
                    972:                    error ("multiple default labels in one switch");
                    973:                }
                    974:          stmt
                    975:        | BREAK ';'
                    976:                { emit_note (input_filename, lineno);
                    977:                  if ( ! expand_exit_something ())
                    978:                    error ("break statement not within loop or switch"); }
                    979:        | CONTINUE ';'  
                    980:                { emit_note (input_filename, lineno);
                    981:                  if (! expand_continue_loop ())
                    982:                    error ("continue statement not within a loop"); }
                    983:        | RETURN ';'
                    984:                { emit_note (input_filename, lineno);
                    985:                  c_expand_return (NULL_TREE); }
                    986:        | RETURN expr ';'
                    987:                { emit_note (input_filename, lineno);
                    988:                  c_expand_return ($2); }
                    989:        | ASM maybe_type_qual '(' string ')' ';'
                    990:                { if (pedantic)
                    991:                    warning ("ANSI C forbids use of `asm' keyword");
                    992:                  if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                    993:                  expand_asm ($4); }
                    994:        /* This is the case with just output operands.  */
                    995:        | ASM maybe_type_qual '(' string ':' asm_operands ')' ';'
                    996:                { if (pedantic)
                    997:                    warning ("ANSI C forbids use of `asm' keyword");
                    998:                  if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
1.1.1.3   root      999:                  c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
1.1       root     1000:                                         $2 == ridpointers[(int)RID_VOLATILE]); }
                   1001:        /* This is the case with input operands as well.  */
                   1002:        | ASM maybe_type_qual '(' string ':' asm_operands ':' asm_operands ')' ';'
                   1003:                { if (pedantic)
                   1004:                    warning ("ANSI C forbids use of `asm' keyword");
                   1005:                  if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
1.1.1.3   root     1006:                  c_expand_asm_operands ($4, $6, $8, NULL_TREE,
                   1007:                                         $2 == ridpointers[(int)RID_VOLATILE]); }
                   1008:        /* This is the case with clobbered registers as well.  */
                   1009:        | ASM maybe_type_qual '(' string ':' asm_operands ':'
                   1010:          asm_operands ':' asm_clobbers ')' ';'
                   1011:                { if (pedantic)
                   1012:                    warning ("ANSI C forbids use of `asm' keyword");
                   1013:                  if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
                   1014:                  c_expand_asm_operands ($4, $6, $8, $10,
1.1       root     1015:                                         $2 == ridpointers[(int)RID_VOLATILE]); }
                   1016:        | GOTO identifier ';'
                   1017:                { tree decl;
                   1018:                  emit_note (input_filename, lineno);
                   1019:                  decl = lookup_label ($2);
                   1020:                  expand_goto (decl); }
                   1021:        | identifier ':'
                   1022:                { tree label = define_label (input_filename, lineno, $1);
                   1023:                  if (label)
                   1024:                    expand_label (label); }
                   1025:          stmt
                   1026:        | ';'
                   1027:        ;
                   1028: 
                   1029: maybe_type_qual:
                   1030:        /* empty */
                   1031:                { emit_note (input_filename, lineno); }
                   1032:        | TYPE_QUAL
                   1033:                { emit_note (input_filename, lineno); }
                   1034:        ;
                   1035: 
                   1036: xexpr:
                   1037:        /* empty */
                   1038:                { $$ = NULL_TREE; }
                   1039:        | expr
                   1040:        ;
                   1041: 
                   1042: /* These are the operands other than the first string and colon
                   1043:    in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
                   1044: asm_operands: /* empty */
                   1045:                { $$ = NULL_TREE; }
                   1046:        | nonnull_asm_operands
                   1047:        ;
                   1048: 
                   1049: nonnull_asm_operands:
                   1050:          asm_operand
                   1051:        | nonnull_asm_operands ',' asm_operand
                   1052:                { $$ = chainon ($1, $3); }
                   1053:        ;
                   1054: 
                   1055: asm_operand:
1.1.1.3   root     1056:          STRING '(' expr ')'
1.1       root     1057:                { $$ = build_tree_list ($1, $3); }
                   1058:        ;
                   1059: 
1.1.1.3   root     1060: asm_clobbers:
                   1061:          STRING
                   1062:                { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
                   1063:        | asm_clobbers ',' STRING
                   1064:                { $$ = tree_cons (NULL_TREE, $3, $1); }
                   1065:        ;
                   1066: 
1.1       root     1067: /* This is what appears inside the parens in a function declarator.
                   1068:    Its value is a list of ..._TYPE nodes.  */
                   1069: parmlist:
                   1070:                { pushlevel (0); }
                   1071:          parmlist_1
                   1072:                { $$ = $2; poplevel (0, 0, 0); }
                   1073:        ;
                   1074: 
                   1075: /* This is referred to where either a parmlist or an identifier list is ok.
                   1076:    Its value is a list of ..._TYPE nodes or a list of identifiers.  */
                   1077: parmlist_or_identifiers:
                   1078:                { pushlevel (0); }
                   1079:          parmlist_or_identifiers_1
                   1080:                { $$ = $2; poplevel (0, 0, 0); }
                   1081:        ;
                   1082: 
                   1083: parmlist_or_identifiers_1:
                   1084:          parmlist_2 ')'
                   1085:        | identifiers ')'
                   1086:                { $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }
                   1087:        | error ')'
                   1088:                { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
                   1089:        ;
                   1090: 
                   1091: parmlist_1:
                   1092:          parmlist_2 ')'
                   1093:        | error ')'
                   1094:                { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
                   1095:        ;
                   1096: 
                   1097: /* This is what appears inside the parens in a function declarator.
                   1098:    Is value is represented in the format that grokdeclarator expects.  */
                   1099: parmlist_2:  /* empty */
                   1100:                { $$ = get_parm_info (0); }
                   1101:        | parms
                   1102:                { $$ = get_parm_info (1); }
                   1103:        | parms ',' ELLIPSIS
                   1104:                { $$ = get_parm_info (0); }
                   1105:        ;
                   1106: 
                   1107: parms: 
                   1108:        parm
                   1109:                { push_parm_decl ($1); }
                   1110:        | parms ',' parm
                   1111:                { push_parm_decl ($3); }
                   1112:        ;
                   1113: 
                   1114: /* A single parameter declaration or parameter type name,
                   1115:    as found in a parmlist.  */
                   1116: parm:
                   1117:          typed_declspecs parm_declarator
                   1118:                { $$ = build_tree_list ($1, $2) ; }
                   1119:        | typed_declspecs notype_declarator
                   1120:                { $$ = build_tree_list ($1, $2) ; }
                   1121:        | typed_declspecs absdcl
                   1122:                { $$ = build_tree_list ($1, $2); }
                   1123:        | declmods notype_declarator
                   1124:                { $$ = build_tree_list ($1, $2) ; }
                   1125:        | declmods absdcl
                   1126:                { $$ = build_tree_list ($1, $2); }
                   1127:        ;
                   1128: 
                   1129: /* A nonempty list of identifiers.  */
                   1130: identifiers:   
                   1131:        IDENTIFIER
                   1132:                { $$ = build_tree_list (NULL_TREE, $1); }
                   1133:        | identifiers ',' IDENTIFIER
                   1134:                { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
                   1135:        ;
                   1136: %%
                   1137: 
                   1138: /* Return something to represent absolute declarators containing a *.
                   1139:    TARGET is the absolute declarator that the * contains.
                   1140:    TYPE_QUALS is a list of modifiers such as const or volatile
                   1141:    to apply to the pointer type, represented as identifiers.
                   1142: 
                   1143:    We return an INDIRECT_REF whose "contents" are TARGET
                   1144:    and whose type is the modifier list.  */
                   1145:    
                   1146: static tree
                   1147: make_pointer_declarator (type_quals, target)
                   1148:      tree type_quals, target;
                   1149: {
                   1150:   return build (INDIRECT_REF, type_quals, target);
                   1151: }
                   1152: 
                   1153: /* Given a chain of STRING_CST nodes,
                   1154:    concatenate them into one STRING_CST
                   1155:    and give it a suitable array-of-chars data type.  */
                   1156: 
                   1157: static tree
                   1158: combine_strings (strings)
                   1159:      tree strings;
                   1160: {
                   1161:   register tree value, t;
                   1162:   register int length = 1;
                   1163:   int wide_length = 0;
                   1164:   int wide_flag = 0;
                   1165: 
                   1166:   if (TREE_CHAIN (strings))
                   1167:     {
                   1168:       /* More than one in the chain, so concatenate.  */
                   1169:       register char *p, *q;
                   1170: 
                   1171:       /* Don't include the \0 at the end of each substring,
                   1172:         except for the last one.
                   1173:         Count wide strings and ordinary strings separately.  */
                   1174:       for (t = strings; t; t = TREE_CHAIN (t))
                   1175:        {
                   1176:          if (TREE_TYPE (t) == int_array_type_node)
                   1177:            {
                   1178:              wide_length += (TREE_STRING_LENGTH (t) - 1);
                   1179:              wide_flag = 1;
                   1180:            }
                   1181:          else
                   1182:            length += (TREE_STRING_LENGTH (t) - 1);
                   1183:        }
                   1184: 
                   1185:       /* If anything is wide, the non-wides will be converted,
                   1186:         which makes them take more space.  */
                   1187:       if (wide_flag)
                   1188:        length = length * UNITS_PER_WORD + wide_length;
                   1189: 
                   1190:       p = (char *) oballoc (length);
                   1191: 
                   1192:       /* Copy the individual strings into the new combined string.
                   1193:         If the combined string is wide, convert the chars to ints
                   1194:         for any individual strings that are not wide.  */
                   1195: 
                   1196:       q = p;
                   1197:       for (t = strings; t; t = TREE_CHAIN (t))
                   1198:        {
                   1199:          int len = TREE_STRING_LENGTH (t) - 1;
                   1200:          if ((TREE_TYPE (t) == int_array_type_node) == wide_flag)
                   1201:            {
                   1202:              bcopy (TREE_STRING_POINTER (t), q, len);
                   1203:              q += len;
                   1204:            }
                   1205:          else
                   1206:            {
                   1207:              int i;
                   1208:              for (i = 0; i < len; i++)
                   1209:                ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
                   1210:              q += len * UNITS_PER_WORD;
                   1211:            }
                   1212:        }
                   1213:       *q = 0;
                   1214: 
                   1215:       value = make_node (STRING_CST);
                   1216:       TREE_STRING_POINTER (value) = p;
                   1217:       TREE_STRING_LENGTH (value) = length;
                   1218:       TREE_LITERAL (value) = 1;
                   1219:     }
                   1220:   else
                   1221:     {
                   1222:       value = strings;
                   1223:       length = TREE_STRING_LENGTH (value);
                   1224:       if (TREE_TYPE (value) == int_array_type_node)
                   1225:        wide_flag = 1;
                   1226:     }
                   1227: 
1.1.1.3   root     1228:   /* Create the array type for the string constant.
                   1229:      -Wwrite-strings says make the string constant an array of const char
                   1230:      so that copying it to a non-const pointer will get a warning.  */
                   1231:   if (warn_write_strings)
                   1232:     {
                   1233:       tree elements
                   1234:        = build_type_variant (wide_flag ? integer_type_node : char_type_node,
                   1235:                              1, 0);
                   1236:       TREE_TYPE (value)
                   1237:        = build_array_type (elements,
                   1238:                            build_index_type (build_int_2 (length - 1, 0)));
                   1239:     }
                   1240:   else
                   1241:     TREE_TYPE (value)
                   1242:       = build_array_type (wide_flag ? integer_type_node : char_type_node,
                   1243:                          build_index_type (build_int_2 (length - 1, 0)));
1.1       root     1244:   TREE_LITERAL (value) = 1;
                   1245:   TREE_STATIC (value) = 1;
                   1246:   return value;
                   1247: }
                   1248: 
                   1249: int lineno;                    /* current line number in file being read */
                   1250: 
                   1251: FILE *finput;                  /* input file.
                   1252:                                   Normally a pipe from the preprocessor.  */
                   1253: 
                   1254: /* lexical analyzer */
                   1255: 
                   1256: static int maxtoken;           /* Current nominal length of token buffer */
                   1257: static char *token_buffer;     /* Pointer to token buffer.
                   1258:                                   Actual allocated length is maxtoken + 2.  */
1.1.1.5 ! root     1259: static int end_of_file;
1.1       root     1260: 
1.1.1.4   root     1261: #define MIN_WORD_SIZE       2      /* minimum size for C keyword */
                   1262: #define MAX_WORD_SIZE       9      /* maximum size for C keyword */
                   1263: #define MIN_KEY_SIZE        4      /* range of the hash keys values for the */
                   1264: #define MAX_KEY_SIZE        39     /* minimum perfect hash generator */
1.1       root     1265: 
                   1266: #define NORID RID_UNUSED
                   1267: 
1.1.1.4   root     1268: struct resword {char *name; short token; enum rid rid;};
                   1269: 
                   1270: /* This is the hash table of keywords.
                   1271:    The order of keywords has been chosen for perfect hashing.
                   1272:    Therefore, this table cannot be updated by hand.
                   1273:    Use the program perfect-hash to generate an updated table.  */
                   1274: 
                   1275: static struct resword reswords[] 
                   1276:   = {{NULL, 0, NORID},            
                   1277:      {NULL, 0, NORID}, /* these locations are not used. */
                   1278:      {NULL, 0, NORID}, /* they simplify the hashing.    */
                   1279:      {NULL, 0, NORID},
1.1       root     1280:      {"else", ELSE, NORID},
                   1281:      {"enum", ENUM, NORID},
                   1282:      {"while", WHILE, NORID},
                   1283:      {"extern", SCSPEC, RID_EXTERN},
1.1.1.4   root     1284:      {"double", TYPESPEC, RID_DOUBLE},
                   1285:      {"default", DEFAULT, NORID},
                   1286:      {"do", DO, NORID},
                   1287:      {"goto", GOTO, NORID},
                   1288:      {"short", TYPESPEC, RID_SHORT},        
1.1       root     1289:      {"struct", STRUCT, NORID},
                   1290:      {"return", RETURN, NORID},
1.1.1.4   root     1291:      {"signed", TYPESPEC, RID_SIGNED},       
                   1292:      {"float", TYPESPEC, RID_FLOAT},        
1.1       root     1293:      {"typeof", TYPEOF, NORID},
1.1.1.4   root     1294:      {"typedef", SCSPEC, RID_TYPEDEF},        
1.1       root     1295:      {"switch", SWITCH, NORID},
1.1.1.4   root     1296:      {"int", TYPESPEC, RID_INT},          
                   1297:      {"for", FOR, NORID},
                   1298:      {"register", SCSPEC, RID_REGISTER},       
                   1299:      {"inline", SCSPEC, RID_INLINE},         
                   1300:      {"sizeof", SIZEOF, NORID},
                   1301:      {"void", TYPESPEC, RID_VOID},         
                   1302:      {"__alignof", ALIGNOF, NORID},
                   1303:      {"volatile", TYPE_QUAL, RID_VOLATILE},    
                   1304:      {"case", CASE, NORID},
                   1305:      {"const", TYPE_QUAL, RID_CONST},       
                   1306:      {"if", IF, NORID},
                   1307:      {"long", TYPESPEC, RID_LONG},         
1.1       root     1308:      {"continue", CONTINUE, NORID},
1.1.1.4   root     1309:      {"asm", ASM, NORID},
                   1310:      {"union", UNION, NORID},
                   1311:      {"char", TYPESPEC, RID_CHAR},         
                   1312:      {"break", BREAK, NORID},               
                   1313:      {"static", SCSPEC, RID_STATIC},         
                   1314:      {"unsigned", TYPESPEC, RID_UNSIGNED},     
                   1315:      {"auto", SCSPEC, RID_AUTO}};
1.1       root     1316: 
                   1317: /* The elements of `ridpointers' are identifier nodes
                   1318:    for the reserved type names and storage classes.
                   1319:    It is indexed by a RID_... value.  */
                   1320: 
                   1321: tree ridpointers[(int) RID_MAX];
                   1322: 
                   1323: int check_newline ();
1.1.1.4   root     1324: 
                   1325: /* This function performs the minimum-perfect hash mapping from input
                   1326:    string to reswords table index.  It only looks at the first and 
                   1327:    last characters in the string, thus assuring the O(1) lookup time 
                   1328:    (this keeps our constant down to an insignificant amount!).  Compiling
                   1329:    the following 2 functions as inline removes all overhead of the
                   1330:    function calls. */
                   1331: 
                   1332: #ifdef __GNUC__
                   1333: inline
                   1334: #endif
                   1335: static int
                   1336: hash (str, len)
                   1337:      register char *str;             
                   1338:      register int len;
                   1339: {
                   1340:   /* This table is used to build the hash table index that recognizes
                   1341:      reserved words in 0(1) steps.  It is larger than strictly necessary, 
                   1342:      but I'm trading off the space for the time-saving luxury of avoiding 
                   1343:      subtraction of an offset. */
                   1344: 
                   1345:   static char hash_table[]
                   1346:     = {0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1347:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1348:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1349:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1350:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1351:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1352:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1353:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1354:        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
                   1355:        0,  0,  0,  0,  0,  6,  0, 29, 31, 24,
                   1356:        2,  0, 11,  1,  6, 17,  0,  0, 26,  1,
                   1357:        1,  6,  0,  0,  7,  7,  0, 28, 19,  1,
                   1358:        0,  0,  0,  0,  0,  0,  0,  0};
                   1359: 
                   1360:   /* The hash function couldn't be simpler: add the length of the string
                   1361:      to the Hash_Table value of its first and last character. */
                   1362: 
                   1363:   return len + hash_table[(int) str[0]] + hash_table[(int) str[len - 1]];
                   1364: }
                   1365: 
                   1366: /* This routine attempts to match the string found in the reswords with
                   1367:    the one from the input stream.  If all the relevant details match an
                   1368:    actual strcmp comparison is performed.  */
                   1369: 
                   1370: #ifdef __GNUC__
                   1371: inline
                   1372: #endif
                   1373: static struct resword *
                   1374: is_reserved_word (str,len)
                   1375:      register char *str;
                   1376:      register int len;
                   1377: {
                   1378:   if (len <= MAX_WORD_SIZE && len >= MIN_WORD_SIZE) 
                   1379:     {
                   1380:       register int key = hash (str, len);
                   1381: 
                   1382:       if (key >= MIN_KEY_SIZE && key <= MAX_KEY_SIZE)
                   1383:        if (reswords[key].name[0] == str[0]
                   1384:            && !strcmp (reswords[key].name + 1, str + 1))
                   1385:          return &reswords[key];
                   1386:     }
                   1387:   return NULL;   
                   1388: }
1.1       root     1389: 
                   1390: void
                   1391: init_lex ()
                   1392: {
                   1393:   extern char *malloc ();
                   1394: 
                   1395:   /* Start it at 0, because check_newline is called at the very beginning
                   1396:      and will increment it to 1.  */
                   1397:   lineno = 0;
                   1398: 
                   1399:   maxtoken = 40;
                   1400:   token_buffer = malloc (maxtoken + 2);
                   1401:   ridpointers[(int) RID_INT] = get_identifier ("int");
                   1402:   ridpointers[(int) RID_CHAR] = get_identifier ("char");
                   1403:   ridpointers[(int) RID_VOID] = get_identifier ("void");
                   1404:   ridpointers[(int) RID_FLOAT] = get_identifier ("float");
                   1405:   ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
                   1406:   ridpointers[(int) RID_SHORT] = get_identifier ("short");
                   1407:   ridpointers[(int) RID_LONG] = get_identifier ("long");
                   1408:   ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
                   1409:   ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
                   1410:   ridpointers[(int) RID_INLINE] = get_identifier ("inline");
                   1411:   ridpointers[(int) RID_CONST] = get_identifier ("const");
                   1412:   ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
                   1413:   ridpointers[(int) RID_AUTO] = get_identifier ("auto");
                   1414:   ridpointers[(int) RID_STATIC] = get_identifier ("static");
                   1415:   ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
                   1416:   ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
                   1417:   ridpointers[(int) RID_REGISTER] = get_identifier ("register");
                   1418: }
                   1419: 
                   1420: static void
                   1421: reinit_parse_for_function ()
                   1422: {
                   1423: }
                   1424: 
                   1425: /* If C is not whitespace, return C.
                   1426:    Otherwise skip whitespace and return first nonwhite char read.  */
                   1427: 
                   1428: static int
                   1429: skip_white_space (c)
                   1430:      register int c;
                   1431: {
                   1432:   register int inside;
                   1433: 
                   1434:   for (;;)
                   1435:     {
                   1436:       switch (c)
                   1437:        {
                   1438:        case '/':
                   1439:          c = getc (finput);
                   1440:          if (c != '*')
                   1441:            {
                   1442:              ungetc (c, finput);
                   1443:              return '/';
                   1444:            }
                   1445: 
                   1446:          c = getc (finput);
                   1447: 
                   1448:          inside = 1;
                   1449:          while (inside)
                   1450:            {
                   1451:              if (c == '*')
                   1452:                {
                   1453:                  while (c == '*')
                   1454:                    c = getc (finput);
                   1455: 
                   1456:                  if (c == '/')
                   1457:                    {
                   1458:                      inside = 0;
                   1459:                      c = getc (finput);
                   1460:                    }
                   1461:                }
                   1462:              else if (c == '\n')
                   1463:                {
                   1464:                  lineno++;
                   1465:                  c = getc (finput);
                   1466:                }
                   1467:              else if (c == EOF)
                   1468:                {
                   1469:                  error ("unterminated comment");
                   1470:                  break;
                   1471:                }
                   1472:              else
                   1473:                c = getc (finput);
                   1474:            }
                   1475: 
                   1476:          break;
                   1477: 
                   1478:        case '\n':
                   1479:          c = check_newline ();
                   1480:          break;
                   1481: 
                   1482:        case ' ':
                   1483:        case '\t':
                   1484:        case '\f':
                   1485:        case '\r':
                   1486:        case '\b':
                   1487:          c = getc (finput);
                   1488:          break;
                   1489: 
                   1490:        case '\\':
                   1491:          c = getc (finput);
                   1492:          if (c == '\n')
                   1493:            lineno++;
                   1494:          else
                   1495:            error ("stray '\\' in program");
                   1496:          c = getc (finput);
                   1497:          break;
                   1498: 
                   1499:        default:
                   1500:          return (c);
                   1501:        }
                   1502:     }
                   1503: }
                   1504: 
                   1505: 
                   1506: 
                   1507: /* Make the token buffer longer, preserving the data in it.
                   1508:    P should point to just beyond the last valid character in the old buffer.
                   1509:    The value we return is a pointer to the new buffer
                   1510:    at a place corresponding to P.  */
                   1511: 
                   1512: static char *
                   1513: extend_token_buffer (p)
                   1514:      char *p;
                   1515: {
                   1516:   int offset = p - token_buffer;
                   1517: 
                   1518:   maxtoken = maxtoken * 2 + 10;
                   1519:   token_buffer = (char *) realloc (token_buffer, maxtoken + 2);
                   1520:   if (token_buffer == 0)
                   1521:     fatal ("virtual memory exceeded");
                   1522: 
                   1523:   return token_buffer + offset;
                   1524: }
                   1525: 
                   1526: /* At the beginning of a line, increment the line number
                   1527:    and handle a #line directive immediately following.
                   1528:    Return first nonwhite char of first non-# line following.  */
                   1529: 
                   1530: int
                   1531: check_newline ()
                   1532: {
                   1533:   register int c;
                   1534:   register int token;
                   1535: 
                   1536:   while (1)
                   1537:     {
                   1538:       lineno++;
                   1539: 
                   1540:       /* Read first nonwhite char on the line.  */
                   1541: 
                   1542:       c = getc (finput);
                   1543:       while (c == ' ' || c == '\t')
                   1544:        c = getc (finput);
                   1545: 
                   1546:       if (c != '#')
                   1547:        {
                   1548:          /* If not #, return it so caller will use it.  */
                   1549:          return c;
                   1550:        }
                   1551: 
                   1552:       /* Read first nonwhite char after the `#'.  */
                   1553: 
                   1554:       c = getc (finput);
                   1555:       while (c == ' ' || c == '\t')
                   1556:        c = getc (finput);
                   1557: 
                   1558:       /* If a letter follows, then if the word here is `line', skip
                   1559:         it and ignore it; otherwise, ignore the line, with an error
                   1560:         if the word isn't `pragma'.  */
                   1561: 
                   1562:       if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
                   1563:        {
                   1564:          if (c == 'p')
                   1565:            {
                   1566:              if (getc (finput) == 'r'
                   1567:                  && getc (finput) == 'a'
                   1568:                  && getc (finput) == 'g'
                   1569:                  && getc (finput) == 'm'
                   1570:                  && getc (finput) == 'a'
                   1571:                  && ((c = getc (finput)) == ' ' || c == '\t'))
                   1572:                goto noerror;
                   1573:            }
                   1574: 
                   1575:          else if (c == 'l')
                   1576:            {
                   1577:              if (getc (finput) == 'i'
                   1578:                  && getc (finput) == 'n'
                   1579:                  && getc (finput) == 'e'
                   1580:                  && ((c = getc (finput)) == ' ' || c == '\t'))
                   1581:                goto linenum;
                   1582:            }
                   1583: #ifdef IDENT_DIRECTIVE
                   1584:          else if (c == 'i')
                   1585:            {
                   1586:              if (getc (finput) == 'd'
                   1587:                  && getc (finput) == 'e'
                   1588:                  && getc (finput) == 'n'
                   1589:                  && getc (finput) == 't'
                   1590:                  && ((c = getc (finput)) == ' ' || c == '\t'))
                   1591:                {
                   1592:                  extern FILE *asm_out_file;
                   1593: 
                   1594:                  if (pedantic)
                   1595:                    error ("ANSI C does not allow #ident");
                   1596: 
                   1597:                  /* Here we have just seen `#ident '.
                   1598:                     A string constant should follow.  */
                   1599: 
                   1600:                  while (c == ' ' || c == '\t')
                   1601:                    c = getc (finput);
                   1602: 
                   1603:                  /* If no argument, ignore the line.  */
                   1604:                  if (c == '\n')
                   1605:                    continue;
                   1606: 
                   1607:                  ungetc (c, finput);
                   1608:                  token = yylex ();
                   1609:                  if (token != STRING
                   1610:                      || TREE_CODE (yylval.ttype) != STRING_CST)
                   1611:                    {
                   1612:                      error ("invalid #ident");
                   1613:                      return getc (finput);
                   1614:                    }
                   1615: 
1.1.1.5 ! root     1616: #ifdef ASM_OUTPUT_IDENT
        !          1617:                  ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
        !          1618: #else
1.1       root     1619:                  fprintf (asm_out_file, "\t.ident \"%s\"\n",
                   1620:                           TREE_STRING_POINTER (yylval.ttype));
1.1.1.5 ! root     1621: #endif
1.1       root     1622: 
                   1623:                  /* Skip the rest of this line.  */
                   1624:                  while ((c = getc (finput)) && c != '\n');
                   1625:                  if (c == 0)
                   1626:                    return 0;
                   1627:                  continue;
                   1628:                }
                   1629:            }
                   1630: #endif
                   1631: 
                   1632:          error ("undefined or invalid # directive");
                   1633:        noerror:
                   1634: 
                   1635:          while ((c = getc (finput)) && c != '\n');
                   1636: 
                   1637:          if (c == 0)
                   1638:            return 0;
                   1639:          continue;
                   1640:        }
                   1641: 
                   1642:     linenum:
                   1643:       /* Here we have either `#line' or `# <nonletter>'.
                   1644:         In either case, it should be a line number; a digit should follow.  */
                   1645: 
                   1646:       while (c == ' ' || c == '\t')
                   1647:        c = getc (finput);
                   1648: 
                   1649:       /* If the # is the only nonwhite char on the line,
                   1650:         just ignore it.  Check the new newline.  */
                   1651:       if (c == '\n')
                   1652:        continue;
                   1653: 
                   1654:       /* Something follows the #; read a token.  */
                   1655: 
                   1656:       ungetc (c, finput);
                   1657:       token = yylex ();
                   1658: 
                   1659:       if (token == CONSTANT
                   1660:          && TREE_CODE (yylval.ttype) == INTEGER_CST)
                   1661:        {
                   1662:          /* subtract one, because it is the following line that
                   1663:             gets the specified number */
                   1664: 
                   1665:          int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
                   1666: 
                   1667:          /* Is this the last nonwhite stuff on the line?  */
                   1668:          c = getc (finput);
                   1669:          while (c == ' ' || c == '\t')
                   1670:            c = getc (finput);
                   1671:          if (c == '\n')
                   1672:            {
                   1673:              /* No more: store the line number and check following line.  */
                   1674:              lineno = l;
                   1675:              continue;
                   1676:            }
                   1677:          ungetc (c, finput);
                   1678: 
                   1679:          /* More follows: it must be a string constant (filename).  */
                   1680: 
                   1681:          token = yylex ();
                   1682:          if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
                   1683:            {
                   1684:              error ("invalid #line");
                   1685:              return getc (finput);
                   1686:            }
                   1687: 
                   1688:          input_filename
                   1689:            = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
                   1690:          strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
                   1691:          lineno = l;
                   1692: 
                   1693:          if (main_input_filename == 0)
                   1694:            main_input_filename = input_filename;
                   1695:        }
                   1696:       else
                   1697:        error ("invalid #line");
                   1698: 
                   1699:       /* skip the rest of this line.  */
                   1700:       while ((c = getc (finput)) && c != '\n');
                   1701:       if (c == 0)
                   1702:        return 0;
                   1703:     }
                   1704: }
                   1705: 
                   1706: #define isalnum(char) ((char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z') || (char >= '0' && char <= '9'))
                   1707: #define isdigit(char) (char >= '0' && char <= '9')
                   1708: #define ENDFILE -1  /* token that represents end-of-file */
                   1709: 
                   1710: 
                   1711: static int
                   1712: readescape ()
                   1713: {
                   1714:   register int c = getc (finput);
                   1715:   register int count, code;
                   1716: 
                   1717:   switch (c)
                   1718:     {
                   1719:     case 'x':
                   1720:       code = 0;
                   1721:       count = 0;
                   1722:       while (1)
                   1723:        {
                   1724:          c = getc (finput);
                   1725:          if (!(c >= 'a' && c <= 'f')
                   1726:              && !(c >= 'A' && c <= 'F')
                   1727:              && !(c >= '0' && c <= '9'))
                   1728:            {
                   1729:              ungetc (c, finput);
                   1730:              break;
                   1731:            }
                   1732:          code *= 16;
                   1733:          if (c >= 'a' && c <= 'f')
                   1734:            code += c - 'a' + 10;
                   1735:          if (c >= 'A' && c <= 'F')
                   1736:            code += c - 'A' + 10;
                   1737:          if (c >= '0' && c <= '9')
                   1738:            code += c - '0';
                   1739:          count++;
                   1740:        }
                   1741:       if (count == 0)
                   1742:        error ("\\x used with no following hex digits");
                   1743:       return code;
                   1744: 
                   1745:     case '0':  case '1':  case '2':  case '3':  case '4':
                   1746:     case '5':  case '6':  case '7':
                   1747:       code = 0;
                   1748:       count = 0;
                   1749:       while ((c <= '7') && (c >= '0') && (count++ < 3))
                   1750:        {
                   1751:          code = (code * 8) + (c - '0');
                   1752:          c = getc (finput);
                   1753:        }
                   1754:       ungetc (c, finput);
                   1755:       return code;
                   1756: 
                   1757:     case '\\': case '\'': case '"':
                   1758:       return c;
                   1759: 
                   1760:     case '\n':
                   1761:       lineno++;
                   1762:       return -1;
                   1763: 
                   1764:     case 'n':
                   1765:       return TARGET_NEWLINE;
                   1766: 
                   1767:     case 't':
                   1768:       return TARGET_TAB;
                   1769: 
                   1770:     case 'r':
                   1771:       return TARGET_CR;
                   1772: 
                   1773:     case 'f':
                   1774:       return TARGET_FF;
                   1775: 
                   1776:     case 'b':
                   1777:       return TARGET_BS;
                   1778: 
                   1779:     case 'a':
                   1780:       return TARGET_BELL;
                   1781: 
                   1782:     case 'v':
                   1783:       return TARGET_VT;
                   1784: 
                   1785:     case 'E':
                   1786:       return 033;
                   1787: 
                   1788:     case '?':
1.1.1.3   root     1789:       /* `\(', etc, are used at beginning of line to avoid confusing Emacs.  */
1.1.1.2   root     1790:     case '(':
1.1.1.3   root     1791:     case '{':
                   1792:     case '[':
1.1       root     1793:       return c;
                   1794:     }
                   1795:   if (c >= 040 && c <= 0177)
                   1796:     warning ("unknown escape sequence `\\%c'", c);
                   1797:   else
                   1798:     warning ("unknown escape sequence: `\\' followed by char code 0x%x", c);
                   1799:   return c;
                   1800: }
                   1801: 
                   1802: void
                   1803: yyerror (string)
                   1804:      char *string;
                   1805: {
                   1806:   char buf[200];
                   1807: 
                   1808:   strcpy (buf, string);
                   1809: 
                   1810:   /* We can't print string and character constants well
                   1811:      because the token_buffer contains the result of processing escapes.  */
1.1.1.5 ! root     1812:   if (end_of_file)
1.1       root     1813:     strcat (buf, " at end of input");
1.1.1.5 ! root     1814:   else if (token_buffer[0] == 0)
        !          1815:     strcat (buf, " at null character");
1.1       root     1816:   else if (token_buffer[0] == '"')
                   1817:     strcat (buf, " before string constant");
                   1818:   else if (token_buffer[0] == '\'')
                   1819:     strcat (buf, " before character constant");
                   1820:   else
                   1821:     strcat (buf, " before `%s'");
                   1822: 
                   1823:   error (buf, token_buffer);
                   1824: }
                   1825: 
                   1826: static int nextchar = -1;
                   1827: 
                   1828: static int
                   1829: yylex ()
                   1830: {
                   1831:   register int c;
                   1832:   register char *p;
                   1833:   register int value;
                   1834:   int wide_flag = 0;
                   1835: 
                   1836:   if (nextchar >= 0)
                   1837:     c = nextchar, nextchar = -1;
                   1838:   else
                   1839:     c = getc (finput);
                   1840: 
                   1841:   /* Effectively do c = skip_white_space (c)
                   1842:      but do it faster in the usual cases.  */
                   1843:   while (1)
                   1844:     switch (c)
                   1845:       {
                   1846:       case ' ':
                   1847:       case '\t':
                   1848:       case '\f':
                   1849:       case '\r':
                   1850:       case '\b':
                   1851:        c = getc (finput);
                   1852:        break;
                   1853: 
                   1854:       case '\n':
                   1855:       case '/':
                   1856:       case '\\':
                   1857:        c = skip_white_space (c);
                   1858:       default:
                   1859:        goto found_nonwhite;
                   1860:       }
                   1861:  found_nonwhite:
                   1862: 
                   1863:   token_buffer[0] = c;
                   1864:   token_buffer[1] = 0;
                   1865: 
                   1866: /*  yylloc.first_line = lineno; */
                   1867: 
                   1868:   switch (c)
                   1869:     {
                   1870:     case EOF:
1.1.1.5 ! root     1871:       end_of_file = 1;
1.1       root     1872:       token_buffer[0] = 0;
                   1873:       value = ENDFILE;
                   1874:       break;
                   1875: 
                   1876:     case '$':
                   1877:       if (dollars_in_ident)
                   1878:        goto letter;
                   1879:       return '$';
                   1880: 
                   1881:     case 'L':
                   1882:       /* Capital L may start a wide-string or wide-character constant.  */
                   1883:       {
                   1884:        register int c = getc (finput);
                   1885:        if (c == '\'')
                   1886:          {
                   1887:            wide_flag = 1;
                   1888:            goto char_constant;
                   1889:          }
                   1890:        if (c == '"')
                   1891:          {
                   1892:            wide_flag = 1;
                   1893:            goto string_constant;
                   1894:          }
                   1895:        ungetc (c, finput);
                   1896:       }
                   1897: 
                   1898:     case 'A':  case 'B':  case 'C':  case 'D':  case 'E':
                   1899:     case 'F':  case 'G':  case 'H':  case 'I':  case 'J':
                   1900:     case 'K':            case 'M':  case 'N':  case 'O':
                   1901:     case 'P':  case 'Q':  case 'R':  case 'S':  case 'T':
                   1902:     case 'U':  case 'V':  case 'W':  case 'X':  case 'Y':
                   1903:     case 'Z':
                   1904:     case 'a':  case 'b':  case 'c':  case 'd':  case 'e':
                   1905:     case 'f':  case 'g':  case 'h':  case 'i':  case 'j':
                   1906:     case 'k':  case 'l':  case 'm':  case 'n':  case 'o':
                   1907:     case 'p':  case 'q':  case 'r':  case 's':  case 't':
                   1908:     case 'u':  case 'v':  case 'w':  case 'x':  case 'y':
                   1909:     case 'z':
                   1910:     case '_':
                   1911:     letter:
                   1912:       p = token_buffer;
                   1913:       while (isalnum (c) || c == '_' || c == '$')
                   1914:        {
                   1915:          if (p >= token_buffer + maxtoken)
                   1916:            p = extend_token_buffer (p);
                   1917:          if (c == '$' && ! dollars_in_ident)
                   1918:            break;
                   1919: 
                   1920:          *p++ = c;
                   1921:          c = getc (finput);
                   1922:        }
                   1923: 
                   1924:       *p = 0;
                   1925:       nextchar = c;
                   1926: 
                   1927:       value = IDENTIFIER;
                   1928:       yylval.itype = 0;
                   1929: 
1.1.1.4   root     1930:       /* Try to recognize a keyword.  Uses minimum-perfect hash function */
                   1931:   
                   1932:       {
                   1933:        register struct resword *ptr;
1.1       root     1934: 
1.1.1.4   root     1935:        if (ptr = is_reserved_word (token_buffer, p - token_buffer))
                   1936:          {
                   1937:            if (ptr->rid)
                   1938:              yylval.ttype = ridpointers[(int) ptr->rid];
                   1939:            if ((! flag_no_asm
                   1940:                 /* -fno-asm means don't recognize the non-ANSI keywords.  */
                   1941:                 || ((int) ptr->token != ASM
                   1942:                     && (int) ptr->token != TYPEOF
                   1943:                     && ptr->rid != RID_INLINE))
                   1944:                /* -ftraditional means don't recognize nontraditional keywords
                   1945:                   typeof, const, volatile, signed or inline.  */
                   1946:                && (! flag_traditional
                   1947:                    || ((int) ptr->token != TYPE_QUAL
                   1948:                        && (int) ptr->token != TYPEOF
                   1949:                        && ptr->rid != RID_SIGNED
                   1950:                        && ptr->rid != RID_INLINE)))
                   1951:              value = (int) ptr->token;
                   1952:          }
                   1953:       }
1.1       root     1954: 
                   1955:       /* If we did not find a keyword, look for an identifier
                   1956:         (or a typename).  */
                   1957: 
                   1958:       if (value == IDENTIFIER)
                   1959:        {
                   1960:           yylval.ttype = get_identifier (token_buffer);
                   1961:          lastiddecl = lookup_name (yylval.ttype);
                   1962: 
                   1963:          if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL)
                   1964:            value = TYPENAME;
                   1965:        }
                   1966: 
                   1967:       break;
                   1968: 
                   1969:     case '0':  case '1':  case '2':  case '3':  case '4':
                   1970:     case '5':  case '6':  case '7':  case '8':  case '9':
                   1971:     case '.':
                   1972:       {
                   1973:        int base = 10;
                   1974:        int count = 0;
                   1975:        int largest_digit = 0;
                   1976:        int numdigits = 0;
                   1977:        /* for multi-precision arithmetic,
                   1978:           we store only 8 live bits in each short,
                   1979:           giving us 64 bits of reliable precision */
                   1980:        short shorts[8];
1.1.1.3   root     1981: 
1.1.1.5 ! root     1982:        enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag
1.1.1.3   root     1983:          = NOT_FLOAT;
1.1       root     1984: 
                   1985:        for (count = 0; count < 8; count++)
                   1986:          shorts[count] = 0;
                   1987: 
                   1988:        p = token_buffer;
                   1989:        *p++ = c;
                   1990: 
                   1991:        if (c == '0')
                   1992:          {
                   1993:            *p++ = (c = getc (finput));
                   1994:            if ((c == 'x') || (c == 'X'))
                   1995:              {
                   1996:                base = 16;
                   1997:                *p++ = (c = getc (finput));
                   1998:              }
                   1999:            else
                   2000:              {
                   2001:                base = 8;
                   2002:                numdigits++;
                   2003:              }
                   2004:          }
                   2005: 
                   2006:        /* Read all the digits-and-decimal-points.  */
                   2007: 
                   2008:        while (c == '.'
                   2009:               || (isalnum (c) && (c != 'l') && (c != 'L')
                   2010:                   && (c != 'u') && (c != 'U')
1.1.1.3   root     2011:                   && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
1.1       root     2012:          {
                   2013:            if (c == '.')
                   2014:              {
                   2015:                if (base == 16)
                   2016:                  error ("floating constant may not be in radix 16");
1.1.1.3   root     2017:                if (floatflag == AFTER_POINT)
                   2018:                  {
                   2019:                    error ("malformed floating constant");
                   2020:                    floatflag = TOO_MANY_POINTS;
                   2021:                  }
                   2022:                else
                   2023:                  floatflag = AFTER_POINT;
                   2024: 
1.1       root     2025:                base = 10;
                   2026:                *p++ = c = getc (finput);
                   2027:                /* Accept '.' as the start of a floating-point number
                   2028:                   only when it is followed by a digit.
                   2029:                   Otherwise, unread the following non-digit
                   2030:                   and use the '.' as a structural token.  */
                   2031:                if (p == token_buffer + 2 && !isdigit (c))
                   2032:                  {
                   2033:                    if (c == '.')
                   2034:                      {
                   2035:                        c = getc (finput);
                   2036:                        if (c == '.')
                   2037:                          {
                   2038:                            *p++ = c;
                   2039:                            *p = 0;
                   2040:                            return ELLIPSIS;
                   2041:                          }
                   2042:                        error ("parse error at `..'");
                   2043:                      }
                   2044:                    ungetc (c, finput);
                   2045:                    token_buffer[1] = 0;
                   2046:                    value = '.';
                   2047:                    goto done;
                   2048:                  }
                   2049:              }
                   2050:            else
                   2051:              {
                   2052:                /* It is not a decimal point.
                   2053:                   It should be a digit (perhaps a hex digit).  */
                   2054: 
                   2055:                if (isdigit (c))
                   2056:                  {
                   2057:                    c = c - '0';
                   2058:                  }
                   2059:                else if (base <= 10)
                   2060:                  {
                   2061:                    if ((c&~040) == 'E')
                   2062:                      {
                   2063:                        base = 10;
1.1.1.3   root     2064:                        floatflag = AFTER_POINT;
1.1       root     2065:                        break;   /* start of exponent */
                   2066:                      }
                   2067:                    error ("nondigits in number and not hexadecimal");
                   2068:                    c = 0;
                   2069:                  }
                   2070:                else if (c >= 'a')
                   2071:                  {
                   2072:                    c = c - 'a' + 10;
                   2073:                  }
                   2074:                else
                   2075:                  {
                   2076:                    c = c - 'A' + 10;
                   2077:                  }
                   2078:                if (c >= largest_digit)
                   2079:                  largest_digit = c;
                   2080:                numdigits++;
                   2081:            
                   2082:                for (count = 0; count < 8; count++)
                   2083:                  {
                   2084:                    (shorts[count] *= base);
                   2085:                    if (count)
                   2086:                      {
                   2087:                        shorts[count] += (shorts[count-1] >> 8);
                   2088:                        shorts[count-1] &= (1<<8)-1;
                   2089:                      }
                   2090:                    else shorts[0] += c;
                   2091:                  }
                   2092:     
                   2093:                if (p >= token_buffer + maxtoken - 3)
                   2094:                  p = extend_token_buffer (p);
                   2095:                *p++ = (c = getc (finput));
                   2096:              }
                   2097:          }
                   2098: 
                   2099:        if (numdigits == 0)
                   2100:          error ("numeric constant with no digits");
                   2101: 
                   2102:        if (largest_digit >= base)
                   2103:          error ("numeric constant contains digits beyond the radix");
                   2104: 
                   2105:        /* Remove terminating char from the token buffer and delimit the string */
                   2106:        *--p = 0;
                   2107: 
1.1.1.3   root     2108:        if (floatflag != NOT_FLOAT)
1.1       root     2109:          {
                   2110:            tree type = double_type_node;
                   2111:            char f_seen = 0;
                   2112:            char l_seen = 0;
                   2113:            double value;
                   2114: 
                   2115:            /* Read explicit exponent if any, and put it in tokenbuf.  */
                   2116: 
                   2117:            if ((c == 'e') || (c == 'E'))
                   2118:              {
                   2119:                if (p >= token_buffer + maxtoken - 3)
                   2120:                  p = extend_token_buffer (p);
                   2121:                *p++ = c;
                   2122:                c = getc (finput);
                   2123:                if ((c == '+') || (c == '-'))
                   2124:                  {
                   2125:                    *p++ = c;
                   2126:                    c = getc (finput);
                   2127:                  }
                   2128:                if (! isdigit (c))
                   2129:                  error ("floating constant exponent has no digits");
                   2130:                while (isdigit (c))
                   2131:                  {
                   2132:                    if (p >= token_buffer + maxtoken - 3)
                   2133:                      p = extend_token_buffer (p);
                   2134:                    *p++ = c;
                   2135:                    c = getc (finput);
                   2136:                  }
                   2137:              }
                   2138: 
                   2139:            *p = 0;
                   2140:            errno = 0;
                   2141:            value = atof (token_buffer);
                   2142: #ifdef ERANGE
                   2143:            if (errno == ERANGE && !flag_traditional)
1.1.1.5 ! root     2144:              {
        !          2145:                char *p1 = token_buffer;
        !          2146:                /* Check for "0.0" and variants;
        !          2147:                   Sunos 4 spuriously returns ERANGE for them.  */
        !          2148:                while (*p1 == '0') p1++;
        !          2149:                if (*p1 == '.') p1++;
        !          2150:                while (*p1 == '0') p1++;
        !          2151:                if (*p1 != 0)
        !          2152:                  warning ("floating point number exceeds range of `double'");
        !          2153:              }
1.1       root     2154: #endif
                   2155: 
                   2156:            /* Read the suffixes to choose a data type.  */
                   2157:            while (1)
                   2158:              {
                   2159:                if (c == 'f' || c == 'F')
                   2160:                  {
                   2161:                    if (f_seen)
                   2162:                      error ("two `f's in floating constant");
                   2163:                    f_seen = 1;
                   2164:                    type = float_type_node;
                   2165:                  }
                   2166:                else if (c == 'l' || c == 'L')
                   2167:                  {
                   2168:                    if (l_seen)
                   2169:                      error ("two `l's in floating constant");
                   2170:                    l_seen = 1;
                   2171:                    type = long_double_type_node;
                   2172:                  }
                   2173:                else
                   2174:                  {
                   2175:                    if (isalnum (c))
                   2176:                      {
                   2177:                        error ("garbage at end of number");
                   2178:                        while (isalnum (c))
                   2179:                          {
                   2180:                            if (p >= token_buffer + maxtoken - 3)
                   2181:                              p = extend_token_buffer (p);
                   2182:                            *p++ = c;
                   2183:                            c = getc (finput);
                   2184:                          }
                   2185:                      }
                   2186:                    break;
                   2187:                  }
                   2188:                if (p >= token_buffer + maxtoken - 3)
                   2189:                  p = extend_token_buffer (p);
                   2190:                *p++ = c;
                   2191:                c = getc (finput);
                   2192:              }
                   2193: 
                   2194:            /* Create a node with determined type and value.  */
                   2195:            yylval.ttype = build_real (type, value);
                   2196: 
                   2197:            ungetc (c, finput);
                   2198:            *p = 0;
                   2199:          }
                   2200:        else
                   2201:          {
                   2202:            tree type;
                   2203:            int spec_unsigned = 0;
                   2204:            int spec_long = 0;
                   2205: 
                   2206:            while (1)
                   2207:              {
                   2208:                if (c == 'u' || c == 'U')
                   2209:                  {
                   2210:                    if (spec_unsigned)
                   2211:                      error ("two `u's in integer constant");
                   2212:                    spec_unsigned = 1;
                   2213:                  }
                   2214:                else if (c == 'l' || c == 'L')
                   2215:                  {
                   2216:                    if (spec_long)
                   2217:                      error ("two `l's in integer constant");
                   2218:                    spec_long = 1;
                   2219:                  }
                   2220:                else
                   2221:                  {
                   2222:                    if (isalnum (c))
                   2223:                      {
                   2224:                        error ("garbage at end of number");
                   2225:                        while (isalnum (c))
                   2226:                          {
                   2227:                            if (p >= token_buffer + maxtoken - 3)
                   2228:                              p = extend_token_buffer (p);
                   2229:                            *p++ = c;
                   2230:                            c = getc (finput);
                   2231:                          }
                   2232:                      }
                   2233:                    break;
                   2234:                  }
                   2235:                if (p >= token_buffer + maxtoken - 3)
                   2236:                  p = extend_token_buffer (p);
                   2237:                *p++ = c;
                   2238:                c = getc (finput);
                   2239:              }
                   2240: 
                   2241:            ungetc (c, finput);
                   2242: 
                   2243:            if (shorts[7] | shorts[6] | shorts[5] | shorts[4])
                   2244:              warning ("integer constant out of range");
                   2245: 
                   2246:            /* This is simplified by the fact that our constant
                   2247:               is always positive.  */
                   2248:            yylval.ttype
                   2249:              = build_int_2 ((shorts[3]<<24) + (shorts[2]<<16) + (shorts[1]<<8) + shorts[0],
                   2250:                             0);
                   2251:     
                   2252:            if (!spec_long && !spec_unsigned
                   2253:                && int_fits_type_p (yylval.ttype, integer_type_node))
                   2254:              type = integer_type_node;
                   2255: 
                   2256:            else if (!spec_long && base != 10
                   2257:                && int_fits_type_p (yylval.ttype, unsigned_type_node))
                   2258:              type = unsigned_type_node;
                   2259: 
                   2260:            else if (!spec_unsigned
                   2261:                && int_fits_type_p (yylval.ttype, long_integer_type_node))
                   2262:              type = long_integer_type_node;
                   2263: 
                   2264:            else
                   2265:              {
                   2266:                type = long_unsigned_type_node;
                   2267:                if (! int_fits_type_p (yylval.ttype, long_unsigned_type_node))
                   2268:                  warning ("integer constant out of range");
                   2269:              }
                   2270:            TREE_TYPE (yylval.ttype) = type;
                   2271:          }
                   2272: 
                   2273:        value = CONSTANT; break;
                   2274:       }
                   2275: 
                   2276:     case '\'':
                   2277:     char_constant:
                   2278:       c = getc (finput);
                   2279:       {
                   2280:        register int code = 0;
                   2281: 
                   2282:       tryagain:
                   2283: 
                   2284:        if (c == '\\')
                   2285:          {
                   2286:            c = readescape ();
                   2287:            if (c < 0)
                   2288:              goto tryagain;
                   2289:          }
                   2290:        else if (c == '\n')
                   2291:          {
                   2292:            if (pedantic)
                   2293:              warning ("ANSI C forbids newline in character constant");
                   2294:            lineno++;
                   2295:          }
                   2296: 
                   2297:        code = c;
                   2298:        token_buffer[1] = c;
                   2299:        token_buffer[2] = '\'';
                   2300:        token_buffer[3] = 0;
                   2301: 
                   2302:        c = getc (finput);
                   2303:        if (c != '\'')
                   2304:          error ("malformatted character constant");
                   2305: 
                   2306:        /* If char type is signed, sign-extend the constant.  */
                   2307:        if (TREE_UNSIGNED (char_type_node)
                   2308:            || ((code >> (BITS_PER_UNIT - 1)) & 1) == 0)
                   2309:          yylval.ttype = build_int_2 (code & ((1 << BITS_PER_UNIT) - 1), 0);
                   2310:        else
                   2311:          yylval.ttype = build_int_2 (code | ((-1) << BITS_PER_UNIT), -1);
                   2312: 
                   2313:        TREE_TYPE (yylval.ttype) = integer_type_node;
                   2314:        value = CONSTANT; break;
                   2315:       }
                   2316: 
                   2317:     case '"':
                   2318:     string_constant:
                   2319:       {
                   2320:        c = getc (finput);
                   2321:        p = token_buffer + 1;
                   2322: 
                   2323:        while (c != '"')
                   2324:          {
                   2325:            if (c == '\\')
                   2326:              {
                   2327:                c = readescape ();
                   2328:                if (c < 0)
                   2329:                  goto skipnewline;
                   2330:              }
                   2331:            else if (c == '\n')
                   2332:              {
                   2333:                if (pedantic)
                   2334:                  warning ("ANSI C forbids newline in string constant");
                   2335:                lineno++;
                   2336:              }
                   2337: 
                   2338:            if (p == token_buffer + maxtoken)
                   2339:              p = extend_token_buffer (p);
                   2340:            *p++ = c;
                   2341: 
                   2342:          skipnewline:
                   2343:            c = getc (finput);
                   2344:          }
                   2345: 
                   2346:        *p = 0;
                   2347: 
                   2348:        if (wide_flag)
                   2349:          {
                   2350:            /* If this is a L"..." wide-string, convert each char
                   2351:               to an int, making a vector of ints.  */
                   2352:            int *widebuf = (int *) alloca (p - token_buffer);
                   2353:            char *p1 = token_buffer + 1;
                   2354:            for (; p1 != p; p1++)
                   2355:              widebuf[p1 - token_buffer - 1] = *p1;
                   2356:            yylval.ttype = build_string ((p - token_buffer) * sizeof (int),
                   2357:                                         widebuf);
                   2358:            TREE_TYPE (yylval.ttype) = int_array_type_node;
                   2359:          }
                   2360:        else
                   2361:          {
                   2362:            yylval.ttype = build_string (p - token_buffer, token_buffer + 1);
                   2363:            TREE_TYPE (yylval.ttype) = char_array_type_node;
                   2364:          }
                   2365: 
                   2366:        *p++ = '"';
                   2367:        *p = 0;
                   2368: 
                   2369:        value = STRING; break;
                   2370:       }
                   2371:       
                   2372:     case '+':
                   2373:     case '-':
                   2374:     case '&':
                   2375:     case '|':
                   2376:     case '<':
                   2377:     case '>':
                   2378:     case '*':
                   2379:     case '/':
                   2380:     case '%':
                   2381:     case '^':
                   2382:     case '!':
                   2383:     case '=':
                   2384:       {
                   2385:        register int c1;
                   2386: 
                   2387:       combine:
                   2388: 
                   2389:        switch (c)
                   2390:          {
                   2391:          case '+':
                   2392:            yylval.code = PLUS_EXPR; break;
                   2393:          case '-':
                   2394:            yylval.code = MINUS_EXPR; break;
                   2395:          case '&':
                   2396:            yylval.code = BIT_AND_EXPR; break;
                   2397:          case '|':
                   2398:            yylval.code = BIT_IOR_EXPR; break;
                   2399:          case '*':
                   2400:            yylval.code = MULT_EXPR; break;
                   2401:          case '/':
                   2402:            yylval.code = TRUNC_DIV_EXPR; break;
                   2403:          case '%':
                   2404:            yylval.code = TRUNC_MOD_EXPR; break;
                   2405:          case '^':
                   2406:            yylval.code = BIT_XOR_EXPR; break;
                   2407:          case LSHIFT:
                   2408:            yylval.code = LSHIFT_EXPR; break;
                   2409:          case RSHIFT:
                   2410:            yylval.code = RSHIFT_EXPR; break;
                   2411:          case '<':
                   2412:            yylval.code = LT_EXPR; break;
                   2413:          case '>':
                   2414:            yylval.code = GT_EXPR; break;
                   2415:          }     
                   2416: 
                   2417:        token_buffer[1] = c1 = getc (finput);
                   2418:        token_buffer[2] = 0;
                   2419: 
                   2420:        if (c1 == '=')
                   2421:          {
                   2422:            switch (c)
                   2423:              {
                   2424:              case '<':
                   2425:                value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
                   2426:              case '>':
                   2427:                value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
                   2428:              case '!':
                   2429:                value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
                   2430:              case '=':
                   2431:                value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
                   2432:              } 
                   2433:            value = ASSIGN; goto done;
                   2434:          }
                   2435:        else if (c == c1)
                   2436:          switch (c)
                   2437:            {
                   2438:            case '+':
                   2439:              value = PLUSPLUS; goto done;
                   2440:            case '-':
                   2441:              value = MINUSMINUS; goto done;
                   2442:            case '&':
                   2443:              value = ANDAND; goto done;
                   2444:            case '|':
                   2445:              value = OROR; goto done;
                   2446:            case '<':
                   2447:              c = LSHIFT;
                   2448:              goto combine;
                   2449:            case '>':
                   2450:              c = RSHIFT;
                   2451:              goto combine;
                   2452:            }
                   2453:        else if ((c == '-') && (c1 == '>'))
                   2454:          { value = POINTSAT; goto done; }
                   2455:        ungetc (c1, finput);
                   2456:        token_buffer[1] = 0;
                   2457: 
                   2458:        if ((c == '<') || (c == '>'))
                   2459:          value = ARITHCOMPARE;
                   2460:        else value = c;
                   2461:        goto done;
                   2462:       }
                   2463: 
1.1.1.5 ! root     2464:     case 0:
        !          2465:       /* Don't make yyparse think this is eof.  */
        !          2466:       value = 1;
        !          2467:       break;
        !          2468: 
1.1       root     2469:     default:
                   2470:       value = c;
                   2471:     }
                   2472: 
                   2473: done:
                   2474: /*  yylloc.last_line = lineno; */
                   2475: 
                   2476:   return value;
                   2477: }

unix.superglobalmegacorp.com

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