home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.5.8-src.lha / src / amiga / gcc-2.5.8 / c-parse.y < prev    next >
Encoding:
GNU Bison Grammar  |  1994-02-22  |  55.2 KB  |  1,937 lines

  1. /* YACC parser for C syntax and for Objective C.  -*-c-*-
  2.    Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This file defines the grammar of C and that of Objective C.
  21.    ifobjc ... end ifobjc  conditionals contain code for Objective C only.
  22.    ifc ... end ifc  conditionals contain code for C only.
  23.    Sed commands in Makefile.in are used to convert this file into
  24.    c-parse.y and into objc-parse.y.  */
  25.  
  26. /* To whomever it may concern: I have heard that such a thing was once
  27. written by AT&T, but I have never seen it.  */
  28.  
  29. %expect 8
  30.  
  31. /* These are the 8 conflicts you should get in parse.output;
  32.    the state numbers may vary if minor changes in the grammar are made.
  33.  
  34. State 41 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  35. State 92 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  36. State 99 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  37. State 103 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  38. State 119 contains 1 shift/reduce conflict.  (See comment at component_decl.)
  39. State 183 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  40. State 193 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  41. State 199 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
  42. */
  43.  
  44. %{
  45. #include <stdio.h>
  46. #include <errno.h>
  47. #include <setjmp.h>
  48.  
  49. #include "config.h"
  50. #include "tree.h"
  51. #include "input.h"
  52. #include "c-lex.h"
  53. #include "c-tree.h"
  54. #include "flags.h"
  55.  
  56. #ifdef MULTIBYTE_CHARS
  57. #include <stdlib.h>
  58. #include <locale.h>
  59. #endif
  60.  
  61.  
  62. /* Since parsers are distinct for each language, put the language string
  63.    definition here.  */
  64. char *language_string = "GNU C";
  65.  
  66. #ifndef errno
  67. extern int errno;
  68. #endif
  69.  
  70. void yyerror ();
  71.  
  72. /* Like YYERROR but do call yyerror.  */
  73. #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
  74.  
  75. /* Cause the `yydebug' variable to be defined.  */
  76. #define YYDEBUG 1
  77. %}
  78.  
  79. %start program
  80.  
  81. %union {long itype; tree ttype; enum tree_code code;
  82.     char *filename; int lineno; }
  83.  
  84. /* All identifiers that are not reserved words
  85.    and are not declared typedefs in the current block */
  86. %token IDENTIFIER
  87.  
  88. /* All identifiers that are declared typedefs in the current block.
  89.    In some contexts, they are treated just like IDENTIFIER,
  90.    but they can also serve as typespecs in declarations.  */
  91. %token TYPENAME
  92.  
  93. /* Reserved words that specify storage class.
  94.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  95. %token SCSPEC
  96.  
  97. /* Reserved words that specify type.
  98.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  99. %token TYPESPEC
  100.  
  101. /* Reserved words that qualify type: "const" or "volatile".
  102.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  103. %token TYPE_QUAL
  104.  
  105. /* Character or numeric constants.
  106.    yylval is the node for the constant.  */
  107. %token CONSTANT
  108.  
  109. /* String constants in raw form.
  110.    yylval is a STRING_CST node.  */
  111. %token STRING
  112.  
  113. /* "...", used for functions with variable arglists.  */
  114. %token ELLIPSIS
  115.  
  116. /* the reserved words */
  117. /* SCO include files test "ASM", so use something else. */
  118. %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
  119. %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF ALIGN
  120. %token ATTRIBUTE EXTENSION LABEL
  121. %token REALPART IMAGPART
  122.  
  123. /* Add precedence rules to solve dangling else s/r conflict */
  124. %nonassoc IF
  125. %nonassoc ELSE
  126.  
  127. /* Define the operator tokens and their precedences.
  128.    The value is an integer because, if used, it is the tree code
  129.    to use in the expression made from the operator.  */
  130.  
  131. %right <code> ASSIGN '='
  132. %right <code> '?' ':'
  133. %left <code> OROR
  134. %left <code> ANDAND
  135. %left <code> '|'
  136. %left <code> '^'
  137. %left <code> '&'
  138. %left <code> EQCOMPARE
  139. %left <code> ARITHCOMPARE
  140. %left <code> LSHIFT RSHIFT
  141. %left <code> '+' '-'
  142. %left <code> '*' '/' '%'
  143. %right <code> UNARY PLUSPLUS MINUSMINUS
  144. %left HYPERUNARY
  145. %left <code> POINTSAT '.' '(' '['
  146.  
  147. /* The Objective-C keywords.  These are included in C and in
  148.    Objective C, so that the token codes are the same in both.  */
  149. %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
  150. %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
  151.  
  152. /* Objective-C string constants in raw form.
  153.    yylval is an OBJC_STRING_CST node.  */
  154. %token OBJC_STRING
  155.  
  156.  
  157. %type <code> unop
  158.  
  159. %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
  160. %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
  161. %type <ttype> typed_declspecs reserved_declspecs
  162. %type <ttype> typed_typespecs reserved_typespecquals
  163. %type <ttype> declmods typespec typespecqual_reserved
  164. %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
  165. %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
  166. %type <ttype> init maybeasm
  167. %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
  168. %type <ttype> maybe_attribute attribute_list attrib
  169.  
  170. %type <ttype> compstmt
  171.  
  172. %type <ttype> declarator
  173. %type <ttype> notype_declarator after_type_declarator
  174. %type <ttype> parm_declarator
  175.  
  176. %type <ttype> structsp component_decl_list component_decl_list2
  177. %type <ttype> component_decl components component_declarator
  178. %type <ttype> enumlist enumerator
  179. %type <ttype> typename absdcl absdcl1 type_quals
  180. %type <ttype> xexpr parms parm identifiers
  181.  
  182. %type <ttype> parmlist parmlist_1 parmlist_2
  183. %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
  184. %type <ttype> identifiers_or_typenames
  185.  
  186. %type <itype> setspecs
  187.  
  188. %type <filename> save_filename
  189. %type <lineno> save_lineno
  190.  
  191.  
  192. %{
  193. /* Number of statements (loosely speaking) seen so far.  */
  194. static int stmt_count;
  195.  
  196. /* Input file and line number of the end of the body of last simple_if;
  197.    used by the stmt-rule immediately after simple_if returns.  */
  198. static char *if_stmt_file;
  199. static int if_stmt_line;
  200.  
  201. /* List of types and structure classes of the current declaration.  */
  202. static tree current_declspecs;
  203.  
  204. /* Stack of saved values of current_declspecs.  */
  205. static tree declspec_stack;
  206.  
  207. /* 1 if we explained undeclared var errors.  */
  208. static int undeclared_variable_notice;
  209.  
  210.  
  211. /* Tell yyparse how to print a token's value, if yydebug is set.  */
  212.  
  213. #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
  214. extern void yyprint ();
  215. %}
  216.  
  217. %%
  218. program: /* empty */
  219.         { if (pedantic)
  220.             pedwarn ("ANSI C forbids an empty source file");
  221.         }
  222.     | extdefs
  223.         {
  224.           /* In case there were missing closebraces,
  225.              get us back to the global binding level.  */
  226.           while (! global_bindings_p ())
  227.             poplevel (0, 0, 0);
  228.         }
  229.     ;
  230.  
  231. /* the reason for the strange actions in this rule
  232.  is so that notype_initdecls when reached via datadef
  233.  can find a valid list of type and sc specs in $0. */
  234.  
  235. extdefs:
  236.     {$<ttype>$ = NULL_TREE; } extdef
  237.     | extdefs {$<ttype>$ = NULL_TREE; } extdef
  238.     ;
  239.  
  240. extdef:
  241.     fndef
  242.     | datadef
  243.     | ASM_KEYWORD '(' expr ')' ';'
  244.         { STRIP_NOPS ($3);
  245.           if ((TREE_CODE ($3) == ADDR_EXPR
  246.                && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
  247.               || TREE_CODE ($3) == STRING_CST)
  248.             assemble_asm ($3);
  249.           else
  250.             error ("argument of `asm' is not a constant string"); }
  251.     ;
  252.  
  253. datadef:
  254.       setspecs notype_initdecls ';'
  255.         { if (pedantic)
  256.             error ("ANSI C forbids data definition with no type or storage class");
  257.           else if (!flag_traditional)
  258.             warning ("data definition has no type or storage class"); }
  259.         | declmods setspecs notype_initdecls ';'
  260.       {}
  261.     | typed_declspecs setspecs initdecls ';'
  262.       {}
  263.         | declmods ';'
  264.       { pedwarn ("empty declaration"); }
  265.     | typed_declspecs ';'
  266.       { shadow_tag ($1); }
  267.     | error ';'
  268.     | error '}'
  269.     | ';'
  270.         { if (pedantic)
  271.             pedwarn ("ANSI C does not allow extra `;' outside of a function"); }
  272.     ;
  273.  
  274. fndef:
  275.       typed_declspecs setspecs declarator
  276.         { if (! start_function ($1, $3, 0))
  277.             YYERROR1;
  278.           reinit_parse_for_function (); }
  279.       xdecls
  280.         { store_parm_decls (); }
  281.       compstmt_or_error
  282.         { finish_function (0); }
  283.     | typed_declspecs setspecs declarator error
  284.         { }
  285.     | declmods setspecs notype_declarator
  286.         { if (! start_function ($1, $3, 0))
  287.             YYERROR1;
  288.           reinit_parse_for_function (); }
  289.       xdecls
  290.         { store_parm_decls (); }
  291.       compstmt_or_error
  292.         { finish_function (0); }
  293.     | declmods setspecs notype_declarator error
  294.         { }
  295.     | setspecs notype_declarator
  296.         { if (! start_function (NULL_TREE, $2, 0))
  297.             YYERROR1;
  298.           reinit_parse_for_function (); }
  299.       xdecls
  300.         { store_parm_decls (); }
  301.       compstmt_or_error
  302.         { finish_function (0); }
  303.     | setspecs notype_declarator error
  304.         { }
  305.     ;
  306.  
  307. identifier:
  308.     IDENTIFIER
  309.     | TYPENAME
  310.     ;
  311.  
  312. unop:     '&'
  313.         { $$ = ADDR_EXPR; }
  314.     | '-'
  315.         { $$ = NEGATE_EXPR; }
  316.     | '+'
  317.         { $$ = CONVERT_EXPR; }
  318.     | PLUSPLUS
  319.         { $$ = PREINCREMENT_EXPR; }
  320.     | MINUSMINUS
  321.         { $$ = PREDECREMENT_EXPR; }
  322.     | '~'
  323.         { $$ = BIT_NOT_EXPR; }
  324.     | '!'
  325.         { $$ = TRUTH_NOT_EXPR; }
  326.     ;
  327.  
  328. expr:    nonnull_exprlist
  329.         { $$ = build_compound_expr ($1); }
  330.     ;
  331.  
  332. exprlist:
  333.       /* empty */
  334.         { $$ = NULL_TREE; }
  335.     | nonnull_exprlist
  336.     ;
  337.  
  338. nonnull_exprlist:
  339.     expr_no_commas
  340.         { $$ = build_tree_list (NULL_TREE, $1); }
  341.     | nonnull_exprlist ',' expr_no_commas
  342.         { chainon ($1, build_tree_list (NULL_TREE, $3)); }
  343.     ;
  344.  
  345. unary_expr:
  346.     primary
  347.     | '*' cast_expr   %prec UNARY
  348.         { $$ = build_indirect_ref ($2, "unary *"); }
  349.     /* __extension__ turns off -pedantic for following primary.  */
  350.     | EXTENSION
  351.         { $<itype>1 = pedantic;
  352.           pedantic = 0; }
  353.       cast_expr      %prec UNARY
  354.         { $$ = $3;
  355.           pedantic = $<itype>1; }
  356.     | unop cast_expr  %prec UNARY
  357.         { $$ = build_unary_op ($1, $2, 0);
  358.           overflow_warning ($$); }
  359.     /* Refer to the address of a label as a pointer.  */
  360.     | ANDAND identifier
  361.         { tree label = lookup_label ($2);
  362.           if (label == 0)
  363.             $$ = null_pointer_node;
  364.           else
  365.             {
  366.               TREE_USED (label) = 1;
  367.               $$ = build1 (ADDR_EXPR, ptr_type_node, label);
  368.               TREE_CONSTANT ($$) = 1;
  369.             }
  370.         }
  371. /* This seems to be impossible on some machines, so let's turn it off.
  372.    You can use __builtin_next_arg to find the anonymous stack args.
  373.     | '&' ELLIPSIS
  374.         { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
  375.           $$ = error_mark_node;
  376.           if (TREE_VALUE (tree_last (types)) == void_type_node)
  377.             error ("`&...' used in function with fixed number of arguments");
  378.           else
  379.             {
  380.               if (pedantic)
  381.             pedwarn ("ANSI C forbids `&...'");
  382.               $$ = tree_last (DECL_ARGUMENTS (current_function_decl));
  383.               $$ = build_unary_op (ADDR_EXPR, $$, 0);
  384.             } }
  385. */
  386.     | SIZEOF unary_expr  %prec UNARY
  387.         { if (TREE_CODE ($2) == COMPONENT_REF
  388.               && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
  389.             error ("`sizeof' applied to a bit-field");
  390.           $$ = c_sizeof (TREE_TYPE ($2)); }
  391.     | SIZEOF '(' typename ')'  %prec HYPERUNARY
  392.         { $$ = c_sizeof (groktypename ($3)); }
  393.     | ALIGNOF unary_expr  %prec UNARY
  394.         { $$ = c_alignof_expr ($2); }
  395.     | ALIGNOF '(' typename ')'  %prec HYPERUNARY
  396.         { $$ = c_alignof (groktypename ($3)); }
  397.     | REALPART cast_expr %prec UNARY
  398.         { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
  399.     | IMAGPART cast_expr %prec UNARY
  400.         { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
  401.     ;
  402.  
  403. cast_expr:
  404.     unary_expr
  405.     | '(' typename ')' cast_expr  %prec UNARY
  406.         { tree type = groktypename ($2);
  407.           $$ = build_c_cast (type, $4); }
  408.     | '(' typename ')' '{' 
  409.         { start_init (NULL_TREE, NULL, 0);
  410.           $2 = groktypename ($2);
  411.           really_start_incremental_init ($2); }
  412.       initlist_maybe_comma '}'  %prec UNARY
  413.         { char *name;
  414.           tree result = pop_init_level (0);
  415.           tree type = $2;
  416.           finish_init ();
  417.  
  418.           if (pedantic)
  419.             pedwarn ("ANSI C forbids constructor expressions");
  420.           if (TYPE_NAME (type) != 0)
  421.             {
  422.               if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
  423.             name = IDENTIFIER_POINTER (TYPE_NAME (type));
  424.               else
  425.             name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
  426.             }
  427.           else
  428.             name = "";
  429.           $$ = result;
  430.           if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
  431.             {
  432.               int failure = complete_array_type (type, $$, 1);
  433.               if (failure)
  434.             abort ();
  435.             }
  436.         }
  437.     ;
  438.  
  439. expr_no_commas:
  440.       cast_expr
  441.     | expr_no_commas '+' expr_no_commas
  442.         { $$ = parser_build_binary_op ($2, $1, $3); }
  443.     | expr_no_commas '-' expr_no_commas
  444.         { $$ = parser_build_binary_op ($2, $1, $3); }
  445.     | expr_no_commas '*' expr_no_commas
  446.         { $$ = parser_build_binary_op ($2, $1, $3); }
  447.     | expr_no_commas '/' expr_no_commas
  448.         { $$ = parser_build_binary_op ($2, $1, $3); }
  449.     | expr_no_commas '%' expr_no_commas
  450.         { $$ = parser_build_binary_op ($2, $1, $3); }
  451.     | expr_no_commas LSHIFT expr_no_commas
  452.         { $$ = parser_build_binary_op ($2, $1, $3); }
  453.     | expr_no_commas RSHIFT expr_no_commas
  454.         { $$ = parser_build_binary_op ($2, $1, $3); }
  455.     | expr_no_commas ARITHCOMPARE expr_no_commas
  456.         { $$ = parser_build_binary_op ($2, $1, $3); }
  457.     | expr_no_commas EQCOMPARE expr_no_commas
  458.         { $$ = parser_build_binary_op ($2, $1, $3); }
  459.     | expr_no_commas '&' expr_no_commas
  460.         { $$ = parser_build_binary_op ($2, $1, $3); }
  461.     | expr_no_commas '|' expr_no_commas
  462.         { $$ = parser_build_binary_op ($2, $1, $3); }
  463.     | expr_no_commas '^' expr_no_commas
  464.         { $$ = parser_build_binary_op ($2, $1, $3); }
  465.     | expr_no_commas ANDAND expr_no_commas
  466.         { $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $3); }
  467.     | expr_no_commas OROR expr_no_commas
  468.         { $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $3); }
  469.     | expr_no_commas '?' xexpr ':' expr_no_commas
  470.         { $$ = build_conditional_expr ($1, $3, $5); }
  471.     | expr_no_commas '=' expr_no_commas
  472.         { $$ = build_modify_expr ($1, NOP_EXPR, $3);
  473.           C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
  474.     | expr_no_commas ASSIGN expr_no_commas
  475.         { $$ = build_modify_expr ($1, $2, $3);
  476.           /* This inhibits warnings in truthvalue_conversion.  */
  477.           C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
  478.     ;
  479.  
  480. primary:
  481.     IDENTIFIER
  482.         {
  483.           tree context;
  484.  
  485.           $$ = lastiddecl;
  486.           if (!$$ || $$ == error_mark_node)
  487.             {
  488.               if (yychar == YYEMPTY)
  489.             yychar = YYLEX;
  490.               if (yychar == '(')
  491.             {
  492.                 {
  493.                   /* Ordinary implicit function declaration.  */
  494.                   $$ = implicitly_declare ($1);
  495.                   assemble_external ($$);
  496.                   TREE_USED ($$) = 1;
  497.                 }
  498.             }
  499.               else if (current_function_decl == 0)
  500.             {
  501.               error ("`%s' undeclared here (not in a function)",
  502.                  IDENTIFIER_POINTER ($1));
  503.               $$ = error_mark_node;
  504.             }
  505.               else
  506.             {
  507.                 {
  508.                   if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node
  509.                   || IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl)
  510.                 {
  511.                   error ("`%s' undeclared (first use this function)",
  512.                      IDENTIFIER_POINTER ($1));
  513.  
  514.                   if (! undeclared_variable_notice)
  515.                     {
  516.                       error ("(Each undeclared identifier is reported only once");
  517.                       error ("for each function it appears in.)");
  518.                       undeclared_variable_notice = 1;
  519.                     }
  520.                 }
  521.                   $$ = error_mark_node;
  522.                   /* Prevent repeated error messages.  */
  523.                   IDENTIFIER_GLOBAL_VALUE ($1) = error_mark_node;
  524.                   IDENTIFIER_ERROR_LOCUS ($1) = current_function_decl;
  525.                 }
  526.             }
  527.             }
  528.           else if (TREE_TYPE ($$) == error_mark_node)
  529.             $$ = error_mark_node;
  530.           else if (C_DECL_ANTICIPATED ($$))
  531.             {
  532.               /* The first time we see a build-in function used,
  533.              if it has not been declared.  */
  534.               C_DECL_ANTICIPATED ($$) = 0;
  535.               if (yychar == YYEMPTY)
  536.             yychar = YYLEX;
  537.               if (yychar == '(')
  538.             {
  539.               /* Omit the implicit declaration we
  540.                  would ordinarily do, so we don't lose
  541.                  the actual built in type.
  542.                  But print a diagnostic for the mismatch.  */
  543.                 if (TREE_CODE ($$) != FUNCTION_DECL)
  544.                   error ("`%s' implicitly declared as function",
  545.                      IDENTIFIER_POINTER (DECL_NAME ($$)));
  546.               else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$)))
  547.                     != TYPE_MODE (integer_type_node))
  548.                    && (TREE_TYPE (TREE_TYPE ($$))
  549.                        != void_type_node))
  550.                 pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
  551.                      IDENTIFIER_POINTER (DECL_NAME ($$)));
  552.               /* If it really returns void, change that to int.  */
  553.               if (TREE_TYPE (TREE_TYPE ($$)) == void_type_node)
  554.                 TREE_TYPE ($$)
  555.                   = build_function_type (integer_type_node,
  556.                              TYPE_ARG_TYPES (TREE_TYPE ($$)));
  557.             }
  558.               else
  559.             pedwarn ("built-in function `%s' used without declaration",
  560.                  IDENTIFIER_POINTER (DECL_NAME ($$)));
  561.  
  562.               /* Do what we would ordinarily do when a fn is used.  */
  563.               assemble_external ($$);
  564.               TREE_USED ($$) = 1;
  565.             }
  566.           else
  567.             {
  568.               assemble_external ($$);
  569.               TREE_USED ($$) = 1;
  570.             }
  571.  
  572.           if (TREE_CODE ($$) == CONST_DECL)
  573.             {
  574.               $$ = DECL_INITIAL ($$);
  575.               /* This is to prevent an enum whose value is 0
  576.              from being considered a null pointer constant.  */
  577.               $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$);
  578.               TREE_CONSTANT ($$) = 1;
  579.             }
  580.         }
  581.     | CONSTANT
  582.     | string
  583.         { $$ = combine_strings ($1); }
  584.     | '(' expr ')'
  585.         { char class = TREE_CODE_CLASS (TREE_CODE ($2));
  586.           if (class == 'e' || class == '1'
  587.               || class == '2' || class == '<')
  588.             C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
  589.           $$ = $2; }
  590.     | '(' error ')'
  591.         { $$ = error_mark_node; }
  592.     | '('
  593.         { if (current_function_decl == 0)
  594.             {
  595.               error ("braced-group within expression allowed only inside a function");
  596.               YYERROR;
  597.             }
  598.           /* We must force a BLOCK for this level
  599.              so that, if it is not expanded later,
  600.              there is a way to turn off the entire subtree of blocks
  601.              that are contained in it.  */
  602.           keep_next_level ();
  603.           push_iterator_stack ();
  604.           push_label_level ();
  605.           $<ttype>$ = expand_start_stmt_expr (); }
  606.       compstmt ')'
  607.         { tree rtl_exp;
  608.           if (pedantic)
  609.             pedwarn ("ANSI C forbids braced-groups within expressions");
  610.           pop_iterator_stack ();
  611.           pop_label_level ();
  612.           rtl_exp = expand_end_stmt_expr ($<ttype>2);
  613.           /* The statements have side effects, so the group does.  */
  614.           TREE_SIDE_EFFECTS (rtl_exp) = 1;
  615.  
  616.           if (TREE_CODE ($3) == BLOCK)
  617.             {
  618.               /* Make a BIND_EXPR for the BLOCK already made.  */
  619.               $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
  620.                   NULL_TREE, rtl_exp, $3);
  621.               /* Remove the block from the tree at this point.
  622.              It gets put back at the proper place
  623.              when the BIND_EXPR is expanded.  */
  624.               delete_block ($3);
  625.             }
  626.           else
  627.             $$ = $3;
  628.         }
  629.     | primary '(' exprlist ')'   %prec '.'
  630.         { $$ = build_function_call ($1, $3); }
  631.     | primary '[' expr ']'   %prec '.'
  632.         { $$ = build_array_ref ($1, $3); }
  633.     | primary '.' identifier
  634.         {
  635.             $$ = build_component_ref ($1, $3);
  636.         }
  637.     | primary POINTSAT identifier
  638.         {
  639.                   tree expr = build_indirect_ref ($1, "->");
  640.  
  641.                     $$ = build_component_ref (expr, $3);
  642.         }
  643.     | primary PLUSPLUS
  644.         { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
  645.     | primary MINUSMINUS
  646.         { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
  647.     ;
  648.  
  649. /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it.  */
  650. string:
  651.       STRING
  652.     | string STRING
  653.         { $$ = chainon ($1, $2); }
  654.     ;
  655.  
  656.  
  657. xdecls:
  658.     /* empty */
  659.     | datadecls
  660.     | datadecls ELLIPSIS
  661.         /* ... is used here to indicate a varargs function.  */
  662.         { c_mark_varargs ();
  663.           if (pedantic)
  664.             pedwarn ("ANSI C does not permit use of `varargs.h'"); }
  665.     ;
  666.  
  667. /* The following are analogous to lineno_decl, decls and decl
  668.    except that they do not allow nested functions.
  669.    They are used for old-style parm decls.  */
  670. lineno_datadecl:
  671.       save_filename save_lineno datadecl
  672.         { }
  673.     ;
  674.  
  675. datadecls:
  676.     lineno_datadecl
  677.     | errstmt
  678.     | datadecls lineno_datadecl
  679.     | lineno_datadecl errstmt
  680.     ;
  681.  
  682. datadecl:
  683.     typed_declspecs setspecs initdecls ';'
  684.         { current_declspecs = TREE_VALUE (declspec_stack);
  685.           declspec_stack = TREE_CHAIN (declspec_stack);
  686.           resume_momentary ($2); }
  687.     | declmods setspecs notype_initdecls ';'
  688.         { current_declspecs = TREE_VALUE (declspec_stack);
  689.           declspec_stack = TREE_CHAIN (declspec_stack);
  690.           resume_momentary ($2); }
  691.     | typed_declspecs ';'
  692.         { shadow_tag_warned ($1, 1);
  693.           pedwarn ("empty declaration"); }
  694.     | declmods ';'
  695.         { pedwarn ("empty declaration"); }
  696.     ;
  697.  
  698. /* This combination which saves a lineno before a decl
  699.    is the normal thing to use, rather than decl itself.
  700.    This is to avoid shift/reduce conflicts in contexts
  701.    where statement labels are allowed.  */
  702. lineno_decl:
  703.       save_filename save_lineno decl
  704.         { }
  705.     ;
  706.  
  707. decls:
  708.     lineno_decl
  709.     | errstmt
  710.     | decls lineno_decl
  711.     | lineno_decl errstmt
  712.     ;
  713.  
  714. /* records the type and storage class specs to use for processing
  715.    the declarators that follow.
  716.    Maintains a stack of outer-level values of current_declspecs,
  717.    for the sake of parm declarations nested in function declarators.  */
  718. setspecs: /* empty */
  719.         { $$ = suspend_momentary ();
  720.           pending_xref_error ();
  721.           declspec_stack = tree_cons (NULL_TREE, current_declspecs,
  722.                           declspec_stack);
  723.           current_declspecs = $<ttype>0; }
  724.     ;
  725.  
  726. decl:
  727.     typed_declspecs setspecs initdecls ';'
  728.         { current_declspecs = TREE_VALUE (declspec_stack);
  729.           declspec_stack = TREE_CHAIN (declspec_stack);
  730.           resume_momentary ($2); }
  731.     | declmods setspecs notype_initdecls ';'
  732.         { current_declspecs = TREE_VALUE (declspec_stack);
  733.           declspec_stack = TREE_CHAIN (declspec_stack);
  734.           resume_momentary ($2); }
  735.     | typed_declspecs setspecs nested_function
  736.         { current_declspecs = TREE_VALUE (declspec_stack);
  737.           declspec_stack = TREE_CHAIN (declspec_stack);
  738.           resume_momentary ($2); }
  739.     | declmods setspecs notype_nested_function
  740.         { current_declspecs = TREE_VALUE (declspec_stack);
  741.           declspec_stack = TREE_CHAIN (declspec_stack);
  742.           resume_momentary ($2); }
  743.     | typed_declspecs ';'
  744.         { shadow_tag ($1); }
  745.     | declmods ';'
  746.         { pedwarn ("empty declaration"); }
  747.     ;
  748.  
  749. /* Declspecs which contain at least one type specifier or typedef name.
  750.    (Just `const' or `volatile' is not enough.)
  751.    A typedef'd name following these is taken as a name to be declared.  */
  752.  
  753. typed_declspecs:
  754.       typespec reserved_declspecs
  755.         { $$ = tree_cons (NULL_TREE, $1, $2); }
  756.     | declmods typespec reserved_declspecs
  757.         { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
  758.     ;
  759.  
  760. reserved_declspecs:  /* empty */
  761.         { $$ = NULL_TREE; }
  762.     | reserved_declspecs typespecqual_reserved
  763.         { $$ = tree_cons (NULL_TREE, $2, $1); }
  764.     | reserved_declspecs SCSPEC
  765.         { if (extra_warnings)
  766.             warning ("`%s' is not at beginning of declaration",
  767.                  IDENTIFIER_POINTER ($2));
  768.           $$ = tree_cons (NULL_TREE, $2, $1); }
  769.     ;
  770.  
  771. /* List of just storage classes and type modifiers.
  772.    A declaration can start with just this, but then it cannot be used
  773.    to redeclare a typedef-name.  */
  774.  
  775. declmods:
  776.       TYPE_QUAL
  777.         { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
  778.           TREE_STATIC ($$) = 1; }
  779.     | SCSPEC
  780.         { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
  781.     | declmods TYPE_QUAL
  782.         { $$ = tree_cons (NULL_TREE, $2, $1);
  783.           TREE_STATIC ($$) = 1; }
  784.     | declmods SCSPEC
  785.         { if (extra_warnings && TREE_STATIC ($1))
  786.             warning ("`%s' is not at beginning of declaration",
  787.                  IDENTIFIER_POINTER ($2));
  788.           $$ = tree_cons (NULL_TREE, $2, $1);
  789.           TREE_STATIC ($$) = TREE_STATIC ($1); }
  790.     ;
  791.  
  792.  
  793. /* Used instead of declspecs where storage classes are not allowed
  794.    (that is, for typenames and structure components).
  795.    Don't accept a typedef-name if anything but a modifier precedes it.  */
  796.  
  797. typed_typespecs:
  798.       typespec reserved_typespecquals
  799.         { $$ = tree_cons (NULL_TREE, $1, $2); }
  800.     | nonempty_type_quals typespec reserved_typespecquals
  801.         { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
  802.     ;
  803.  
  804. reserved_typespecquals:  /* empty */
  805.         { $$ = NULL_TREE; }
  806.     | reserved_typespecquals typespecqual_reserved
  807.         { $$ = tree_cons (NULL_TREE, $2, $1); }
  808.     ;
  809.  
  810. /* A typespec (but not a type qualifier).
  811.    Once we have seen one of these in a declaration,
  812.    if a typedef name appears then it is being redeclared.  */
  813.  
  814. typespec: TYPESPEC
  815.     | structsp
  816.     | TYPENAME
  817.         { /* For a typedef name, record the meaning, not the name.
  818.              In case of `foo foo, bar;'.  */
  819.           $$ = lookup_name ($1); }
  820.     | TYPEOF '(' expr ')'
  821.         { $$ = TREE_TYPE ($3); }
  822.     | TYPEOF '(' typename ')'
  823.         { $$ = groktypename ($3); }
  824.     ;
  825.  
  826. /* A typespec that is a reserved word, or a type qualifier.  */
  827.  
  828. typespecqual_reserved: TYPESPEC
  829.     | TYPE_QUAL
  830.     | structsp
  831.     ;
  832.  
  833. initdecls:
  834.     initdcl
  835.     | initdecls ',' initdcl
  836.     ;
  837.  
  838. notype_initdecls:
  839.     notype_initdcl
  840.     | notype_initdecls ',' initdcl
  841.     ;
  842.  
  843. maybeasm:
  844.       /* empty */
  845.         { $$ = NULL_TREE; }
  846.     | ASM_KEYWORD '(' string ')'
  847.         { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
  848.           $$ = $3;
  849.         }
  850.     ;
  851.  
  852. initdcl:
  853.       declarator maybeasm maybe_attribute '='
  854.         { $<ttype>$ = start_decl ($1, current_declspecs, 1);
  855.           decl_attributes ($<ttype>$, $3);
  856.           start_init ($<ttype>$, $2, global_bindings_p ()); }
  857.       init
  858. /* Note how the declaration of the variable is in effect while its init is parsed! */
  859.         { finish_init ();
  860.           decl_attributes ($<ttype>5, $3);
  861.           finish_decl ($<ttype>5, $6, $2); }
  862.     | declarator maybeasm maybe_attribute
  863.         { tree d = start_decl ($1, current_declspecs, 0);
  864.           decl_attributes (d, $3);
  865.           finish_decl (d, NULL_TREE, $2); }
  866.     ;
  867.  
  868. notype_initdcl:
  869.       notype_declarator maybeasm maybe_attribute '='
  870.         { $<ttype>$ = start_decl ($1, current_declspecs, 1);
  871.           decl_attributes ($<ttype>$, $3);
  872.           start_init ($<ttype>$, $2, global_bindings_p ()); }
  873.       init
  874. /* Note how the declaration of the variable is in effect while its init is parsed! */
  875.         { finish_init ();
  876.           decl_attributes ($<ttype>5, $3);
  877.           finish_decl ($<ttype>5, $6, $2); }
  878.     | notype_declarator maybeasm maybe_attribute
  879.         { tree d = start_decl ($1, current_declspecs, 0);
  880.           decl_attributes (d, $3);
  881.           finish_decl (d, NULL_TREE, $2); }
  882.     ;
  883. /* the * rules are dummies to accept the Apollo extended syntax
  884.    so that the header files compile. */
  885. maybe_attribute:
  886.     /* empty */
  887.         { $$ = NULL_TREE; }
  888.     | ATTRIBUTE '(' '(' attribute_list ')' ')'
  889.         { $$ = $4; }
  890.     ;
  891.  
  892. attribute_list
  893.     : attrib
  894.     { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
  895.     | attribute_list ',' attrib
  896.     { $$ = tree_cons (NULL_TREE, $3, $1); }
  897.     ;
  898.  
  899. attrib
  900.     : IDENTIFIER
  901.     {
  902. #ifdef HANDLE_ATTRIBUTE0
  903.       /* give the function a chance to validate further attributes */
  904.       if (HANDLE_ATTRIBUTE0 (IDENTIFIER_POINTER ($1)) ||
  905.           (strcmp (IDENTIFIER_POINTER ($1), "packed")
  906.           && strcmp (IDENTIFIER_POINTER ($1), "noreturn")))
  907. #else
  908.       if (strcmp (IDENTIFIER_POINTER ($1), "packed")
  909.           && strcmp (IDENTIFIER_POINTER ($1), "noreturn"))
  910. #endif
  911.         warning ("`%s' attribute directive ignored",
  912.              IDENTIFIER_POINTER ($1));
  913.       $$ = $1; }
  914.     | TYPE_QUAL
  915.     | IDENTIFIER '(' IDENTIFIER ')'
  916.     { /* If not "mode (m)", then issue warning.  */
  917.       if (strcmp (IDENTIFIER_POINTER ($1), "mode") != 0)
  918.         {
  919.           warning ("`%s' attribute directive ignored",
  920.                IDENTIFIER_POINTER ($1));
  921.           $$ = $1;
  922.         }
  923.       else
  924.         $$ = tree_cons ($1, $3, NULL_TREE); }
  925.     | IDENTIFIER '(' CONSTANT ')'
  926.     { /* if not "aligned(n)", then issue warning */
  927.       if (strcmp (IDENTIFIER_POINTER ($1), "aligned") != 0
  928.           || TREE_CODE ($3) != INTEGER_CST)
  929.         {
  930.           warning ("`%s' attribute directive ignored",
  931.                IDENTIFIER_POINTER ($1));
  932.           $$ = $1;
  933.         }
  934.       else
  935.         $$ = tree_cons ($1, $3, NULL_TREE); }
  936.     | IDENTIFIER '(' IDENTIFIER ',' CONSTANT ',' CONSTANT ')'
  937.     { /* if not "format(...)", then issue warning */
  938.       if (strcmp (IDENTIFIER_POINTER ($1), "format") != 0
  939.           || TREE_CODE ($5) != INTEGER_CST
  940.           || TREE_CODE ($7) != INTEGER_CST)
  941.         {
  942.           warning ("`%s' attribute directive ignored",
  943.                IDENTIFIER_POINTER ($1));
  944.           $$ = $1;
  945.         }
  946.       else
  947.         $$ = tree_cons ($1,
  948.                 tree_cons ($3,
  949.                        tree_cons ($5, $7, NULL_TREE),
  950.                        NULL_TREE),
  951.                 NULL_TREE); }
  952.     ;
  953.  
  954. /* Initializers.  `init' is the entry point.  */
  955.  
  956. init:
  957.     expr_no_commas
  958.     | '{'
  959.         { really_start_incremental_init (NULL_TREE);
  960.           /* Note that the call to clear_momentary
  961.              is in process_init_element.  */
  962.           push_momentary (); }
  963.       initlist_maybe_comma '}'
  964.         { $$ = pop_init_level (0);
  965.           if ($$ == error_mark_node)
  966.             pop_momentary ();
  967.           else
  968.             pop_momentary_nofree (); }
  969.  
  970.     | error
  971.         { $$ = error_mark_node; }
  972.     ;
  973.  
  974. /* `initlist_maybe_comma' is the guts of an initializer in braces.  */
  975. initlist_maybe_comma:
  976.       /* empty */
  977.         { if (pedantic)
  978.             pedwarn ("ANSI C forbids empty initializer braces"); }
  979.     | initlist1 maybecomma
  980.     ;
  981.  
  982. initlist1:
  983.       initelt
  984.     | initlist1 ',' initelt
  985.     ;
  986.  
  987. /* `initelt' is a single element of an initializer.
  988.    It may use braces.  */
  989. initelt:
  990.     expr_no_commas
  991.         { process_init_element ($1); }
  992.     | '{' 
  993.         { push_init_level (0); }
  994.       initlist_maybe_comma '}'
  995.         { process_init_element (pop_init_level (0)); }
  996.     | error
  997.     /* These are for labeled elements.  The syntax for an array element
  998.        initializer conflicts with the syntax for an Objective-C message,
  999.        so don't include these productions in the Objective-C grammer.  */
  1000.     | '[' expr_no_commas ELLIPSIS expr_no_commas ']' '='
  1001.         { set_init_index ($2, $4); }
  1002.       initelt
  1003.     | '[' expr_no_commas ']' '='
  1004.         { set_init_index ($2, NULL_TREE); }
  1005.       initelt
  1006.     | identifier ':'
  1007.         { set_init_label ($1); }
  1008.       initelt
  1009.     | '.' identifier '='
  1010.         { set_init_label ($2); }
  1011.       initelt
  1012.     ;
  1013.  
  1014. nested_function:
  1015.       declarator
  1016.         { push_c_function_context ();
  1017.           if (! start_function (current_declspecs, $1, 1))
  1018.             {
  1019.               pop_c_function_context ();
  1020.               YYERROR1;
  1021.             }
  1022.           reinit_parse_for_function ();
  1023.           store_parm_decls (); }
  1024. /* This used to use compstmt_or_error.
  1025.    That caused a bug with input `f(g) int g {}',
  1026.    where the use of YYERROR1 above caused an error
  1027.    which then was handled by compstmt_or_error.
  1028.    There followed a repeated execution of that same rule,
  1029.    which called YYERROR1 again, and so on.  */
  1030.       compstmt
  1031.         { finish_function (1);
  1032.           pop_c_function_context (); }
  1033.     ;
  1034.  
  1035. notype_nested_function:
  1036.       notype_declarator
  1037.         { push_c_function_context ();
  1038.           if (! start_function (current_declspecs, $1, 1))
  1039.             {
  1040.               pop_c_function_context ();
  1041.               YYERROR1;
  1042.             }
  1043.           reinit_parse_for_function ();
  1044.           store_parm_decls (); }
  1045. /* This used to use compstmt_or_error.
  1046.    That caused a bug with input `f(g) int g {}',
  1047.    where the use of YYERROR1 above caused an error
  1048.    which then was handled by compstmt_or_error.
  1049.    There followed a repeated execution of that same rule,
  1050.    which called YYERROR1 again, and so on.  */
  1051.       compstmt
  1052.         { finish_function (1);
  1053.           pop_c_function_context (); }
  1054.     ;
  1055.  
  1056. /* Any kind of declarator (thus, all declarators allowed
  1057.    after an explicit typespec).  */
  1058.  
  1059. declarator:
  1060.       after_type_declarator
  1061.     | notype_declarator
  1062.     ;
  1063.  
  1064. /* A declarator that is allowed only after an explicit typespec.  */
  1065.  
  1066. after_type_declarator:
  1067.       '(' after_type_declarator ')'
  1068.         { $$ = $2; }
  1069.     | after_type_declarator '(' parmlist_or_identifiers  %prec '.'
  1070.         { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
  1071. /*    | after_type_declarator '(' error ')'  %prec '.'
  1072.         { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
  1073.           poplevel (0, 0, 0); }  */
  1074.     | after_type_declarator '[' expr ']'  %prec '.'
  1075.         { $$ = build_nt (ARRAY_REF, $1, $3); }
  1076.     | after_type_declarator '[' ']'  %prec '.'
  1077.         { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
  1078.     | '*' type_quals after_type_declarator  %prec UNARY
  1079.         { $$ = make_pointer_declarator ($2, $3); }
  1080.     | TYPENAME
  1081.     ;
  1082.  
  1083. /* Kinds of declarator that can appear in a parameter list
  1084.    in addition to notype_declarator.  This is like after_type_declarator
  1085.    but does not allow a typedef name in parentheses as an identifier
  1086.    (because it would conflict with a function with that typedef as arg).  */
  1087.  
  1088. parm_declarator:
  1089.       parm_declarator '(' parmlist_or_identifiers  %prec '.'
  1090.         { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
  1091. /*    | parm_declarator '(' error ')'  %prec '.'
  1092.         { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
  1093.           poplevel (0, 0, 0); }  */
  1094.     | parm_declarator '[' expr ']'  %prec '.'
  1095.         { $$ = build_nt (ARRAY_REF, $1, $3); }
  1096.     | parm_declarator '[' ']'  %prec '.'
  1097.         { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
  1098.     | '*' type_quals parm_declarator  %prec UNARY
  1099.         { $$ = make_pointer_declarator ($2, $3); }
  1100.     | TYPENAME
  1101.     ;
  1102.  
  1103. /* A declarator allowed whether or not there has been
  1104.    an explicit typespec.  These cannot redeclare a typedef-name.  */
  1105.  
  1106. notype_declarator:
  1107.       notype_declarator '(' parmlist_or_identifiers  %prec '.'
  1108.         { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
  1109. /*    | notype_declarator '(' error ')'  %prec '.'
  1110.         { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
  1111.           poplevel (0, 0, 0); }  */
  1112.     | '(' notype_declarator ')'
  1113.         { $$ = $2; }
  1114.     | '*' type_quals notype_declarator  %prec UNARY
  1115.         { $$ = make_pointer_declarator ($2, $3); }
  1116.     | notype_declarator '[' expr ']'  %prec '.'
  1117.         { $$ = build_nt (ARRAY_REF, $1, $3); }
  1118.     | notype_declarator '[' ']'  %prec '.'
  1119.         { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
  1120.     | IDENTIFIER
  1121.     ;
  1122.  
  1123. structsp:
  1124.       STRUCT identifier '{'
  1125.         { $$ = start_struct (RECORD_TYPE, $2);
  1126.           /* Start scope of tag before parsing components.  */
  1127.         }
  1128.       component_decl_list '}'
  1129.         { $$ = finish_struct ($<ttype>4, $5);
  1130.           /* Really define the structure.  */
  1131.         }
  1132.     | STRUCT '{' component_decl_list '}'
  1133.         { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
  1134.                       $3); }
  1135.     | STRUCT identifier
  1136.         { $$ = xref_tag (RECORD_TYPE, $2); }
  1137.     | UNION identifier '{'
  1138.         { $$ = start_struct (UNION_TYPE, $2); }
  1139.       component_decl_list '}'
  1140.         { $$ = finish_struct ($<ttype>4, $5); }
  1141.     | UNION '{' component_decl_list '}'
  1142.         { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
  1143.                       $3); }
  1144.     | UNION identifier
  1145.         { $$ = xref_tag (UNION_TYPE, $2); }
  1146.     | ENUM identifier '{'
  1147.         { $<itype>3 = suspend_momentary ();
  1148.           $$ = start_enum ($2); }
  1149.       enumlist maybecomma_warn '}'
  1150.         { $$ = finish_enum ($<ttype>4, nreverse ($5));
  1151.           resume_momentary ($<itype>3); }
  1152.     | ENUM '{'
  1153.         { $<itype>2 = suspend_momentary ();
  1154.           $$ = start_enum (NULL_TREE); }
  1155.       enumlist maybecomma_warn '}'
  1156.         { $$ = finish_enum ($<ttype>3, nreverse ($4));
  1157.           resume_momentary ($<itype>2); }
  1158.     | ENUM identifier
  1159.         { $$ = xref_tag (ENUMERAL_TYPE, $2); }
  1160.     ;
  1161.  
  1162. maybecomma:
  1163.       /* empty */
  1164.     | ','
  1165.     ;
  1166.  
  1167. maybecomma_warn:
  1168.       /* empty */
  1169.     | ','
  1170.         { if (pedantic) pedwarn ("comma at end of enumerator list"); }
  1171.     ;
  1172.  
  1173. component_decl_list:
  1174.       component_decl_list2
  1175.         { $$ = $1; }
  1176.     | component_decl_list2 component_decl
  1177.         { $$ = chainon ($1, $2);
  1178.           pedwarn ("no semicolon at end of struct or union"); }
  1179.     ;
  1180.  
  1181. component_decl_list2:    /* empty */
  1182.         { $$ = NULL_TREE; }
  1183.     | component_decl_list2 component_decl ';'
  1184.         { $$ = chainon ($1, $2); }
  1185.     | component_decl_list2 ';'
  1186.         { if (pedantic)
  1187.             pedwarn ("extra semicolon in struct or union specified"); }
  1188.     ;
  1189.  
  1190. /* There is a shift-reduce conflict here, because `components' may
  1191.    start with a `typename'.  It happens that shifting (the default resolution)
  1192.    does the right thing, because it treats the `typename' as part of
  1193.    a `typed_typespecs'.
  1194.  
  1195.    It is possible that this same technique would allow the distinction
  1196.    between `notype_initdecls' and `initdecls' to be eliminated.
  1197.    But I am being cautious and not trying it.  */
  1198.  
  1199. component_decl:
  1200.       typed_typespecs setspecs components
  1201.         { $$ = $3;
  1202.           current_declspecs = TREE_VALUE (declspec_stack);
  1203.           declspec_stack = TREE_CHAIN (declspec_stack);
  1204.           resume_momentary ($2); }
  1205.     | typed_typespecs
  1206.         { if (pedantic)
  1207.             pedwarn ("ANSI C forbids member declarations with no members");
  1208.           shadow_tag($1);
  1209.           $$ = NULL_TREE; }
  1210.     | nonempty_type_quals setspecs components
  1211.         { $$ = $3;
  1212.           current_declspecs = TREE_VALUE (declspec_stack);
  1213.           declspec_stack = TREE_CHAIN (declspec_stack);
  1214.           resume_momentary ($2); }
  1215.     | nonempty_type_quals
  1216.         { if (pedantic)
  1217.             pedwarn ("ANSI C forbids member declarations with no members");
  1218.           shadow_tag($1);
  1219.           $$ = NULL_TREE; }
  1220.     | error
  1221.         { $$ = NULL_TREE; }
  1222.     ;
  1223.  
  1224. components:
  1225.       component_declarator
  1226.     | components ',' component_declarator
  1227.         { $$ = chainon ($1, $3); }
  1228.     ;
  1229.  
  1230. component_declarator:
  1231.       save_filename save_lineno declarator maybe_attribute
  1232.         { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
  1233.           decl_attributes ($$, $4); }
  1234.     | save_filename save_lineno
  1235.       declarator ':' expr_no_commas maybe_attribute
  1236.         { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
  1237.           decl_attributes ($$, $6); }
  1238.     | save_filename save_lineno ':' expr_no_commas maybe_attribute
  1239.         { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
  1240.           decl_attributes ($$, $5); }
  1241.     ;
  1242.  
  1243. /* We chain the enumerators in reverse order.
  1244.    They are put in forward order where enumlist is used.
  1245.    (The order used to be significant, but no longer is so.
  1246.    However, we still maintain the order, just to be clean.)  */
  1247.  
  1248. enumlist:
  1249.       enumerator
  1250.     | enumlist ',' enumerator
  1251.         { $$ = chainon ($3, $1); }
  1252.     ;
  1253.  
  1254.  
  1255. enumerator:
  1256.       identifier
  1257.         { $$ = build_enumerator ($1, NULL_TREE); }
  1258.     | identifier '=' expr_no_commas
  1259.         { $$ = build_enumerator ($1, $3); }
  1260.     ;
  1261.  
  1262. typename:
  1263.     typed_typespecs absdcl
  1264.         { $$ = build_tree_list ($1, $2); }
  1265.     | nonempty_type_quals absdcl
  1266.         { $$ = build_tree_list ($1, $2); }
  1267.     ;
  1268.  
  1269. absdcl:   /* an absolute declarator */
  1270.     /* empty */
  1271.         { $$ = NULL_TREE; }
  1272.     | absdcl1
  1273.     ;
  1274.  
  1275. nonempty_type_quals:
  1276.       TYPE_QUAL
  1277.         { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
  1278.     | nonempty_type_quals TYPE_QUAL
  1279.         { $$ = tree_cons (NULL_TREE, $2, $1); }
  1280.     ;
  1281.  
  1282. type_quals:
  1283.       /* empty */
  1284.         { $$ = NULL_TREE; }
  1285.     | type_quals TYPE_QUAL
  1286.         { $$ = tree_cons (NULL_TREE, $2, $1); }
  1287.     ;
  1288.  
  1289. absdcl1:  /* a nonempty absolute declarator */
  1290.       '(' absdcl1 ')'
  1291.         { $$ = $2; }
  1292.       /* `(typedef)1' is `int'.  */
  1293.     | '*' type_quals absdcl1  %prec UNARY
  1294.         { $$ = make_pointer_declarator ($2, $3); }
  1295.     | '*' type_quals  %prec UNARY
  1296.         { $$ = make_pointer_declarator ($2, NULL_TREE); }
  1297.     | absdcl1 '(' parmlist  %prec '.'
  1298.         { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
  1299.     | absdcl1 '[' expr ']'  %prec '.'
  1300.         { $$ = build_nt (ARRAY_REF, $1, $3); }
  1301.     | absdcl1 '[' ']'  %prec '.'
  1302.         { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
  1303.     | '(' parmlist  %prec '.'
  1304.         { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
  1305.     | '[' expr ']'  %prec '.'
  1306.         { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
  1307.     | '[' ']'  %prec '.'
  1308.         { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
  1309.     ;
  1310.  
  1311. /* at least one statement, the first of which parses without error.  */
  1312. /* stmts is used only after decls, so an invalid first statement
  1313.    is actually regarded as an invalid decl and part of the decls.  */
  1314.  
  1315. stmts:
  1316.       lineno_stmt_or_label
  1317.     | stmts lineno_stmt_or_label
  1318.     | stmts errstmt
  1319.     ;
  1320.  
  1321. xstmts:
  1322.     /* empty */
  1323.     | stmts
  1324.     ;
  1325.  
  1326. errstmt:  error ';'
  1327.     ;
  1328.  
  1329. pushlevel:  /* empty */
  1330.         { emit_line_note (input_filename, lineno);
  1331.           pushlevel (0);
  1332.           clear_last_expr ();
  1333.           push_momentary ();
  1334.           expand_start_bindings (0);
  1335.         }
  1336.     ;
  1337.  
  1338. /* Read zero or more forward-declarations for labels
  1339.    that nested functions can jump to.  */
  1340. maybe_label_decls:
  1341.       /* empty */
  1342.     | label_decls
  1343.         { if (pedantic)
  1344.             pedwarn ("ANSI C forbids label declarations"); }
  1345.     ;
  1346.  
  1347. label_decls:
  1348.       label_decl
  1349.     | label_decls label_decl
  1350.     ;
  1351.  
  1352. label_decl:
  1353.       LABEL identifiers_or_typenames ';'
  1354.         { tree link;
  1355.           for (link = $2; link; link = TREE_CHAIN (link))
  1356.             {
  1357.               tree label = shadow_label (TREE_VALUE (link));
  1358.               C_DECLARED_LABEL_FLAG (label) = 1;
  1359.               declare_nonlocal_label (label);
  1360.             }
  1361.         }
  1362.     ;
  1363.  
  1364. /* This is the body of a function definition.
  1365.    It causes syntax errors to ignore to the next openbrace.  */
  1366. compstmt_or_error:
  1367.       compstmt
  1368.         {}
  1369.     | error compstmt
  1370.     ;
  1371.  
  1372. compstmt: '{' '}'
  1373.         { $$ = convert (void_type_node, integer_zero_node); }
  1374.     | '{' pushlevel maybe_label_decls decls xstmts '}'
  1375.         { emit_line_note (input_filename, lineno);
  1376.           expand_end_bindings (getdecls (), 1, 0);
  1377.           $$ = poplevel (1, 1, 0);
  1378.           pop_momentary (); }
  1379.     | '{' pushlevel maybe_label_decls error '}'
  1380.         { emit_line_note (input_filename, lineno);
  1381.           expand_end_bindings (getdecls (), kept_level_p (), 0);
  1382.           $$ = poplevel (kept_level_p (), 0, 0);
  1383.           pop_momentary (); }
  1384.     | '{' pushlevel maybe_label_decls stmts '}'
  1385.         { emit_line_note (input_filename, lineno);
  1386.           expand_end_bindings (getdecls (), kept_level_p (), 0);
  1387.           $$ = poplevel (kept_level_p (), 0, 0);
  1388.           pop_momentary (); }
  1389.     ;
  1390.  
  1391. /* Value is number of statements counted as of the closeparen.  */
  1392. simple_if:
  1393.       if_prefix lineno_labeled_stmt
  1394. /* Make sure expand_end_cond is run once
  1395.    for each call to expand_start_cond.
  1396.    Otherwise a crash is likely.  */
  1397.     | if_prefix error
  1398.     ;
  1399.  
  1400. if_prefix:
  1401.       IF '(' expr ')'
  1402.         { emit_line_note ($<filename>-1, $<lineno>0);
  1403.           expand_start_cond (truthvalue_conversion ($3), 0);
  1404.           $<itype>$ = stmt_count;
  1405.           if_stmt_file = $<filename>-1;
  1406.           if_stmt_line = $<lineno>0;
  1407.           position_after_white_space (); }
  1408.     ;
  1409.  
  1410. /* This is a subroutine of stmt.
  1411.    It is used twice, once for valid DO statements
  1412.    and once for catching errors in parsing the end test.  */
  1413. do_stmt_start:
  1414.       DO
  1415.         { stmt_count++;
  1416.           emit_line_note ($<filename>-1, $<lineno>0);
  1417.           /* See comment in `while' alternative, above.  */
  1418.           emit_nop ();
  1419.           expand_start_loop_continue_elsewhere (1);
  1420.           position_after_white_space (); }
  1421.       lineno_labeled_stmt WHILE
  1422.         { expand_loop_continue_here (); }
  1423.     ;
  1424.  
  1425. save_filename:
  1426.         { $$ = input_filename; }
  1427.     ;
  1428.  
  1429. save_lineno:
  1430.         { $$ = lineno; }
  1431.     ;
  1432.  
  1433. lineno_labeled_stmt:
  1434.       save_filename save_lineno stmt
  1435.         { }
  1436. /*    | save_filename save_lineno error
  1437.         { }
  1438. */
  1439.     | save_filename save_lineno label lineno_labeled_stmt
  1440.         { }
  1441.     ;
  1442.  
  1443. lineno_stmt_or_label:
  1444.       save_filename save_lineno stmt_or_label
  1445.         { }
  1446.     ;
  1447.  
  1448. stmt_or_label:
  1449.       stmt
  1450.     | label
  1451.         { int next;
  1452.           position_after_white_space ();
  1453.           next = getc (finput);
  1454.           ungetc (next, finput);
  1455.           if (pedantic && next == '}')
  1456.             pedwarn ("ANSI C forbids label at end of compound statement");
  1457.         }
  1458.     ;
  1459.  
  1460. /* Parse a single real statement, not including any labels.  */
  1461. stmt:
  1462.       compstmt
  1463.         { stmt_count++; }
  1464.         | all_iter_stmt 
  1465.     | expr ';'
  1466.         { stmt_count++;
  1467.           emit_line_note ($<filename>-1, $<lineno>0);
  1468. /* It appears that this should not be done--that a non-lvalue array
  1469.    shouldn't get an error if the value isn't used.
  1470.    Section 3.2.2.1 says that an array lvalue gets converted to a pointer
  1471.    if it appears as a top-level expression,
  1472.    but says nothing about non-lvalue arrays.  */
  1473. #if 0
  1474.           /* Call default_conversion to get an error
  1475.              on referring to a register array if pedantic.  */
  1476.           if (TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE
  1477.               || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE)
  1478.             $1 = default_conversion ($1);
  1479. #endif
  1480.           iterator_expand ($1);
  1481.           clear_momentary (); }
  1482.     | simple_if ELSE
  1483.         { expand_start_else ();
  1484.           $<itype>1 = stmt_count;
  1485.           position_after_white_space (); }
  1486.       lineno_labeled_stmt
  1487.         { expand_end_cond ();
  1488.           if (extra_warnings && stmt_count == $<itype>1)
  1489.             warning ("empty body in an else-statement"); }
  1490.     | simple_if %prec IF
  1491.         { expand_end_cond ();
  1492.           /* This warning is here instead of in simple_if, because we
  1493.              do not want a warning if an empty if is followed by an
  1494.              else statement.  */
  1495.           if (extra_warnings && stmt_count == $<itype>1)
  1496.             warning_with_file_and_line (if_stmt_file, if_stmt_line,
  1497.                         "empty body in an if-statement"); }
  1498. /* Make sure expand_end_cond is run once
  1499.    for each call to expand_start_cond.
  1500.    Otherwise a crash is likely.  */
  1501.     | simple_if ELSE error
  1502.         { expand_end_cond (); }
  1503.     | WHILE
  1504.         { stmt_count++;
  1505.           emit_line_note ($<filename>-1, $<lineno>0);
  1506.           /* The emit_nop used to come before emit_line_note,
  1507.              but that made the nop seem like part of the preceding line.
  1508.              And that was confusing when the preceding line was
  1509.              inside of an if statement and was not really executed.
  1510.              I think it ought to work to put the nop after the line number.
  1511.              We will see.  --rms, July 15, 1991.  */
  1512.           emit_nop (); }
  1513.       '(' expr ')'
  1514.         { /* Don't start the loop till we have succeeded
  1515.              in parsing the end test.  This is to make sure
  1516.              that we end every loop we start.  */
  1517.           expand_start_loop (1);
  1518.           emit_line_note (input_filename, lineno);
  1519.           expand_exit_loop_if_false (NULL_PTR,
  1520.                          truthvalue_conversion ($4));
  1521.           position_after_white_space (); }
  1522.       lineno_labeled_stmt
  1523.         { expand_end_loop (); }
  1524.     | do_stmt_start
  1525.       '(' expr ')' ';'
  1526.         { emit_line_note (input_filename, lineno);
  1527.           expand_exit_loop_if_false (NULL_PTR,
  1528.                          truthvalue_conversion ($3));
  1529.           expand_end_loop ();
  1530.           clear_momentary (); }
  1531. /* This rule is needed to make sure we end every loop we start.  */
  1532.     | do_stmt_start error
  1533.         { expand_end_loop ();
  1534.           clear_momentary (); }
  1535.     | FOR
  1536.       '(' xexpr ';'
  1537.         { stmt_count++;
  1538.           emit_line_note ($<filename>-1, $<lineno>0);
  1539.           /* See comment in `while' alternative, above.  */
  1540.           emit_nop ();
  1541.           if ($3) c_expand_expr_stmt ($3);
  1542.           /* Next step is to call expand_start_loop_continue_elsewhere,
  1543.              but wait till after we parse the entire for (...).
  1544.              Otherwise, invalid input might cause us to call that
  1545.              fn without calling expand_end_loop.  */
  1546.         }
  1547.       xexpr ';'
  1548.         /* Can't emit now; wait till after expand_start_loop...  */
  1549.         { $<lineno>7 = lineno;
  1550.           $<filename>$ = input_filename; }
  1551.       xexpr ')'
  1552.         { 
  1553.           /* Start the loop.  Doing this after parsing
  1554.              all the expressions ensures we will end the loop.  */
  1555.           expand_start_loop_continue_elsewhere (1);
  1556.           /* Emit the end-test, with a line number.  */
  1557.           emit_line_note ($<filename>8, $<lineno>7);
  1558.           if ($6)
  1559.             expand_exit_loop_if_false (NULL_PTR,
  1560.                            truthvalue_conversion ($6));
  1561.           /* Don't let the tree nodes for $9 be discarded by
  1562.              clear_momentary during the parsing of the next stmt.  */
  1563.           push_momentary ();
  1564.           $<lineno>7 = lineno;
  1565.           $<filename>8 = input_filename;
  1566.           position_after_white_space (); }
  1567.       lineno_labeled_stmt
  1568.         { /* Emit the increment expression, with a line number.  */
  1569.           emit_line_note ($<filename>8, $<lineno>7);
  1570.           expand_loop_continue_here ();
  1571.           if ($9)
  1572.             c_expand_expr_stmt ($9);
  1573.           pop_momentary ();
  1574.           expand_end_loop (); }
  1575.     | SWITCH '(' expr ')'
  1576.         { stmt_count++;
  1577.           emit_line_note ($<filename>-1, $<lineno>0);
  1578.           c_expand_start_case ($3);
  1579.           /* Don't let the tree nodes for $3 be discarded by
  1580.              clear_momentary during the parsing of the next stmt.  */
  1581.           push_momentary ();
  1582.           position_after_white_space (); }
  1583.       lineno_labeled_stmt
  1584.         { expand_end_case ($3);
  1585.           pop_momentary (); }
  1586.     | BREAK ';'
  1587.         { stmt_count++;
  1588.           emit_line_note ($<filename>-1, $<lineno>0);
  1589.           if ( ! expand_exit_something ())
  1590.             error ("break statement not within loop or switch"); }
  1591.     | CONTINUE ';'
  1592.         { stmt_count++;
  1593.           emit_line_note ($<filename>-1, $<lineno>0);
  1594.           if (! expand_continue_loop (NULL_PTR))
  1595.             error ("continue statement not within a loop"); }
  1596.     | RETURN ';'
  1597.         { stmt_count++;
  1598.           emit_line_note ($<filename>-1, $<lineno>0);
  1599.           c_expand_return (NULL_TREE); }
  1600.     | RETURN expr ';'
  1601.         { stmt_count++;
  1602.           emit_line_note ($<filename>-1, $<lineno>0);
  1603.           c_expand_return ($2); }
  1604.     | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
  1605.         { stmt_count++;
  1606.           emit_line_note ($<filename>-1, $<lineno>0);
  1607.           STRIP_NOPS ($4);
  1608.           if ((TREE_CODE ($4) == ADDR_EXPR
  1609.                && TREE_CODE (TREE_OPERAND ($4, 0)) == STRING_CST)
  1610.               || TREE_CODE ($4) == STRING_CST)
  1611.             expand_asm ($4);
  1612.           else
  1613.             error ("argument of `asm' is not a constant string"); }
  1614.     /* This is the case with just output operands.  */
  1615.     | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
  1616.         { stmt_count++;
  1617.           emit_line_note ($<filename>-1, $<lineno>0);
  1618.           c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
  1619.                      $2 == ridpointers[(int)RID_VOLATILE],
  1620.                      input_filename, lineno); }
  1621.     /* This is the case with input operands as well.  */
  1622.     | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';'
  1623.         { stmt_count++;
  1624.           emit_line_note ($<filename>-1, $<lineno>0);
  1625.           c_expand_asm_operands ($4, $6, $8, NULL_TREE,
  1626.                      $2 == ridpointers[(int)RID_VOLATILE],
  1627.                      input_filename, lineno); }
  1628.     /* This is the case with clobbered registers as well.  */
  1629.     | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
  1630.         asm_operands ':' asm_clobbers ')' ';'
  1631.         { stmt_count++;
  1632.           emit_line_note ($<filename>-1, $<lineno>0);
  1633.           c_expand_asm_operands ($4, $6, $8, $10,
  1634.                      $2 == ridpointers[(int)RID_VOLATILE],
  1635.                      input_filename, lineno); }
  1636.     | GOTO identifier ';'
  1637.         { tree decl;
  1638.           stmt_count++;
  1639.           emit_line_note ($<filename>-1, $<lineno>0);
  1640.           decl = lookup_label ($2);
  1641.           if (decl != 0)
  1642.             {
  1643.               TREE_USED (decl) = 1;
  1644.               expand_goto (decl);
  1645.             }
  1646.         }
  1647.     | GOTO '*' expr ';'
  1648.         { stmt_count++;
  1649.           emit_line_note ($<filename>-1, $<lineno>0);
  1650.           expand_computed_goto (convert (ptr_type_node, $3)); }
  1651.     | ';'
  1652.     ;
  1653.  
  1654. all_iter_stmt:
  1655.       all_iter_stmt_simple
  1656. /*    | all_iter_stmt_with_decl */
  1657.     ;
  1658.  
  1659. all_iter_stmt_simple:
  1660.       FOR '(' primary ')' 
  1661.       {
  1662.         /* The value returned by this action is  */
  1663.         /*      1 if everything is OK */ 
  1664.         /*      0 in case of error or already bound iterator */
  1665.  
  1666.         $<itype>$ = 0;
  1667.         if (TREE_CODE ($3) != VAR_DECL)
  1668.           error ("invalid `for (ITERATOR)' syntax");
  1669.         else if (! ITERATOR_P ($3))
  1670.           error ("`%s' is not an iterator",
  1671.              IDENTIFIER_POINTER (DECL_NAME ($3)));
  1672.         else if (ITERATOR_BOUND_P ($3))
  1673.           error ("`for (%s)' inside expansion of same iterator",
  1674.              IDENTIFIER_POINTER (DECL_NAME ($3)));
  1675.         else
  1676.           {
  1677.         $<itype>$ = 1;
  1678.         iterator_for_loop_start ($3);
  1679.           }
  1680.       }
  1681.       lineno_labeled_stmt
  1682.       {
  1683.         if ($<itype>5)
  1684.           iterator_for_loop_end ($3);
  1685.       }
  1686.  
  1687. /*  This really should allow any kind of declaration,
  1688.     for generality.  Fix it before turning it back on.
  1689.  
  1690. all_iter_stmt_with_decl:
  1691.       FOR '(' ITERATOR pushlevel setspecs iterator_spec ')' 
  1692.       {
  1693. */        /* The value returned by this action is  */
  1694.         /*      1 if everything is OK */ 
  1695.         /*      0 in case of error or already bound iterator */
  1696. /*
  1697.         iterator_for_loop_start ($6);
  1698.       }
  1699.       lineno_labeled_stmt
  1700.       {
  1701.         iterator_for_loop_end ($6);
  1702.         emit_line_note (input_filename, lineno);
  1703.         expand_end_bindings (getdecls (), 1, 0);
  1704.         $<ttype>$ = poplevel (1, 1, 0);
  1705.         pop_momentary ();        
  1706.       }
  1707. */
  1708.  
  1709. /* Any kind of label, including jump labels and case labels.
  1710.    ANSI C accepts labels only before statements, but we allow them
  1711.    also at the end of a compound statement.  */
  1712.  
  1713. label:      CASE expr_no_commas ':'
  1714.         { register tree value = check_case_value ($2);
  1715.           register tree label
  1716.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  1717.  
  1718.           stmt_count++;
  1719.  
  1720.           if (value != error_mark_node)
  1721.             {
  1722.               tree duplicate;
  1723.               int success = pushcase (value, convert_and_check,
  1724.                           label, &duplicate);
  1725.               if (success == 1)
  1726.             error ("case label not within a switch statement");
  1727.               else if (success == 2)
  1728.             {
  1729.               error ("duplicate case value");
  1730.               error_with_decl (duplicate, "this is the first entry for that value");
  1731.             }
  1732.               else if (success == 3)
  1733.             warning ("case value out of range");
  1734.               else if (success == 5)
  1735.             error ("case label within scope of cleanup or variable array");
  1736.             }
  1737.           position_after_white_space (); }
  1738.     | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
  1739.         { register tree value1 = check_case_value ($2);
  1740.           register tree value2 = check_case_value ($4);
  1741.           register tree label
  1742.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  1743.  
  1744.           stmt_count++;
  1745.  
  1746.           if (value1 != error_mark_node && value2 != error_mark_node)
  1747.             {
  1748.               tree duplicate;
  1749.               int success = pushcase_range (value1, value2,
  1750.                             convert_and_check, label,
  1751.                             &duplicate);
  1752.               if (success == 1)
  1753.             error ("case label not within a switch statement");
  1754.               else if (success == 2)
  1755.             {
  1756.               error ("duplicate case value");
  1757.               error_with_decl (duplicate, "this is the first entry for that value");
  1758.             }
  1759.               else if (success == 3)
  1760.             warning ("case value out of range");
  1761.               else if (success == 4)
  1762.             warning ("empty case range");
  1763.               else if (success == 5)
  1764.             error ("case label within scope of cleanup or variable array");
  1765.             }
  1766.           position_after_white_space (); }
  1767.     | DEFAULT ':'
  1768.         {
  1769.           tree duplicate;
  1770.           register tree label
  1771.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  1772.           int success = pushcase (NULL_TREE, 0, label, &duplicate);
  1773.           stmt_count++;
  1774.           if (success == 1)
  1775.             error ("default label not within a switch statement");
  1776.           else if (success == 2)
  1777.             {
  1778.               error ("multiple default labels in one switch");
  1779.               error_with_decl (duplicate, "this is the first default label");
  1780.             }
  1781.           position_after_white_space (); }
  1782.     | identifier ':'
  1783.         { tree label = define_label (input_filename, lineno, $1);
  1784.           stmt_count++;
  1785.           emit_nop ();
  1786.           if (label)
  1787.             expand_label (label);
  1788.           position_after_white_space (); }
  1789.     ;
  1790.  
  1791. /* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
  1792.  
  1793. maybe_type_qual:
  1794.     /* empty */
  1795.         { emit_line_note (input_filename, lineno);
  1796.           $$ = NULL_TREE; }
  1797.     | TYPE_QUAL
  1798.         { emit_line_note (input_filename, lineno); }
  1799.     ;
  1800.  
  1801. xexpr:
  1802.     /* empty */
  1803.         { $$ = NULL_TREE; }
  1804.     | expr
  1805.     ;
  1806.  
  1807. /* These are the operands other than the first string and colon
  1808.    in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
  1809. asm_operands: /* empty */
  1810.         { $$ = NULL_TREE; }
  1811.     | nonnull_asm_operands
  1812.     ;
  1813.  
  1814. nonnull_asm_operands:
  1815.       asm_operand
  1816.     | nonnull_asm_operands ',' asm_operand
  1817.         { $$ = chainon ($1, $3); }
  1818.     ;
  1819.  
  1820. asm_operand:
  1821.       STRING '(' expr ')'
  1822.         { $$ = build_tree_list ($1, $3); }
  1823.     ;
  1824.  
  1825. asm_clobbers:
  1826.       string
  1827.         { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); }
  1828.     | asm_clobbers ',' string
  1829.         { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
  1830.     ;
  1831.  
  1832. /* This is what appears inside the parens in a function declarator.
  1833.    Its value is a list of ..._TYPE nodes.  */
  1834. parmlist:
  1835.         { pushlevel (0);
  1836.           clear_parm_order ();
  1837.           declare_parm_level (0); }
  1838.       parmlist_1
  1839.         { $$ = $2;
  1840.           parmlist_tags_warning ();
  1841.           poplevel (0, 0, 0); }
  1842.     ;
  1843.  
  1844. parmlist_1:
  1845.       parmlist_2 ')'
  1846.     | parms ';'
  1847.         { tree parm;
  1848.           if (pedantic)
  1849.             pedwarn ("ANSI C forbids forward parameter declarations");
  1850.           /* Mark the forward decls as such.  */
  1851.           for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
  1852.             TREE_ASM_WRITTEN (parm) = 1;
  1853.           clear_parm_order (); }
  1854.       parmlist_1
  1855.         { $$ = $4; }
  1856.     | error ')'
  1857.         { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
  1858.     ;
  1859.  
  1860. /* This is what appears inside the parens in a function declarator.
  1861.    Is value is represented in the format that grokdeclarator expects.  */
  1862. parmlist_2:  /* empty */
  1863.         { $$ = get_parm_info (0); }
  1864.     | ELLIPSIS
  1865.         { $$ = get_parm_info (0);
  1866.           if (pedantic)
  1867.             pedwarn ("ANSI C requires a named argument before `...'");
  1868.         }
  1869.     | parms
  1870.         { $$ = get_parm_info (1); }
  1871.     | parms ',' ELLIPSIS
  1872.         { $$ = get_parm_info (0); }
  1873.     ;
  1874.  
  1875. parms:
  1876.     parm
  1877.         { push_parm_decl ($1); }
  1878.     | parms ',' parm
  1879.         { push_parm_decl ($3); }
  1880.     ;
  1881.  
  1882. /* A single parameter declaration or parameter type name,
  1883.    as found in a parmlist.  */
  1884. parm:
  1885.       typed_declspecs parm_declarator
  1886.         { $$ = build_tree_list ($1, $2)    ; }
  1887.     | typed_declspecs notype_declarator
  1888.         { $$ = build_tree_list ($1, $2)    ; }
  1889.     | typed_declspecs absdcl
  1890.         { $$ = build_tree_list ($1, $2); }
  1891.     | declmods notype_declarator
  1892.         { $$ = build_tree_list ($1, $2)    ; }
  1893.     | declmods absdcl
  1894.         { $$ = build_tree_list ($1, $2); }
  1895.     ;
  1896.  
  1897. /* This is used in a function definition
  1898.    where either a parmlist or an identifier list is ok.
  1899.    Its value is a list of ..._TYPE nodes or a list of identifiers.  */
  1900. parmlist_or_identifiers:
  1901.         { pushlevel (0);
  1902.           clear_parm_order ();
  1903.           declare_parm_level (1); }
  1904.       parmlist_or_identifiers_1
  1905.         { $$ = $2;
  1906.           parmlist_tags_warning ();
  1907.           poplevel (0, 0, 0); }
  1908.     ;
  1909.  
  1910. parmlist_or_identifiers_1:
  1911.       parmlist_1
  1912.     | identifiers ')'
  1913.         { tree t;
  1914.           for (t = $1; t; t = TREE_CHAIN (t))
  1915.             if (TREE_VALUE (t) == NULL_TREE)
  1916.               error ("`...' in old-style identifier list");
  1917.           $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }
  1918.     ;
  1919.  
  1920. /* A nonempty list of identifiers.  */
  1921. identifiers:
  1922.     IDENTIFIER
  1923.         { $$ = build_tree_list (NULL_TREE, $1); }
  1924.     | identifiers ',' IDENTIFIER
  1925.         { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
  1926.     ;
  1927.  
  1928. /* A nonempty list of identifiers, including typenames.  */
  1929. identifiers_or_typenames:
  1930.     identifier
  1931.         { $$ = build_tree_list (NULL_TREE, $1); }
  1932.     | identifiers_or_typenames ',' identifier
  1933.         { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
  1934.     ;
  1935.  
  1936. %%
  1937.