PageRenderTime 8ms CodeModel.GetById 18ms app.highlight 19ms RepoModel.GetById 1ms app.codeStats 1ms

/gcc/c-parse.y

https://github.com/acassis/xap-gcc
Happy | 3132 lines | 2808 code | 324 blank | 0 comment | 0 complexity | 75e13aa4d238329138d6b3add519f117 MD5 | raw file
   1/*WARNING: This file is automatically generated!*/
   2/* YACC parser for C syntax and for Objective C.  -*-c-*-
   3   Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996,
   4   1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
   5
   6This file is part of GCC.
   7
   8GCC is free software; you can redistribute it and/or modify it under
   9the terms of the GNU General Public License as published by the Free
  10Software Foundation; either version 2, or (at your option) any later
  11version.
  12
  13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  14WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16for more details.
  17
  18You should have received a copy of the GNU General Public License
  19along with GCC; see the file COPYING.  If not, write to the Free
  20Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  2102111-1307, USA.  */
  22
  23/* This file defines the grammar of C and that of Objective C.
  24   ifobjc ... end ifobjc  conditionals contain code for Objective C only.
  25   ifc ... end ifc  conditionals contain code for C only.
  26   Sed commands in Makefile.in are used to convert this file into
  27   c-parse.y and into objc-parse.y.  */
  28
  29/* To whomever it may concern: I have heard that such a thing was once
  30   written by AT&T, but I have never seen it.  */
  31
  32%expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts.  */
  33
  34%{
  35#include "config.h"
  36#include "system.h"
  37#include "tree.h"
  38#include "input.h"
  39#include "cpplib.h"
  40#include "intl.h"
  41#include "timevar.h"
  42#include "c-pragma.h"		/* For YYDEBUG definition, and parse_in.  */
  43#include "c-tree.h"
  44#include "flags.h"
  45#include "output.h"
  46#include "toplev.h"
  47#include "ggc.h"
  48
  49#ifdef MULTIBYTE_CHARS
  50#include <locale.h>
  51#endif
  52
  53
  54/* Like YYERROR but do call yyerror.  */
  55#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
  56
  57/* Like the default stack expander, except (1) use realloc when possible,
  58   (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca.
  59
  60   Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot
  61   give malloced_yyvs its proper type.  This is ok since all we need from
  62   it is to be able to free it.  */
  63
  64static short *malloced_yyss;
  65static void *malloced_yyvs;
  66
  67#define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ)			\
  68do {									\
  69  size_t newsize;							\
  70  short *newss;								\
  71  YYSTYPE *newvs;							\
  72  newsize = *(YYSSZ) *= 2;						\
  73  if (malloced_yyss)							\
  74    {									\
  75      newss = (short *)							\
  76	really_call_realloc (*(SS), newsize * sizeof (short));		\
  77      newvs = (YYSTYPE *)						\
  78	really_call_realloc (*(VS), newsize * sizeof (YYSTYPE));	\
  79    }									\
  80  else									\
  81    {									\
  82      newss = (short *) really_call_malloc (newsize * sizeof (short));	\
  83      newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \
  84      if (newss)							\
  85        memcpy (newss, *(SS), (SSSIZE));				\
  86      if (newvs)							\
  87        memcpy (newvs, *(VS), (VSSIZE));				\
  88    }									\
  89  if (!newss || !newvs)							\
  90    {									\
  91      yyerror (MSG);							\
  92      return 2;								\
  93    }									\
  94  *(SS) = newss;							\
  95  *(VS) = newvs;							\
  96  malloced_yyss = newss;						\
  97  malloced_yyvs = (void *) newvs;					\
  98} while (0)
  99%}
 100
 101%start program
 102
 103%union {long itype; tree ttype; enum tree_code code;
 104	const char *filename; int lineno; }
 105
 106/* All identifiers that are not reserved words
 107   and are not declared typedefs in the current block */
 108%token IDENTIFIER
 109
 110/* All identifiers that are declared typedefs in the current block.
 111   In some contexts, they are treated just like IDENTIFIER,
 112   but they can also serve as typespecs in declarations.  */
 113%token TYPENAME
 114
 115/* Reserved words that specify storage class.
 116   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 117%token SCSPEC			/* Storage class other than static.  */
 118%token STATIC			/* Static storage class.  */
 119
 120/* Reserved words that specify type.
 121   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 122%token TYPESPEC
 123
 124/* Reserved words that qualify type: "const", "volatile", or "restrict".
 125   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 126%token TYPE_QUAL
 127
 128/* Character or numeric constants.
 129   yylval is the node for the constant.  */
 130%token CONSTANT
 131
 132/* String constants in raw form.
 133   yylval is a STRING_CST node.  */
 134%token STRING
 135
 136/* "...", used for functions with variable arglists.  */
 137%token ELLIPSIS
 138
 139/* the reserved words */
 140/* SCO include files test "ASM", so use something else. */
 141%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
 142%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
 143%token ATTRIBUTE EXTENSION LABEL
 144%token REALPART IMAGPART VA_ARG CHOOSE_EXPR TYPES_COMPATIBLE_P
 145%token PTR_VALUE PTR_BASE PTR_EXTENT
 146
 147/* function name can be a string const or a var decl. */
 148%token STRING_FUNC_NAME VAR_FUNC_NAME
 149
 150/* Add precedence rules to solve dangling else s/r conflict */
 151%nonassoc IF
 152%nonassoc ELSE
 153
 154/* Define the operator tokens and their precedences.
 155   The value is an integer because, if used, it is the tree code
 156   to use in the expression made from the operator.  */
 157
 158%right <code> ASSIGN '='
 159%right <code> '?' ':'
 160%left <code> OROR
 161%left <code> ANDAND
 162%left <code> '|'
 163%left <code> '^'
 164%left <code> '&'
 165%left <code> EQCOMPARE
 166%left <code> ARITHCOMPARE
 167%left <code> LSHIFT RSHIFT
 168%left <code> '+' '-'
 169%left <code> '*' '/' '%'
 170%right <code> UNARY PLUSPLUS MINUSMINUS
 171%left HYPERUNARY
 172%left <code> POINTSAT '.' '(' '['
 173
 174/* The Objective-C keywords.  These are included in C and in
 175   Objective C, so that the token codes are the same in both.  */
 176%token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
 177%token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
 178
 179%type <code> unop
 180%type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
 181%type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
 182
 183%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
 184%type <ttype> expr_no_commas cast_expr unary_expr primary STRING
 185%type <ttype> declspecs_nosc_nots_nosa_noea declspecs_nosc_nots_nosa_ea
 186%type <ttype> declspecs_nosc_nots_sa_noea declspecs_nosc_nots_sa_ea
 187%type <ttype> declspecs_nosc_ts_nosa_noea declspecs_nosc_ts_nosa_ea
 188%type <ttype> declspecs_nosc_ts_sa_noea declspecs_nosc_ts_sa_ea
 189%type <ttype> declspecs_sc_nots_nosa_noea declspecs_sc_nots_nosa_ea
 190%type <ttype> declspecs_sc_nots_sa_noea declspecs_sc_nots_sa_ea
 191%type <ttype> declspecs_sc_ts_nosa_noea declspecs_sc_ts_nosa_ea
 192%type <ttype> declspecs_sc_ts_sa_noea declspecs_sc_ts_sa_ea
 193%type <ttype> declspecs_ts declspecs_nots
 194%type <ttype> declspecs_ts_nosa declspecs_nots_nosa
 195%type <ttype> declspecs_nosc_ts declspecs_nosc_nots declspecs_nosc declspecs
 196%type <ttype> maybe_type_quals_attrs typespec_nonattr typespec_attr
 197%type <ttype> typespec_reserved_nonattr typespec_reserved_attr
 198%type <ttype> typespec_nonreserved_nonattr
 199
 200%type <ttype> scspec SCSPEC STATIC TYPESPEC TYPE_QUAL maybe_type_qual
 201%type <ttype> initdecls notype_initdecls initdcl notype_initdcl
 202%type <ttype> init maybeasm
 203%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
 204%type <ttype> maybe_attribute attributes attribute attribute_list attrib
 205%type <ttype> any_word extension
 206
 207%type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
 208%type <ttype> do_stmt_start poplevel stmt label
 209
 210%type <ttype> c99_block_start c99_block_end
 211%type <ttype> declarator
 212%type <ttype> notype_declarator after_type_declarator
 213%type <ttype> parm_declarator
 214%type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename
 215%type <ttype> array_declarator
 216
 217%type <ttype> structsp_attr structsp_nonattr
 218%type <ttype> component_decl_list component_decl_list2
 219%type <ttype> component_decl components components_notype component_declarator
 220%type <ttype> component_notype_declarator
 221%type <ttype> enumlist enumerator
 222%type <ttype> struct_head union_head enum_head
 223%type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea
 224%type <ttype> direct_absdcl1 absdcl_maybe_attribute
 225%type <ttype> xexpr parms parm firstparm identifiers
 226
 227%type <ttype> parmlist parmlist_1 parmlist_2
 228%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
 229%type <ttype> identifiers_or_typenames
 230
 231%type <itype> setspecs setspecs_fp
 232
 233%type <filename> save_filename
 234%type <lineno> save_lineno
 235
 236
 237%{
 238/* Number of statements (loosely speaking) and compound statements
 239   seen so far.  */
 240static int stmt_count;
 241static int compstmt_count;
 242
 243/* Input file and line number of the end of the body of last simple_if;
 244   used by the stmt-rule immediately after simple_if returns.  */
 245static const char *if_stmt_file;
 246static int if_stmt_line;
 247
 248/* List of types and structure classes of the current declaration.  */
 249static GTY(()) tree current_declspecs;
 250static GTY(()) tree prefix_attributes;
 251
 252/* List of all the attributes applying to the identifier currently being
 253   declared; includes prefix_attributes and possibly some more attributes
 254   just after a comma.  */
 255static GTY(()) tree all_prefix_attributes;
 256
 257/* Stack of saved values of current_declspecs, prefix_attributes and
 258   all_prefix_attributes.  */
 259static GTY(()) tree declspec_stack;
 260
 261/* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
 262   should be called from the productions making use of setspecs.  */
 263#define PUSH_DECLSPEC_STACK						 \
 264  do {									 \
 265    declspec_stack = tree_cons (build_tree_list (prefix_attributes,	 \
 266						 all_prefix_attributes), \
 267				current_declspecs,			 \
 268				declspec_stack);			 \
 269  } while (0)
 270
 271#define POP_DECLSPEC_STACK						\
 272  do {									\
 273    current_declspecs = TREE_VALUE (declspec_stack);			\
 274    prefix_attributes = TREE_PURPOSE (TREE_PURPOSE (declspec_stack));	\
 275    all_prefix_attributes = TREE_VALUE (TREE_PURPOSE (declspec_stack));	\
 276    declspec_stack = TREE_CHAIN (declspec_stack);			\
 277  } while (0)
 278
 279/* For __extension__, save/restore the warning flags which are
 280   controlled by __extension__.  */
 281#define SAVE_EXT_FLAGS()			\
 282	size_int (pedantic			\
 283		  | (warn_pointer_arith << 1)	\
 284		  | (warn_traditional << 2)	\
 285		  | (flag_iso << 3))
 286
 287#define RESTORE_EXT_FLAGS(tval)			\
 288  do {						\
 289    int val = tree_low_cst (tval, 0);		\
 290    pedantic = val & 1;				\
 291    warn_pointer_arith = (val >> 1) & 1;	\
 292    warn_traditional = (val >> 2) & 1;		\
 293    flag_iso = (val >> 3) & 1;			\
 294  } while (0)
 295
 296
 297#define OBJC_NEED_RAW_IDENTIFIER(VAL)	/* nothing */
 298
 299static bool parsing_iso_function_signature;
 300
 301/* Tell yyparse how to print a token's value, if yydebug is set.  */
 302
 303#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
 304
 305static void yyprint	  PARAMS ((FILE *, int, YYSTYPE));
 306static void yyerror	  PARAMS ((const char *));
 307static int yylexname	  PARAMS ((void));
 308static int yylexstring	  PARAMS ((void));
 309static inline int _yylex  PARAMS ((void));
 310static int  yylex	  PARAMS ((void));
 311static void init_reswords PARAMS ((void));
 312
 313  /* Initialisation routine for this file.  */
 314void
 315c_parse_init ()
 316{
 317  init_reswords ();
 318}
 319
 320%}
 321
 322%%
 323program: /* empty */
 324		{ if (pedantic)
 325		    pedwarn ("ISO C forbids an empty source file");
 326		  finish_file ();
 327		}
 328	| extdefs
 329		{
 330		  /* In case there were missing closebraces,
 331		     get us back to the global binding level.  */
 332		  while (! global_bindings_p ())
 333		    poplevel (0, 0, 0);
 334		  /* __FUNCTION__ is defined at file scope ("").  This
 335		     call may not be necessary as my tests indicate it
 336		     still works without it.  */
 337		  finish_fname_decls ();
 338                  finish_file ();
 339		}
 340	;
 341
 342/* the reason for the strange actions in this rule
 343 is so that notype_initdecls when reached via datadef
 344 can find a valid list of type and sc specs in $0. */
 345
 346extdefs:
 347	{$<ttype>$ = NULL_TREE; } extdef
 348	| extdefs {$<ttype>$ = NULL_TREE; ggc_collect(); } extdef
 349	;
 350
 351extdef:
 352	extdef_1
 353	{ parsing_iso_function_signature = false; } /* Reset after any external definition.  */
 354	;
 355
 356extdef_1:
 357	fndef
 358	| datadef
 359	| ASM_KEYWORD '(' expr ')' ';'
 360		{ STRIP_NOPS ($3);
 361		  if ((TREE_CODE ($3) == ADDR_EXPR
 362		       && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
 363		      || TREE_CODE ($3) == STRING_CST)
 364		    assemble_asm ($3);
 365		  else
 366		    error ("argument of `asm' is not a constant string"); }
 367	| extension extdef
 368		{ RESTORE_EXT_FLAGS ($1); }
 369	;
 370
 371datadef:
 372	  setspecs notype_initdecls ';'
 373		{ if (pedantic)
 374		    error ("ISO C forbids data definition with no type or storage class");
 375		  else
 376		    warning ("data definition has no type or storage class");
 377
 378		  POP_DECLSPEC_STACK; }
 379        | declspecs_nots setspecs notype_initdecls ';'
 380		{ POP_DECLSPEC_STACK; }
 381	| declspecs_ts setspecs initdecls ';'
 382		{ POP_DECLSPEC_STACK; }
 383	| declspecs ';'
 384	  { shadow_tag ($1); }
 385	| error ';'
 386	| error '}'
 387	| ';'
 388		{ if (pedantic)
 389		    pedwarn ("ISO C does not allow extra `;' outside of a function"); }
 390	;
 391
 392fndef:
 393	  declspecs_ts setspecs declarator
 394		{ if (! start_function (current_declspecs, $3,
 395					all_prefix_attributes))
 396		    YYERROR1;
 397		}
 398	  old_style_parm_decls
 399		{ store_parm_decls (); }
 400	  save_filename save_lineno compstmt_or_error
 401		{ DECL_SOURCE_FILE (current_function_decl) = $7;
 402		  DECL_SOURCE_LINE (current_function_decl) = $8;
 403		  finish_function (0, 1);
 404		  POP_DECLSPEC_STACK; }
 405	| declspecs_ts setspecs declarator error
 406		{ POP_DECLSPEC_STACK; }
 407	| declspecs_nots setspecs notype_declarator
 408		{ if (! start_function (current_declspecs, $3,
 409					all_prefix_attributes))
 410		    YYERROR1;
 411		}
 412	  old_style_parm_decls
 413		{ store_parm_decls (); }
 414	  save_filename save_lineno compstmt_or_error
 415		{ DECL_SOURCE_FILE (current_function_decl) = $7;
 416		  DECL_SOURCE_LINE (current_function_decl) = $8;
 417		  finish_function (0, 1);
 418		  POP_DECLSPEC_STACK; }
 419	| declspecs_nots setspecs notype_declarator error
 420		{ POP_DECLSPEC_STACK; }
 421	| setspecs notype_declarator
 422		{ if (! start_function (NULL_TREE, $2,
 423					all_prefix_attributes))
 424		    YYERROR1;
 425		}
 426	  old_style_parm_decls
 427		{ store_parm_decls (); }
 428	  save_filename save_lineno compstmt_or_error
 429		{ DECL_SOURCE_FILE (current_function_decl) = $6;
 430		  DECL_SOURCE_LINE (current_function_decl) = $7;
 431		  finish_function (0, 1);
 432		  POP_DECLSPEC_STACK; }
 433	| setspecs notype_declarator error
 434		{ POP_DECLSPEC_STACK; }
 435	;
 436
 437identifier:
 438	IDENTIFIER
 439	| TYPENAME
 440	;
 441
 442unop:     '&'
 443		{ $$ = ADDR_EXPR; }
 444	| '-'
 445		{ $$ = NEGATE_EXPR; }
 446	| '+'
 447		{ $$ = CONVERT_EXPR;
 448  if (warn_traditional && !in_system_header)
 449    warning ("traditional C rejects the unary plus operator");
 450		}
 451	| PLUSPLUS
 452		{ $$ = PREINCREMENT_EXPR; }
 453	| MINUSMINUS
 454		{ $$ = PREDECREMENT_EXPR; }
 455	| '~'
 456		{ $$ = BIT_NOT_EXPR; }
 457	| '!'
 458		{ $$ = TRUTH_NOT_EXPR; }
 459	;
 460
 461expr:	nonnull_exprlist
 462		{ $$ = build_compound_expr ($1); }
 463	;
 464
 465exprlist:
 466	  /* empty */
 467		{ $$ = NULL_TREE; }
 468	| nonnull_exprlist
 469	;
 470
 471nonnull_exprlist:
 472	expr_no_commas
 473		{ $$ = build_tree_list (NULL_TREE, $1); }
 474	| nonnull_exprlist ',' expr_no_commas
 475		{ chainon ($1, build_tree_list (NULL_TREE, $3)); }
 476	;
 477
 478unary_expr:
 479	primary
 480	| '*' cast_expr   %prec UNARY
 481		{ $$ = build_indirect_ref ($2, "unary *"); }
 482	/* __extension__ turns off -pedantic for following primary.  */
 483	| extension cast_expr	  %prec UNARY
 484		{ $$ = $2;
 485		  RESTORE_EXT_FLAGS ($1); }
 486	| unop cast_expr  %prec UNARY
 487		{ $$ = build_unary_op ($1, $2, 0);
 488		  overflow_warning ($$); }
 489	/* Refer to the address of a label as a pointer.  */
 490	| ANDAND identifier
 491		{ $$ = finish_label_address_expr ($2); }
 492	| sizeof unary_expr  %prec UNARY
 493		{ skip_evaluation--;
 494		  if (TREE_CODE ($2) == COMPONENT_REF
 495		      && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
 496		    error ("`sizeof' applied to a bit-field");
 497		  $$ = c_sizeof (TREE_TYPE ($2)); }
 498	| sizeof '(' typename ')'  %prec HYPERUNARY
 499		{ skip_evaluation--;
 500		  $$ = c_sizeof (groktypename ($3)); }
 501	| alignof unary_expr  %prec UNARY
 502		{ skip_evaluation--;
 503		  $$ = c_alignof_expr ($2); }
 504	| alignof '(' typename ')'  %prec HYPERUNARY
 505		{ skip_evaluation--;
 506		  $$ = c_alignof (groktypename ($3)); }
 507	| REALPART cast_expr %prec UNARY
 508		{ $$ = build_unary_op (REALPART_EXPR, $2, 0); }
 509	| IMAGPART cast_expr %prec UNARY
 510		{ $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
 511	;
 512
 513sizeof:
 514	SIZEOF { skip_evaluation++; }
 515	;
 516
 517alignof:
 518	ALIGNOF { skip_evaluation++; }
 519	;
 520
 521typeof:
 522	TYPEOF { skip_evaluation++; }
 523	;
 524
 525cast_expr:
 526	unary_expr
 527	| '(' typename ')' cast_expr  %prec UNARY
 528		{ $$ = c_cast_expr ($2, $4); }
 529	;
 530
 531expr_no_commas:
 532	  cast_expr
 533	| expr_no_commas '+' expr_no_commas
 534		{ $$ = parser_build_binary_op ($2, $1, $3); }
 535	| expr_no_commas '-' expr_no_commas
 536		{ $$ = parser_build_binary_op ($2, $1, $3); }
 537	| expr_no_commas '*' expr_no_commas
 538		{ $$ = parser_build_binary_op ($2, $1, $3); }
 539	| expr_no_commas '/' expr_no_commas
 540		{ $$ = parser_build_binary_op ($2, $1, $3); }
 541	| expr_no_commas '%' expr_no_commas
 542		{ $$ = parser_build_binary_op ($2, $1, $3); }
 543	| expr_no_commas LSHIFT expr_no_commas
 544		{ $$ = parser_build_binary_op ($2, $1, $3); }
 545	| expr_no_commas RSHIFT expr_no_commas
 546		{ $$ = parser_build_binary_op ($2, $1, $3); }
 547	| expr_no_commas ARITHCOMPARE expr_no_commas
 548		{ $$ = parser_build_binary_op ($2, $1, $3); }
 549	| expr_no_commas EQCOMPARE expr_no_commas
 550		{ $$ = parser_build_binary_op ($2, $1, $3); }
 551	| expr_no_commas '&' expr_no_commas
 552		{ $$ = parser_build_binary_op ($2, $1, $3); }
 553	| expr_no_commas '|' expr_no_commas
 554		{ $$ = parser_build_binary_op ($2, $1, $3); }
 555	| expr_no_commas '^' expr_no_commas
 556		{ $$ = parser_build_binary_op ($2, $1, $3); }
 557	| expr_no_commas ANDAND
 558		{ $1 = c_common_truthvalue_conversion
 559		    (default_conversion ($1));
 560		  skip_evaluation += $1 == boolean_false_node; }
 561	  expr_no_commas
 562		{ skip_evaluation -= $1 == boolean_false_node;
 563		  $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
 564	| expr_no_commas OROR
 565		{ $1 = c_common_truthvalue_conversion
 566		    (default_conversion ($1));
 567		  skip_evaluation += $1 == boolean_true_node; }
 568	  expr_no_commas
 569		{ skip_evaluation -= $1 == boolean_true_node;
 570		  $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
 571	| expr_no_commas '?'
 572		{ $1 = c_common_truthvalue_conversion
 573		    (default_conversion ($1));
 574		  skip_evaluation += $1 == boolean_false_node; }
 575          expr ':'
 576		{ skip_evaluation += (($1 == boolean_true_node)
 577				      - ($1 == boolean_false_node)); }
 578	  expr_no_commas
 579		{ skip_evaluation -= $1 == boolean_true_node;
 580		  $$ = build_conditional_expr ($1, $4, $7); }
 581	| expr_no_commas '?'
 582		{ if (pedantic)
 583		    pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
 584		  /* Make sure first operand is calculated only once.  */
 585		  $<ttype>2 = save_expr ($1);
 586		  $1 = c_common_truthvalue_conversion
 587		    (default_conversion ($<ttype>2));
 588		  skip_evaluation += $1 == boolean_true_node; }
 589	  ':' expr_no_commas
 590		{ skip_evaluation -= $1 == boolean_true_node;
 591		  $$ = build_conditional_expr ($1, $<ttype>2, $5); }
 592	| expr_no_commas '=' expr_no_commas
 593		{ char class;
 594		  $$ = build_modify_expr ($1, NOP_EXPR, $3);
 595		  class = TREE_CODE_CLASS (TREE_CODE ($$));
 596		  if (IS_EXPR_CODE_CLASS (class))
 597		    C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
 598		}
 599	| expr_no_commas ASSIGN expr_no_commas
 600		{ char class;
 601		  $$ = build_modify_expr ($1, $2, $3);
 602		  /* This inhibits warnings in
 603		     c_common_truthvalue_conversion.  */
 604		  class = TREE_CODE_CLASS (TREE_CODE ($$));
 605		  if (IS_EXPR_CODE_CLASS (class))
 606		    C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
 607		}
 608	;
 609
 610primary:
 611	IDENTIFIER
 612		{
 613		  if (yychar == YYEMPTY)
 614		    yychar = YYLEX;
 615		  $$ = build_external_ref ($1, yychar == '(');
 616		}
 617	| CONSTANT
 618	| STRING
 619		{ $$ = fix_string_type ($$); }
 620	| VAR_FUNC_NAME
 621		{ $$ = fname_decl (C_RID_CODE ($$), $$); }
 622	| '(' typename ')' '{'
 623		{ start_init (NULL_TREE, NULL, 0);
 624		  $2 = groktypename ($2);
 625		  really_start_incremental_init ($2); }
 626	  initlist_maybe_comma '}'  %prec UNARY
 627		{ tree constructor = pop_init_level (0);
 628		  tree type = $2;
 629		  finish_init ();
 630
 631		  if (pedantic && ! flag_isoc99)
 632		    pedwarn ("ISO C89 forbids compound literals");
 633		  $$ = build_compound_literal (type, constructor);
 634		}
 635	| '(' expr ')'
 636		{ char class = TREE_CODE_CLASS (TREE_CODE ($2));
 637		  if (IS_EXPR_CODE_CLASS (class))
 638		    C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
 639		  $$ = $2; }
 640	| '(' error ')'
 641		{ $$ = error_mark_node; }
 642	| compstmt_primary_start compstmt_nostart ')'
 643                 { tree saved_last_tree;
 644
 645		   if (pedantic)
 646		     pedwarn ("ISO C forbids braced-groups within expressions");
 647		  pop_label_level ();
 648
 649		  saved_last_tree = COMPOUND_BODY ($1);
 650		  RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
 651		  last_tree = saved_last_tree;
 652		  TREE_CHAIN (last_tree) = NULL_TREE;
 653		  if (!last_expr_type)
 654		    last_expr_type = void_type_node;
 655		  $$ = build1 (STMT_EXPR, last_expr_type, $1);
 656		  TREE_SIDE_EFFECTS ($$) = 1;
 657		}
 658	| compstmt_primary_start error ')'
 659		{
 660		  pop_label_level ();
 661		  last_tree = COMPOUND_BODY ($1);
 662		  TREE_CHAIN (last_tree) = NULL_TREE;
 663		  $$ = error_mark_node;
 664		}
 665	| primary '(' exprlist ')'   %prec '.'
 666		{ $$ = build_function_call ($1, $3); }
 667	| VA_ARG '(' expr_no_commas ',' typename ')'
 668		{ $$ = build_va_arg ($3, groktypename ($5)); }
 669
 670      | CHOOSE_EXPR '(' expr_no_commas ',' expr_no_commas ',' expr_no_commas ')'
 671		{
 672                  tree c;
 673
 674                  c = fold ($3);
 675                  STRIP_NOPS (c);
 676                  if (TREE_CODE (c) != INTEGER_CST)
 677                    error ("first argument to __builtin_choose_expr not a constant");
 678                  $$ = integer_zerop (c) ? $7 : $5;
 679		}
 680      | TYPES_COMPATIBLE_P '(' typename ',' typename ')'
 681		{
 682		  tree e1, e2;
 683
 684		  e1 = TYPE_MAIN_VARIANT (groktypename ($3));
 685		  e2 = TYPE_MAIN_VARIANT (groktypename ($5));
 686
 687		  $$ = comptypes (e1, e2)
 688		    ? build_int_2 (1, 0) : build_int_2 (0, 0);
 689		}
 690	| primary '[' expr ']'   %prec '.'
 691		{ $$ = build_array_ref ($1, $3); }
 692	| primary '.' identifier
 693		{
 694		      $$ = build_component_ref ($1, $3);
 695		}
 696	| primary POINTSAT identifier
 697		{
 698                  tree expr = build_indirect_ref ($1, "->");
 699
 700			$$ = build_component_ref (expr, $3);
 701		}
 702	| primary PLUSPLUS
 703		{ $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
 704	| primary MINUSMINUS
 705		{ $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
 706	;
 707
 708
 709old_style_parm_decls:
 710	old_style_parm_decls_1
 711	{
 712	  parsing_iso_function_signature = false; /* Reset after decls.  */
 713	}
 714	;
 715
 716old_style_parm_decls_1:
 717	/* empty */
 718	{
 719	  if (warn_traditional && !in_system_header
 720	      && parsing_iso_function_signature)
 721	    warning ("traditional C rejects ISO C style function definitions");
 722	  parsing_iso_function_signature = false; /* Reset after warning.  */
 723	}
 724	| datadecls
 725	;
 726
 727/* The following are analogous to lineno_decl, decls and decl
 728   except that they do not allow nested functions.
 729   They are used for old-style parm decls.  */
 730lineno_datadecl:
 731	  save_filename save_lineno datadecl
 732		{ }
 733	;
 734
 735datadecls:
 736	lineno_datadecl
 737	| errstmt
 738	| datadecls lineno_datadecl
 739	| lineno_datadecl errstmt
 740	;
 741
 742/* We don't allow prefix attributes here because they cause reduce/reduce
 743   conflicts: we can't know whether we're parsing a function decl with
 744   attribute suffix, or function defn with attribute prefix on first old
 745   style parm.  */
 746datadecl:
 747	declspecs_ts_nosa setspecs initdecls ';'
 748		{ POP_DECLSPEC_STACK; }
 749	| declspecs_nots_nosa setspecs notype_initdecls ';'
 750		{ POP_DECLSPEC_STACK; }
 751	| declspecs_ts_nosa ';'
 752		{ shadow_tag_warned ($1, 1);
 753		  pedwarn ("empty declaration"); }
 754	| declspecs_nots_nosa ';'
 755		{ pedwarn ("empty declaration"); }
 756	;
 757
 758/* This combination which saves a lineno before a decl
 759   is the normal thing to use, rather than decl itself.
 760   This is to avoid shift/reduce conflicts in contexts
 761   where statement labels are allowed.  */
 762lineno_decl:
 763	  save_filename save_lineno decl
 764		{ }
 765	;
 766
 767/* records the type and storage class specs to use for processing
 768   the declarators that follow.
 769   Maintains a stack of outer-level values of current_declspecs,
 770   for the sake of parm declarations nested in function declarators.  */
 771setspecs: /* empty */
 772		{ pending_xref_error ();
 773		  PUSH_DECLSPEC_STACK;
 774		  split_specs_attrs ($<ttype>0,
 775				     &current_declspecs, &prefix_attributes);
 776		  all_prefix_attributes = prefix_attributes; }
 777	;
 778
 779/* Possibly attributes after a comma, which should reset all_prefix_attributes
 780   to prefix_attributes with these ones chained on the front.  */
 781maybe_resetattrs:
 782	  maybe_attribute
 783		{ all_prefix_attributes = chainon ($1, prefix_attributes); }
 784	;
 785
 786decl:
 787	declspecs_ts setspecs initdecls ';'
 788		{ POP_DECLSPEC_STACK; }
 789	| declspecs_nots setspecs notype_initdecls ';'
 790		{ POP_DECLSPEC_STACK; }
 791	| declspecs_ts setspecs nested_function
 792		{ POP_DECLSPEC_STACK; }
 793	| declspecs_nots setspecs notype_nested_function
 794		{ POP_DECLSPEC_STACK; }
 795	| declspecs ';'
 796		{ shadow_tag ($1); }
 797	| extension decl
 798		{ RESTORE_EXT_FLAGS ($1); }
 799	;
 800
 801/* A list of declaration specifiers.  These are:
 802
 803   - Storage class specifiers (scspec), which for GCC currently includes
 804   function specifiers ("inline").
 805
 806   - Type specifiers (typespec_*).
 807
 808   - Type qualifiers (TYPE_QUAL).
 809
 810   - Attribute specifier lists (attributes).
 811
 812   These are stored as a TREE_LIST; the head of the list is the last
 813   item in the specifier list.  Each entry in the list has either a
 814   TREE_PURPOSE that is an attribute specifier list, or a TREE_VALUE that
 815   is a single other specifier or qualifier; and a TREE_CHAIN that is the
 816   rest of the list.  TREE_STATIC is set on the list if something other
 817   than a storage class specifier or attribute has been seen; this is used
 818   to warn for the obsolescent usage of storage class specifiers other than
 819   at the start of the list.  (Doing this properly would require function
 820   specifiers to be handled separately from storage class specifiers.)
 821
 822   The various cases below are classified according to:
 823
 824   (a) Whether a storage class specifier is included or not; some
 825   places in the grammar disallow storage class specifiers (_sc or _nosc).
 826
 827   (b) Whether a type specifier has been seen; after a type specifier,
 828   a typedef name is an identifier to redeclare (_ts or _nots).
 829
 830   (c) Whether the list starts with an attribute; in certain places,
 831   the grammar requires specifiers that don't start with an attribute
 832   (_sa or _nosa).
 833
 834   (d) Whether the list ends with an attribute (or a specifier such that
 835   any following attribute would have been parsed as part of that specifier);
 836   this avoids shift-reduce conflicts in the parsing of attributes
 837   (_ea or _noea).
 838
 839   TODO:
 840
 841   (i) Distinguish between function specifiers and storage class specifiers,
 842   at least for the purpose of warnings about obsolescent usage.
 843
 844   (ii) Halve the number of productions here by eliminating the _sc/_nosc
 845   distinction and instead checking where required that storage class
 846   specifiers aren't present.  */
 847
 848/* Declspecs which contain at least one type specifier or typedef name.
 849   (Just `const' or `volatile' is not enough.)
 850   A typedef'd name following these is taken as a name to be declared.
 851   Declspecs have a non-NULL TREE_VALUE, attributes do not.  */
 852
 853declspecs_nosc_nots_nosa_noea:
 854	  TYPE_QUAL
 855		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 856		  TREE_STATIC ($$) = 1; }
 857	| declspecs_nosc_nots_nosa_noea TYPE_QUAL
 858		{ $$ = tree_cons (NULL_TREE, $2, $1);
 859		  TREE_STATIC ($$) = 1; }
 860	| declspecs_nosc_nots_nosa_ea TYPE_QUAL
 861		{ $$ = tree_cons (NULL_TREE, $2, $1);
 862		  TREE_STATIC ($$) = 1; }
 863	;
 864
 865declspecs_nosc_nots_nosa_ea:
 866	  declspecs_nosc_nots_nosa_noea attributes
 867		{ $$ = tree_cons ($2, NULL_TREE, $1);
 868		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 869	;
 870
 871declspecs_nosc_nots_sa_noea:
 872	  declspecs_nosc_nots_sa_noea TYPE_QUAL
 873		{ $$ = tree_cons (NULL_TREE, $2, $1);
 874		  TREE_STATIC ($$) = 1; }
 875	| declspecs_nosc_nots_sa_ea TYPE_QUAL
 876		{ $$ = tree_cons (NULL_TREE, $2, $1);
 877		  TREE_STATIC ($$) = 1; }
 878	;
 879
 880declspecs_nosc_nots_sa_ea:
 881	  attributes
 882		{ $$ = tree_cons ($1, NULL_TREE, NULL_TREE);
 883		  TREE_STATIC ($$) = 0; }
 884	| declspecs_nosc_nots_sa_noea attributes
 885		{ $$ = tree_cons ($2, NULL_TREE, $1);
 886		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 887	;
 888
 889declspecs_nosc_ts_nosa_noea:
 890	  typespec_nonattr
 891		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 892		  TREE_STATIC ($$) = 1; }
 893	| declspecs_nosc_ts_nosa_noea TYPE_QUAL
 894		{ $$ = tree_cons (NULL_TREE, $2, $1);
 895		  TREE_STATIC ($$) = 1; }
 896	| declspecs_nosc_ts_nosa_ea TYPE_QUAL
 897		{ $$ = tree_cons (NULL_TREE, $2, $1);
 898		  TREE_STATIC ($$) = 1; }
 899	| declspecs_nosc_ts_nosa_noea typespec_reserved_nonattr
 900		{ $$ = tree_cons (NULL_TREE, $2, $1);
 901		  TREE_STATIC ($$) = 1; }
 902	| declspecs_nosc_ts_nosa_ea typespec_reserved_nonattr
 903		{ $$ = tree_cons (NULL_TREE, $2, $1);
 904		  TREE_STATIC ($$) = 1; }
 905	| declspecs_nosc_nots_nosa_noea typespec_nonattr
 906		{ $$ = tree_cons (NULL_TREE, $2, $1);
 907		  TREE_STATIC ($$) = 1; }
 908	| declspecs_nosc_nots_nosa_ea typespec_nonattr
 909		{ $$ = tree_cons (NULL_TREE, $2, $1);
 910		  TREE_STATIC ($$) = 1; }
 911	;
 912
 913declspecs_nosc_ts_nosa_ea:
 914	  typespec_attr
 915		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 916		  TREE_STATIC ($$) = 1; }
 917	| declspecs_nosc_ts_nosa_noea attributes
 918		{ $$ = tree_cons ($2, NULL_TREE, $1);
 919		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 920	| declspecs_nosc_ts_nosa_noea typespec_reserved_attr
 921		{ $$ = tree_cons (NULL_TREE, $2, $1);
 922		  TREE_STATIC ($$) = 1; }
 923	| declspecs_nosc_ts_nosa_ea typespec_reserved_attr
 924		{ $$ = tree_cons (NULL_TREE, $2, $1);
 925		  TREE_STATIC ($$) = 1; }
 926	| declspecs_nosc_nots_nosa_noea typespec_attr
 927		{ $$ = tree_cons (NULL_TREE, $2, $1);
 928		  TREE_STATIC ($$) = 1; }
 929	| declspecs_nosc_nots_nosa_ea typespec_attr
 930		{ $$ = tree_cons (NULL_TREE, $2, $1);
 931		  TREE_STATIC ($$) = 1; }
 932	;
 933
 934declspecs_nosc_ts_sa_noea:
 935	  declspecs_nosc_ts_sa_noea TYPE_QUAL
 936		{ $$ = tree_cons (NULL_TREE, $2, $1);
 937		  TREE_STATIC ($$) = 1; }
 938	| declspecs_nosc_ts_sa_ea TYPE_QUAL
 939		{ $$ = tree_cons (NULL_TREE, $2, $1);
 940		  TREE_STATIC ($$) = 1; }
 941	| declspecs_nosc_ts_sa_noea typespec_reserved_nonattr
 942		{ $$ = tree_cons (NULL_TREE, $2, $1);
 943		  TREE_STATIC ($$) = 1; }
 944	| declspecs_nosc_ts_sa_ea typespec_reserved_nonattr
 945		{ $$ = tree_cons (NULL_TREE, $2, $1);
 946		  TREE_STATIC ($$) = 1; }
 947	| declspecs_nosc_nots_sa_noea typespec_nonattr
 948		{ $$ = tree_cons (NULL_TREE, $2, $1);
 949		  TREE_STATIC ($$) = 1; }
 950	| declspecs_nosc_nots_sa_ea typespec_nonattr
 951		{ $$ = tree_cons (NULL_TREE, $2, $1);
 952		  TREE_STATIC ($$) = 1; }
 953	;
 954
 955declspecs_nosc_ts_sa_ea:
 956	  declspecs_nosc_ts_sa_noea attributes
 957		{ $$ = tree_cons ($2, NULL_TREE, $1);
 958		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 959	| declspecs_nosc_ts_sa_noea typespec_reserved_attr
 960		{ $$ = tree_cons (NULL_TREE, $2, $1);
 961		  TREE_STATIC ($$) = 1; }
 962	| declspecs_nosc_ts_sa_ea typespec_reserved_attr
 963		{ $$ = tree_cons (NULL_TREE, $2, $1);
 964		  TREE_STATIC ($$) = 1; }
 965	| declspecs_nosc_nots_sa_noea typespec_attr
 966		{ $$ = tree_cons (NULL_TREE, $2, $1);
 967		  TREE_STATIC ($$) = 1; }
 968	| declspecs_nosc_nots_sa_ea typespec_attr
 969		{ $$ = tree_cons (NULL_TREE, $2, $1);
 970		  TREE_STATIC ($$) = 1; }
 971	;
 972
 973declspecs_sc_nots_nosa_noea:
 974	  scspec
 975		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 976		  TREE_STATIC ($$) = 0; }
 977	| declspecs_sc_nots_nosa_noea TYPE_QUAL
 978		{ $$ = tree_cons (NULL_TREE, $2, $1);
 979		  TREE_STATIC ($$) = 1; }
 980	| declspecs_sc_nots_nosa_ea TYPE_QUAL
 981		{ $$ = tree_cons (NULL_TREE, $2, $1);
 982		  TREE_STATIC ($$) = 1; }
 983	| declspecs_nosc_nots_nosa_noea scspec
 984		{ if (extra_warnings && TREE_STATIC ($1))
 985		    warning ("`%s' is not at beginning of declaration",
 986			     IDENTIFIER_POINTER ($2));
 987		  $$ = tree_cons (NULL_TREE, $2, $1);
 988		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 989	| declspecs_nosc_nots_nosa_ea scspec
 990		{ if (extra_warnings && TREE_STATIC ($1))
 991		    warning ("`%s' is not at beginning of declaration",
 992			     IDENTIFIER_POINTER ($2));
 993		  $$ = tree_cons (NULL_TREE, $2, $1);
 994		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 995	| declspecs_sc_nots_nosa_noea scspec
 996		{ if (extra_warnings && TREE_STATIC ($1))
 997		    warning ("`%s' is not at beginning of declaration",
 998			     IDENTIFIER_POINTER ($2));
 999		  $$ = tree_cons (NULL_TREE, $2, $1);
1000		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1001	| declspecs_sc_nots_nosa_ea scspec
1002		{ if (extra_warnings && TREE_STATIC ($1))
1003		    warning ("`%s' is not at beginning of declaration",
1004			     IDENTIFIER_POINTER ($2));
1005		  $$ = tree_cons (NULL_TREE, $2, $1);
1006		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1007	;
1008
1009declspecs_sc_nots_nosa_ea:
1010	  declspecs_sc_nots_nosa_noea attributes
1011		{ $$ = tree_cons ($2, NULL_TREE, $1);
1012		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1013	;
1014
1015declspecs_sc_nots_sa_noea:
1016	  declspecs_sc_nots_sa_noea TYPE_QUAL
1017		{ $$ = tree_cons (NULL_TREE, $2, $1);
1018		  TREE_STATIC ($$) = 1; }
1019	| declspecs_sc_nots_sa_ea TYPE_QUAL
1020		{ $$ = tree_cons (NULL_TREE, $2, $1);
1021		  TREE_STATIC ($$) = 1; }
1022	| declspecs_nosc_nots_sa_noea scspec
1023		{ if (extra_warnings && TREE_STATIC ($1))
1024		    warning ("`%s' is not at beginning of declaration",
1025			     IDENTIFIER_POINTER ($2));
1026		  $$ = tree_cons (NULL_TREE, $2, $1);
1027		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1028	| declspecs_nosc_nots_sa_ea scspec
1029		{ if (extra_warnings && TREE_STATIC ($1))
1030		    warning ("`%s' is not at beginning of declaration",
1031			     IDENTIFIER_POINTER ($2));
1032		  $$ = tree_cons (NULL_TREE, $2, $1);
1033		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1034	| declspecs_sc_nots_sa_noea scspec
1035		{ if (extra_warnings && TREE_STATIC ($1))
1036		    warning ("`%s' is not at beginning of declaration",
1037			     IDENTIFIER_POINTER ($2));
1038		  $$ = tree_cons (NULL_TREE, $2, $1);
1039		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1040	| declspecs_sc_nots_sa_ea scspec
1041		{ if (extra_warnings && TREE_STATIC ($1))
1042		    warning ("`%s' is not at beginning of declaration",
1043			     IDENTIFIER_POINTER ($2));
1044		  $$ = tree_cons (NULL_TREE, $2, $1);
1045		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1046	;
1047
1048declspecs_sc_nots_sa_ea:
1049	  declspecs_sc_nots_sa_noea attributes
1050		{ $$ = tree_cons ($2, NULL_TREE, $1);
1051		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1052	;
1053
1054declspecs_sc_ts_nosa_noea:
1055	  declspecs_sc_ts_nosa_noea TYPE_QUAL
1056		{ $$ = tree_cons (NULL_TREE, $2, $1);
1057		  TREE_STATIC ($$) = 1; }
1058	| declspecs_sc_ts_nosa_ea TYPE_QUAL
1059		{ $$ = tree_cons (NULL_TREE, $2, $1);
1060		  TREE_STATIC ($$) = 1; }
1061	| declspecs_sc_ts_nosa_noea typespec_reserved_nonattr
1062		{ $$ = tree_cons (NULL_TREE, $2, $1);
1063		  TREE_STATIC ($$) = 1; }
1064	| declspecs_sc_ts_nosa_ea typespec_reserved_nonattr
1065		{ $$ = tree_cons (NULL_TREE, $2, $1);
1066		  TREE_STATIC ($$) = 1; }
1067	| declspecs_sc_nots_nosa_noea typespec_nonattr
1068		{ $$ = tree_cons (NULL_TREE, $2, $1);
1069		  TREE_STATIC ($$) = 1; }
1070	| declspecs_sc_nots_nosa_ea typespec_nonattr
1071		{ $$ = tree_cons (NULL_TREE, $2, $1);
1072		  TREE_STATIC ($$) = 1; }
1073	| declspecs_nosc_ts_nosa_noea scspec
1074		{ if (extra_warnings && TREE_STATIC ($1))
1075		    warning ("`%s' is not at beginning of declaration",
1076			     IDENTIFIER_POINTER ($2));
1077		  $$ = tree_cons (NULL_TREE, $2, $1);
1078		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1079	| declspecs_nosc_ts_nosa_ea scspec
1080		{ if (extra_warnings && TREE_STATIC ($1))
1081		    warning ("`%s' is not at beginning of declaration",
1082			     IDENTIFIER_POINTER ($2));
1083		  $$ = tree_cons (NULL_TREE, $2, $1);
1084		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1085	| declspecs_sc_ts_nosa_noea scspec
1086		{ if (extra_warnings && TREE_STATIC ($1))
1087		    warning ("`%s' is not at beginning of declaration",
1088			     IDENTIFIER_POINTER ($2));
1089		  $$ = tree_cons (NULL_TREE, $2, $1);
1090		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1091	| declspecs_sc_ts_nosa_ea scspec
1092		{ if (extra_warnings && TREE_STATIC ($1))
1093		    warning ("`%s' is not at beginning of declaration",
1094			     IDENTIFIER_POINTER ($2));
1095		  $$ = tree_cons (NULL_TREE, $2, $1);
1096		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1097	;
1098
1099declspecs_sc_ts_nosa_ea:
1100	  declspecs_sc_ts_nosa_noea attributes
1101		{ $$ = tree_cons ($2, NULL_TREE, $1);
1102		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1103	| declspecs_sc_ts_nosa_noea typespec_reserved_attr
1104		{ $$ = tree_cons (NULL_TREE, $2, $1);
1105		  TREE_STATIC ($$) = 1; }
1106	| declspecs_sc_ts_nosa_ea typespec_reserved_attr
1107		{ $$ = tree_cons (NULL_TREE, $2, $1);
1108		  TREE_STATIC ($$) = 1; }
1109	| declspecs_sc_nots_nosa_noea typespec_attr
1110		{ $$ = tree_cons (NULL_TREE, $2, $1);
1111		  TREE_STATIC ($$) = 1; }
1112	| declspecs_sc_nots_nosa_ea typespec_attr
1113		{ $$ = tree_cons (NULL_TREE, $2, $1);
1114		  TREE_STATIC ($$) = 1; }
1115	;
1116
1117declspecs_sc_ts_sa_noea:
1118	  declspecs_sc_ts_sa_noea TYPE_QUAL
1119		{ $$ = tree_cons (NULL_TREE, $2, $1);
1120		  TREE_STATIC ($$) = 1; }
1121	| declspecs_sc_ts_sa_ea TYPE_QUAL
1122		{ $$ = tree_cons (NULL_TREE, $2, $1);
1123		  TREE_STATIC ($$) = 1; }
1124	| declspecs_sc_ts_sa_noea typespec_reserved_nonattr
1125		{ $$ = tree_cons (NULL_TREE, $2, $1);
1126		  TREE_STATIC ($$) = 1; }
1127	| declspecs_sc_ts_sa_ea typespec_reserved_nonattr
1128		{ $$ = tree_cons (NULL_TREE, $2, $1);
1129		  TREE_STATIC ($$) = 1; }
1130	| declspecs_sc_nots_sa_noea typespec_nonattr
1131		{ $$ = tree_cons (NULL_TREE, $2, $1);
1132		  TREE_STATIC ($$) = 1; }
1133	| declspecs_sc_nots_sa_ea typespec_nonattr
1134		{ $$ = tree_cons (NULL_TREE, $2, $1);
1135		  TREE_STATIC ($$) = 1; }
1136	| declspecs_nosc_ts_sa_noea scspec
1137		{ if (extra_warnings && TREE_STATIC ($1))
1138		    warning ("`%s' is not at beginning of declaration",
1139			     IDENTIFIER_POINTER ($2));
1140		  $$ = tree_cons (NULL_TREE, $2, $1);
1141		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1142	| declspecs_nosc_ts_sa_ea scspec
1143		{ if (extra_warnings && TREE_STATIC ($1))
1144		    warning ("`%s' is not at beginning of declaration",
1145			     IDENTIFIER_POINTER ($2));
1146		  $$ = tree_cons (NULL_TREE, $2, $1);
1147		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1148	| declspecs_sc_ts_sa_noea scspec
1149		{ if (extra_warnings && TREE_STATIC ($1))
1150		    warning ("`%s' is not at beginning of declaration",
1151			     IDENTIFIER_POINTER ($2));
1152		  $$ = tree_cons (NULL_TREE, $2, $1);
1153		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1154	| declspecs_sc_ts_sa_ea scspec
1155		{ if (extra_warnings && TREE_STATIC ($1))
1156		    warning ("`%s' is not at beginning of declaration",
1157			     IDENTIFIER_POINTER ($2));
1158		  $$ = tree_cons (NULL_TREE, $2, $1);
1159		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1160	;
1161
1162declspecs_sc_ts_sa_ea:
1163	  declspecs_sc_ts_sa_noea attributes
1164		{ $$ = tree_cons ($2, NULL_TREE, $1);
1165		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1166	| declspecs_sc_ts_sa_noea typespec_reserved_attr
1167		{ $$ = tree_cons (NULL_TREE, $2, $1);
1168		  TREE_STATIC ($$) = 1; }
1169	| declspecs_sc_ts_sa_ea typespec_reserved_attr
1170		{ $$ = tree_cons (NULL_TREE, $2, $1);
1171		  TREE_STATIC ($$) = 1; }
1172	| declspecs_sc_nots_sa_noea typespec_attr
1173		{ $$ = tree_cons (NULL_TREE, $2, $1);
1174		  TREE_STATIC ($$) = 1; }
1175	| declspecs_sc_nots_sa_ea typespec_attr
1176		{ $$ = tree_cons (NULL_TREE, $2, $1);
1177		  TREE_STATIC ($$) = 1; }
1178	;
1179
1180/* Particular useful classes of declspecs.  */
1181declspecs_ts:
1182	  declspecs_nosc_ts_nosa_noea
1183	| declspecs_nosc_ts_nosa_ea
1184	| declspecs_nosc_ts_sa_noea
1185	| declspecs_nosc_ts_sa_ea
1186	| declspecs_sc_ts_nosa_noea
1187	| declspecs_sc_ts_nosa_ea
1188	| declspecs_sc_ts_sa_noea
1189	| declspecs_sc_ts_sa_ea
1190	;
1191
1192declspecs_nots:
1193	  declspecs_nosc_nots_nosa_noea
1194	| declspecs_nosc_nots_nosa_ea
1195	| declspecs_nosc_nots_sa_noea
1196	| declspecs_nosc_nots_sa_ea
1197	| declspecs_sc_nots_nosa_noea
1198	| declspecs_sc_nots_nosa_ea
1199	| declspecs_sc_nots_sa_noea
1200	| declspecs_sc_nots_sa_ea
1201	;
1202
1203declspecs_ts_nosa:
1204	  declspecs_nosc_ts_nosa_noea
1205	| declspecs_nosc_ts_nosa_ea
1206	| declspecs_sc_ts_nosa_noea
1207	| declspecs_sc_ts_nosa_ea
1208	;
1209
1210declspecs_nots_nosa:
1211	  declspecs_nosc_nots_nosa_noea
1212	| declspecs_nosc_nots_nosa_ea
1213	| declspecs_sc_nots_nosa_noea
1214	| declspecs_sc_nots_nosa_ea
1215	;
1216
1217declspecs_nosc_ts:
1218	  declspecs_nosc_ts_nosa_noea
1219	| declspecs_nosc_ts_nosa_ea
1220	| declspecs_nosc_ts_sa_noea
1221	| declspecs_nosc_ts_sa_ea
1222	;
1223
1224declspecs_nosc_nots:
1225	  declspecs_nosc_nots_nosa_noea
1226	| declspecs_nosc_nots_nosa_ea
1227	| declspecs_nosc_nots_sa_noea
1228	| declspecs_nosc_nots_sa_ea
1229	;
1230
1231declspecs_nosc:
1232	  declspecs_nosc_ts_nosa_noea
1233	| declspecs_nosc_ts_nosa_ea
1234	| declspecs_nosc_ts_sa_noea
1235	| declspecs_nosc_ts_sa_ea
1236	| declspecs_nosc_nots_nosa_noea
1237	| declspecs_nosc_nots_nosa_ea
1238	| declspecs_nosc_nots_sa_noea
1239	| declspecs_nosc_nots_sa_ea
1240	;
1241
1242declspecs:
1243	  declspecs_nosc_nots_nosa_noea
1244	| declspecs_nosc_nots_nosa_ea
1245	| declspecs_nosc_nots_sa_noea
1246	| declspecs_nosc_nots_sa_ea
1247	| declspecs_nosc_ts_nosa_noea
1248	| declspecs_nosc_ts_nosa_ea
1249	| declspecs_nosc_ts_sa_noea
1250	| declspecs_nosc_ts_sa_ea
1251	| declspecs_sc_nots_nosa_noea
1252	| declspecs_sc_nots_nosa_ea
1253	| declspecs_sc_nots_sa_noea
1254	| declspecs_sc_nots_sa_ea
1255	| declspecs_sc_ts_nosa_noea
1256	| declspecs_sc_ts_nosa_ea
1257	| declspecs_sc_ts_sa_noea
1258	| declspecs_sc_ts_sa_ea
1259	;
1260
1261/* A (possibly empty) sequence of type qualifiers and attributes.  */
1262maybe_type_quals_attrs:
1263	  /* empty */
1264		{ $$ = NULL_TREE; }
1265	| declspecs_nosc_nots
1266		{ $$ = $1; }
1267	;
1268
1269/* A type specifier (but not a type qualifier).
1270   Once we have seen one of these in a declaration,
1271   if a typedef name appears then it is being redeclared.
1272
1273   The _reserved versions start with a reserved word and may appear anywhere
1274   in the declaration specifiers; the _nonreserved versions may only
1275   appear before any other type specifiers, and after that are (if names)
1276   being redeclared.
1277
1278   FIXME: should the _nonreserved version be restricted to names being
1279   redeclared only?  The other entries there relate only the GNU extensions
1280   and Objective C, and are historically parsed thus, and don't make sense
1281   after other type specifiers, but it might be cleaner to count them as
1282   _reserved.
1283
1284   _attr means: specifiers that either end with attributes,
1285   or are such that any following attributes would
1286   be parsed as part of the specifier.
1287
1288   _nonattr: specifiers.  */
1289
1290typespec_nonattr:
1291	  typespec_reserved_nonattr
1292	| typespec_nonreserved_nonattr
1293	;
1294
1295typespec_attr:
1296	  typespec_reserved_attr
1297	;
1298
1299typespec_reserved_nonattr:
1300	  TYPESPEC
1301		{ OBJC_NEED_RAW_IDENTIFIER (1);	}
1302	| structsp_nonattr
1303	;
1304
1305typespec_reserved_attr:
1306	  structsp_attr
1307	;
1308
1309typespec_nonreserved_nonattr:
1310	  TYPENAME
1311		{ /* For a typedef name, record the meaning, not the name.
1312		     In case of `foo foo, bar;'.  */
1313		  $$ = lookup_name ($1); }
1314	| typeof '(' expr ')'
1315		{ skip_evaluation--; $$ = TREE_TYPE ($3); }
1316	| typeof '(' typename ')'
1317		{ skip_evaluation--; $$ = groktypename ($3); }
1318	;
1319
1320/* typespec_nonreserved_attr does not exist.  */
1321
1322initdecls:
1323	initdcl
1324	| initdecls ',' maybe_resetattrs initdcl
1325	;
1326
1327notype_initdecls:
1328	notype_initdcl
1329	| notype_initdecls ',' maybe_resetattrs notype_initdcl
1330	;
1331
1332maybeasm:
1333	  /* empty */
1334		{ $$ = NULL_TREE; }
1335	| ASM_KEYWORD '(' STRING ')'
1336		{ $$ = $3; }
1337	;
1338
1339initdcl:
1340	  declarator maybeasm maybe_attribute '='
1341		{ $<ttype>$ = start_decl ($1, current_declspecs, 1,
1342					  chainon ($3, all_prefix_attributes));
1343		  start_init ($<ttype>$, $2, global_bindings_p ()); }
1344	  init
1345/* Note how the declaration of the variable is in effect while its init is parsed! */
1346		{ finish_init ();
1347		  finish_decl ($<ttype>5, $6, $2); }
1348	| declarator maybeasm maybe_attribute
1349		{ tree d = start_decl ($1, current_declspecs, 0,
1350				       chainon ($3, all_prefix_attributes));
1351		  finish_decl (d, NULL_TREE, $2);
1352                }
1353	;
1354
1355notype_initdcl:
1356	  notype_declarator maybeasm maybe_attribute '='
1357		{ $<ttype>$ = start_decl ($1, current_declspecs, 1,
1358					  chainon ($3, all_prefix_attributes));
1359		  start_init ($<ttype>$, $2, global_bindings_p ()); }
1360	  init
1361/* Note how the declaration of the variable is in effect while its init is parsed! */
1362		{ finish_init ();
1363		  finish_decl ($<ttype>5, $6, $2); }
1364	| notype_declarator maybeasm maybe_attribute
1365		{ tree d = start_decl ($1, current_declspecs, 0,
1366				       chainon ($3, all_prefix_attributes));
1367		  finish_decl (d, NULL_TREE, $2); }
1368	;
1369/* the * rules are dummies to accept the Apollo extended syntax
1370   so that the header files compile. */
1371maybe_attribute:
1372      /* empty */
1373  		{ $$ = NULL_TREE; }
1374	| attributes
1375		{ $$ = $1; }
1376	;
1377
1378attributes:
1379      attribute
1380		{ $$ = $1; }
1381	| attributes attribute
1382		{ $$ = chainon ($1, $2); }
1383	;
1384
1385attribute:
1386      ATTRIBUTE '(' '(' attribute_list ')' ')'
1387		{ $$ = $4; }
1388	;
1389
1390attribute_list:
1391      attrib
1392		{ $$ = $1; }
1393	| attribute_list ',' attrib
1394		{ $$ = chainon ($1, $3); }
1395	;
1396
1397attrib:
1398    /* empty */
1399		{ $$ = NULL_TREE; }
1400	| any_word
1401		{ $$ = build_tree_list ($1, NULL_TREE); }
1402	| any_word '(' IDENTIFIER ')'
1403		{ $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
1404	| any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1405		{ $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
1406	| any_word '(' exprlist ')'
1407		{ $$ = build_tree_list ($1, $3); }
1408	;
1409
1410/* This still leaves out most reserved keywords,
1411   shouldn't we include them?  */
1412
1413any_word:
1414	  identifier
1415	| scspec
1416	| TYPESPEC
1417	| TYPE_QUAL
1418	;
1419
1420scspec:
1421	  STATIC
1422	| SCSPEC
1423	;
1424
1425/* Initializers.  `init' is the entry point.  */
1426
1427init:
1428	expr_no_commas
1429	| '{'
1430		{ really_start_incremental_init (NULL_TREE); }
1431	  initlist_maybe_comma '}'
1432		{ $$ = pop_init_level (0); }
1433	| error
1434		{ $$ = error_mark_node; }
1435	;
1436
1437/* `initlist_maybe_comma' is the guts of an initializer in braces.  */
1438initlist_maybe_comma:
1439	  /* empty */
1440		{ if (pedantic)
1441		    pedwarn ("ISO C forbids empty initializer braces"); }
1442	| initlist1 maybecomma
1443	;
1444
1445initlist1:
1446	  initelt
1447	| initlist1 ',' initelt
1448	;
1449
1450/* `initelt' is a single element of an initializer.
1451   It may use braces.  */
1452initelt:
1453	  designator_list '=' initval
1454		{ if (pedantic && ! flag_isoc99)
1455		    pedwarn ("ISO C89 forbids specifying subobject to initialize"); }
1456	| designator initval
1457		{ if (pedantic)
1458		    pedwarn ("obsolete use of designated initializer without `='"); }
1459	| identifier ':'
1460		{ set_init_label ($1);
1461		  if (pedantic)
1462		    pedwarn ("obsolete use of designated initializer with `:'"); }
1463	  initval
1464		{}
1465	| initval
1466	;
1467
1468initval:
1469	  '{'
1470		{ push_init_level (0); }
1471	  initlist_maybe_comma '}'
1472		{ process_init_element (pop_init_level (0)); }
1473	| expr_no_commas
1474		{ process_init_element ($1); }
1475	| error
1476	;
1477
1478designator_list:
1479	  designator
1480	| designator_list designator
1481	;
1482
1483designator:
1484	  '.' identifier
1485		{ set_init_label ($2); }
1486	| '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1487		{ set_init_index ($2, $4);
1488		  if (pedantic)
1489		    pedwarn ("ISO C forbids specifying range of elements to initialize"); }
1490	| '[' expr_no_commas ']'
1491		{ set_init_index ($2, NULL_TREE); }
1492	;
1493
1494nested_function:
1495	  declarator
1496		{ if (pedantic)
1497		    pedwarn ("ISO C forbids nested functions");
1498
1499		  push_function_context ();
1500		  if (! start_function (current_declspecs, $1,
1501					all_prefix_attributes))
1502		    {
1503		      pop_function_context ();
1504		      YYERROR1;
1505		    }
1506		  parsing_iso_function_signature = false; /* Don't warn about nested functions.  */
1507		}
1508	   old_style_parm_decls
1509		{ store_parm_decls (); }
1510/* This used to use compstmt_or_error.
1511   That caused a bug with input `f(g) int g {}',
1512   where the use of YYERROR1 above caused an error
1513   which then was handled by compstmt_or_error.
1514   There followed a repeated execution of that same rule,
1515   which called YYERROR1 again, and so on.  */
1516	  save_filename save_lineno compstmt
1517		{ tree decl = current_function_decl;
1518		  DECL_SOURCE_FILE (decl) = $5;
1519		  DECL_SOURCE_LINE (decl) = $6;
1520		  finish_function (1, 1);
1521		  pop_function_context ();
1522		  add_decl_stmt (decl); }
1523	;
1524
1525notype_nested_function:
1526	  notype_declarator
1527		{ if (pedantic)
1528		    pedwarn ("ISO C forbids nested functions");
1529
1530		  push_function_context ();
1531		  if (! start_function (current_declspecs, $1,
1532					all_prefix_attributes))
1533		    {
1534		      pop_function_context ();
1535		      YYERROR1;
1536		    }
1537		  parsing_iso_function_signature = false; /* Don't warn about nested functions.  */
1538		}
1539	  old_style_parm_decls
1540		{ store_parm_decls (); }
1541/* This used to use compstmt_or_error.
1542   That caused a bug with input `f(g) int g {}',
1543   where the use of YYERROR1 above caused an error
1544   which then was handled by compstmt_or_error.
1545   There followed a repeated execution of that same rule,
1546   which called YYERROR1 again, and so on.  */
1547	  save_filename save_lineno compstmt
1548		{ tree decl = current_function_decl;
1549		  DECL_SOURCE_FILE (decl) = $5;
1550		  DECL_SOURCE_LINE (decl) = $6;
1551		  finish_function (1, 1);
1552		  pop_function_context ();
1553		  add_decl_stmt (decl); }
1554	;
1555
1556/* Any kind of declarator (thus, all declarators allowed
1557   after an explicit typespec).  */
1558
1559declarator:
1560	  after_type_declarator
1561	| notype_declarator
1562	;
1563
1564/* A declarator that is allowed only after an explicit typespec.  */
1565
1566after_type_declarator:
1567	  '(' maybe_attribute after_type_declarator ')'
1568		{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1569	| after_type_declarator '(' parmlist_or_identifiers  %prec '.'
1570		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1571/*	| after_type_declarator '(' error ')'  %prec '.'
1572		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1573		  poplevel (0, 0, 0); }  */
1574	| after_type_declarator array_declarator  %prec '.'
1575		{ $$ = set_array_declarator_type ($2, $1, 0); }
1576	| '*' maybe_type_quals_attrs after_type_declarator  %prec UNARY
1577		{ $$ = make_pointer_declarator ($2, $3); }
1578	| TYPENAME
1579	;
1580
1581/* Kinds of declarator that can appear in a parameter list
1582   in addition to notype_declarator.  This is like after_type_declarator
1583   but does not allow a typedef name in parentheses as an identifier
1584   (because it would conflict with a function with that typedef as arg).  */
1585parm_declarator:
1586	  parm_declarator_starttypename
1587	| parm_declarator_nostarttypename
1588	;
1589
1590parm_declarator_starttypename:
1591	  parm_declarator_starttypename '(' parmlist_or_identifiers  %prec '.'
1592		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1593/*	| parm_declarator_starttypename '(' error ')'  %prec '.'
1594		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1595		  poplevel (0, 0, 0); }  */
1596	| parm_declarator_starttypename array_declarator  %prec '.'
1597		{ $$ = set_array_declarator_type ($2, $1, 0); }
1598	| TYPENAME
1599	;
1600
1601parm_declarator_nostarttypename:
1602	  parm_declarator_nostarttypename '(' parmlist_or_identifiers  %prec '.'
1603		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1604/*	| parm_declarator_nostarttypename '(' error ')'  %prec '.'
1605		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1606		  poplevel (0, 0, 0); }  */
1607	| parm_declarator_nostarttypename array_declarator  %prec '.'
1608		{ $$ = set_array_declarator_type ($2, $1, 0); }
1609	| '*' maybe_type_quals_attrs parm_declarator_starttypename  %prec UNARY
1610		{ $$ = make_pointer_declarator ($2, $3); }
1611	| '*' maybe_type_quals_attrs parm_declarator_nostarttypename  %prec UNARY
1612		{ $$ = make_pointer_declarator ($2, $3); }
1613	| '(' maybe_attribute parm_declarator_nostarttypename ')'
1614		{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1615	;
1616
1617/* A declarator allowed whether or not there has been
1618   an explicit typespec.  These cannot redeclare a typedef-name.  */
1619
1620notype_declarator:
1621	  notype_declarator '(' parmlist_or_identifiers  %prec '.'
1622		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1623/*	| notype_declarator '(' error ')'  %prec '.'
1624		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1625		  poplevel (0, 0, 0); }  */
1626	| '(' maybe_attribute notype_declarator ')'
1627		{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1628	| '*' maybe_type_quals_attrs notype_declarator  %prec UNARY
1629		{ $$ = make_pointer_declarator ($2, $3); }
1630	| notype_declarator array_declarator  %prec '.'
1631		{ $$ = set_array_declarator_type ($2, $1, 0); }
1632	| IDENTIFIER
1633	;
1634
1635struct_head:
1636	  STRUCT
1637		{ $$ = NULL_TREE; }
1638	| STRUCT attributes
1639		{ $$ = $2; }
1640	;
1641
1642union_head:
1643	  UNION
1644		{ $$ = NULL_TREE; }
1645	| UNION attributes
1646		{ $$ = $2; }
1647	;
1648
1649enum_head:
1650	  ENUM
1651		{ $$ = NULL_TREE; }
1652	| ENUM attributes
1653		{ $$ = $2; }
1654	;
1655
1656/* structsp_attr: struct/union/enum specifiers that either
1657   end with attributes, or are such that any following attributes would
1658   be parsed as part of the struct/union/enum specifier.
1659
1660   structsp_nonattr: other struct/union/enum specifiers.  */
1661
1662structsp_attr:
1663	  struct_head identifier '{'
1664		{ $$ = start_struct (RECORD_TYPE, $2);
1665		  /* Start scope of tag before parsing components.  */
1666		}
1667	  component_decl_list '}' maybe_attribute
1668		{ $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1669	| struct_head '{' component_decl_list '}' maybe_attribute
1670		{ $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1671				      $3, chainon ($1, $5));
1672		}
1673	| union_head identifier '{'
1674		{ $$ = start_struct (UNION_TYPE, $2); }
1675	  component_decl_list '}' maybe_attribute
1676		{ $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1677	| union_head '{' component_decl_list '}' maybe_attribute
1678		{ $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1679				      $3, chainon ($1, $5));
1680		}
1681	| enum_head identifier '{'
1682		{ $$ = start_enum ($2); }
1683	  enumlist maybecomma_warn '}' maybe_attribute
1684		{ $$ = finish_enum ($<ttype>4, nreverse ($5),
1685				    chainon ($1, $8)); }
1686	| enum_head '{'
1687		{ $$ = start_enum (NULL_TREE); }
1688	  enumlist maybecomma_warn '}' maybe_attribute
1689		{ $$ = finish_enum ($<ttype>3, nreverse ($4),
1690				    chainon ($1, $7)); }
1691	;
1692
1693structsp_nonattr:
1694	  struct_head identifier
1695		{ $$ = xref_tag (RECORD_TYPE, $2); }
1696	| union_head identifier
1697		{ $$ = xref_tag (UNION_TYPE, $2); }
1698	| enum_head identifier
1699		{ $$ = xref_tag (ENUMERAL_TYPE, $2);
1700		  /* In ISO C, enumerated types can be referred to
1701		     only if already defined.  */
1702		  if (pedantic && !COMPLETE_TYPE_P ($$))
1703		    pedwarn ("ISO C forbids forward references to `enum' types"); }
1704	;
1705
1706maybecomma:
1707	  /* empty */
1708	| ','
1709	;
1710
1711maybecomma_warn:
1712	  /* empty */
1713	| ','
1714		{ if (pedantic && ! flag_isoc99)
1715		    pedwarn ("comma at end of enumerator list"); }
1716	;
1717
1718component_decl_list:
1719	  component_decl_list2
1720		{ $$ = $1; }
1721	| component_decl_list2 component_decl
1722		{ $$ = chainon ($1, $2);
1723		  pedwarn ("no semicolon at end of struct or union"); }
1724	;
1725
1726component_decl_list2:	/* empty */
1727		{ $$ = NULL_TREE; }
1728	| component_decl_list2 component_decl ';'
1729		{ $$ = chainon ($1, $2); }
1730	| component_decl_list2 ';'
1731		{ if (pedantic)
1732		    pedwarn ("extra semicolon in struct or union specified"); }
1733	;
1734
1735component_decl:
1736	  declspecs_nosc_ts setspecs components
1737		{ $$ = $3;
1738		  POP_DECLSPEC_STACK; }
1739	| declspecs_nosc_ts setspecs save_filename save_lineno
1740		{
1741		  /* Support for unnamed structs or unions as members of
1742		     structs or unions (which is [a] useful and [b] supports
1743		     MS P-SDK).  */
1744		  if (pedantic)
1745		    pedwarn ("ISO C doesn't support unnamed structs/unions");
1746
1747		  $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE);
1748		  POP_DECLSPEC_STACK; }
1749	| declspecs_nosc_nots setspecs components_notype
1750		{ $$ = $3;
1751		  POP_DECLSPEC_STACK; }
1752	| declspecs_nosc_nots
1753		{ if (pedantic)
1754		    pedwarn ("ISO C forbids member declarations with no members");
1755		  shadow_tag($1);
1756		  $$ = NULL_TREE; }
1757	| error
1758		{ $$ = NULL_TREE; }
1759	| extension component_decl
1760		{ $$ = $2;
1761		  RESTORE_EXT_FLAGS ($1); }
1762	;
1763
1764components:
1765	  component_declarator
1766	| components ',' maybe_resetattrs component_declarator
1767		{ $$ = chainon ($1, $4); }
1768	;
1769
1770components_notype:
1771	  component_notype_declarator
1772	| components_notype ',' maybe_resetattrs component_notype_declarator
1773		{ $$ = chainon ($1, $4); }
1774	;
1775
1776component_declarator:
1777	  save_filename save_lineno declarator maybe_attribute
1778		{ $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1779		  decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1780	| save_filename save_lineno
1781	  declarator ':' expr_no_commas maybe_attribute
1782		{ $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1783		  decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1784	| save_filename save_lineno ':' expr_no_commas maybe_attribute
1785		{ $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1786		  decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1787	;
1788
1789component_notype_declarator:
1790	  save_filename save_lineno notype_declarator maybe_attribute
1791		{ $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1792		  decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1793	| save_filename save_lineno
1794	  notype_declarator ':' expr_no_commas maybe_attribute
1795		{ $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1796		  decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1797	| save_filename save_lineno ':' expr_no_commas maybe_attribute
1798		{ $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1799		  decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1800	;
1801
1802/* We chain the enumerators in reverse order.
1803   They are put in forward order where enumlist is used.
1804   (The order used to be significant, but no longer is so.
1805   However, we still maintain the order, just to be clean.)  */
1806
1807enumlist:
1808	  enumerator
1809	| enumlist ',' enumerator
1810		{ if ($1 == error_mark_node)
1811		    $$ = $1;
1812		  else
1813		    $$ = chainon ($3, $1); }
1814	| error
1815		{ $$ = error_mark_node; }
1816	;
1817
1818
1819enumerator:
1820	  identifier
1821		{ $$ = build_enumerator ($1, NULL_TREE); }
1822	| identifier '=' expr_no_commas
1823		{ $$ = build_enumerator ($1, $3); }
1824	;
1825
1826typename:
1827	  declspecs_nosc
1828		{ pending_xref_error ();
1829		  $<ttype>$ = $1; }
1830	  absdcl
1831		{ $$ = build_tree_list ($<ttype>2, $3); }
1832	;
1833
1834absdcl:   /* an absolute declarator */
1835	/* empty */
1836		{ $$ = NULL_TREE; }
1837	| absdcl1
1838	;
1839
1840absdcl_maybe_attribute:   /* absdcl maybe_attribute, but not just attributes */
1841	/* empty */
1842		{ $$ = build_tree_list (build_tree_list (current_declspecs,
1843							 NULL_TREE),
1844					all_prefix_attributes); }
1845	| absdcl1
1846		{ $$ = build_tree_list (build_tree_list (current_declspecs,
1847							 $1),
1848					all_prefix_attributes); }
1849	| absdcl1_noea attributes
1850		{ $$ = build_tree_list (build_tree_list (current_declspecs,
1851							 $1),
1852					chainon ($2, all_prefix_attributes)); }
1853	;
1854
1855absdcl1:  /* a nonempty absolute declarator */
1856	  absdcl1_ea
1857	| absdcl1_noea
1858	;
1859
1860absdcl1_noea:
1861	  direct_absdcl1
1862	| '*' maybe_type_quals_attrs absdcl1_noea
1863		{ $$ = make_pointer_declarator ($2, $3); }
1864	;
1865
1866absdcl1_ea:
1867	  '*' maybe_type_quals_attrs
1868		{ $$ = make_pointer_declarator ($2, NULL_TREE); }
1869	| '*' maybe_type_quals_attrs absdcl1_ea
1870		{ $$ = make_pointer_declarator ($2, $3); }
1871	;
1872
1873direct_absdcl1:
1874	  '(' maybe_attribute absdcl1 ')'
1875		{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1876	| direct_absdcl1 '(' parmlist
1877		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1878	| direct_absdcl1 array_declarator
1879		{ $$ = set_array_declarator_type ($2, $1, 1); }
1880	| '(' parmlist
1881		{ $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
1882	| array_declarator
1883		{ $$ = set_array_declarator_type ($1, NULL_TREE, 1); }
1884	;
1885
1886/* The [...] part of a declarator for an array type.  */
1887
1888array_declarator:
1889	'[' maybe_type_quals_attrs expr ']'
1890		{ $$ = build_array_declarator ($3, $2, 0, 0); }
1891	| '[' maybe_type_quals_attrs ']'
1892		{ $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
1893	| '[' maybe_type_quals_attrs '*' ']'
1894		{ $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
1895	| '[' STATIC maybe_type_quals_attrs expr ']'
1896		{ $$ = build_array_declarator ($4, $3, 1, 0); }
1897	/* declspecs_nosc_nots is a synonym for type_quals_attrs.  */
1898	| '[' declspecs_nosc_nots STATIC expr ']'
1899		{ $$ = build_array_declarator ($4, $2, 1, 0); }
1900	;
1901
1902/* A nonempty series of declarations and statements (possibly followed by
1903   some labels) that can form the body of a compound statement.
1904   NOTE: we don't allow labels on declarations; this might seem like a
1905   natural extension, but there would be a conflict between attributes
1906   on the label and prefix attributes on the declaration.  */
1907
1908stmts_and_decls:
1909	  lineno_stmt_decl_or_labels_ending_stmt
1910	| lineno_stmt_decl_or_labels_ending_decl
1911	| lineno_stmt_decl_or_labels_ending_label
1912		{
1913		  pedwarn ("deprecated use of label at end of compound statement");
1914		}
1915	| lineno_stmt_decl_or_labels_ending_error
1916	;
1917
1918lineno_stmt_decl_or_labels_ending_stmt:
1919	  lineno_stmt
1920	| lineno_stmt_decl_or_labels_ending_stmt lineno_stmt
1921	| lineno_stmt_decl_or_labels_ending_decl lineno_stmt
1922	| lineno_stmt_decl_or_labels_ending_label lineno_stmt
1923	| lineno_stmt_decl_or_labels_ending_error lineno_stmt
1924	;
1925
1926lineno_stmt_decl_or_labels_ending_decl:
1927	  lineno_decl
1928	| lineno_stmt_decl_or_labels_ending_stmt lineno_decl
1929		{ if (pedantic && !flag_isoc99)
1930		    pedwarn ("ISO C89 forbids mixed declarations and code"); }
1931	| lineno_stmt_decl_or_labels_ending_decl lineno_decl
1932	| lineno_stmt_decl_or_labels_ending_error lineno_decl
1933	;
1934
1935lineno_stmt_decl_or_labels_ending_label:
1936	  lineno_label
1937	| lineno_stmt_decl_or_labels_ending_stmt lineno_label
1938	| lineno_stmt_decl_or_labels_ending_decl lineno_label
1939	| lineno_stmt_decl_or_labels_ending_label lineno_label
1940	| lineno_stmt_decl_or_labels_ending_error lineno_label
1941	;
1942
1943lineno_stmt_decl_or_labels_ending_error:
1944	errstmt
1945	| lineno_stmt_decl_or_labels errstmt
1946	;
1947
1948lineno_stmt_decl_or_labels:
1949	  lineno_stmt_decl_or_labels_ending_stmt
1950	| lineno_stmt_decl_or_labels_ending_decl
1951	| lineno_stmt_decl_or_labels_ending_label
1952	| lineno_stmt_decl_or_labels_ending_error
1953	;
1954
1955errstmt:  error ';'
1956	;
1957
1958pushlevel:  /* empty */
1959		{ pushlevel (0);
1960		  clear_last_expr ();
1961		  add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
1962		}
1963	;
1964
1965poplevel:  /* empty */
1966                { $$ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); }
1967        ;
1968
1969/* Start and end blocks created for the new scopes of C99.  */
1970c99_block_start: /* empty */
1971		{ if (flag_isoc99)
1972		    {
1973		      $$ = c_begin_compound_stmt ();
1974		      pushlevel (0);
1975		      clear_last_expr ();
1976		      add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
1977		    }
1978		  else
1979		    $$ = NULL_TREE;
1980		}
1981	;
1982
1983/* Productions using c99_block_start and c99_block_end will need to do what's
1984   in compstmt: RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); $$ = $2; where
1985   $1 is the value of c99_block_start and $2 of c99_block_end.  */
1986c99_block_end: /* empty */
1987                { if (flag_isoc99)
1988		    {
1989		      tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
1990		      $$ = poplevel (kept_level_p (), 0, 0);
1991		      SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
1992			= SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
1993			= $$;
1994		    }
1995		  else
1996		    $$ = NULL_TREE; }
1997	;
1998
1999/* Read zero or more forward-declarations for labels
2000   that nested functions can jump to.  */
2001maybe_label_decls:
2002	  /* empty */
2003	| label_decls
2004		{ if (pedantic)
2005		    pedwarn ("ISO C forbids label declarations"); }
2006	;
2007
2008label_decls:
2009	  label_decl
2010	| label_decls label_decl
2011	;
2012
2013label_decl:
2014	  LABEL identifiers_or_typenames ';'
2015		{ tree link;
2016		  for (link = $2; link; link = TREE_CHAIN (link))
2017		    {
2018		      tree label = shadow_label (TREE_VALUE (link));
2019		      C_DECLARED_LABEL_FLAG (label) = 1;
2020		      add_decl_stmt (label);
2021		    }
2022		}
2023	;
2024
2025/* This is the body of a function definition.
2026   It causes syntax errors to ignore to the next openbrace.  */
2027compstmt_or_error:
2028	  compstmt
2029		{}
2030	| error compstmt
2031	;
2032
2033compstmt_start: '{' { compstmt_count++;
2034                      $$ = c_begin_compound_stmt (); }
2035        ;
2036
2037compstmt_nostart: '}'
2038		{ $$ = convert (void_type_node, integer_zero_node); }
2039	| pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel
2040		{ $$ = poplevel (kept_level_p (), 1, 0);
2041		  SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
2042		    = SCOPE_STMT_BLOCK (TREE_VALUE ($5))
2043		    = $$; }
2044	;
2045
2046compstmt_contents_nonempty:
2047	  stmts_and_decls
2048	| error
2049	;
2050
2051compstmt_primary_start:
2052	'(' '{'
2053		{ if (current_function_decl == 0)
2054		    {
2055		      error ("braced-group within expression allowed only inside a function");
2056		      YYERROR;
2057		    }
2058		  /* We must force a BLOCK for this level
2059		     so that, if it is not expanded later,
2060		     there is a way to turn off the entire subtree of blocks
2061		     that are contained in it.  */
2062		  keep_next_level ();
2063		  push_label_level ();
2064		  compstmt_count++;
2065		  $$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree));
2066		}
2067        ;
2068
2069compstmt: compstmt_start compstmt_nostart
2070		{ RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2071		  last_expr_type = NULL_TREE;
2072                  $$ = $1; }
2073	;
2074
2075/* Value is number of statements counted as of the closeparen.  */
2076simple_if:
2077	  if_prefix c99_block_lineno_labeled_stmt
2078                { c_finish_then (); }
2079/* Make sure c_expand_end_cond is run once
2080   for each call to c_expand_start_cond.
2081   Otherwise a crash is likely.  */
2082	| if_prefix error
2083	;
2084
2085if_prefix:
2086	  /* We must build the IF_STMT node before parsing its
2087	     condition so that STMT_LINENO refers to the line
2088	     containing the "if", and not the line containing
2089	     the close-parenthesis.
2090
2091	     c_begin_if_stmt returns the IF_STMT node, which
2092	     we later pass to c_expand_start_cond to fill
2093	     in the condition and other tidbits.  */
2094          IF
2095                { $<ttype>$ = c_begin_if_stmt (); }
2096            '(' expr ')'
2097		{ c_expand_start_cond (c_common_truthvalue_conversion ($4),
2098				       compstmt_count,$<ttype>2);
2099		  $<itype>$ = stmt_count;
2100		  if_stmt_file = $<filename>-2;
2101		  if_stmt_line = $<lineno>-1; }
2102        ;
2103
2104/* This is a subroutine of stmt.
2105   It is used twice, once for valid DO statements
2106   and once for catching errors in parsing the end test.  */
2107do_stmt_start:
2108	  DO
2109		{ stmt_count++;
2110		  compstmt_count++;
2111		  $<ttype>$
2112		    = add_stmt (build_stmt (DO_STMT, NULL_TREE,
2113					    NULL_TREE));
2114		  /* In the event that a parse error prevents
2115		     parsing the complete do-statement, set the
2116		     condition now.  Otherwise, we can get crashes at
2117		     RTL-generation time.  */
2118		  DO_COND ($<ttype>$) = error_mark_node; }
2119	  c99_block_lineno_labeled_stmt WHILE
2120		{ $$ = $<ttype>2;
2121		  RECHAIN_STMTS ($$, DO_BODY ($$)); }
2122	;
2123
2124/* The forced readahead in here is because we might be at the end of a
2125   line, and the line and file won't be bumped until yylex absorbs the
2126   first token on the next line.  */
2127save_filename:
2128		{ if (yychar == YYEMPTY)
2129		    yychar = YYLEX;
2130		  $$ = input_filename; }
2131	;
2132
2133save_lineno:
2134		{ if (yychar == YYEMPTY)
2135		    yychar = YYLEX;
2136		  $$ = lineno; }
2137	;
2138
2139lineno_labeled_stmt:
2140	  lineno_stmt
2141	| lineno_label lineno_labeled_stmt
2142	;
2143
2144/* Like lineno_labeled_stmt, but a block in C99.  */
2145c99_block_lineno_labeled_stmt:
2146	  c99_block_start lineno_labeled_stmt c99_block_end
2147		{ if (flag_isoc99)
2148		    RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); }
2149	;
2150
2151lineno_stmt:
2152	  save_filename save_lineno stmt
2153		{ if ($3)
2154		    {
2155		      STMT_LINENO ($3) = $2;
2156		      /* ??? We currently have no way of recording
2157			 the filename for a statement.  This probably
2158			 matters little in practice at the moment,
2159			 but I suspect that problems will occur when
2160			 doing inlining at the tree level.  */
2161		    }
2162		}
2163	;
2164
2165lineno_label:
2166	  save_filename save_lineno label
2167		{ if ($3)
2168		    {
2169		      STMT_LINENO ($3) = $2;
2170		    }
2171		}
2172	;
2173
2174select_or_iter_stmt:
2175	  simple_if ELSE
2176		{ c_expand_start_else ();
2177		  $<itype>1 = stmt_count; }
2178	  c99_block_lineno_labeled_stmt
2179                { c_finish_else ();
2180		  c_expand_end_cond ();
2181		  if (extra_warnings && stmt_count == $<itype>1)
2182		    warning ("empty body in an else-statement"); }
2183	| simple_if %prec IF
2184		{ c_expand_end_cond ();
2185		  /* This warning is here instead of in simple_if, because we
2186		     do not want a warning if an empty if is followed by an
2187		     else statement.  Increment stmt_count so we don't
2188		     give a second error if this is a nested `if'.  */
2189		  if (extra_warnings && stmt_count++ == $<itype>1)
2190		    warning_with_file_and_line (if_stmt_file, if_stmt_line,
2191						"empty body in an if-statement"); }
2192/* Make sure c_expand_end_cond is run once
2193   for each call to c_expand_start_cond.
2194   Otherwise a crash is likely.  */
2195	| simple_if ELSE error
2196		{ c_expand_end_cond (); }
2197       /* We must build the WHILE_STMT node before parsing its
2198	  condition so that STMT_LINENO refers to the line
2199	  containing the "while", and not the line containing
2200	  the close-parenthesis.
2201
2202	  c_begin_while_stmt returns the WHILE_STMT node, which
2203	  we later pass to c_finish_while_stmt_cond to fill
2204	  in the condition and other tidbits.  */
2205	| WHILE
2206                { stmt_count++;
2207		  $<ttype>$ = c_begin_while_stmt (); }
2208	  '(' expr ')'
2209                { $4 = c_common_truthvalue_conversion ($4);
2210		  c_finish_while_stmt_cond
2211		    (c_common_truthvalue_conversion ($4), $<ttype>2);
2212		  $<ttype>$ = add_stmt ($<ttype>2); }
2213	  c99_block_lineno_labeled_stmt
2214		{ RECHAIN_STMTS ($<ttype>6, WHILE_BODY ($<ttype>6)); }
2215	| do_stmt_start
2216	  '(' expr ')' ';'
2217                { DO_COND ($1) = c_common_truthvalue_conversion ($3); }
2218	| do_stmt_start error
2219 		{ }
2220	| FOR
2221		{ $<ttype>$ = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
2222					  NULL_TREE, NULL_TREE);
2223		  add_stmt ($<ttype>$); }
2224	  '(' for_init_stmt
2225		{ stmt_count++;
2226		  RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
2227	  xexpr ';'
2228                { if ($6)
2229		    FOR_COND ($<ttype>2)
2230		      = c_common_truthvalue_conversion ($6); }
2231	  xexpr ')'
2232		{ FOR_EXPR ($<ttype>2) = $9; }
2233	  c99_block_lineno_labeled_stmt
2234                { RECHAIN_STMTS ($<ttype>2, FOR_BODY ($<ttype>2)); }
2235	| SWITCH '(' expr ')'
2236		{ stmt_count++;
2237		  $<ttype>$ = c_start_case ($3); }
2238	  c99_block_lineno_labeled_stmt
2239                { c_finish_case (); }
2240	;
2241
2242for_init_stmt:
2243	  xexpr ';'
2244		{ add_stmt (build_stmt (EXPR_STMT, $1)); }
2245	| decl
2246		{ check_for_loop_decls (); }
2247	;
2248
2249/* Parse a single real statement, not including any labels.  */
2250stmt:
2251	  compstmt
2252		{ stmt_count++; $$ = $1; }
2253	| expr ';'
2254		{ stmt_count++;
2255		  $$ = c_expand_expr_stmt ($1); }
2256	| c99_block_start select_or_iter_stmt c99_block_end
2257		{ if (flag_isoc99)
2258		    RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2259		  $$ = NULL_TREE; }
2260	| BREAK ';'
2261	        { stmt_count++;
2262		  $$ = add_stmt (build_break_stmt ()); }
2263	| CONTINUE ';'
2264                { stmt_count++;
2265		  $$ = add_stmt (build_continue_stmt ()); }
2266	| RETURN ';'
2267                { stmt_count++;
2268		  $$ = c_expand_return (NULL_TREE); }
2269	| RETURN expr ';'
2270                { stmt_count++;
2271		  $$ = c_expand_return ($2); }
2272	| ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
2273		{ stmt_count++;
2274		  $$ = simple_asm_stmt ($4); }
2275	/* This is the case with just output operands.  */
2276	| ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
2277		{ stmt_count++;
2278		  $$ = build_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
2279	/* This is the case with input operands as well.  */
2280	| ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2281	  asm_operands ')' ';'
2282		{ stmt_count++;
2283		  $$ = build_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
2284	/* This is the case with clobbered registers as well.  */
2285	| ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2286  	  asm_operands ':' asm_clobbers ')' ';'
2287		{ stmt_count++;
2288		  $$ = build_asm_stmt ($2, $4, $6, $8, $10); }
2289	| GOTO identifier ';'
2290		{ tree decl;
2291		  stmt_count++;
2292		  decl = lookup_label ($2);
2293		  if (decl != 0)
2294		    {
2295		      TREE_USED (decl) = 1;
2296		      $$ = add_stmt (build_stmt (GOTO_STMT, decl));
2297		    }
2298		  else
2299		    $$ = NULL_TREE;
2300		}
2301	| GOTO '*' expr ';'
2302		{ if (pedantic)
2303		    pedwarn ("ISO C forbids `goto *expr;'");
2304		  stmt_count++;
2305		  $3 = convert (ptr_type_node, $3);
2306		  $$ = add_stmt (build_stmt (GOTO_STMT, $3)); }
2307	| ';'
2308		{ $$ = NULL_TREE; }
2309	;
2310
2311/* Any kind of label, including jump labels and case labels.
2312   ANSI C accepts labels only before statements, but we allow them
2313   also at the end of a compound statement.  */
2314
2315label:	  CASE expr_no_commas ':'
2316                { stmt_count++;
2317		  $$ = do_case ($2, NULL_TREE); }
2318	| CASE expr_no_commas ELLIPSIS expr_no_commas ':'
2319                { stmt_count++;
2320		  $$ = do_case ($2, $4); }
2321	| DEFAULT ':'
2322                { stmt_count++;
2323		  $$ = do_case (NULL_TREE, NULL_TREE); }
2324	| identifier save_filename save_lineno ':' maybe_attribute
2325		{ tree label = define_label ($2, $3, $1);
2326		  stmt_count++;
2327		  if (label)
2328		    {
2329		      decl_attributes (&label, $5, 0);
2330		      $$ = add_stmt (build_stmt (LABEL_STMT, label));
2331		    }
2332		  else
2333		    $$ = NULL_TREE;
2334		}
2335	;
2336
2337/* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
2338
2339maybe_type_qual:
2340	/* empty */
2341		{ emit_line_note (input_filename, lineno);
2342		  $$ = NULL_TREE; }
2343	| TYPE_QUAL
2344		{ emit_line_note (input_filename, lineno); }
2345	;
2346
2347xexpr:
2348	/* empty */
2349		{ $$ = NULL_TREE; }
2350	| expr
2351	;
2352
2353/* These are the operands other than the first string and colon
2354   in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
2355asm_operands: /* empty */
2356		{ $$ = NULL_TREE; }
2357	| nonnull_asm_operands
2358	;
2359
2360nonnull_asm_operands:
2361	  asm_operand
2362	| nonnull_asm_operands ',' asm_operand
2363		{ $$ = chainon ($1, $3); }
2364	;
2365
2366asm_operand:
2367	  STRING '(' expr ')'
2368		{ $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
2369	| '[' identifier ']' STRING '(' expr ')'
2370		{ $2 = build_string (IDENTIFIER_LENGTH ($2),
2371				     IDENTIFIER_POINTER ($2));
2372		  $$ = build_tree_list (build_tree_list ($2, $4), $6); }
2373	;
2374
2375asm_clobbers:
2376	  STRING
2377		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
2378	| asm_clobbers ',' STRING
2379		{ $$ = tree_cons (NULL_TREE, $3, $1); }
2380	;
2381
2382/* This is what appears inside the parens in a function declarator.
2383   Its value is a list of ..._TYPE nodes.  Attributes must appear here
2384   to avoid a conflict with their appearance after an open parenthesis
2385   in an abstract declarator, as in
2386   "void bar (int (__attribute__((__mode__(SI))) int foo));".  */
2387parmlist:
2388	  maybe_attribute
2389		{ pushlevel (0);
2390		  clear_parm_order ();
2391		  declare_parm_level (0); }
2392	  parmlist_1
2393		{ $$ = $3;
2394		  parmlist_tags_warning ();
2395		  poplevel (0, 0, 0); }
2396	;
2397
2398parmlist_1:
2399	  parmlist_2 ')'
2400	| parms ';'
2401		{ tree parm;
2402		  if (pedantic)
2403		    pedwarn ("ISO C forbids forward parameter declarations");
2404		  /* Mark the forward decls as such.  */
2405		  for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
2406		    TREE_ASM_WRITTEN (parm) = 1;
2407		  clear_parm_order (); }
2408	  maybe_attribute
2409		{ /* Dummy action so attributes are in known place
2410		     on parser stack.  */ }
2411	  parmlist_1
2412		{ $$ = $6; }
2413	| error ')'
2414		{ $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
2415	;
2416
2417/* This is what appears inside the parens in a function declarator.
2418   Is value is represented in the format that grokdeclarator expects.  */
2419parmlist_2:  /* empty */
2420		{ $$ = get_parm_info (0); }
2421	| ELLIPSIS
2422		{ $$ = get_parm_info (0);
2423		  /* Gcc used to allow this as an extension.  However, it does
2424		     not work for all targets, and thus has been disabled.
2425		     Also, since func (...) and func () are indistinguishable,
2426		     it caused problems with the code in expand_builtin which
2427		     tries to verify that BUILT_IN_NEXT_ARG is being used
2428		     correctly.  */
2429		  error ("ISO C requires a named argument before `...'");
2430		}
2431	| parms
2432		{ $$ = get_parm_info (1);
2433		  parsing_iso_function_signature = true;
2434		}
2435	| parms ',' ELLIPSIS
2436		{ $$ = get_parm_info (0); }
2437	;
2438
2439parms:
2440	firstparm
2441		{ push_parm_decl ($1); }
2442	| parms ',' parm
2443		{ push_parm_decl ($3); }
2444	;
2445
2446/* A single parameter declaration or parameter type name,
2447   as found in a parmlist.  */
2448parm:
2449	  declspecs_ts setspecs parm_declarator maybe_attribute
2450		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2451							 $3),
2452					chainon ($4, all_prefix_attributes));
2453		  POP_DECLSPEC_STACK; }
2454	| declspecs_ts setspecs notype_declarator maybe_attribute
2455		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2456							 $3),
2457					chainon ($4, all_prefix_attributes));
2458		  POP_DECLSPEC_STACK; }
2459	| declspecs_ts setspecs absdcl_maybe_attribute
2460		{ $$ = $3;
2461		  POP_DECLSPEC_STACK; }
2462	| declspecs_nots setspecs notype_declarator maybe_attribute
2463		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2464							 $3),
2465					chainon ($4, all_prefix_attributes));
2466		  POP_DECLSPEC_STACK; }
2467
2468	| declspecs_nots setspecs absdcl_maybe_attribute
2469		{ $$ = $3;
2470		  POP_DECLSPEC_STACK; }
2471	;
2472
2473/* The first parm, which must suck attributes from off the top of the parser
2474   stack.  */
2475firstparm:
2476	  declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute
2477		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2478							 $3),
2479					chainon ($4, all_prefix_attributes));
2480		  POP_DECLSPEC_STACK; }
2481	| declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
2482		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2483							 $3),
2484					chainon ($4, all_prefix_attributes));
2485		  POP_DECLSPEC_STACK; }
2486	| declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
2487		{ $$ = $3;
2488		  POP_DECLSPEC_STACK; }
2489	| declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute
2490		{ $$ = build_tree_list (build_tree_list (current_declspecs,
2491							 $3),
2492					chainon ($4, all_prefix_attributes));
2493		  POP_DECLSPEC_STACK; }
2494
2495	| declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute
2496		{ $$ = $3;
2497		  POP_DECLSPEC_STACK; }
2498	;
2499
2500setspecs_fp:
2501	  setspecs
2502		{ prefix_attributes = chainon (prefix_attributes, $<ttype>-2);
2503		  all_prefix_attributes = prefix_attributes; }
2504	;
2505
2506/* This is used in a function definition
2507   where either a parmlist or an identifier list is ok.
2508   Its value is a list of ..._TYPE nodes or a list of identifiers.  */
2509parmlist_or_identifiers:
2510	  maybe_attribute
2511		{ pushlevel (0);
2512		  clear_parm_order ();
2513		  declare_parm_level (1); }
2514	  parmlist_or_identifiers_1
2515		{ $$ = $3;
2516		  parmlist_tags_warning ();
2517		  poplevel (0, 0, 0); }
2518	;
2519
2520parmlist_or_identifiers_1:
2521	  parmlist_1
2522	| identifiers ')'
2523		{ tree t;
2524		  for (t = $1; t; t = TREE_CHAIN (t))
2525		    if (TREE_VALUE (t) == NULL_TREE)
2526		      error ("`...' in old-style identifier list");
2527		  $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
2528
2529		  /* Make sure we have a parmlist after attributes.  */
2530		  if ($<ttype>-1 != 0
2531		      && (TREE_CODE ($$) != TREE_LIST
2532			  || TREE_PURPOSE ($$) == 0
2533			  || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
2534		    YYERROR1;
2535		}
2536	;
2537
2538/* A nonempty list of identifiers.  */
2539identifiers:
2540	IDENTIFIER
2541		{ $$ = build_tree_list (NULL_TREE, $1); }
2542	| identifiers ',' IDENTIFIER
2543		{ $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2544	;
2545
2546/* A nonempty list of identifiers, including typenames.  */
2547identifiers_or_typenames:
2548	identifier
2549		{ $$ = build_tree_list (NULL_TREE, $1); }
2550	| identifiers_or_typenames ',' identifier
2551		{ $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2552	;
2553
2554extension:
2555	EXTENSION
2556		{ $$ = SAVE_EXT_FLAGS();
2557		  pedantic = 0;
2558		  warn_pointer_arith = 0;
2559		  warn_traditional = 0;
2560		  flag_iso = 0; }
2561	;
2562
2563%%
2564
2565/* yylex() is a thin wrapper around c_lex(), all it does is translate
2566   cpplib.h's token codes into yacc's token codes.  */
2567
2568static enum cpp_ttype last_token;
2569
2570/* The reserved keyword table.  */
2571struct resword
2572{
2573  const char *word;
2574  ENUM_BITFIELD(rid) rid : 16;
2575  unsigned int disable   : 16;
2576};
2577
2578/* Disable mask.  Keywords are disabled if (reswords[i].disable & mask) is
2579   _true_.  */
2580#define D_C89	0x01	/* not in C89 */
2581#define D_EXT	0x02	/* GCC extension */
2582#define D_EXT89	0x04	/* GCC extension incorporated in C99 */
2583#define D_OBJC	0x08	/* Objective C only */
2584
2585static const struct resword reswords[] =
2586{
2587  { "_Bool",		RID_BOOL,	0 },
2588  { "_Complex",		RID_COMPLEX,	0 },
2589  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
2590  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
2591  { "__alignof",	RID_ALIGNOF,	0 },
2592  { "__alignof__",	RID_ALIGNOF,	0 },
2593  { "__asm",		RID_ASM,	0 },
2594  { "__asm__",		RID_ASM,	0 },
2595  { "__attribute",	RID_ATTRIBUTE,	0 },
2596  { "__attribute__",	RID_ATTRIBUTE,	0 },
2597  { "__bounded",	RID_BOUNDED,	0 },
2598  { "__bounded__",	RID_BOUNDED,	0 },
2599  { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
2600  { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
2601  { "__builtin_va_arg",	RID_VA_ARG,	0 },
2602  { "__complex",	RID_COMPLEX,	0 },
2603  { "__complex__",	RID_COMPLEX,	0 },
2604  { "__const",		RID_CONST,	0 },
2605  { "__const__",	RID_CONST,	0 },
2606  { "__extension__",	RID_EXTENSION,	0 },
2607  { "__func__",		RID_C99_FUNCTION_NAME, 0 },
2608  { "__imag",		RID_IMAGPART,	0 },
2609  { "__imag__",		RID_IMAGPART,	0 },
2610  { "__inline",		RID_INLINE,	0 },
2611  { "__inline__",	RID_INLINE,	0 },
2612  { "__label__",	RID_LABEL,	0 },
2613  { "__ptrbase",	RID_PTRBASE,	0 },
2614  { "__ptrbase__",	RID_PTRBASE,	0 },
2615  { "__ptrextent",	RID_PTREXTENT,	0 },
2616  { "__ptrextent__",	RID_PTREXTENT,	0 },
2617  { "__ptrvalue",	RID_PTRVALUE,	0 },
2618  { "__ptrvalue__",	RID_PTRVALUE,	0 },
2619  { "__real",		RID_REALPART,	0 },
2620  { "__real__",		RID_REALPART,	0 },
2621  { "__restrict",	RID_RESTRICT,	0 },
2622  { "__restrict__",	RID_RESTRICT,	0 },
2623  { "__signed",		RID_SIGNED,	0 },
2624  { "__signed__",	RID_SIGNED,	0 },
2625  { "__thread",		RID_THREAD,	0 },
2626  { "__typeof",		RID_TYPEOF,	0 },
2627  { "__typeof__",	RID_TYPEOF,	0 },
2628  { "__unbounded",	RID_UNBOUNDED,	0 },
2629  { "__unbounded__",	RID_UNBOUNDED,	0 },
2630  { "__volatile",	RID_VOLATILE,	0 },
2631  { "__volatile__",	RID_VOLATILE,	0 },
2632  { "asm",		RID_ASM,	D_EXT },
2633  { "auto",		RID_AUTO,	0 },
2634  { "break",		RID_BREAK,	0 },
2635  { "case",		RID_CASE,	0 },
2636  { "char",		RID_CHAR,	0 },
2637  { "const",		RID_CONST,	0 },
2638  { "continue",		RID_CONTINUE,	0 },
2639  { "default",		RID_DEFAULT,	0 },
2640  { "do",		RID_DO,		0 },
2641  { "double",		RID_DOUBLE,	0 },
2642  { "else",		RID_ELSE,	0 },
2643  { "enum",		RID_ENUM,	0 },
2644  { "extern",		RID_EXTERN,	0 },
2645  { "float",		RID_FLOAT,	0 },
2646  { "for",		RID_FOR,	0 },
2647  { "goto",		RID_GOTO,	0 },
2648  { "if",		RID_IF,		0 },
2649  { "inline",		RID_INLINE,	D_EXT89 },
2650  { "int",		RID_INT,	0 },
2651  { "long",		RID_LONG,	0 },
2652  { "register",		RID_REGISTER,	0 },
2653  { "restrict",		RID_RESTRICT,	D_C89 },
2654  { "return",		RID_RETURN,	0 },
2655  { "short",		RID_SHORT,	0 },
2656  { "signed",		RID_SIGNED,	0 },
2657  { "sizeof",		RID_SIZEOF,	0 },
2658  { "static",		RID_STATIC,	0 },
2659  { "struct",		RID_STRUCT,	0 },
2660  { "switch",		RID_SWITCH,	0 },
2661  { "typedef",		RID_TYPEDEF,	0 },
2662  { "typeof",		RID_TYPEOF,	D_EXT },
2663  { "union",		RID_UNION,	0 },
2664  { "unsigned",		RID_UNSIGNED,	0 },
2665  { "void",		RID_VOID,	0 },
2666  { "volatile",		RID_VOLATILE,	0 },
2667  { "while",		RID_WHILE,	0 },
2668};
2669#define N_reswords (sizeof reswords / sizeof (struct resword))
2670
2671/* Table mapping from RID_* constants to yacc token numbers.
2672   Unfortunately we have to have entries for all the keywords in all
2673   three languages.  */
2674static const short rid_to_yy[RID_MAX] =
2675{
2676  /* RID_STATIC */	STATIC,
2677  /* RID_UNSIGNED */	TYPESPEC,
2678  /* RID_LONG */	TYPESPEC,
2679  /* RID_CONST */	TYPE_QUAL,
2680  /* RID_EXTERN */	SCSPEC,
2681  /* RID_REGISTER */	SCSPEC,
2682  /* RID_TYPEDEF */	SCSPEC,
2683  /* RID_SHORT */	TYPESPEC,
2684  /* RID_INLINE */	SCSPEC,
2685  /* RID_VOLATILE */	TYPE_QUAL,
2686  /* RID_SIGNED */	TYPESPEC,
2687  /* RID_AUTO */	SCSPEC,
2688  /* RID_RESTRICT */	TYPE_QUAL,
2689
2690  /* C extensions */
2691  /* RID_BOUNDED */	TYPE_QUAL,
2692  /* RID_UNBOUNDED */	TYPE_QUAL,
2693  /* RID_COMPLEX */	TYPESPEC,
2694  /* RID_THREAD */	SCSPEC,
2695
2696  /* C++ */
2697  /* RID_FRIEND */	0,
2698  /* RID_VIRTUAL */	0,
2699  /* RID_EXPLICIT */	0,
2700  /* RID_EXPORT */	0,
2701  /* RID_MUTABLE */	0,
2702
2703  /* ObjC */
2704  /* RID_IN */		TYPE_QUAL,
2705  /* RID_OUT */		TYPE_QUAL,
2706  /* RID_INOUT */	TYPE_QUAL,
2707  /* RID_BYCOPY */	TYPE_QUAL,
2708  /* RID_BYREF */	TYPE_QUAL,
2709  /* RID_ONEWAY */	TYPE_QUAL,
2710
2711  /* C */
2712  /* RID_INT */		TYPESPEC,
2713  /* RID_CHAR */	TYPESPEC,
2714  /* RID_FLOAT */	TYPESPEC,
2715  /* RID_DOUBLE */	TYPESPEC,
2716  /* RID_VOID */	TYPESPEC,
2717  /* RID_ENUM */	ENUM,
2718  /* RID_STRUCT */	STRUCT,
2719  /* RID_UNION */	UNION,
2720  /* RID_IF */		IF,
2721  /* RID_ELSE */	ELSE,
2722  /* RID_WHILE */	WHILE,
2723  /* RID_DO */		DO,
2724  /* RID_FOR */		FOR,
2725  /* RID_SWITCH */	SWITCH,
2726  /* RID_CASE */	CASE,
2727  /* RID_DEFAULT */	DEFAULT,
2728  /* RID_BREAK */	BREAK,
2729  /* RID_CONTINUE */	CONTINUE,
2730  /* RID_RETURN */	RETURN,
2731  /* RID_GOTO */	GOTO,
2732  /* RID_SIZEOF */	SIZEOF,
2733
2734  /* C extensions */
2735  /* RID_ASM */		ASM_KEYWORD,
2736  /* RID_TYPEOF */	TYPEOF,
2737  /* RID_ALIGNOF */	ALIGNOF,
2738  /* RID_ATTRIBUTE */	ATTRIBUTE,
2739  /* RID_VA_ARG */	VA_ARG,
2740  /* RID_EXTENSION */	EXTENSION,
2741  /* RID_IMAGPART */	IMAGPART,
2742  /* RID_REALPART */	REALPART,
2743  /* RID_LABEL */	LABEL,
2744  /* RID_PTRBASE */	PTR_BASE,
2745  /* RID_PTREXTENT */	PTR_EXTENT,
2746  /* RID_PTRVALUE */	PTR_VALUE,
2747
2748  /* RID_CHOOSE_EXPR */			CHOOSE_EXPR,
2749  /* RID_TYPES_COMPATIBLE_P */		TYPES_COMPATIBLE_P,
2750
2751  /* RID_FUNCTION_NAME */		STRING_FUNC_NAME,
2752  /* RID_PRETTY_FUNCTION_NAME */	STRING_FUNC_NAME,
2753  /* RID_C99_FUNCTION_NAME */		VAR_FUNC_NAME,
2754
2755  /* C++ */
2756  /* RID_BOOL */	TYPESPEC,
2757  /* RID_WCHAR */	0,
2758  /* RID_CLASS */	0,
2759  /* RID_PUBLIC */	0,
2760  /* RID_PRIVATE */	0,
2761  /* RID_PROTECTED */	0,
2762  /* RID_TEMPLATE */	0,
2763  /* RID_NULL */	0,
2764  /* RID_CATCH */	0,
2765  /* RID_DELETE */	0,
2766  /* RID_FALSE */	0,
2767  /* RID_NAMESPACE */	0,
2768  /* RID_NEW */		0,
2769  /* RID_OPERATOR */	0,
2770  /* RID_THIS */	0,
2771  /* RID_THROW */	0,
2772  /* RID_TRUE */	0,
2773  /* RID_TRY */		0,
2774  /* RID_TYPENAME */	0,
2775  /* RID_TYPEID */	0,
2776  /* RID_USING */	0,
2777
2778  /* casts */
2779  /* RID_CONSTCAST */	0,
2780  /* RID_DYNCAST */	0,
2781  /* RID_REINTCAST */	0,
2782  /* RID_STATCAST */	0,
2783
2784  /* Objective C */
2785  /* RID_ID */			OBJECTNAME,
2786  /* RID_AT_ENCODE */		ENCODE,
2787  /* RID_AT_END */		END,
2788  /* RID_AT_CLASS */		CLASS,
2789  /* RID_AT_ALIAS */		ALIAS,
2790  /* RID_AT_DEFS */		DEFS,
2791  /* RID_AT_PRIVATE */		PRIVATE,
2792  /* RID_AT_PROTECTED */	PROTECTED,
2793  /* RID_AT_PUBLIC */		PUBLIC,
2794  /* RID_AT_PROTOCOL */		PROTOCOL,
2795  /* RID_AT_SELECTOR */		SELECTOR,
2796  /* RID_AT_INTERFACE */	INTERFACE,
2797  /* RID_AT_IMPLEMENTATION */	IMPLEMENTATION
2798};
2799
2800static void
2801init_reswords ()
2802{
2803  unsigned int i;
2804  tree id;
2805  int mask = (flag_isoc99 ? 0 : D_C89)
2806	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
2807
2808  if (!flag_objc)
2809     mask |= D_OBJC;
2810
2811  /* It is not necessary to register ridpointers as a GC root, because
2812     all the trees it points to are permanently interned in the
2813     get_identifier hash anyway.  */
2814  ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
2815  for (i = 0; i < N_reswords; i++)
2816    {
2817      /* If a keyword is disabled, do not enter it into the table
2818	 and so create a canonical spelling that isn't a keyword.  */
2819      if (reswords[i].disable & mask)
2820	continue;
2821
2822      id = get_identifier (reswords[i].word);
2823      C_RID_CODE (id) = reswords[i].rid;
2824      C_IS_RESERVED_WORD (id) = 1;
2825      ridpointers [(int) reswords[i].rid] = id;
2826    }
2827}
2828
2829#define NAME(type) cpp_type2name (type)
2830
2831static void
2832yyerror (msgid)
2833     const char *msgid;
2834{
2835  const char *string = _(msgid);
2836
2837  if (last_token == CPP_EOF)
2838    error ("%s at end of input", string);
2839  else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
2840    {
2841      unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
2842      const char *const ell = (last_token == CPP_CHAR) ? "" : "L";
2843      if (val <= UCHAR_MAX && ISGRAPH (val))
2844	error ("%s before %s'%c'", string, ell, val);
2845      else
2846	error ("%s before %s'\\x%x'", string, ell, val);
2847    }
2848  else if (last_token == CPP_STRING
2849	   || last_token == CPP_WSTRING)
2850    error ("%s before string constant", string);
2851  else if (last_token == CPP_NUMBER)
2852    error ("%s before numeric constant", string);
2853  else if (last_token == CPP_NAME)
2854    error ("%s before \"%s\"", string, IDENTIFIER_POINTER (yylval.ttype));
2855  else
2856    error ("%s before '%s' token", string, NAME(last_token));
2857}
2858
2859static int
2860yylexname ()
2861{
2862  tree decl;
2863
2864
2865  if (C_IS_RESERVED_WORD (yylval.ttype))
2866    {
2867      enum rid rid_code = C_RID_CODE (yylval.ttype);
2868
2869      {
2870	int yycode = rid_to_yy[(int) rid_code];
2871	if (yycode == STRING_FUNC_NAME)
2872	  {
2873	    /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
2874	       to string constants.  */
2875	    const char *name = fname_string (rid_code);
2876
2877	    yylval.ttype = build_string (strlen (name) + 1, name);
2878	    C_ARTIFICIAL_STRING_P (yylval.ttype) = 1;
2879	    last_token = CPP_STRING;  /* so yyerror won't choke */
2880	    return STRING;
2881	  }
2882
2883	/* Return the canonical spelling for this keyword.  */
2884	yylval.ttype = ridpointers[(int) rid_code];
2885	return yycode;
2886      }
2887    }
2888
2889  decl = lookup_name (yylval.ttype);
2890  if (decl)
2891    {
2892      if (TREE_CODE (decl) == TYPE_DECL)
2893	return TYPENAME;
2894    }
2895
2896  return IDENTIFIER;
2897}
2898
2899/* Concatenate strings before returning them to the parser.  This isn't quite
2900   as good as having it done in the lexer, but it's better than nothing.  */
2901
2902static int
2903yylexstring ()
2904{
2905  enum cpp_ttype next_type;
2906  tree orig = yylval.ttype;
2907
2908  next_type = c_lex (&yylval.ttype);
2909  if (next_type == CPP_STRING
2910      || next_type == CPP_WSTRING
2911      || (next_type == CPP_NAME && yylexname () == STRING))
2912    {
2913      varray_type strings;
2914
2915      static int last_lineno = 0;
2916      static const char *last_input_filename = 0;
2917      if (warn_traditional && !in_system_header
2918	  && (lineno != last_lineno || !last_input_filename ||
2919	      strcmp (last_input_filename, input_filename)))
2920	{
2921	  warning ("traditional C rejects string concatenation");
2922	  last_lineno = lineno;
2923	  last_input_filename = input_filename;
2924	}
2925
2926      VARRAY_TREE_INIT (strings, 32, "strings");
2927      VARRAY_PUSH_TREE (strings, orig);
2928
2929      do
2930	{
2931	  VARRAY_PUSH_TREE (strings, yylval.ttype);
2932	  next_type = c_lex (&yylval.ttype);
2933	}
2934      while (next_type == CPP_STRING
2935	     || next_type == CPP_WSTRING
2936	     || (next_type == CPP_NAME && yylexname () == STRING));
2937
2938      yylval.ttype = combine_strings (strings);
2939    }
2940  else
2941    yylval.ttype = orig;
2942
2943  /* We will have always read one token too many.  */
2944  _cpp_backup_tokens (parse_in, 1);
2945
2946  return STRING;
2947}
2948
2949static inline int
2950_yylex ()
2951{
2952 get_next:
2953  last_token = c_lex (&yylval.ttype);
2954  switch (last_token)
2955    {
2956    case CPP_EQ:					return '=';
2957    case CPP_NOT:					return '!';
2958    case CPP_GREATER:	yylval.code = GT_EXPR;		return ARITHCOMPARE;
2959    case CPP_LESS:	yylval.code = LT_EXPR;		return ARITHCOMPARE;
2960    case CPP_PLUS:	yylval.code = PLUS_EXPR;	return '+';
2961    case CPP_MINUS:	yylval.code = MINUS_EXPR;	return '-';
2962    case CPP_MULT:	yylval.code = MULT_EXPR;	return '*';
2963    case CPP_DIV:	yylval.code = TRUNC_DIV_EXPR;	return '/';
2964    case CPP_MOD:	yylval.code = TRUNC_MOD_EXPR;	return '%';
2965    case CPP_AND:	yylval.code = BIT_AND_EXPR;	return '&';
2966    case CPP_OR:	yylval.code = BIT_IOR_EXPR;	return '|';
2967    case CPP_XOR:	yylval.code = BIT_XOR_EXPR;	return '^';
2968    case CPP_RSHIFT:	yylval.code = RSHIFT_EXPR;	return RSHIFT;
2969    case CPP_LSHIFT:	yylval.code = LSHIFT_EXPR;	return LSHIFT;
2970
2971    case CPP_COMPL:					return '~';
2972    case CPP_AND_AND:					return ANDAND;
2973    case CPP_OR_OR:					return OROR;
2974    case CPP_QUERY:					return '?';
2975    case CPP_OPEN_PAREN:				return '(';
2976    case CPP_EQ_EQ:	yylval.code = EQ_EXPR;		return EQCOMPARE;
2977    case CPP_NOT_EQ:	yylval.code = NE_EXPR;		return EQCOMPARE;
2978    case CPP_GREATER_EQ:yylval.code = GE_EXPR;		return ARITHCOMPARE;
2979    case CPP_LESS_EQ:	yylval.code = LE_EXPR;		return ARITHCOMPARE;
2980
2981    case CPP_PLUS_EQ:	yylval.code = PLUS_EXPR;	return ASSIGN;
2982    case CPP_MINUS_EQ:	yylval.code = MINUS_EXPR;	return ASSIGN;
2983    case CPP_MULT_EQ:	yylval.code = MULT_EXPR;	return ASSIGN;
2984    case CPP_DIV_EQ:	yylval.code = TRUNC_DIV_EXPR;	return ASSIGN;
2985    case CPP_MOD_EQ:	yylval.code = TRUNC_MOD_EXPR;	return ASSIGN;
2986    case CPP_AND_EQ:	yylval.code = BIT_AND_EXPR;	return ASSIGN;
2987    case CPP_OR_EQ:	yylval.code = BIT_IOR_EXPR;	return ASSIGN;
2988    case CPP_XOR_EQ:	yylval.code = BIT_XOR_EXPR;	return ASSIGN;
2989    case CPP_RSHIFT_EQ:	yylval.code = RSHIFT_EXPR;	return ASSIGN;
2990    case CPP_LSHIFT_EQ:	yylval.code = LSHIFT_EXPR;	return ASSIGN;
2991
2992    case CPP_OPEN_SQUARE:				return '[';
2993    case CPP_CLOSE_SQUARE:				return ']';
2994    case CPP_OPEN_BRACE:				return '{';
2995    case CPP_CLOSE_BRACE:				return '}';
2996    case CPP_ELLIPSIS:					return ELLIPSIS;
2997
2998    case CPP_PLUS_PLUS:					return PLUSPLUS;
2999    case CPP_MINUS_MINUS:				return MINUSMINUS;
3000    case CPP_DEREF:					return POINTSAT;
3001    case CPP_DOT:					return '.';
3002
3003      /* The following tokens may affect the interpretation of any
3004	 identifiers following, if doing Objective-C.  */
3005    case CPP_COLON:		OBJC_NEED_RAW_IDENTIFIER (0);	return ':';
3006    case CPP_COMMA:		OBJC_NEED_RAW_IDENTIFIER (0);	return ',';
3007    case CPP_CLOSE_PAREN:	OBJC_NEED_RAW_IDENTIFIER (0);	return ')';
3008    case CPP_SEMICOLON:		OBJC_NEED_RAW_IDENTIFIER (0);	return ';';
3009
3010    case CPP_EOF:
3011      return 0;
3012
3013    case CPP_NAME:
3014      {
3015	int ret = yylexname ();
3016	if (ret == STRING)
3017	  return yylexstring ();
3018	else
3019	  return ret;
3020      }
3021
3022    case CPP_NUMBER:
3023    case CPP_CHAR:
3024    case CPP_WCHAR:
3025      return CONSTANT;
3026
3027    case CPP_STRING:
3028    case CPP_WSTRING:
3029      return yylexstring ();
3030
3031      /* This token is Objective-C specific.  It gives the next token
3032	 special significance.  */
3033    case CPP_ATSIGN:
3034
3035      /* These tokens are C++ specific (and will not be generated
3036         in C mode, but let's be cautious).  */
3037    case CPP_SCOPE:
3038    case CPP_DEREF_STAR:
3039    case CPP_DOT_STAR:
3040    case CPP_MIN_EQ:
3041    case CPP_MAX_EQ:
3042    case CPP_MIN:
3043    case CPP_MAX:
3044      /* These tokens should not survive translation phase 4.  */
3045    case CPP_HASH:
3046    case CPP_PASTE:
3047      error ("syntax error at '%s' token", NAME(last_token));
3048      goto get_next;
3049
3050    default:
3051      abort ();
3052    }
3053  /* NOTREACHED */
3054}
3055
3056static int
3057yylex()
3058{
3059  int r;
3060  timevar_push (TV_LEX);
3061  r = _yylex();
3062  timevar_pop (TV_LEX);
3063  return r;
3064}
3065
3066/* Function used when yydebug is set, to print a token in more detail.  */
3067
3068static void
3069yyprint (file, yychar, yyl)
3070     FILE *file;
3071     int yychar;
3072     YYSTYPE yyl;
3073{
3074  tree t = yyl.ttype;
3075
3076  fprintf (file, " [%s]", NAME(last_token));
3077
3078  switch (yychar)
3079    {
3080    case IDENTIFIER:
3081    case TYPENAME:
3082    case OBJECTNAME:
3083    case TYPESPEC:
3084    case TYPE_QUAL:
3085    case SCSPEC:
3086    case STATIC:
3087      if (IDENTIFIER_POINTER (t))
3088	fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
3089      break;
3090
3091    case CONSTANT:
3092      fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
3093      if (TREE_CODE (t) == INTEGER_CST)
3094	fprintf (file,
3095#if HOST_BITS_PER_WIDE_INT == 64
3096#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
3097		 " 0x%x%016x",
3098#else
3099#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
3100		 " 0x%lx%016lx",
3101#else
3102		 " 0x%llx%016llx",
3103#endif
3104#endif
3105#else
3106#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
3107		 " 0x%lx%08lx",
3108#else
3109		 " 0x%x%08x",
3110#endif
3111#endif
3112		 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
3113      break;
3114    }
3115}
3116
3117/* This is not the ideal place to put these, but we have to get them out
3118   of c-lex.c because cp/lex.c has its own versions.  */
3119
3120/* Free malloced parser stacks if necessary.  */
3121
3122void
3123free_parser_stacks ()
3124{
3125  if (malloced_yyss)
3126    {
3127      free (malloced_yyss);
3128      free (malloced_yyvs);
3129    }
3130}
3131
3132#include "gt-c-parse.h"