PageRenderTime 42ms CodeModel.GetById 4ms app.highlight 15ms RepoModel.GetById 2ms app.codeStats 1ms

/osprey/kgccfe/gnu/c-parse.y

https://bitbucket.org/osunix/open64
Happy | 4011 lines | 3598 code | 413 blank | 0 comment | 0 complexity | 096dadafdb13c294c10f26603605c22d MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*
   2 * Copyright (C) 2006. QLogic Corporation. All Rights Reserved.
   3 */
   4
   5/*WARNING: This file is automatically generated from kgccfe/gnu/c-parse.in!
   6  ***WARNING***: And then modified to handle OpenMP constructs!*/
   7
   8/*
   9   Copyright 2004, 2005, 2006 PathScale, Inc.  All Rights Reserved.
  10   File modified February 17, 2005 by PathScale, Inc. to add OpenMP support.
  11 */
  12
  13/* YACC parser for C syntax and for Objective C.  -*-c-*-
  14   Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996,
  15   1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
  16
  17This file is part of GCC.
  18
  19GCC is free software; you can redistribute it and/or modify it under
  20the terms of the GNU General Public License as published by the Free
  21Software Foundation; either version 2, or (at your option) any later
  22version.
  23
  24GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  25WARRANTY; without even the implied warranty of MERCHANTABILITY or
  26FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  27for more details.
  28
  29You should have received a copy of the GNU General Public License
  30along with GCC; see the file COPYING.  If not, write to the Free
  31Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  3202111-1307, USA.  */
  33
  34/* This file defines the grammar of C and that of Objective C.
  35   ifobjc ... end ifobjc  conditionals contain code for Objective C only.
  36   ifc ... end ifc  conditionals contain code for C only.
  37   Sed commands in Makefile.in are used to convert this file into
  38   c-parse.y and into objc-parse.y.  */
  39
  40/* To whomever it may concern: I have heard that such a thing was once
  41   written by AT&T, but I have never seen it.  */
  42
  43%expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts.  */
  44
  45%{
  46#include "config.h"
  47#include "system.h"
  48#include "tree.h"
  49#include "omp_types.h"
  50#include "omp_directive.h"
  51#include "input.h"
  52#include "cpplib.h"
  53#include "intl.h"
  54#include "timevar.h"
  55#include "c-pragma.h"		/* For YYDEBUG definition, and parse_in.  */
  56#include "c-tree.h"
  57#include "flags.h"
  58#include "output.h"
  59#include "toplev.h"
  60#include "ggc.h"
  61
  62#ifdef MULTIBYTE_CHARS
  63#include <locale.h>
  64#endif
  65
  66
  67/* Like YYERROR but do call yyerror.  */
  68#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
  69
  70/* Like the default stack expander, except (1) use realloc when possible,
  71   (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca.
  72
  73   Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot
  74   give malloced_yyvs its proper type.  This is ok since all we need from
  75   it is to be able to free it.  */
  76
  77static short *malloced_yyss;
  78static void *malloced_yyvs;
  79
  80#define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ)			\
  81do {									\
  82  size_t newsize;							\
  83  short *newss;								\
  84  YYSTYPE *newvs;							\
  85  newsize = *(YYSSZ) *= 2;						\
  86  if (malloced_yyss)							\
  87    {									\
  88      newss = (short *)							\
  89	really_call_realloc (*(SS), newsize * sizeof (short));		\
  90      newvs = (YYSTYPE *)						\
  91	really_call_realloc (*(VS), newsize * sizeof (YYSTYPE));	\
  92    }									\
  93  else									\
  94    {									\
  95      newss = (short *) really_call_malloc (newsize * sizeof (short));	\
  96      newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \
  97      if (newss)							\
  98        memcpy (newss, *(SS), (SSSIZE));				\
  99      if (newvs)							\
 100        memcpy (newvs, *(VS), (VSSIZE));				\
 101    }									\
 102  if (!newss || !newvs)							\
 103    {									\
 104      yyerror (MSG);							\
 105      return 2;								\
 106    }									\
 107  *(SS) = newss;							\
 108  *(VS) = newvs;							\
 109  malloced_yyss = newss;						\
 110  malloced_yyvs = (void *) newvs;					\
 111} while (0)
 112%}
 113
 114%start program
 115
 116%union {long itype; tree ttype; enum tree_code code;
 117	const char *filename; int lineno;
 118	enum reduction_op_type red_op_type;
 119	enum schedule_kind_type sch_k_type;
 120	struct parallel_clause_list * pclause_type;
 121	struct for_clause_list * for_clause_type;
 122	struct sections_clause_list * sections_clause_type;
 123	struct single_clause_list * single_clause_type;
 124	struct parallel_for_clause_list * parallel_for_clause_type;
 125	struct parallel_sections_clause_list * parallel_sections_clause_type;
 126	}
 127
 128/* All identifiers that are not reserved words
 129   and are not declared typedefs in the current block */
 130%token IDENTIFIER
 131
 132/* All identifiers that are declared typedefs in the current block.
 133   In some contexts, they are treated just like IDENTIFIER,
 134   but they can also serve as typespecs in declarations.  */
 135%token TYPENAME
 136
 137/* Reserved words that specify storage class.
 138   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 139%token SCSPEC			/* Storage class other than static.  */
 140%token STATIC			/* Static storage class.  */
 141
 142/* Reserved words that specify type.
 143   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 144%token TYPESPEC
 145
 146/* Reserved words that qualify type: "const", "volatile", or "restrict".
 147   yylval contains an IDENTIFIER_NODE which indicates which one.  */
 148%token TYPE_QUAL
 149
 150/* Character or numeric constants.
 151   yylval is the node for the constant.  */
 152%token CONSTANT
 153
 154/* String constants in raw form.
 155   yylval is a STRING_CST node.  */
 156%token STRING
 157
 158/* "...", used for functions with variable arglists.  */
 159%token ELLIPSIS
 160
 161%token PRAGMA_OPTIONS PRAGMA_EXEC_FREQ FREQ_NEVER FREQ_INIT FREQ_FREQUENT
 162%token PRAGMA_UNROLL
 163
 164%token PRIVATE COPYPRIVATE FIRSTPRIVATE LASTPRIVATE SHARED DEFAULT NONE
 165%token REDUCTION COPYIN DYNAMIC GUIDED RUNTIME ORDERED SCHEDULE
 166%token NOWAIT PRAGMA_OMP PARALLEL NUM_THREADS SECTIONS SECTION
 167%token SINGLE MASTER CRITICAL BARRIER
 168%token ATOMIC FLUSH THREADPRIVATE
 169
 170/* the reserved words */
 171/* SCO include files test "ASM", so use something else. */
 172%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
 173%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
 174%token ATTRIBUTE EXTENSION LABEL
 175%token REALPART IMAGPART VA_ARG CHOOSE_EXPR TYPES_COMPATIBLE_P
 176%token PTR_VALUE PTR_BASE PTR_EXTENT
 177
 178/* function name can be a string const or a var decl. */
 179%token STRING_FUNC_NAME VAR_FUNC_NAME
 180
 181/* Add precedence rules to solve dangling else s/r conflict */
 182%nonassoc IF
 183%nonassoc ELSE
 184
 185/* Define the operator tokens and their precedences.
 186   The value is an integer because, if used, it is the tree code
 187   to use in the expression made from the operator.  */
 188
 189%right <code> ASSIGN '='
 190%right <code> '?' ':'
 191%left <code> OROR
 192%left <code> ANDAND
 193%left <code> '|'
 194%left <code> '^'
 195%left <code> '&'
 196%left <code> EQCOMPARE
 197%left <code> ARITHCOMPARE
 198%left <code> LSHIFT RSHIFT
 199%left <code> '+' '-'
 200%left <code> '*' '/' '%'
 201%right <code> UNARY PLUSPLUS MINUSMINUS
 202%left HYPERUNARY
 203%left <code> POINTSAT '.' '(' '['
 204
 205/* The Objective-C keywords.  These are included in C and in
 206   Objective C, so that the token codes are the same in both.  */
 207%token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
 208%token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
 209
 210%type <code> unop
 211%type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
 212%type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
 213
 214%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
 215%type <ttype> expr_no_commas cast_expr unary_expr primary STRING
 216%type <ttype> declspecs_nosc_nots_nosa_noea declspecs_nosc_nots_nosa_ea
 217%type <ttype> declspecs_nosc_nots_sa_noea declspecs_nosc_nots_sa_ea
 218%type <ttype> declspecs_nosc_ts_nosa_noea declspecs_nosc_ts_nosa_ea
 219%type <ttype> declspecs_nosc_ts_sa_noea declspecs_nosc_ts_sa_ea
 220%type <ttype> declspecs_sc_nots_nosa_noea declspecs_sc_nots_nosa_ea
 221%type <ttype> declspecs_sc_nots_sa_noea declspecs_sc_nots_sa_ea
 222%type <ttype> declspecs_sc_ts_nosa_noea declspecs_sc_ts_nosa_ea
 223%type <ttype> declspecs_sc_ts_sa_noea declspecs_sc_ts_sa_ea
 224%type <ttype> declspecs_ts declspecs_nots
 225%type <ttype> declspecs_ts_nosa declspecs_nots_nosa
 226%type <ttype> declspecs_nosc_ts declspecs_nosc_nots declspecs_nosc declspecs
 227%type <ttype> maybe_type_quals_attrs typespec_nonattr typespec_attr
 228%type <ttype> typespec_reserved_nonattr typespec_reserved_attr
 229%type <ttype> typespec_nonreserved_nonattr
 230
 231%type <ttype> scspec SCSPEC STATIC TYPESPEC TYPE_QUAL maybe_type_qual
 232%type <ttype> initdecls notype_initdecls initdcl notype_initdcl
 233%type <ttype> init maybeasm
 234%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
 235%type <ttype> maybe_attribute attributes attribute attribute_list attrib
 236%type <ttype> any_word extension
 237
 238%type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
 239%type <ttype> do_stmt_start poplevel stmt label structured_block
 240
 241%type <ttype> c99_block_start c99_block_end
 242%type <ttype> declarator
 243%type <ttype> notype_declarator after_type_declarator
 244%type <ttype> parm_declarator
 245%type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename
 246%type <ttype> array_declarator
 247
 248%type <ttype> structsp_attr structsp_nonattr
 249%type <ttype> component_decl_list component_decl_list2
 250%type <ttype> component_decl components components_notype component_declarator
 251%type <ttype> component_notype_declarator
 252%type <ttype> enumlist enumerator
 253%type <ttype> struct_head union_head enum_head
 254%type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea
 255%type <ttype> direct_absdcl1 absdcl_maybe_attribute
 256%type <ttype> xexpr parms parm firstparm identifiers
 257
 258%type <ttype> parmlist parmlist_1 parmlist_2
 259%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
 260%type <ttype> identifiers_or_typenames
 261
 262%type <itype> setspecs setspecs_fp
 263
 264%type <filename> save_filename
 265%type <lineno> save_lineno
 266
 267%type <ttype> options_directive pragma_directives exec_freq_directive
 268%type <ttype> exec_freq_directive_ignore
 269%type <ttype> unroll_directive
 270
 271%type <ttype> freq_hint
 272
 273%type <ttype> variable_list critical_directive region_phrase
 274%type <red_op_type> reduction_operator
 275%type <sch_k_type> schedule_kind
 276%type <pclause_type> parallel_clause_list parallel_clause parallel_directive
 277%type <ttype> openmp_construct parallel_construct for_construct sections_construct
 278%type <ttype> single_construct parallel_for_construct parallel_sections_construct
 279%type <ttype> master_construct critical_construct atomic_construct
 280%type <ttype> ordered_construct
 281%type <ttype> barrier_directive flush_directive
 282%type <for_clause_type> for_clause_list for_clause for_directive
 283%type <sections_clause_type> sections_clause_list sections_clause sections_directive
 284%type <single_clause_type> single_clause single_clause_list single_directive
 285%type <parallel_for_clause_type> parallel_for_clause parallel_for_clause_list parallel_for_directive
 286%type <parallel_sections_clause_type> parallel_sections_clause parallel_sections_clause_list parallel_sections_directive
 287
 288/* sl2 fork_joint */ 
 289%token SL2_SECTIONS SL2_MINOR_SECTIONS SL2_SECTION PRAGMA_SL2 SL2_MINOR_SECTION 
 290%type <ttype> sl2_sections_construct sl2_section_scope sl2_maybe_section_sequence
 291%type <ttype> sl2_section_sequence sl2_maybe_structured_block sl2_section_construct 
 292
 293
 294
 295%{
 296/* Number of statements (loosely speaking) and compound statements
 297   seen so far.  */
 298static int stmt_count;
 299static int compstmt_count;
 300
 301/* Input file and line number of the end of the body of last simple_if;
 302   used by the stmt-rule immediately after simple_if returns.  */
 303static const char *if_stmt_file;
 304static int if_stmt_line;
 305
 306/* List of types and structure classes of the current declaration.  */
 307static GTY(()) tree current_declspecs;
 308static GTY(()) tree prefix_attributes;
 309
 310/* List of all the attributes applying to the identifier currently being
 311   declared; includes prefix_attributes and possibly some more attributes
 312   just after a comma.  */
 313static GTY(()) tree all_prefix_attributes;
 314
 315/* Stack of saved values of current_declspecs, prefix_attributes and
 316   all_prefix_attributes.  */
 317static GTY(()) tree declspec_stack;
 318
 319/* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
 320   should be called from the productions making use of setspecs.  */
 321#define PUSH_DECLSPEC_STACK						 \
 322  do {									 \
 323    declspec_stack = tree_cons (build_tree_list (prefix_attributes,	 \
 324						 all_prefix_attributes), \
 325				current_declspecs,			 \
 326				declspec_stack);			 \
 327  } while (0)
 328
 329#define POP_DECLSPEC_STACK						\
 330  do {									\
 331    current_declspecs = TREE_VALUE (declspec_stack);			\
 332    prefix_attributes = TREE_PURPOSE (TREE_PURPOSE (declspec_stack));	\
 333    all_prefix_attributes = TREE_VALUE (TREE_PURPOSE (declspec_stack));	\
 334    declspec_stack = TREE_CHAIN (declspec_stack);			\
 335  } while (0)
 336
 337/* For __extension__, save/restore the warning flags which are
 338   controlled by __extension__.  */
 339#define SAVE_EXT_FLAGS()			\
 340	size_int (pedantic			\
 341		  | (warn_pointer_arith << 1)	\
 342		  | (warn_traditional << 2)	\
 343		  | (flag_iso << 3))
 344
 345#define RESTORE_EXT_FLAGS(tval)			\
 346  do {						\
 347    int val = tree_low_cst (tval, 0);		\
 348    pedantic = val & 1;				\
 349    warn_pointer_arith = (val >> 1) & 1;	\
 350    warn_traditional = (val >> 2) & 1;		\
 351    flag_iso = (val >> 3) & 1;			\
 352  } while (0)
 353
 354
 355#define OBJC_NEED_RAW_IDENTIFIER(VAL)	/* nothing */
 356
 357static bool parsing_iso_function_signature;
 358
 359static bool In_MP_Region = false;
 360static bool In_MP_Section = false;
 361#define MAX_MP_NESTING 10
 362static GTY(()) tree mp_locals[MAX_MP_NESTING];
 363static int mp_nesting = -1;
 364extern bool Is_shared_mp_var (tree);
 365
 366/* Tell yyparse how to print a token's value, if yydebug is set.  */
 367
 368#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
 369
 370static void yyprint	  PARAMS ((FILE *, int, YYSTYPE));
 371static void yyerror	  PARAMS ((const char *));
 372static int yylexname	  PARAMS ((void));
 373static int yylexstring	  PARAMS ((void));
 374static inline int _yylex  PARAMS ((void));
 375static int  yylex	  PARAMS ((void));
 376static void init_reswords PARAMS ((void));
 377
 378  /* Initialisation routine for this file.  */
 379void
 380c_parse_init ()
 381{
 382  init_reswords ();
 383}
 384
 385%}
 386
 387%%
 388program: /* empty */
 389		{ if (pedantic)
 390		    pedwarn ("ISO C forbids an empty source file");
 391		  finish_file ();
 392		}
 393	| extdefs
 394		{
 395		  /* In case there were missing closebraces,
 396		     get us back to the global binding level.  */
 397		  while (! global_bindings_p ())
 398		    poplevel (0, 0, 0);
 399		  /* __FUNCTION__ is defined at file scope ("").  This
 400		     call may not be necessary as my tests indicate it
 401		     still works without it.  */
 402		  finish_fname_decls ();
 403                  finish_file ();
 404		}
 405	;
 406
 407/* the reason for the strange actions in this rule
 408 is so that notype_initdecls when reached via datadef
 409 can find a valid list of type and sc specs in $0. */
 410
 411extdefs:
 412	{$<ttype>$ = NULL_TREE; } extdef
 413	| extdefs {$<ttype>$ = NULL_TREE; ggc_collect(); } extdef
 414	;
 415
 416extdef:
 417	extdef_1
 418	{ parsing_iso_function_signature = false; } /* Reset after any external definition.  */
 419	;
 420
 421extdef_1:
 422	fndef
 423	| datadef
 424	| ASM_KEYWORD '(' expr ')' ';'
 425		{ STRIP_NOPS ($3);
 426		  if ((TREE_CODE ($3) == ADDR_EXPR
 427		       && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
 428		      || TREE_CODE ($3) == STRING_CST)
 429		    assemble_asm ($3);
 430		  else
 431		    error ("argument of `asm' is not a constant string"); }
 432	| extension extdef
 433		{ RESTORE_EXT_FLAGS ($1); }
 434	| threadprivate_directive
 435	| exec_freq_directive_ignore
 436	{}
 437	;
 438
 439datadef:
 440	  setspecs notype_initdecls ';'
 441		{ if (pedantic)
 442		    error ("ISO C forbids data definition with no type or storage class");
 443		  else
 444		    warning ("data definition has no type or storage class");
 445
 446		  POP_DECLSPEC_STACK; }
 447        | declspecs_nots setspecs notype_initdecls ';'
 448		{ POP_DECLSPEC_STACK; }
 449	| declspecs_ts setspecs initdecls ';'
 450		{ POP_DECLSPEC_STACK; }
 451	| declspecs ';'
 452	  { shadow_tag ($1); }
 453	| error ';'
 454	| error '}'
 455	| ';'
 456		{ if (pedantic)
 457		    pedwarn ("ISO C does not allow extra `;' outside of a function"); }
 458	;
 459
 460fndef:
 461	  declspecs_ts setspecs declarator
 462		{ if (! start_function (current_declspecs, $3,
 463					all_prefix_attributes))
 464		    YYERROR1;
 465		}
 466	  old_style_parm_decls
 467		{ store_parm_decls (); }
 468	  save_filename save_lineno compstmt_or_error
 469		{ DECL_SOURCE_FILE (current_function_decl) = $7;
 470		  DECL_SOURCE_LINE (current_function_decl) = $8;
 471		  finish_function (0, 1);
 472		  POP_DECLSPEC_STACK; }
 473	| declspecs_ts setspecs declarator error
 474		{ POP_DECLSPEC_STACK; }
 475	| declspecs_nots setspecs notype_declarator
 476		{ if (! start_function (current_declspecs, $3,
 477					all_prefix_attributes))
 478		    YYERROR1;
 479		}
 480	  old_style_parm_decls
 481		{ store_parm_decls (); }
 482	  save_filename save_lineno compstmt_or_error
 483		{ DECL_SOURCE_FILE (current_function_decl) = $7;
 484		  DECL_SOURCE_LINE (current_function_decl) = $8;
 485		  finish_function (0, 1);
 486		  POP_DECLSPEC_STACK; }
 487	| declspecs_nots setspecs notype_declarator error
 488		{ POP_DECLSPEC_STACK; }
 489	| setspecs notype_declarator
 490		{ if (! start_function (NULL_TREE, $2,
 491					all_prefix_attributes))
 492		    YYERROR1;
 493		}
 494	  old_style_parm_decls
 495		{ store_parm_decls (); }
 496	  save_filename save_lineno compstmt_or_error
 497		{ DECL_SOURCE_FILE (current_function_decl) = $6;
 498		  DECL_SOURCE_LINE (current_function_decl) = $7;
 499		  finish_function (0, 1);
 500		  POP_DECLSPEC_STACK; }
 501	| setspecs notype_declarator error
 502		{ POP_DECLSPEC_STACK; }
 503	;
 504
 505identifier:
 506	IDENTIFIER
 507	| TYPENAME
 508	;
 509
 510unop:     '&'
 511		{ $$ = ADDR_EXPR; }
 512	| '-'
 513		{ $$ = NEGATE_EXPR; }
 514	| '+'
 515		{ $$ = CONVERT_EXPR;
 516  if (warn_traditional && !in_system_header)
 517    warning ("traditional C rejects the unary plus operator");
 518		}
 519	| PLUSPLUS
 520		{ $$ = PREINCREMENT_EXPR; }
 521	| MINUSMINUS
 522		{ $$ = PREDECREMENT_EXPR; }
 523	| '~'
 524		{ $$ = BIT_NOT_EXPR; }
 525	| '!'
 526		{ $$ = TRUTH_NOT_EXPR; }
 527	;
 528
 529expr:	nonnull_exprlist
 530		{ $$ = build_compound_expr ($1); }
 531	;
 532
 533exprlist:
 534	  /* empty */
 535		{ $$ = NULL_TREE; }
 536	| nonnull_exprlist
 537	;
 538
 539nonnull_exprlist:
 540	expr_no_commas
 541		{ $$ = build_tree_list (NULL_TREE, $1); }
 542	| nonnull_exprlist ',' expr_no_commas
 543		{ chainon ($1, build_tree_list (NULL_TREE, $3)); }
 544	;
 545
 546unary_expr:
 547	primary
 548	| '*' cast_expr   %prec UNARY
 549		{ $$ = build_indirect_ref ($2, "unary *"); }
 550	/* __extension__ turns off -pedantic for following primary.  */
 551	| extension cast_expr	  %prec UNARY
 552		{ $$ = $2;
 553		  RESTORE_EXT_FLAGS ($1); }
 554	| unop cast_expr  %prec UNARY
 555		{ $$ = build_unary_op ($1, $2, 0);
 556		  overflow_warning ($$); }
 557	/* Refer to the address of a label as a pointer.  */
 558	| ANDAND identifier
 559		{ $$ = finish_label_address_expr ($2); }
 560	| sizeof unary_expr  %prec UNARY
 561		{ skip_evaluation--;
 562		  if (TREE_CODE ($2) == COMPONENT_REF
 563		      && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
 564		    error ("`sizeof' applied to a bit-field");
 565		  $$ = c_sizeof (TREE_TYPE ($2)); }
 566	| sizeof '(' typename ')'  %prec HYPERUNARY
 567		{ skip_evaluation--;
 568		  $$ = c_sizeof (groktypename ($3)); }
 569	| alignof unary_expr  %prec UNARY
 570		{ skip_evaluation--;
 571		  $$ = c_alignof_expr ($2); }
 572	| alignof '(' typename ')'  %prec HYPERUNARY
 573		{ skip_evaluation--;
 574		  $$ = c_alignof (groktypename ($3)); }
 575	| REALPART cast_expr %prec UNARY
 576		{ $$ = build_unary_op (REALPART_EXPR, $2, 0); }
 577	| IMAGPART cast_expr %prec UNARY
 578		{ $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
 579	;
 580
 581sizeof:
 582	SIZEOF { skip_evaluation++; }
 583	;
 584
 585alignof:
 586	ALIGNOF { skip_evaluation++; }
 587	;
 588
 589typeof:
 590	TYPEOF { skip_evaluation++; }
 591	;
 592
 593cast_expr:
 594	unary_expr
 595	| '(' typename ')' cast_expr  %prec UNARY
 596		{ $$ = c_cast_expr ($2, $4); }
 597	;
 598
 599expr_no_commas:
 600	  cast_expr
 601	| expr_no_commas '+' expr_no_commas
 602		{ $$ = parser_build_binary_op ($2, $1, $3); }
 603	| expr_no_commas '-' expr_no_commas
 604		{ $$ = parser_build_binary_op ($2, $1, $3); }
 605	| expr_no_commas '*' expr_no_commas
 606		{ $$ = parser_build_binary_op ($2, $1, $3); }
 607	| expr_no_commas '/' expr_no_commas
 608		{ $$ = parser_build_binary_op ($2, $1, $3); }
 609	| expr_no_commas '%' expr_no_commas
 610		{ $$ = parser_build_binary_op ($2, $1, $3); }
 611	| expr_no_commas LSHIFT expr_no_commas
 612		{ $$ = parser_build_binary_op ($2, $1, $3); }
 613	| expr_no_commas RSHIFT expr_no_commas
 614		{ $$ = parser_build_binary_op ($2, $1, $3); }
 615	| expr_no_commas ARITHCOMPARE expr_no_commas
 616		{ $$ = parser_build_binary_op ($2, $1, $3); }
 617	| expr_no_commas EQCOMPARE expr_no_commas
 618		{ $$ = parser_build_binary_op ($2, $1, $3); }
 619	| expr_no_commas '&' expr_no_commas
 620		{ $$ = parser_build_binary_op ($2, $1, $3); }
 621	| expr_no_commas '|' expr_no_commas
 622		{ $$ = parser_build_binary_op ($2, $1, $3); }
 623	| expr_no_commas '^' expr_no_commas
 624		{ $$ = parser_build_binary_op ($2, $1, $3); }
 625	| expr_no_commas ANDAND
 626		{ $1 = c_common_truthvalue_conversion
 627		    (default_conversion ($1));
 628		  skip_evaluation += $1 == boolean_false_node; }
 629	  expr_no_commas
 630		{ skip_evaluation -= $1 == boolean_false_node;
 631		  $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
 632	| expr_no_commas OROR
 633		{ $1 = c_common_truthvalue_conversion
 634		    (default_conversion ($1));
 635		  skip_evaluation += $1 == boolean_true_node; }
 636	  expr_no_commas
 637		{ skip_evaluation -= $1 == boolean_true_node;
 638		  $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
 639	| expr_no_commas '?'
 640		{ $1 = c_common_truthvalue_conversion
 641		    (default_conversion ($1));
 642		  skip_evaluation += $1 == boolean_false_node; }
 643          expr ':'
 644		{ skip_evaluation += (($1 == boolean_true_node)
 645				      - ($1 == boolean_false_node)); }
 646	  expr_no_commas
 647		{ skip_evaluation -= $1 == boolean_true_node;
 648		  $$ = build_conditional_expr ($1, $4, $7); }
 649	| expr_no_commas '?'
 650		{ if (pedantic)
 651		    pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
 652		  /* Make sure first operand is calculated only once.  */
 653		  $<ttype>2 = save_expr ($1);
 654		  $1 = c_common_truthvalue_conversion
 655		    (default_conversion ($<ttype>2));
 656		  skip_evaluation += $1 == boolean_true_node; }
 657	  ':' expr_no_commas
 658		{ skip_evaluation -= $1 == boolean_true_node;
 659		  $$ = build_conditional_expr ($1, $<ttype>2, $5); }
 660	| expr_no_commas '=' expr_no_commas
 661		{ char class;
 662		  $$ = build_modify_expr ($1, NOP_EXPR, $3);
 663		  class = TREE_CODE_CLASS (TREE_CODE ($$));
 664		  if (IS_EXPR_CODE_CLASS (class))
 665		    C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
 666		}
 667	| expr_no_commas ASSIGN expr_no_commas
 668		{ char class;
 669		  $$ = build_modify_expr ($1, $2, $3);
 670		  /* This inhibits warnings in
 671		     c_common_truthvalue_conversion.  */
 672		  class = TREE_CODE_CLASS (TREE_CODE ($$));
 673		  if (IS_EXPR_CODE_CLASS (class))
 674		    C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
 675		}
 676	;
 677
 678primary:
 679	IDENTIFIER
 680		{
 681		  if (yychar == YYEMPTY)
 682		    yychar = YYLEX;
 683		  $$ = build_external_ref ($1, yychar == '(');
 684		}
 685	| CONSTANT
 686	| STRING
 687		{ $$ = fix_string_type ($$); }
 688	| VAR_FUNC_NAME
 689		{ $$ = fname_decl (C_RID_CODE ($$), $$); }
 690	| '(' typename ')' '{'
 691		{ start_init (NULL_TREE, NULL, 0);
 692		  $2 = groktypename ($2);
 693		  really_start_incremental_init ($2); }
 694	  initlist_maybe_comma '}'  %prec UNARY
 695		{ tree constructor = pop_init_level (0);
 696		  tree type = $2;
 697		  finish_init ();
 698
 699		  if (pedantic && ! flag_isoc99)
 700		    pedwarn ("ISO C89 forbids compound literals");
 701		  $$ = build_compound_literal (type, constructor);
 702		}
 703	| '(' expr ')'
 704		{ char class = TREE_CODE_CLASS (TREE_CODE ($2));
 705		  if (IS_EXPR_CODE_CLASS (class))
 706		    C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
 707		  $$ = $2; }
 708	| '(' error ')'
 709		{ $$ = error_mark_node; }
 710	| compstmt_primary_start compstmt_nostart ')'
 711                 { tree saved_last_tree;
 712
 713		   if (pedantic)
 714		     pedwarn ("ISO C forbids braced-groups within expressions");
 715		  pop_label_level ();
 716
 717		  saved_last_tree = COMPOUND_BODY ($1);
 718		  RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
 719		  last_tree = saved_last_tree;
 720		  TREE_CHAIN (last_tree) = NULL_TREE;
 721		  if (!last_expr_type)
 722		    last_expr_type = void_type_node;
 723		  $$ = build1 (STMT_EXPR, last_expr_type, $1);
 724		  TREE_SIDE_EFFECTS ($$) = 1;
 725		}
 726	| compstmt_primary_start error ')'
 727		{
 728		  pop_label_level ();
 729		  last_tree = COMPOUND_BODY ($1);
 730		  TREE_CHAIN (last_tree) = NULL_TREE;
 731		  $$ = error_mark_node;
 732		}
 733	| primary '(' exprlist ')'   %prec '.'
 734		{ $$ = build_function_call ($1, $3); }
 735	| VA_ARG '(' expr_no_commas ',' typename ')'
 736		{ $$ = build_va_arg ($3, groktypename ($5)); }
 737
 738      | CHOOSE_EXPR '(' expr_no_commas ',' expr_no_commas ',' expr_no_commas ')'
 739		{
 740                  tree c;
 741
 742                  c = fold ($3);
 743                  STRIP_NOPS (c);
 744                  if (TREE_CODE (c) != INTEGER_CST)
 745                    error ("first argument to __builtin_choose_expr not a constant");
 746                  $$ = integer_zerop (c) ? $7 : $5;
 747		}
 748      | TYPES_COMPATIBLE_P '(' typename ',' typename ')'
 749		{
 750		  tree e1, e2;
 751
 752		  e1 = TYPE_MAIN_VARIANT (groktypename ($3));
 753		  e2 = TYPE_MAIN_VARIANT (groktypename ($5));
 754
 755		  $$ = comptypes (e1, e2)
 756		    ? build_int_2 (1, 0) : build_int_2 (0, 0);
 757		}
 758	| primary '[' expr ']'   %prec '.'
 759		{ $$ = build_array_ref ($1, $3); }
 760	| primary '.' identifier
 761		{
 762		      $$ = build_component_ref ($1, $3);
 763		}
 764	| primary POINTSAT identifier
 765		{
 766                  tree expr = build_indirect_ref ($1, "->");
 767
 768			$$ = build_component_ref (expr, $3);
 769		}
 770	| primary PLUSPLUS
 771		{ $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
 772	| primary MINUSMINUS
 773		{ $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
 774	;
 775
 776
 777old_style_parm_decls:
 778	old_style_parm_decls_1
 779	{
 780	  parsing_iso_function_signature = false; /* Reset after decls.  */
 781	}
 782	;
 783
 784old_style_parm_decls_1:
 785	/* empty */
 786	{
 787	  if (warn_traditional && !in_system_header
 788	      && parsing_iso_function_signature)
 789	    warning ("traditional C rejects ISO C style function definitions");
 790	  parsing_iso_function_signature = false; /* Reset after warning.  */
 791	}
 792	| datadecls
 793	;
 794
 795/* The following are analogous to lineno_decl, decls and decl
 796   except that they do not allow nested functions.
 797   They are used for old-style parm decls.  */
 798lineno_datadecl:
 799	  save_filename save_lineno datadecl
 800		{ }
 801	;
 802
 803datadecls:
 804	lineno_datadecl
 805	| errstmt
 806	| datadecls lineno_datadecl
 807	| lineno_datadecl errstmt
 808	;
 809
 810/* We don't allow prefix attributes here because they cause reduce/reduce
 811   conflicts: we can't know whether we're parsing a function decl with
 812   attribute suffix, or function defn with attribute prefix on first old
 813   style parm.  */
 814datadecl:
 815	declspecs_ts_nosa setspecs initdecls ';'
 816		{ POP_DECLSPEC_STACK; }
 817	| declspecs_nots_nosa setspecs notype_initdecls ';'
 818		{ POP_DECLSPEC_STACK; }
 819	| declspecs_ts_nosa ';'
 820		{ shadow_tag_warned ($1, 1);
 821		  pedwarn ("empty declaration"); }
 822	| declspecs_nots_nosa ';'
 823		{ pedwarn ("empty declaration"); }
 824	;
 825
 826/* This combination which saves a lineno before a decl
 827   is the normal thing to use, rather than decl itself.
 828   This is to avoid shift/reduce conflicts in contexts
 829   where statement labels are allowed.  */
 830lineno_decl:
 831	  save_filename save_lineno decl
 832		{ }
 833	;
 834
 835/* records the type and storage class specs to use for processing
 836   the declarators that follow.
 837   Maintains a stack of outer-level values of current_declspecs,
 838   for the sake of parm declarations nested in function declarators.  */
 839setspecs: /* empty */
 840		{ pending_xref_error ();
 841		  PUSH_DECLSPEC_STACK;
 842		  split_specs_attrs ($<ttype>0,
 843				     &current_declspecs, &prefix_attributes);
 844		  all_prefix_attributes = prefix_attributes; }
 845	;
 846
 847/* Possibly attributes after a comma, which should reset all_prefix_attributes
 848   to prefix_attributes with these ones chained on the front.  */
 849maybe_resetattrs:
 850	  maybe_attribute
 851		{ all_prefix_attributes = chainon ($1, prefix_attributes); }
 852	;
 853
 854decl:
 855	declspecs_ts setspecs initdecls ';'
 856		{ POP_DECLSPEC_STACK; }
 857	| declspecs_nots setspecs notype_initdecls ';'
 858		{ POP_DECLSPEC_STACK; }
 859	| declspecs_ts setspecs nested_function
 860		{ POP_DECLSPEC_STACK; }
 861	| declspecs_nots setspecs notype_nested_function
 862		{ POP_DECLSPEC_STACK; }
 863	| declspecs ';'
 864		{ shadow_tag ($1); }
 865	| extension decl
 866		{ RESTORE_EXT_FLAGS ($1); }
 867	;
 868
 869/* A list of declaration specifiers.  These are:
 870
 871   - Storage class specifiers (scspec), which for GCC currently includes
 872   function specifiers ("inline").
 873
 874   - Type specifiers (typespec_*).
 875
 876   - Type qualifiers (TYPE_QUAL).
 877
 878   - Attribute specifier lists (attributes).
 879
 880   These are stored as a TREE_LIST; the head of the list is the last
 881   item in the specifier list.  Each entry in the list has either a
 882   TREE_PURPOSE that is an attribute specifier list, or a TREE_VALUE that
 883   is a single other specifier or qualifier; and a TREE_CHAIN that is the
 884   rest of the list.  TREE_STATIC is set on the list if something other
 885   than a storage class specifier or attribute has been seen; this is used
 886   to warn for the obsolescent usage of storage class specifiers other than
 887   at the start of the list.  (Doing this properly would require function
 888   specifiers to be handled separately from storage class specifiers.)
 889
 890   The various cases below are classified according to:
 891
 892   (a) Whether a storage class specifier is included or not; some
 893   places in the grammar disallow storage class specifiers (_sc or _nosc).
 894
 895   (b) Whether a type specifier has been seen; after a type specifier,
 896   a typedef name is an identifier to redeclare (_ts or _nots).
 897
 898   (c) Whether the list starts with an attribute; in certain places,
 899   the grammar requires specifiers that don't start with an attribute
 900   (_sa or _nosa).
 901
 902   (d) Whether the list ends with an attribute (or a specifier such that
 903   any following attribute would have been parsed as part of that specifier);
 904   this avoids shift-reduce conflicts in the parsing of attributes
 905   (_ea or _noea).
 906
 907   TODO:
 908
 909   (i) Distinguish between function specifiers and storage class specifiers,
 910   at least for the purpose of warnings about obsolescent usage.
 911
 912   (ii) Halve the number of productions here by eliminating the _sc/_nosc
 913   distinction and instead checking where required that storage class
 914   specifiers aren't present.  */
 915
 916/* Declspecs which contain at least one type specifier or typedef name.
 917   (Just `const' or `volatile' is not enough.)
 918   A typedef'd name following these is taken as a name to be declared.
 919   Declspecs have a non-NULL TREE_VALUE, attributes do not.  */
 920
 921declspecs_nosc_nots_nosa_noea:
 922	  TYPE_QUAL
 923		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 924		  TREE_STATIC ($$) = 1; }
 925	| declspecs_nosc_nots_nosa_noea TYPE_QUAL
 926		{ $$ = tree_cons (NULL_TREE, $2, $1);
 927		  TREE_STATIC ($$) = 1; }
 928	| declspecs_nosc_nots_nosa_ea TYPE_QUAL
 929		{ $$ = tree_cons (NULL_TREE, $2, $1);
 930		  TREE_STATIC ($$) = 1; }
 931	;
 932
 933declspecs_nosc_nots_nosa_ea:
 934	  declspecs_nosc_nots_nosa_noea attributes
 935		{ $$ = tree_cons ($2, NULL_TREE, $1);
 936		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 937	;
 938
 939declspecs_nosc_nots_sa_noea:
 940	  declspecs_nosc_nots_sa_noea TYPE_QUAL
 941		{ $$ = tree_cons (NULL_TREE, $2, $1);
 942		  TREE_STATIC ($$) = 1; }
 943	| declspecs_nosc_nots_sa_ea TYPE_QUAL
 944		{ $$ = tree_cons (NULL_TREE, $2, $1);
 945		  TREE_STATIC ($$) = 1; }
 946	;
 947
 948declspecs_nosc_nots_sa_ea:
 949	  attributes
 950		{ $$ = tree_cons ($1, NULL_TREE, NULL_TREE);
 951		  TREE_STATIC ($$) = 0; }
 952	| declspecs_nosc_nots_sa_noea attributes
 953		{ $$ = tree_cons ($2, NULL_TREE, $1);
 954		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 955	;
 956
 957declspecs_nosc_ts_nosa_noea:
 958	  typespec_nonattr
 959		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 960		  TREE_STATIC ($$) = 1; }
 961	| declspecs_nosc_ts_nosa_noea TYPE_QUAL
 962		{ $$ = tree_cons (NULL_TREE, $2, $1);
 963		  TREE_STATIC ($$) = 1; }
 964	| declspecs_nosc_ts_nosa_ea TYPE_QUAL
 965		{ $$ = tree_cons (NULL_TREE, $2, $1);
 966		  TREE_STATIC ($$) = 1; }
 967	| declspecs_nosc_ts_nosa_noea typespec_reserved_nonattr
 968		{ $$ = tree_cons (NULL_TREE, $2, $1);
 969		  TREE_STATIC ($$) = 1; }
 970	| declspecs_nosc_ts_nosa_ea typespec_reserved_nonattr
 971		{ $$ = tree_cons (NULL_TREE, $2, $1);
 972		  TREE_STATIC ($$) = 1; }
 973	| declspecs_nosc_nots_nosa_noea typespec_nonattr
 974		{ $$ = tree_cons (NULL_TREE, $2, $1);
 975		  TREE_STATIC ($$) = 1; }
 976	| declspecs_nosc_nots_nosa_ea typespec_nonattr
 977		{ $$ = tree_cons (NULL_TREE, $2, $1);
 978		  TREE_STATIC ($$) = 1; }
 979	;
 980
 981declspecs_nosc_ts_nosa_ea:
 982	  typespec_attr
 983		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
 984		  TREE_STATIC ($$) = 1; }
 985	| declspecs_nosc_ts_nosa_noea attributes
 986		{ $$ = tree_cons ($2, NULL_TREE, $1);
 987		  TREE_STATIC ($$) = TREE_STATIC ($1); }
 988	| declspecs_nosc_ts_nosa_noea typespec_reserved_attr
 989		{ $$ = tree_cons (NULL_TREE, $2, $1);
 990		  TREE_STATIC ($$) = 1; }
 991	| declspecs_nosc_ts_nosa_ea typespec_reserved_attr
 992		{ $$ = tree_cons (NULL_TREE, $2, $1);
 993		  TREE_STATIC ($$) = 1; }
 994	| declspecs_nosc_nots_nosa_noea typespec_attr
 995		{ $$ = tree_cons (NULL_TREE, $2, $1);
 996		  TREE_STATIC ($$) = 1; }
 997	| declspecs_nosc_nots_nosa_ea typespec_attr
 998		{ $$ = tree_cons (NULL_TREE, $2, $1);
 999		  TREE_STATIC ($$) = 1; }
1000	;
1001
1002declspecs_nosc_ts_sa_noea:
1003	  declspecs_nosc_ts_sa_noea TYPE_QUAL
1004		{ $$ = tree_cons (NULL_TREE, $2, $1);
1005		  TREE_STATIC ($$) = 1; }
1006	| declspecs_nosc_ts_sa_ea TYPE_QUAL
1007		{ $$ = tree_cons (NULL_TREE, $2, $1);
1008		  TREE_STATIC ($$) = 1; }
1009	| declspecs_nosc_ts_sa_noea typespec_reserved_nonattr
1010		{ $$ = tree_cons (NULL_TREE, $2, $1);
1011		  TREE_STATIC ($$) = 1; }
1012	| declspecs_nosc_ts_sa_ea typespec_reserved_nonattr
1013		{ $$ = tree_cons (NULL_TREE, $2, $1);
1014		  TREE_STATIC ($$) = 1; }
1015	| declspecs_nosc_nots_sa_noea typespec_nonattr
1016		{ $$ = tree_cons (NULL_TREE, $2, $1);
1017		  TREE_STATIC ($$) = 1; }
1018	| declspecs_nosc_nots_sa_ea typespec_nonattr
1019		{ $$ = tree_cons (NULL_TREE, $2, $1);
1020		  TREE_STATIC ($$) = 1; }
1021	;
1022
1023declspecs_nosc_ts_sa_ea:
1024	  declspecs_nosc_ts_sa_noea attributes
1025		{ $$ = tree_cons ($2, NULL_TREE, $1);
1026		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1027	| declspecs_nosc_ts_sa_noea typespec_reserved_attr
1028		{ $$ = tree_cons (NULL_TREE, $2, $1);
1029		  TREE_STATIC ($$) = 1; }
1030	| declspecs_nosc_ts_sa_ea typespec_reserved_attr
1031		{ $$ = tree_cons (NULL_TREE, $2, $1);
1032		  TREE_STATIC ($$) = 1; }
1033	| declspecs_nosc_nots_sa_noea typespec_attr
1034		{ $$ = tree_cons (NULL_TREE, $2, $1);
1035		  TREE_STATIC ($$) = 1; }
1036	| declspecs_nosc_nots_sa_ea typespec_attr
1037		{ $$ = tree_cons (NULL_TREE, $2, $1);
1038		  TREE_STATIC ($$) = 1; }
1039	;
1040
1041declspecs_sc_nots_nosa_noea:
1042	  scspec
1043		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
1044		  TREE_STATIC ($$) = 0; }
1045	| declspecs_sc_nots_nosa_noea TYPE_QUAL
1046		{ $$ = tree_cons (NULL_TREE, $2, $1);
1047		  TREE_STATIC ($$) = 1; }
1048	| declspecs_sc_nots_nosa_ea TYPE_QUAL
1049		{ $$ = tree_cons (NULL_TREE, $2, $1);
1050		  TREE_STATIC ($$) = 1; }
1051	| declspecs_nosc_nots_nosa_noea scspec
1052		{ if (extra_warnings && TREE_STATIC ($1))
1053		    warning ("`%s' is not at beginning of declaration",
1054			     IDENTIFIER_POINTER ($2));
1055		  $$ = tree_cons (NULL_TREE, $2, $1);
1056		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1057	| declspecs_nosc_nots_nosa_ea scspec
1058		{ if (extra_warnings && TREE_STATIC ($1))
1059		    warning ("`%s' is not at beginning of declaration",
1060			     IDENTIFIER_POINTER ($2));
1061		  $$ = tree_cons (NULL_TREE, $2, $1);
1062		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1063	| declspecs_sc_nots_nosa_noea scspec
1064		{ if (extra_warnings && TREE_STATIC ($1))
1065		    warning ("`%s' is not at beginning of declaration",
1066			     IDENTIFIER_POINTER ($2));
1067		  $$ = tree_cons (NULL_TREE, $2, $1);
1068		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1069	| declspecs_sc_nots_nosa_ea scspec
1070		{ if (extra_warnings && TREE_STATIC ($1))
1071		    warning ("`%s' is not at beginning of declaration",
1072			     IDENTIFIER_POINTER ($2));
1073		  $$ = tree_cons (NULL_TREE, $2, $1);
1074		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1075	;
1076
1077declspecs_sc_nots_nosa_ea:
1078	  declspecs_sc_nots_nosa_noea attributes
1079		{ $$ = tree_cons ($2, NULL_TREE, $1);
1080		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1081	;
1082
1083declspecs_sc_nots_sa_noea:
1084	  declspecs_sc_nots_sa_noea TYPE_QUAL
1085		{ $$ = tree_cons (NULL_TREE, $2, $1);
1086		  TREE_STATIC ($$) = 1; }
1087	| declspecs_sc_nots_sa_ea TYPE_QUAL
1088		{ $$ = tree_cons (NULL_TREE, $2, $1);
1089		  TREE_STATIC ($$) = 1; }
1090	| declspecs_nosc_nots_sa_noea scspec
1091		{ if (extra_warnings && TREE_STATIC ($1))
1092		    warning ("`%s' is not at beginning of declaration",
1093			     IDENTIFIER_POINTER ($2));
1094		  $$ = tree_cons (NULL_TREE, $2, $1);
1095		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1096	| declspecs_nosc_nots_sa_ea scspec
1097		{ if (extra_warnings && TREE_STATIC ($1))
1098		    warning ("`%s' is not at beginning of declaration",
1099			     IDENTIFIER_POINTER ($2));
1100		  $$ = tree_cons (NULL_TREE, $2, $1);
1101		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1102	| declspecs_sc_nots_sa_noea scspec
1103		{ if (extra_warnings && TREE_STATIC ($1))
1104		    warning ("`%s' is not at beginning of declaration",
1105			     IDENTIFIER_POINTER ($2));
1106		  $$ = tree_cons (NULL_TREE, $2, $1);
1107		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1108	| declspecs_sc_nots_sa_ea scspec
1109		{ if (extra_warnings && TREE_STATIC ($1))
1110		    warning ("`%s' is not at beginning of declaration",
1111			     IDENTIFIER_POINTER ($2));
1112		  $$ = tree_cons (NULL_TREE, $2, $1);
1113		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1114	;
1115
1116declspecs_sc_nots_sa_ea:
1117	  declspecs_sc_nots_sa_noea attributes
1118		{ $$ = tree_cons ($2, NULL_TREE, $1);
1119		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1120	;
1121
1122declspecs_sc_ts_nosa_noea:
1123	  declspecs_sc_ts_nosa_noea TYPE_QUAL
1124		{ $$ = tree_cons (NULL_TREE, $2, $1);
1125		  TREE_STATIC ($$) = 1; }
1126	| declspecs_sc_ts_nosa_ea TYPE_QUAL
1127		{ $$ = tree_cons (NULL_TREE, $2, $1);
1128		  TREE_STATIC ($$) = 1; }
1129	| declspecs_sc_ts_nosa_noea typespec_reserved_nonattr
1130		{ $$ = tree_cons (NULL_TREE, $2, $1);
1131		  TREE_STATIC ($$) = 1; }
1132	| declspecs_sc_ts_nosa_ea typespec_reserved_nonattr
1133		{ $$ = tree_cons (NULL_TREE, $2, $1);
1134		  TREE_STATIC ($$) = 1; }
1135	| declspecs_sc_nots_nosa_noea typespec_nonattr
1136		{ $$ = tree_cons (NULL_TREE, $2, $1);
1137		  TREE_STATIC ($$) = 1; }
1138	| declspecs_sc_nots_nosa_ea typespec_nonattr
1139		{ $$ = tree_cons (NULL_TREE, $2, $1);
1140		  TREE_STATIC ($$) = 1; }
1141	| declspecs_nosc_ts_nosa_noea scspec
1142		{ if (extra_warnings && TREE_STATIC ($1))
1143		    warning ("`%s' is not at beginning of declaration",
1144			     IDENTIFIER_POINTER ($2));
1145		  $$ = tree_cons (NULL_TREE, $2, $1);
1146		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1147	| declspecs_nosc_ts_nosa_ea scspec
1148		{ if (extra_warnings && TREE_STATIC ($1))
1149		    warning ("`%s' is not at beginning of declaration",
1150			     IDENTIFIER_POINTER ($2));
1151		  $$ = tree_cons (NULL_TREE, $2, $1);
1152		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1153	| declspecs_sc_ts_nosa_noea scspec
1154		{ if (extra_warnings && TREE_STATIC ($1))
1155		    warning ("`%s' is not at beginning of declaration",
1156			     IDENTIFIER_POINTER ($2));
1157		  $$ = tree_cons (NULL_TREE, $2, $1);
1158		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1159	| declspecs_sc_ts_nosa_ea scspec
1160		{ if (extra_warnings && TREE_STATIC ($1))
1161		    warning ("`%s' is not at beginning of declaration",
1162			     IDENTIFIER_POINTER ($2));
1163		  $$ = tree_cons (NULL_TREE, $2, $1);
1164		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1165	;
1166
1167declspecs_sc_ts_nosa_ea:
1168	  declspecs_sc_ts_nosa_noea attributes
1169		{ $$ = tree_cons ($2, NULL_TREE, $1);
1170		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1171	| declspecs_sc_ts_nosa_noea typespec_reserved_attr
1172		{ $$ = tree_cons (NULL_TREE, $2, $1);
1173		  TREE_STATIC ($$) = 1; }
1174	| declspecs_sc_ts_nosa_ea typespec_reserved_attr
1175		{ $$ = tree_cons (NULL_TREE, $2, $1);
1176		  TREE_STATIC ($$) = 1; }
1177	| declspecs_sc_nots_nosa_noea typespec_attr
1178		{ $$ = tree_cons (NULL_TREE, $2, $1);
1179		  TREE_STATIC ($$) = 1; }
1180	| declspecs_sc_nots_nosa_ea typespec_attr
1181		{ $$ = tree_cons (NULL_TREE, $2, $1);
1182		  TREE_STATIC ($$) = 1; }
1183	;
1184
1185declspecs_sc_ts_sa_noea:
1186	  declspecs_sc_ts_sa_noea TYPE_QUAL
1187		{ $$ = tree_cons (NULL_TREE, $2, $1);
1188		  TREE_STATIC ($$) = 1; }
1189	| declspecs_sc_ts_sa_ea TYPE_QUAL
1190		{ $$ = tree_cons (NULL_TREE, $2, $1);
1191		  TREE_STATIC ($$) = 1; }
1192	| declspecs_sc_ts_sa_noea typespec_reserved_nonattr
1193		{ $$ = tree_cons (NULL_TREE, $2, $1);
1194		  TREE_STATIC ($$) = 1; }
1195	| declspecs_sc_ts_sa_ea typespec_reserved_nonattr
1196		{ $$ = tree_cons (NULL_TREE, $2, $1);
1197		  TREE_STATIC ($$) = 1; }
1198	| declspecs_sc_nots_sa_noea typespec_nonattr
1199		{ $$ = tree_cons (NULL_TREE, $2, $1);
1200		  TREE_STATIC ($$) = 1; }
1201	| declspecs_sc_nots_sa_ea typespec_nonattr
1202		{ $$ = tree_cons (NULL_TREE, $2, $1);
1203		  TREE_STATIC ($$) = 1; }
1204	| declspecs_nosc_ts_sa_noea scspec
1205		{ if (extra_warnings && TREE_STATIC ($1))
1206		    warning ("`%s' is not at beginning of declaration",
1207			     IDENTIFIER_POINTER ($2));
1208		  $$ = tree_cons (NULL_TREE, $2, $1);
1209		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1210	| declspecs_nosc_ts_sa_ea scspec
1211		{ if (extra_warnings && TREE_STATIC ($1))
1212		    warning ("`%s' is not at beginning of declaration",
1213			     IDENTIFIER_POINTER ($2));
1214		  $$ = tree_cons (NULL_TREE, $2, $1);
1215		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1216	| declspecs_sc_ts_sa_noea scspec
1217		{ if (extra_warnings && TREE_STATIC ($1))
1218		    warning ("`%s' is not at beginning of declaration",
1219			     IDENTIFIER_POINTER ($2));
1220		  $$ = tree_cons (NULL_TREE, $2, $1);
1221		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1222	| declspecs_sc_ts_sa_ea scspec
1223		{ if (extra_warnings && TREE_STATIC ($1))
1224		    warning ("`%s' is not at beginning of declaration",
1225			     IDENTIFIER_POINTER ($2));
1226		  $$ = tree_cons (NULL_TREE, $2, $1);
1227		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1228	;
1229
1230declspecs_sc_ts_sa_ea:
1231	  declspecs_sc_ts_sa_noea attributes
1232		{ $$ = tree_cons ($2, NULL_TREE, $1);
1233		  TREE_STATIC ($$) = TREE_STATIC ($1); }
1234	| declspecs_sc_ts_sa_noea typespec_reserved_attr
1235		{ $$ = tree_cons (NULL_TREE, $2, $1);
1236		  TREE_STATIC ($$) = 1; }
1237	| declspecs_sc_ts_sa_ea typespec_reserved_attr
1238		{ $$ = tree_cons (NULL_TREE, $2, $1);
1239		  TREE_STATIC ($$) = 1; }
1240	| declspecs_sc_nots_sa_noea typespec_attr
1241		{ $$ = tree_cons (NULL_TREE, $2, $1);
1242		  TREE_STATIC ($$) = 1; }
1243	| declspecs_sc_nots_sa_ea typespec_attr
1244		{ $$ = tree_cons (NULL_TREE, $2, $1);
1245		  TREE_STATIC ($$) = 1; }
1246	;
1247
1248/* Particular useful classes of declspecs.  */
1249declspecs_ts:
1250	  declspecs_nosc_ts_nosa_noea
1251	| declspecs_nosc_ts_nosa_ea
1252	| declspecs_nosc_ts_sa_noea
1253	| declspecs_nosc_ts_sa_ea
1254	| declspecs_sc_ts_nosa_noea
1255	| declspecs_sc_ts_nosa_ea
1256	| declspecs_sc_ts_sa_noea
1257	| declspecs_sc_ts_sa_ea
1258	;
1259
1260declspecs_nots:
1261	  declspecs_nosc_nots_nosa_noea
1262	| declspecs_nosc_nots_nosa_ea
1263	| declspecs_nosc_nots_sa_noea
1264	| declspecs_nosc_nots_sa_ea
1265	| declspecs_sc_nots_nosa_noea
1266	| declspecs_sc_nots_nosa_ea
1267	| declspecs_sc_nots_sa_noea
1268	| declspecs_sc_nots_sa_ea
1269	;
1270
1271declspecs_ts_nosa:
1272	  declspecs_nosc_ts_nosa_noea
1273	| declspecs_nosc_ts_nosa_ea
1274	| declspecs_sc_ts_nosa_noea
1275	| declspecs_sc_ts_nosa_ea
1276	;
1277
1278declspecs_nots_nosa:
1279	  declspecs_nosc_nots_nosa_noea
1280	| declspecs_nosc_nots_nosa_ea
1281	| declspecs_sc_nots_nosa_noea
1282	| declspecs_sc_nots_nosa_ea
1283	;
1284
1285declspecs_nosc_ts:
1286	  declspecs_nosc_ts_nosa_noea
1287	| declspecs_nosc_ts_nosa_ea
1288	| declspecs_nosc_ts_sa_noea
1289	| declspecs_nosc_ts_sa_ea
1290	;
1291
1292declspecs_nosc_nots:
1293	  declspecs_nosc_nots_nosa_noea
1294	| declspecs_nosc_nots_nosa_ea
1295	| declspecs_nosc_nots_sa_noea
1296	| declspecs_nosc_nots_sa_ea
1297	;
1298
1299declspecs_nosc:
1300	  declspecs_nosc_ts_nosa_noea
1301	| declspecs_nosc_ts_nosa_ea
1302	| declspecs_nosc_ts_sa_noea
1303	| declspecs_nosc_ts_sa_ea
1304	| declspecs_nosc_nots_nosa_noea
1305	| declspecs_nosc_nots_nosa_ea
1306	| declspecs_nosc_nots_sa_noea
1307	| declspecs_nosc_nots_sa_ea
1308	;
1309
1310declspecs:
1311	  declspecs_nosc_nots_nosa_noea
1312	| declspecs_nosc_nots_nosa_ea
1313	| declspecs_nosc_nots_sa_noea
1314	| declspecs_nosc_nots_sa_ea
1315	| declspecs_nosc_ts_nosa_noea
1316	| declspecs_nosc_ts_nosa_ea
1317	| declspecs_nosc_ts_sa_noea
1318	| declspecs_nosc_ts_sa_ea
1319	| declspecs_sc_nots_nosa_noea
1320	| declspecs_sc_nots_nosa_ea
1321	| declspecs_sc_nots_sa_noea
1322	| declspecs_sc_nots_sa_ea
1323	| declspecs_sc_ts_nosa_noea
1324	| declspecs_sc_ts_nosa_ea
1325	| declspecs_sc_ts_sa_noea
1326	| declspecs_sc_ts_sa_ea
1327	;
1328
1329/* A (possibly empty) sequence of type qualifiers and attributes.  */
1330maybe_type_quals_attrs:
1331	  /* empty */
1332		{ $$ = NULL_TREE; }
1333	| declspecs_nosc_nots
1334		{ $$ = $1; }
1335	;
1336
1337/* A type specifier (but not a type qualifier).
1338   Once we have seen one of these in a declaration,
1339   if a typedef name appears then it is being redeclared.
1340
1341   The _reserved versions start with a reserved word and may appear anywhere
1342   in the declaration specifiers; the _nonreserved versions may only
1343   appear before any other type specifiers, and after that are (if names)
1344   being redeclared.
1345
1346   FIXME: should the _nonreserved version be restricted to names being
1347   redeclared only?  The other entries there relate only the GNU extensions
1348   and Objective C, and are historically parsed thus, and don't make sense
1349   after other type specifiers, but it might be cleaner to count them as
1350   _reserved.
1351
1352   _attr means: specifiers that either end with attributes,
1353   or are such that any following attributes would
1354   be parsed as part of the specifier.
1355
1356   _nonattr: specifiers.  */
1357
1358typespec_nonattr:
1359	  typespec_reserved_nonattr
1360	| typespec_nonreserved_nonattr
1361	;
1362
1363typespec_attr:
1364	  typespec_reserved_attr
1365	;
1366
1367typespec_reserved_nonattr:
1368	  TYPESPEC
1369		{ OBJC_NEED_RAW_IDENTIFIER (1);	}
1370	| structsp_nonattr
1371	;
1372
1373typespec_reserved_attr:
1374	  structsp_attr
1375	;
1376
1377typespec_nonreserved_nonattr:
1378	  TYPENAME
1379		{ /* For a typedef name, record the meaning, not the name.
1380		     In case of `foo foo, bar;'.  */
1381		  $$ = lookup_name ($1); }
1382	| typeof '(' expr ')'
1383		{ skip_evaluation--; $$ = TREE_TYPE ($3); }
1384	| typeof '(' typename ')'
1385		{ skip_evaluation--; $$ = groktypename ($3); }
1386	;
1387
1388/* typespec_nonreserved_attr does not exist.  */
1389
1390initdecls:
1391	initdcl
1392	| initdecls ',' maybe_resetattrs initdcl
1393	;
1394
1395notype_initdecls:
1396	notype_initdcl
1397	| notype_initdecls ',' maybe_resetattrs notype_initdcl
1398	;
1399
1400maybeasm:
1401	  /* empty */
1402		{ $$ = NULL_TREE; }
1403	| ASM_KEYWORD '(' STRING ')'
1404		{ $$ = $3; }
1405	;
1406
1407initdcl:
1408	  declarator maybeasm maybe_attribute '='
1409		{ $<ttype>$ = start_decl ($1, current_declspecs, 1,
1410					  chainon ($3, all_prefix_attributes));
1411		  start_init ($<ttype>$, $2, global_bindings_p ()); }
1412	  init
1413/* Note how the declaration of the variable is in effect while its init is parsed! */
1414		{ finish_init ();
1415		  finish_decl ($<ttype>5, $6, $2);
1416		  if (In_MP_Region && Is_shared_mp_var ($<ttype>5))
1417		    mp_locals[mp_nesting] = chainon (mp_locals[mp_nesting], build_tree_list (NULL, $<ttype>5));
1418		}
1419	| declarator maybeasm maybe_attribute
1420		{ tree d = start_decl ($1, current_declspecs, 0,
1421				       chainon ($3, all_prefix_attributes));
1422		  finish_decl (d, NULL_TREE, $2);
1423		  if (In_MP_Region && Is_shared_mp_var (d))
1424		    mp_locals[mp_nesting] = chainon (mp_locals[mp_nesting], build_tree_list (NULL, d));
1425                }
1426	;
1427
1428notype_initdcl:
1429	  notype_declarator maybeasm maybe_attribute '='
1430		{ $<ttype>$ = start_decl ($1, current_declspecs, 1,
1431					  chainon ($3, all_prefix_attributes));
1432		  start_init ($<ttype>$, $2, global_bindings_p ()); }
1433	  init
1434/* Note how the declaration of the variable is in effect while its init is parsed! */
1435		{ finish_init ();
1436		  finish_decl ($<ttype>5, $6, $2);
1437		  if (In_MP_Region && Is_shared_mp_var ($<ttype>5))
1438		    mp_locals[mp_nesting] = chainon (mp_locals[mp_nesting], build_tree_list (NULL, $<ttype>5));
1439		}
1440	| notype_declarator maybeasm maybe_attribute
1441		{ tree d = start_decl ($1, current_declspecs, 0,
1442				       chainon ($3, all_prefix_attributes));
1443		  finish_decl (d, NULL_TREE, $2);
1444		  if (In_MP_Region && Is_shared_mp_var (d))
1445		    mp_locals[mp_nesting] = chainon (mp_locals[mp_nesting], build_tree_list (NULL, d));
1446		}
1447	;
1448/* the * rules are dummies to accept the Apollo extended syntax
1449   so that the header files compile. */
1450maybe_attribute:
1451      /* empty */
1452  		{ $$ = NULL_TREE; }
1453	| attributes
1454		{ $$ = $1; }
1455	;
1456
1457attributes:
1458      attribute
1459		{ $$ = $1; }
1460	| attributes attribute
1461		{ $$ = chainon ($1, $2); }
1462	;
1463
1464attribute:
1465      ATTRIBUTE '(' '(' attribute_list ')' ')'
1466		{ $$ = $4; }
1467	;
1468
1469attribute_list:
1470      attrib
1471		{ $$ = $1; }
1472	| attribute_list ',' attrib
1473		{ $$ = chainon ($1, $3); }
1474	;
1475
1476attrib:
1477    /* empty */
1478		{ $$ = NULL_TREE; }
1479	| any_word
1480		{ $$ = build_tree_list ($1, NULL_TREE); }
1481	| any_word '(' IDENTIFIER ')'
1482		{ $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
1483	| any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1484		{ $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
1485	| any_word '(' exprlist ')'
1486		{ $$ = build_tree_list ($1, $3); }
1487	;
1488
1489/* This still leaves out most reserved keywords,
1490   shouldn't we include them?  */
1491
1492any_word:
1493	  identifier
1494	| scspec
1495	| TYPESPEC
1496	| TYPE_QUAL
1497	;
1498
1499scspec:
1500	  STATIC
1501	| SCSPEC
1502	;
1503
1504/* Initializers.  `init' is the entry point.  */
1505
1506init:
1507	expr_no_commas
1508	| '{'
1509		{ really_start_incremental_init (NULL_TREE); }
1510	  initlist_maybe_comma '}'
1511		{ $$ = pop_init_level (0); }
1512	| error
1513		{ $$ = error_mark_node; }
1514	;
1515
1516/* `initlist_maybe_comma' is the guts of an initializer in braces.  */
1517initlist_maybe_comma:
1518	  /* empty */
1519		{ if (pedantic)
1520		    pedwarn ("ISO C forbids empty initializer braces"); }
1521	| initlist1 maybecomma
1522	;
1523
1524initlist1:
1525	  initelt
1526	| initlist1 ',' initelt
1527	;
1528
1529/* `initelt' is a single element of an initializer.
1530   It may use braces.  */
1531initelt:
1532	  designator_list '=' initval
1533		{ if (pedantic && ! flag_isoc99)
1534		    pedwarn ("ISO C89 forbids specifying subobject to initialize"); }
1535	| designator initval
1536		{ if (pedantic)
1537		    pedwarn ("obsolete use of designated initializer without `='"); }
1538	| identifier ':'
1539		{ set_init_label ($1);
1540		  if (pedantic)
1541		    pedwarn ("obsolete use of designated initializer with `:'"); }
1542	  initval
1543		{}
1544	| initval
1545	;
1546
1547initval:
1548	  '{'
1549		{ push_init_level (0); }
1550	  initlist_maybe_comma '}'
1551		{ process_init_element (pop_init_level (0)); }
1552	| expr_no_commas
1553		{ process_init_element ($1); }
1554	| error
1555	;
1556
1557designator_list:
1558	  designator
1559	| designator_list designator
1560	;
1561
1562designator:
1563	  '.' identifier
1564		{ set_init_label ($2); }
1565	| '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1566		{ set_init_index ($2, $4);
1567		  if (pedantic)
1568		    pedwarn ("ISO C forbids specifying range of elements to initialize"); }
1569	| '[' expr_no_commas ']'
1570		{ set_init_index ($2, NULL_TREE); }
1571	;
1572
1573nested_function:
1574	  declarator
1575		{ if (pedantic)
1576		    pedwarn ("ISO C forbids nested functions");
1577
1578		  push_function_context ();
1579		  if (! start_function (current_declspecs, $1,
1580					all_prefix_attributes))
1581		    {
1582		      pop_function_context ();
1583		      YYERROR1;
1584		    }
1585		  parsing_iso_function_signature = false; /* Don't warn about nested functions.  */
1586		}
1587	   old_style_parm_decls
1588		{ store_parm_decls (); }
1589/* This used to use compstmt_or_error.
1590   That caused a bug…

Large files files are truncated, but you can click here to view the full file