1 /* YACC parser for C syntax and for Objective C. -*-c-*-
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996,
3 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 /* This file defines the grammar of C and that of Objective C.
23 ifobjc ... end ifobjc conditionals contain code for Objective C only.
24 ifc ... end ifc conditionals contain code for C only.
25 Sed commands in Makefile.in are used to convert this file into
26 c-parse.y and into objc-parse.y. */
28 /* To whomever it may concern: I have heard that such a thing was once
29 written by AT&T, but I have never seen it. */
32 %expect 32 /* shift/reduce conflicts, and 1 reduce/reduce conflict. */
35 %expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts. */
41 #include "coretypes.h"
48 #include "c-pragma.h" /* For YYDEBUG definition, and parse_in. */
56 #ifdef MULTIBYTE_CHARS
64 /* Like YYERROR but do call yyerror. */
65 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
67 /* Like the default stack expander, except (1) use realloc when possible,
68 (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca.
70 Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot
71 give malloced_yyvs its proper type. This is ok since all we need from
72 it is to be able to free it. */
74 static short *malloced_yyss;
75 static void *malloced_yyvs;
77 #define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \
82 newsize = *(YYSSZ) *= 2; \
86 really_call_realloc (*(SS), newsize * sizeof (short)); \
88 really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \
92 newss = (short *) really_call_malloc (newsize * sizeof (short)); \
93 newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \
95 memcpy (newss, *(SS), (SSSIZE)); \
97 memcpy (newvs, *(VS), (VSSIZE)); \
99 if (!newss || !newvs) \
106 malloced_yyss = newss; \
107 malloced_yyvs = (void *) newvs; \
113 %union {long itype; tree ttype; enum tree_code code;
114 const char *filename; int lineno; }
116 /* All identifiers that are not reserved words
117 and are not declared typedefs in the current block */
120 /* All identifiers that are declared typedefs in the current block.
121 In some contexts, they are treated just like IDENTIFIER,
122 but they can also serve as typespecs in declarations. */
125 /* Reserved words that specify storage class.
126 yylval contains an IDENTIFIER_NODE which indicates which one. */
127 %token SCSPEC /* Storage class other than static. */
128 %token STATIC /* Static storage class. */
130 /* Reserved words that specify type.
131 yylval contains an IDENTIFIER_NODE which indicates which one. */
134 /* Reserved words that qualify type: "const", "volatile", or "restrict".
135 yylval contains an IDENTIFIER_NODE which indicates which one. */
138 /* Character or numeric constants.
139 yylval is the node for the constant. */
142 /* String constants in raw form.
143 yylval is a STRING_CST node. */
146 /* "...", used for functions with variable arglists. */
149 /* the reserved words */
150 /* SCO include files test "ASM", so use something else. */
151 %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
152 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
153 %token ATTRIBUTE EXTENSION LABEL
154 %token REALPART IMAGPART VA_ARG CHOOSE_EXPR TYPES_COMPATIBLE_P
155 %token PTR_VALUE PTR_BASE PTR_EXTENT
157 /* function name can be a string const or a var decl. */
158 %token STRING_FUNC_NAME VAR_FUNC_NAME
160 /* Add precedence rules to solve dangling else s/r conflict */
164 /* Define the operator tokens and their precedences.
165 The value is an integer because, if used, it is the tree code
166 to use in the expression made from the operator. */
168 %right <code> ASSIGN '='
169 %right <code> '?' ':'
175 %left <code> EQCOMPARE
176 %left <code> ARITHCOMPARE
177 %left <code> LSHIFT RSHIFT
179 %left <code> '*' '/' '%'
180 %right <code> UNARY PLUSPLUS MINUSMINUS
182 %left <code> POINTSAT '.' '(' '['
184 /* The Objective-C keywords. These are included in C and in
185 Objective C, so that the token codes are the same in both. */
186 %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
187 %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
190 %type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
191 %type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
193 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
194 %type <ttype> expr_no_commas cast_expr unary_expr primary STRING
195 %type <ttype> declspecs_nosc_nots_nosa_noea declspecs_nosc_nots_nosa_ea
196 %type <ttype> declspecs_nosc_nots_sa_noea declspecs_nosc_nots_sa_ea
197 %type <ttype> declspecs_nosc_ts_nosa_noea declspecs_nosc_ts_nosa_ea
198 %type <ttype> declspecs_nosc_ts_sa_noea declspecs_nosc_ts_sa_ea
199 %type <ttype> declspecs_sc_nots_nosa_noea declspecs_sc_nots_nosa_ea
200 %type <ttype> declspecs_sc_nots_sa_noea declspecs_sc_nots_sa_ea
201 %type <ttype> declspecs_sc_ts_nosa_noea declspecs_sc_ts_nosa_ea
202 %type <ttype> declspecs_sc_ts_sa_noea declspecs_sc_ts_sa_ea
203 %type <ttype> declspecs_ts declspecs_nots
204 %type <ttype> declspecs_ts_nosa declspecs_nots_nosa
205 %type <ttype> declspecs_nosc_ts declspecs_nosc_nots declspecs_nosc declspecs
206 %type <ttype> maybe_type_quals_attrs typespec_nonattr typespec_attr
207 %type <ttype> typespec_reserved_nonattr typespec_reserved_attr
208 %type <ttype> typespec_nonreserved_nonattr
210 %type <ttype> scspec SCSPEC STATIC TYPESPEC TYPE_QUAL maybe_type_qual
211 %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
212 %type <ttype> init maybeasm
213 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
214 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
215 %type <ttype> any_word extension
217 %type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
218 %type <ttype> do_stmt_start poplevel stmt label
220 %type <ttype> c99_block_start c99_block_end
221 %type <ttype> declarator
222 %type <ttype> notype_declarator after_type_declarator
223 %type <ttype> parm_declarator
224 %type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename
225 %type <ttype> array_declarator
227 %type <ttype> structsp_attr structsp_nonattr
228 %type <ttype> component_decl_list component_decl_list2
229 %type <ttype> component_decl components components_notype component_declarator
230 %type <ttype> component_notype_declarator
231 %type <ttype> enumlist enumerator
232 %type <ttype> struct_head union_head enum_head
233 %type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea
234 %type <ttype> direct_absdcl1 absdcl_maybe_attribute
235 %type <ttype> xexpr parms parm firstparm identifiers
237 %type <ttype> parmlist parmlist_1 parmlist_2
238 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
239 %type <ttype> identifiers_or_typenames
241 %type <itype> setspecs setspecs_fp
243 %type <filename> save_filename
244 %type <lineno> save_lineno
247 /* the Objective-C nonterminals */
249 %type <ttype> ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator
250 %type <ttype> methoddecl unaryselector keywordselector selector
251 %type <ttype> keyworddecl receiver objcmessageexpr messageargs
252 %type <ttype> keywordexpr keywordarglist keywordarg
253 %type <ttype> myparms myparm optparmlist reservedwords objcselectorexpr
254 %type <ttype> selectorarg keywordnamelist keywordname objcencodeexpr
255 %type <ttype> objc_string non_empty_protocolrefs protocolrefs identifier_list objcprotocolexpr
257 %type <ttype> CLASSNAME OBJECTNAME
261 /* Number of statements (loosely speaking) and compound statements
263 static int stmt_count;
264 static int compstmt_count;
266 /* Input file and line number of the end of the body of last simple_if;
267 used by the stmt-rule immediately after simple_if returns. */
268 static const char *if_stmt_file;
269 static int if_stmt_line;
271 /* List of types and structure classes of the current declaration. */
272 static GTY(()) tree current_declspecs;
273 static GTY(()) tree prefix_attributes;
275 /* List of all the attributes applying to the identifier currently being
276 declared; includes prefix_attributes and possibly some more attributes
277 just after a comma. */
278 static GTY(()) tree all_prefix_attributes;
280 /* Stack of saved values of current_declspecs, prefix_attributes and
281 all_prefix_attributes. */
282 static GTY(()) tree declspec_stack;
284 /* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
285 should be called from the productions making use of setspecs. */
286 #define PUSH_DECLSPEC_STACK \
288 declspec_stack = tree_cons (build_tree_list (prefix_attributes, \
289 all_prefix_attributes), \
294 #define POP_DECLSPEC_STACK \
296 current_declspecs = TREE_VALUE (declspec_stack); \
297 prefix_attributes = TREE_PURPOSE (TREE_PURPOSE (declspec_stack)); \
298 all_prefix_attributes = TREE_VALUE (TREE_PURPOSE (declspec_stack)); \
299 declspec_stack = TREE_CHAIN (declspec_stack); \
302 /* For __extension__, save/restore the warning flags which are
303 controlled by __extension__. */
304 #define SAVE_EXT_FLAGS() \
306 | (warn_pointer_arith << 1) \
307 | (warn_traditional << 2) \
310 #define RESTORE_EXT_FLAGS(tval) \
312 int val = tree_low_cst (tval, 0); \
313 pedantic = val & 1; \
314 warn_pointer_arith = (val >> 1) & 1; \
315 warn_traditional = (val >> 2) & 1; \
316 flag_iso = (val >> 3) & 1; \
320 /* Objective-C specific parser/lexer information */
322 static enum tree_code objc_inherit_code;
323 static int objc_pq_context = 0, objc_public_flag = 0;
325 /* The following flag is needed to contextualize ObjC lexical analysis.
326 In some cases (e.g., 'int NSObject;'), it is undesirable to bind
327 an identifier to an ObjC class, even if a class with that name
329 static int objc_need_raw_identifier;
330 #define OBJC_NEED_RAW_IDENTIFIER(VAL) objc_need_raw_identifier = VAL
334 #define OBJC_NEED_RAW_IDENTIFIER(VAL) /* nothing */
337 static bool parsing_iso_function_signature;
339 /* Tell yyparse how to print a token's value, if yydebug is set. */
341 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
343 static void yyprint PARAMS ((FILE *, int, YYSTYPE));
344 static void yyerror PARAMS ((const char *));
345 static int yylexname PARAMS ((void));
346 static int yylexstring PARAMS ((void));
347 static inline int _yylex PARAMS ((void));
348 static int yylex PARAMS ((void));
349 static void init_reswords PARAMS ((void));
351 /* Initialisation routine for this file. */
363 pedwarn ("ISO C forbids an empty source file");
368 /* In case there were missing closebraces,
369 get us back to the global binding level. */
370 while (! global_bindings_p ())
372 /* __FUNCTION__ is defined at file scope (""). This
373 call may not be necessary as my tests indicate it
374 still works without it. */
375 finish_fname_decls ();
380 /* the reason for the strange actions in this rule
381 is so that notype_initdecls when reached via datadef
382 can find a valid list of type and sc specs in $0. */
385 {$<ttype>$ = NULL_TREE; } extdef
386 | extdefs {$<ttype>$ = NULL_TREE; ggc_collect(); } extdef
391 { parsing_iso_function_signature = false; } /* Reset after any external definition. */
400 | ASM_KEYWORD '(' expr ')' ';'
402 if ((TREE_CODE ($3) == ADDR_EXPR
403 && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
404 || TREE_CODE ($3) == STRING_CST)
407 error ("argument of `asm' is not a constant string"); }
409 { RESTORE_EXT_FLAGS ($1); }
413 setspecs notype_initdecls ';'
415 error ("ISO C forbids data definition with no type or storage class");
417 warning ("data definition has no type or storage class");
419 POP_DECLSPEC_STACK; }
420 | declspecs_nots setspecs notype_initdecls ';'
421 { POP_DECLSPEC_STACK; }
422 | declspecs_ts setspecs initdecls ';'
423 { POP_DECLSPEC_STACK; }
430 pedwarn ("ISO C does not allow extra `;' outside of a function"); }
434 declspecs_ts setspecs declarator
435 { if (! start_function (current_declspecs, $3,
436 all_prefix_attributes))
440 { store_parm_decls (); }
441 save_filename save_lineno compstmt_or_error
442 { DECL_SOURCE_FILE (current_function_decl) = $7;
443 DECL_SOURCE_LINE (current_function_decl) = $8;
444 finish_function (0, 1);
445 POP_DECLSPEC_STACK; }
446 | declspecs_ts setspecs declarator error
447 { POP_DECLSPEC_STACK; }
448 | declspecs_nots setspecs notype_declarator
449 { if (! start_function (current_declspecs, $3,
450 all_prefix_attributes))
454 { store_parm_decls (); }
455 save_filename save_lineno compstmt_or_error
456 { DECL_SOURCE_FILE (current_function_decl) = $7;
457 DECL_SOURCE_LINE (current_function_decl) = $8;
458 finish_function (0, 1);
459 POP_DECLSPEC_STACK; }
460 | declspecs_nots setspecs notype_declarator error
461 { POP_DECLSPEC_STACK; }
462 | setspecs notype_declarator
463 { if (! start_function (NULL_TREE, $2,
464 all_prefix_attributes))
468 { store_parm_decls (); }
469 save_filename save_lineno compstmt_or_error
470 { DECL_SOURCE_FILE (current_function_decl) = $6;
471 DECL_SOURCE_LINE (current_function_decl) = $7;
472 finish_function (0, 1);
473 POP_DECLSPEC_STACK; }
474 | setspecs notype_declarator error
475 { POP_DECLSPEC_STACK; }
490 { $$ = NEGATE_EXPR; }
494 if (warn_traditional && !in_system_header)
495 warning ("traditional C rejects the unary plus operator");
499 { $$ = PREINCREMENT_EXPR; }
501 { $$ = PREDECREMENT_EXPR; }
503 { $$ = BIT_NOT_EXPR; }
505 { $$ = TRUTH_NOT_EXPR; }
508 expr: nonnull_exprlist
509 { $$ = build_compound_expr ($1); }
520 { $$ = build_tree_list (NULL_TREE, $1); }
521 | nonnull_exprlist ',' expr_no_commas
522 { chainon ($1, build_tree_list (NULL_TREE, $3)); }
527 | '*' cast_expr %prec UNARY
528 { $$ = build_indirect_ref ($2, "unary *"); }
529 /* __extension__ turns off -pedantic for following primary. */
530 | extension cast_expr %prec UNARY
532 RESTORE_EXT_FLAGS ($1); }
533 | unop cast_expr %prec UNARY
534 { $$ = build_unary_op ($1, $2, 0);
535 overflow_warning ($$); }
536 /* Refer to the address of a label as a pointer. */
538 { $$ = finish_label_address_expr ($2); }
539 | sizeof unary_expr %prec UNARY
541 if (TREE_CODE ($2) == COMPONENT_REF
542 && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
543 error ("`sizeof' applied to a bit-field");
544 $$ = c_sizeof (TREE_TYPE ($2)); }
545 | sizeof '(' typename ')' %prec HYPERUNARY
547 $$ = c_sizeof (groktypename ($3)); }
548 | alignof unary_expr %prec UNARY
550 $$ = c_alignof_expr ($2); }
551 | alignof '(' typename ')' %prec HYPERUNARY
553 $$ = c_alignof (groktypename ($3)); }
554 | REALPART cast_expr %prec UNARY
555 { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
556 | IMAGPART cast_expr %prec UNARY
557 { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
561 SIZEOF { skip_evaluation++; }
565 ALIGNOF { skip_evaluation++; }
569 TYPEOF { skip_evaluation++; }
574 | '(' typename ')' cast_expr %prec UNARY
575 { $$ = c_cast_expr ($2, $4); }
580 | expr_no_commas '+' expr_no_commas
581 { $$ = parser_build_binary_op ($2, $1, $3); }
582 | expr_no_commas '-' expr_no_commas
583 { $$ = parser_build_binary_op ($2, $1, $3); }
584 | expr_no_commas '*' expr_no_commas
585 { $$ = parser_build_binary_op ($2, $1, $3); }
586 | expr_no_commas '/' expr_no_commas
587 { $$ = parser_build_binary_op ($2, $1, $3); }
588 | expr_no_commas '%' expr_no_commas
589 { $$ = parser_build_binary_op ($2, $1, $3); }
590 | expr_no_commas LSHIFT expr_no_commas
591 { $$ = parser_build_binary_op ($2, $1, $3); }
592 | expr_no_commas RSHIFT expr_no_commas
593 { $$ = parser_build_binary_op ($2, $1, $3); }
594 | expr_no_commas ARITHCOMPARE expr_no_commas
595 { $$ = parser_build_binary_op ($2, $1, $3); }
596 | expr_no_commas EQCOMPARE expr_no_commas
597 { $$ = parser_build_binary_op ($2, $1, $3); }
598 | expr_no_commas '&' expr_no_commas
599 { $$ = parser_build_binary_op ($2, $1, $3); }
600 | expr_no_commas '|' expr_no_commas
601 { $$ = parser_build_binary_op ($2, $1, $3); }
602 | expr_no_commas '^' expr_no_commas
603 { $$ = parser_build_binary_op ($2, $1, $3); }
604 | expr_no_commas ANDAND
605 { $1 = c_common_truthvalue_conversion
606 (default_conversion ($1));
607 skip_evaluation += $1 == boolean_false_node; }
609 { skip_evaluation -= $1 == boolean_false_node;
610 $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
611 | expr_no_commas OROR
612 { $1 = c_common_truthvalue_conversion
613 (default_conversion ($1));
614 skip_evaluation += $1 == boolean_true_node; }
616 { skip_evaluation -= $1 == boolean_true_node;
617 $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
619 { $1 = c_common_truthvalue_conversion
620 (default_conversion ($1));
621 skip_evaluation += $1 == boolean_false_node; }
623 { skip_evaluation += (($1 == boolean_true_node)
624 - ($1 == boolean_false_node)); }
626 { skip_evaluation -= $1 == boolean_true_node;
627 $$ = build_conditional_expr ($1, $4, $7); }
630 pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
631 /* Make sure first operand is calculated only once. */
632 $<ttype>2 = save_expr ($1);
633 $1 = c_common_truthvalue_conversion
634 (default_conversion ($<ttype>2));
635 skip_evaluation += $1 == boolean_true_node; }
637 { skip_evaluation -= $1 == boolean_true_node;
638 $$ = build_conditional_expr ($1, $<ttype>2, $5); }
639 | expr_no_commas '=' expr_no_commas
641 $$ = build_modify_expr ($1, NOP_EXPR, $3);
642 class = TREE_CODE_CLASS (TREE_CODE ($$));
643 if (IS_EXPR_CODE_CLASS (class))
644 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
646 | expr_no_commas ASSIGN expr_no_commas
648 $$ = build_modify_expr ($1, $2, $3);
649 /* This inhibits warnings in
650 c_common_truthvalue_conversion. */
651 class = TREE_CODE_CLASS (TREE_CODE ($$));
652 if (IS_EXPR_CODE_CLASS (class))
653 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
660 if (yychar == YYEMPTY)
662 $$ = build_external_ref ($1, yychar == '(');
666 { $$ = fix_string_type ($$); }
668 { $$ = fname_decl (C_RID_CODE ($$), $$); }
669 | '(' typename ')' '{'
670 { start_init (NULL_TREE, NULL, 0);
671 $2 = groktypename ($2);
672 really_start_incremental_init ($2); }
673 initlist_maybe_comma '}' %prec UNARY
674 { tree constructor = pop_init_level (0);
678 if (pedantic && ! flag_isoc99)
679 pedwarn ("ISO C89 forbids compound literals");
680 $$ = build_compound_literal (type, constructor);
683 { char class = TREE_CODE_CLASS (TREE_CODE ($2));
684 if (IS_EXPR_CODE_CLASS (class))
685 C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
688 { $$ = error_mark_node; }
689 | compstmt_primary_start compstmt_nostart ')'
690 { tree saved_last_tree;
693 pedwarn ("ISO C forbids braced-groups within expressions");
696 saved_last_tree = COMPOUND_BODY ($1);
697 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
698 last_tree = saved_last_tree;
699 TREE_CHAIN (last_tree) = NULL_TREE;
701 last_expr_type = void_type_node;
702 $$ = build1 (STMT_EXPR, last_expr_type, $1);
703 TREE_SIDE_EFFECTS ($$) = 1;
705 | compstmt_primary_start error ')'
708 last_tree = COMPOUND_BODY ($1);
709 TREE_CHAIN (last_tree) = NULL_TREE;
710 $$ = error_mark_node;
712 | primary '(' exprlist ')' %prec '.'
713 { $$ = build_function_call ($1, $3); }
714 | VA_ARG '(' expr_no_commas ',' typename ')'
715 { $$ = build_va_arg ($3, groktypename ($5)); }
717 | CHOOSE_EXPR '(' expr_no_commas ',' expr_no_commas ',' expr_no_commas ')'
723 if (TREE_CODE (c) != INTEGER_CST)
724 error ("first argument to __builtin_choose_expr not a constant");
725 $$ = integer_zerop (c) ? $7 : $5;
727 | TYPES_COMPATIBLE_P '(' typename ',' typename ')'
731 e1 = TYPE_MAIN_VARIANT (groktypename ($3));
732 e2 = TYPE_MAIN_VARIANT (groktypename ($5));
734 $$ = comptypes (e1, e2)
735 ? build_int_2 (1, 0) : build_int_2 (0, 0);
737 | primary '[' expr ']' %prec '.'
738 { $$ = build_array_ref ($1, $3); }
739 | primary '.' identifier
742 if (!is_public ($1, $3))
743 $$ = error_mark_node;
746 $$ = build_component_ref ($1, $3);
748 | primary POINTSAT identifier
750 tree expr = build_indirect_ref ($1, "->");
753 if (!is_public (expr, $3))
754 $$ = error_mark_node;
757 $$ = build_component_ref (expr, $3);
760 { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
762 { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
765 { $$ = build_message_expr ($1); }
767 { $$ = build_selector_expr ($1); }
769 { $$ = build_protocol_expr ($1); }
771 { $$ = build_encode_expr ($1); }
773 { $$ = build_objc_string_object ($1); }
778 /* Produces an STRING_CST with perhaps more STRING_CSTs chained
779 onto it, which is to be read as an ObjC string object. */
783 | objc_string '@' STRING
784 { $$ = chainon ($1, $3); }
788 old_style_parm_decls:
789 old_style_parm_decls_1
791 parsing_iso_function_signature = false; /* Reset after decls. */
795 old_style_parm_decls_1:
798 if (warn_traditional && !in_system_header
799 && parsing_iso_function_signature)
800 warning ("traditional C rejects ISO C style function definitions");
801 parsing_iso_function_signature = false; /* Reset after warning. */
806 /* The following are analogous to lineno_decl, decls and decl
807 except that they do not allow nested functions.
808 They are used for old-style parm decls. */
810 save_filename save_lineno datadecl
817 | datadecls lineno_datadecl
818 | lineno_datadecl errstmt
821 /* We don't allow prefix attributes here because they cause reduce/reduce
822 conflicts: we can't know whether we're parsing a function decl with
823 attribute suffix, or function defn with attribute prefix on first old
826 declspecs_ts_nosa setspecs initdecls ';'
827 { POP_DECLSPEC_STACK; }
828 | declspecs_nots_nosa setspecs notype_initdecls ';'
829 { POP_DECLSPEC_STACK; }
830 | declspecs_ts_nosa ';'
831 { shadow_tag_warned ($1, 1);
832 pedwarn ("empty declaration"); }
833 | declspecs_nots_nosa ';'
834 { pedwarn ("empty declaration"); }
837 /* This combination which saves a lineno before a decl
838 is the normal thing to use, rather than decl itself.
839 This is to avoid shift/reduce conflicts in contexts
840 where statement labels are allowed. */
842 save_filename save_lineno decl
846 /* records the type and storage class specs to use for processing
847 the declarators that follow.
848 Maintains a stack of outer-level values of current_declspecs,
849 for the sake of parm declarations nested in function declarators. */
850 setspecs: /* empty */
851 { pending_xref_error ();
853 split_specs_attrs ($<ttype>0,
854 ¤t_declspecs, &prefix_attributes);
855 all_prefix_attributes = prefix_attributes; }
858 /* Possibly attributes after a comma, which should reset all_prefix_attributes
859 to prefix_attributes with these ones chained on the front. */
862 { all_prefix_attributes = chainon ($1, prefix_attributes); }
866 declspecs_ts setspecs initdecls ';'
867 { POP_DECLSPEC_STACK; }
868 | declspecs_nots setspecs notype_initdecls ';'
869 { POP_DECLSPEC_STACK; }
870 | declspecs_ts setspecs nested_function
871 { POP_DECLSPEC_STACK; }
872 | declspecs_nots setspecs notype_nested_function
873 { POP_DECLSPEC_STACK; }
877 { RESTORE_EXT_FLAGS ($1); }
880 /* A list of declaration specifiers. These are:
882 - Storage class specifiers (scspec), which for GCC currently includes
883 function specifiers ("inline").
885 - Type specifiers (typespec_*).
887 - Type qualifiers (TYPE_QUAL).
889 - Attribute specifier lists (attributes).
891 These are stored as a TREE_LIST; the head of the list is the last
892 item in the specifier list. Each entry in the list has either a
893 TREE_PURPOSE that is an attribute specifier list, or a TREE_VALUE that
894 is a single other specifier or qualifier; and a TREE_CHAIN that is the
895 rest of the list. TREE_STATIC is set on the list if something other
896 than a storage class specifier or attribute has been seen; this is used
897 to warn for the obsolescent usage of storage class specifiers other than
898 at the start of the list. (Doing this properly would require function
899 specifiers to be handled separately from storage class specifiers.)
901 The various cases below are classified according to:
903 (a) Whether a storage class specifier is included or not; some
904 places in the grammar disallow storage class specifiers (_sc or _nosc).
906 (b) Whether a type specifier has been seen; after a type specifier,
907 a typedef name is an identifier to redeclare (_ts or _nots).
909 (c) Whether the list starts with an attribute; in certain places,
910 the grammar requires specifiers that don't start with an attribute
913 (d) Whether the list ends with an attribute (or a specifier such that
914 any following attribute would have been parsed as part of that specifier);
915 this avoids shift-reduce conflicts in the parsing of attributes
920 (i) Distinguish between function specifiers and storage class specifiers,
921 at least for the purpose of warnings about obsolescent usage.
923 (ii) Halve the number of productions here by eliminating the _sc/_nosc
924 distinction and instead checking where required that storage class
925 specifiers aren't present. */
927 /* Declspecs which contain at least one type specifier or typedef name.
928 (Just `const' or `volatile' is not enough.)
929 A typedef'd name following these is taken as a name to be declared.
930 Declspecs have a non-NULL TREE_VALUE, attributes do not. */
932 declspecs_nosc_nots_nosa_noea:
934 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
935 TREE_STATIC ($$) = 1; }
936 | declspecs_nosc_nots_nosa_noea TYPE_QUAL
937 { $$ = tree_cons (NULL_TREE, $2, $1);
938 TREE_STATIC ($$) = 1; }
939 | declspecs_nosc_nots_nosa_ea TYPE_QUAL
940 { $$ = tree_cons (NULL_TREE, $2, $1);
941 TREE_STATIC ($$) = 1; }
944 declspecs_nosc_nots_nosa_ea:
945 declspecs_nosc_nots_nosa_noea attributes
946 { $$ = tree_cons ($2, NULL_TREE, $1);
947 TREE_STATIC ($$) = TREE_STATIC ($1); }
950 declspecs_nosc_nots_sa_noea:
951 declspecs_nosc_nots_sa_noea TYPE_QUAL
952 { $$ = tree_cons (NULL_TREE, $2, $1);
953 TREE_STATIC ($$) = 1; }
954 | declspecs_nosc_nots_sa_ea TYPE_QUAL
955 { $$ = tree_cons (NULL_TREE, $2, $1);
956 TREE_STATIC ($$) = 1; }
959 declspecs_nosc_nots_sa_ea:
961 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE);
962 TREE_STATIC ($$) = 0; }
963 | declspecs_nosc_nots_sa_noea attributes
964 { $$ = tree_cons ($2, NULL_TREE, $1);
965 TREE_STATIC ($$) = TREE_STATIC ($1); }
968 declspecs_nosc_ts_nosa_noea:
970 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
971 TREE_STATIC ($$) = 1; }
972 | declspecs_nosc_ts_nosa_noea TYPE_QUAL
973 { $$ = tree_cons (NULL_TREE, $2, $1);
974 TREE_STATIC ($$) = 1; }
975 | declspecs_nosc_ts_nosa_ea TYPE_QUAL
976 { $$ = tree_cons (NULL_TREE, $2, $1);
977 TREE_STATIC ($$) = 1; }
978 | declspecs_nosc_ts_nosa_noea typespec_reserved_nonattr
979 { $$ = tree_cons (NULL_TREE, $2, $1);
980 TREE_STATIC ($$) = 1; }
981 | declspecs_nosc_ts_nosa_ea typespec_reserved_nonattr
982 { $$ = tree_cons (NULL_TREE, $2, $1);
983 TREE_STATIC ($$) = 1; }
984 | declspecs_nosc_nots_nosa_noea typespec_nonattr
985 { $$ = tree_cons (NULL_TREE, $2, $1);
986 TREE_STATIC ($$) = 1; }
987 | declspecs_nosc_nots_nosa_ea typespec_nonattr
988 { $$ = tree_cons (NULL_TREE, $2, $1);
989 TREE_STATIC ($$) = 1; }
992 declspecs_nosc_ts_nosa_ea:
994 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
995 TREE_STATIC ($$) = 1; }
996 | declspecs_nosc_ts_nosa_noea attributes
997 { $$ = tree_cons ($2, NULL_TREE, $1);
998 TREE_STATIC ($$) = TREE_STATIC ($1); }
999 | declspecs_nosc_ts_nosa_noea typespec_reserved_attr
1000 { $$ = tree_cons (NULL_TREE, $2, $1);
1001 TREE_STATIC ($$) = 1; }
1002 | declspecs_nosc_ts_nosa_ea typespec_reserved_attr
1003 { $$ = tree_cons (NULL_TREE, $2, $1);
1004 TREE_STATIC ($$) = 1; }
1005 | declspecs_nosc_nots_nosa_noea typespec_attr
1006 { $$ = tree_cons (NULL_TREE, $2, $1);
1007 TREE_STATIC ($$) = 1; }
1008 | declspecs_nosc_nots_nosa_ea typespec_attr
1009 { $$ = tree_cons (NULL_TREE, $2, $1);
1010 TREE_STATIC ($$) = 1; }
1013 declspecs_nosc_ts_sa_noea:
1014 declspecs_nosc_ts_sa_noea TYPE_QUAL
1015 { $$ = tree_cons (NULL_TREE, $2, $1);
1016 TREE_STATIC ($$) = 1; }
1017 | declspecs_nosc_ts_sa_ea TYPE_QUAL
1018 { $$ = tree_cons (NULL_TREE, $2, $1);
1019 TREE_STATIC ($$) = 1; }
1020 | declspecs_nosc_ts_sa_noea typespec_reserved_nonattr
1021 { $$ = tree_cons (NULL_TREE, $2, $1);
1022 TREE_STATIC ($$) = 1; }
1023 | declspecs_nosc_ts_sa_ea typespec_reserved_nonattr
1024 { $$ = tree_cons (NULL_TREE, $2, $1);
1025 TREE_STATIC ($$) = 1; }
1026 | declspecs_nosc_nots_sa_noea typespec_nonattr
1027 { $$ = tree_cons (NULL_TREE, $2, $1);
1028 TREE_STATIC ($$) = 1; }
1029 | declspecs_nosc_nots_sa_ea typespec_nonattr
1030 { $$ = tree_cons (NULL_TREE, $2, $1);
1031 TREE_STATIC ($$) = 1; }
1034 declspecs_nosc_ts_sa_ea:
1035 declspecs_nosc_ts_sa_noea attributes
1036 { $$ = tree_cons ($2, NULL_TREE, $1);
1037 TREE_STATIC ($$) = TREE_STATIC ($1); }
1038 | declspecs_nosc_ts_sa_noea typespec_reserved_attr
1039 { $$ = tree_cons (NULL_TREE, $2, $1);
1040 TREE_STATIC ($$) = 1; }
1041 | declspecs_nosc_ts_sa_ea typespec_reserved_attr
1042 { $$ = tree_cons (NULL_TREE, $2, $1);
1043 TREE_STATIC ($$) = 1; }
1044 | declspecs_nosc_nots_sa_noea typespec_attr
1045 { $$ = tree_cons (NULL_TREE, $2, $1);
1046 TREE_STATIC ($$) = 1; }
1047 | declspecs_nosc_nots_sa_ea typespec_attr
1048 { $$ = tree_cons (NULL_TREE, $2, $1);
1049 TREE_STATIC ($$) = 1; }
1052 declspecs_sc_nots_nosa_noea:
1054 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
1055 TREE_STATIC ($$) = 0; }
1056 | declspecs_sc_nots_nosa_noea TYPE_QUAL
1057 { $$ = tree_cons (NULL_TREE, $2, $1);
1058 TREE_STATIC ($$) = 1; }
1059 | declspecs_sc_nots_nosa_ea TYPE_QUAL
1060 { $$ = tree_cons (NULL_TREE, $2, $1);
1061 TREE_STATIC ($$) = 1; }
1062 | declspecs_nosc_nots_nosa_noea scspec
1063 { if (extra_warnings && TREE_STATIC ($1))
1064 warning ("`%s' is not at beginning of declaration",
1065 IDENTIFIER_POINTER ($2));
1066 $$ = tree_cons (NULL_TREE, $2, $1);
1067 TREE_STATIC ($$) = TREE_STATIC ($1); }
1068 | declspecs_nosc_nots_nosa_ea scspec
1069 { if (extra_warnings && TREE_STATIC ($1))
1070 warning ("`%s' is not at beginning of declaration",
1071 IDENTIFIER_POINTER ($2));
1072 $$ = tree_cons (NULL_TREE, $2, $1);
1073 TREE_STATIC ($$) = TREE_STATIC ($1); }
1074 | declspecs_sc_nots_nosa_noea scspec
1075 { if (extra_warnings && TREE_STATIC ($1))
1076 warning ("`%s' is not at beginning of declaration",
1077 IDENTIFIER_POINTER ($2));
1078 $$ = tree_cons (NULL_TREE, $2, $1);
1079 TREE_STATIC ($$) = TREE_STATIC ($1); }
1080 | declspecs_sc_nots_nosa_ea scspec
1081 { if (extra_warnings && TREE_STATIC ($1))
1082 warning ("`%s' is not at beginning of declaration",
1083 IDENTIFIER_POINTER ($2));
1084 $$ = tree_cons (NULL_TREE, $2, $1);
1085 TREE_STATIC ($$) = TREE_STATIC ($1); }
1088 declspecs_sc_nots_nosa_ea:
1089 declspecs_sc_nots_nosa_noea attributes
1090 { $$ = tree_cons ($2, NULL_TREE, $1);
1091 TREE_STATIC ($$) = TREE_STATIC ($1); }
1094 declspecs_sc_nots_sa_noea:
1095 declspecs_sc_nots_sa_noea TYPE_QUAL
1096 { $$ = tree_cons (NULL_TREE, $2, $1);
1097 TREE_STATIC ($$) = 1; }
1098 | declspecs_sc_nots_sa_ea TYPE_QUAL
1099 { $$ = tree_cons (NULL_TREE, $2, $1);
1100 TREE_STATIC ($$) = 1; }
1101 | declspecs_nosc_nots_sa_noea scspec
1102 { if (extra_warnings && TREE_STATIC ($1))
1103 warning ("`%s' is not at beginning of declaration",
1104 IDENTIFIER_POINTER ($2));
1105 $$ = tree_cons (NULL_TREE, $2, $1);
1106 TREE_STATIC ($$) = TREE_STATIC ($1); }
1107 | declspecs_nosc_nots_sa_ea scspec
1108 { if (extra_warnings && TREE_STATIC ($1))
1109 warning ("`%s' is not at beginning of declaration",
1110 IDENTIFIER_POINTER ($2));
1111 $$ = tree_cons (NULL_TREE, $2, $1);
1112 TREE_STATIC ($$) = TREE_STATIC ($1); }
1113 | declspecs_sc_nots_sa_noea scspec
1114 { if (extra_warnings && TREE_STATIC ($1))
1115 warning ("`%s' is not at beginning of declaration",
1116 IDENTIFIER_POINTER ($2));
1117 $$ = tree_cons (NULL_TREE, $2, $1);
1118 TREE_STATIC ($$) = TREE_STATIC ($1); }
1119 | declspecs_sc_nots_sa_ea scspec
1120 { if (extra_warnings && TREE_STATIC ($1))
1121 warning ("`%s' is not at beginning of declaration",
1122 IDENTIFIER_POINTER ($2));
1123 $$ = tree_cons (NULL_TREE, $2, $1);
1124 TREE_STATIC ($$) = TREE_STATIC ($1); }
1127 declspecs_sc_nots_sa_ea:
1128 declspecs_sc_nots_sa_noea attributes
1129 { $$ = tree_cons ($2, NULL_TREE, $1);
1130 TREE_STATIC ($$) = TREE_STATIC ($1); }
1133 declspecs_sc_ts_nosa_noea:
1134 declspecs_sc_ts_nosa_noea TYPE_QUAL
1135 { $$ = tree_cons (NULL_TREE, $2, $1);
1136 TREE_STATIC ($$) = 1; }
1137 | declspecs_sc_ts_nosa_ea TYPE_QUAL
1138 { $$ = tree_cons (NULL_TREE, $2, $1);
1139 TREE_STATIC ($$) = 1; }
1140 | declspecs_sc_ts_nosa_noea typespec_reserved_nonattr
1141 { $$ = tree_cons (NULL_TREE, $2, $1);
1142 TREE_STATIC ($$) = 1; }
1143 | declspecs_sc_ts_nosa_ea typespec_reserved_nonattr
1144 { $$ = tree_cons (NULL_TREE, $2, $1);
1145 TREE_STATIC ($$) = 1; }
1146 | declspecs_sc_nots_nosa_noea typespec_nonattr
1147 { $$ = tree_cons (NULL_TREE, $2, $1);
1148 TREE_STATIC ($$) = 1; }
1149 | declspecs_sc_nots_nosa_ea typespec_nonattr
1150 { $$ = tree_cons (NULL_TREE, $2, $1);
1151 TREE_STATIC ($$) = 1; }
1152 | declspecs_nosc_ts_nosa_noea scspec
1153 { if (extra_warnings && TREE_STATIC ($1))
1154 warning ("`%s' is not at beginning of declaration",
1155 IDENTIFIER_POINTER ($2));
1156 $$ = tree_cons (NULL_TREE, $2, $1);
1157 TREE_STATIC ($$) = TREE_STATIC ($1); }
1158 | declspecs_nosc_ts_nosa_ea scspec
1159 { if (extra_warnings && TREE_STATIC ($1))
1160 warning ("`%s' is not at beginning of declaration",
1161 IDENTIFIER_POINTER ($2));
1162 $$ = tree_cons (NULL_TREE, $2, $1);
1163 TREE_STATIC ($$) = TREE_STATIC ($1); }
1164 | declspecs_sc_ts_nosa_noea scspec
1165 { if (extra_warnings && TREE_STATIC ($1))
1166 warning ("`%s' is not at beginning of declaration",
1167 IDENTIFIER_POINTER ($2));
1168 $$ = tree_cons (NULL_TREE, $2, $1);
1169 TREE_STATIC ($$) = TREE_STATIC ($1); }
1170 | declspecs_sc_ts_nosa_ea scspec
1171 { if (extra_warnings && TREE_STATIC ($1))
1172 warning ("`%s' is not at beginning of declaration",
1173 IDENTIFIER_POINTER ($2));
1174 $$ = tree_cons (NULL_TREE, $2, $1);
1175 TREE_STATIC ($$) = TREE_STATIC ($1); }
1178 declspecs_sc_ts_nosa_ea:
1179 declspecs_sc_ts_nosa_noea attributes
1180 { $$ = tree_cons ($2, NULL_TREE, $1);
1181 TREE_STATIC ($$) = TREE_STATIC ($1); }
1182 | declspecs_sc_ts_nosa_noea typespec_reserved_attr
1183 { $$ = tree_cons (NULL_TREE, $2, $1);
1184 TREE_STATIC ($$) = 1; }
1185 | declspecs_sc_ts_nosa_ea typespec_reserved_attr
1186 { $$ = tree_cons (NULL_TREE, $2, $1);
1187 TREE_STATIC ($$) = 1; }
1188 | declspecs_sc_nots_nosa_noea typespec_attr
1189 { $$ = tree_cons (NULL_TREE, $2, $1);
1190 TREE_STATIC ($$) = 1; }
1191 | declspecs_sc_nots_nosa_ea typespec_attr
1192 { $$ = tree_cons (NULL_TREE, $2, $1);
1193 TREE_STATIC ($$) = 1; }
1196 declspecs_sc_ts_sa_noea:
1197 declspecs_sc_ts_sa_noea TYPE_QUAL
1198 { $$ = tree_cons (NULL_TREE, $2, $1);
1199 TREE_STATIC ($$) = 1; }
1200 | declspecs_sc_ts_sa_ea TYPE_QUAL
1201 { $$ = tree_cons (NULL_TREE, $2, $1);
1202 TREE_STATIC ($$) = 1; }
1203 | declspecs_sc_ts_sa_noea typespec_reserved_nonattr
1204 { $$ = tree_cons (NULL_TREE, $2, $1);
1205 TREE_STATIC ($$) = 1; }
1206 | declspecs_sc_ts_sa_ea typespec_reserved_nonattr
1207 { $$ = tree_cons (NULL_TREE, $2, $1);
1208 TREE_STATIC ($$) = 1; }
1209 | declspecs_sc_nots_sa_noea typespec_nonattr
1210 { $$ = tree_cons (NULL_TREE, $2, $1);
1211 TREE_STATIC ($$) = 1; }
1212 | declspecs_sc_nots_sa_ea typespec_nonattr
1213 { $$ = tree_cons (NULL_TREE, $2, $1);
1214 TREE_STATIC ($$) = 1; }
1215 | declspecs_nosc_ts_sa_noea scspec
1216 { if (extra_warnings && TREE_STATIC ($1))
1217 warning ("`%s' is not at beginning of declaration",
1218 IDENTIFIER_POINTER ($2));
1219 $$ = tree_cons (NULL_TREE, $2, $1);
1220 TREE_STATIC ($$) = TREE_STATIC ($1); }
1221 | declspecs_nosc_ts_sa_ea scspec
1222 { if (extra_warnings && TREE_STATIC ($1))
1223 warning ("`%s' is not at beginning of declaration",
1224 IDENTIFIER_POINTER ($2));
1225 $$ = tree_cons (NULL_TREE, $2, $1);
1226 TREE_STATIC ($$) = TREE_STATIC ($1); }
1227 | declspecs_sc_ts_sa_noea scspec
1228 { if (extra_warnings && TREE_STATIC ($1))
1229 warning ("`%s' is not at beginning of declaration",
1230 IDENTIFIER_POINTER ($2));
1231 $$ = tree_cons (NULL_TREE, $2, $1);
1232 TREE_STATIC ($$) = TREE_STATIC ($1); }
1233 | declspecs_sc_ts_sa_ea scspec
1234 { if (extra_warnings && TREE_STATIC ($1))
1235 warning ("`%s' is not at beginning of declaration",
1236 IDENTIFIER_POINTER ($2));
1237 $$ = tree_cons (NULL_TREE, $2, $1);
1238 TREE_STATIC ($$) = TREE_STATIC ($1); }
1241 declspecs_sc_ts_sa_ea:
1242 declspecs_sc_ts_sa_noea attributes
1243 { $$ = tree_cons ($2, NULL_TREE, $1);
1244 TREE_STATIC ($$) = TREE_STATIC ($1); }
1245 | declspecs_sc_ts_sa_noea typespec_reserved_attr
1246 { $$ = tree_cons (NULL_TREE, $2, $1);
1247 TREE_STATIC ($$) = 1; }
1248 | declspecs_sc_ts_sa_ea typespec_reserved_attr
1249 { $$ = tree_cons (NULL_TREE, $2, $1);
1250 TREE_STATIC ($$) = 1; }
1251 | declspecs_sc_nots_sa_noea typespec_attr
1252 { $$ = tree_cons (NULL_TREE, $2, $1);
1253 TREE_STATIC ($$) = 1; }
1254 | declspecs_sc_nots_sa_ea typespec_attr
1255 { $$ = tree_cons (NULL_TREE, $2, $1);
1256 TREE_STATIC ($$) = 1; }
1259 /* Particular useful classes of declspecs. */
1261 declspecs_nosc_ts_nosa_noea
1262 | declspecs_nosc_ts_nosa_ea
1263 | declspecs_nosc_ts_sa_noea
1264 | declspecs_nosc_ts_sa_ea
1265 | declspecs_sc_ts_nosa_noea
1266 | declspecs_sc_ts_nosa_ea
1267 | declspecs_sc_ts_sa_noea
1268 | declspecs_sc_ts_sa_ea
1272 declspecs_nosc_nots_nosa_noea
1273 | declspecs_nosc_nots_nosa_ea
1274 | declspecs_nosc_nots_sa_noea
1275 | declspecs_nosc_nots_sa_ea
1276 | declspecs_sc_nots_nosa_noea
1277 | declspecs_sc_nots_nosa_ea
1278 | declspecs_sc_nots_sa_noea
1279 | declspecs_sc_nots_sa_ea
1283 declspecs_nosc_ts_nosa_noea
1284 | declspecs_nosc_ts_nosa_ea
1285 | declspecs_sc_ts_nosa_noea
1286 | declspecs_sc_ts_nosa_ea
1289 declspecs_nots_nosa:
1290 declspecs_nosc_nots_nosa_noea
1291 | declspecs_nosc_nots_nosa_ea
1292 | declspecs_sc_nots_nosa_noea
1293 | declspecs_sc_nots_nosa_ea
1297 declspecs_nosc_ts_nosa_noea
1298 | declspecs_nosc_ts_nosa_ea
1299 | declspecs_nosc_ts_sa_noea
1300 | declspecs_nosc_ts_sa_ea
1303 declspecs_nosc_nots:
1304 declspecs_nosc_nots_nosa_noea
1305 | declspecs_nosc_nots_nosa_ea
1306 | declspecs_nosc_nots_sa_noea
1307 | declspecs_nosc_nots_sa_ea
1311 declspecs_nosc_ts_nosa_noea
1312 | declspecs_nosc_ts_nosa_ea
1313 | declspecs_nosc_ts_sa_noea
1314 | declspecs_nosc_ts_sa_ea
1315 | declspecs_nosc_nots_nosa_noea
1316 | declspecs_nosc_nots_nosa_ea
1317 | declspecs_nosc_nots_sa_noea
1318 | declspecs_nosc_nots_sa_ea
1322 declspecs_nosc_nots_nosa_noea
1323 | declspecs_nosc_nots_nosa_ea
1324 | declspecs_nosc_nots_sa_noea
1325 | declspecs_nosc_nots_sa_ea
1326 | declspecs_nosc_ts_nosa_noea
1327 | declspecs_nosc_ts_nosa_ea
1328 | declspecs_nosc_ts_sa_noea
1329 | declspecs_nosc_ts_sa_ea
1330 | declspecs_sc_nots_nosa_noea
1331 | declspecs_sc_nots_nosa_ea
1332 | declspecs_sc_nots_sa_noea
1333 | declspecs_sc_nots_sa_ea
1334 | declspecs_sc_ts_nosa_noea
1335 | declspecs_sc_ts_nosa_ea
1336 | declspecs_sc_ts_sa_noea
1337 | declspecs_sc_ts_sa_ea
1340 /* A (possibly empty) sequence of type qualifiers and attributes. */
1341 maybe_type_quals_attrs:
1344 | declspecs_nosc_nots
1348 /* A type specifier (but not a type qualifier).
1349 Once we have seen one of these in a declaration,
1350 if a typedef name appears then it is being redeclared.
1352 The _reserved versions start with a reserved word and may appear anywhere
1353 in the declaration specifiers; the _nonreserved versions may only
1354 appear before any other type specifiers, and after that are (if names)
1357 FIXME: should the _nonreserved version be restricted to names being
1358 redeclared only? The other entries there relate only the GNU extensions
1359 and Objective C, and are historically parsed thus, and don't make sense
1360 after other type specifiers, but it might be cleaner to count them as
1363 _attr means: specifiers that either end with attributes,
1364 or are such that any following attributes would
1365 be parsed as part of the specifier.
1367 _nonattr: specifiers. */
1370 typespec_reserved_nonattr
1371 | typespec_nonreserved_nonattr
1375 typespec_reserved_attr
1378 typespec_reserved_nonattr:
1380 { OBJC_NEED_RAW_IDENTIFIER (1); }
1384 typespec_reserved_attr:
1388 typespec_nonreserved_nonattr:
1390 { /* For a typedef name, record the meaning, not the name.
1391 In case of `foo foo, bar;'. */
1392 $$ = lookup_name ($1); }
1394 | CLASSNAME protocolrefs
1395 { $$ = get_static_reference ($1, $2); }
1396 | OBJECTNAME protocolrefs
1397 { $$ = get_object_reference ($2); }
1399 /* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>"
1400 - nisse@lysator.liu.se */
1401 | non_empty_protocolrefs
1402 { $$ = get_object_reference ($1); }
1404 | typeof '(' expr ')'
1405 { skip_evaluation--; $$ = TREE_TYPE ($3); }
1406 | typeof '(' typename ')'
1407 { skip_evaluation--; $$ = groktypename ($3); }
1410 /* typespec_nonreserved_attr does not exist. */
1414 | initdecls ',' maybe_resetattrs initdcl
1419 | notype_initdecls ',' maybe_resetattrs notype_initdcl
1425 | ASM_KEYWORD '(' STRING ')'
1430 declarator maybeasm maybe_attribute '='
1431 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1432 chainon ($3, all_prefix_attributes));
1433 start_init ($<ttype>$, $2, global_bindings_p ()); }
1435 /* Note how the declaration of the variable is in effect while its init is parsed! */
1437 finish_decl ($<ttype>5, $6, $2); }
1438 | declarator maybeasm maybe_attribute
1439 { tree d = start_decl ($1, current_declspecs, 0,
1440 chainon ($3, all_prefix_attributes));
1441 finish_decl (d, NULL_TREE, $2);
1446 notype_declarator maybeasm maybe_attribute '='
1447 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1448 chainon ($3, all_prefix_attributes));
1449 start_init ($<ttype>$, $2, global_bindings_p ()); }
1451 /* Note how the declaration of the variable is in effect while its init is parsed! */
1453 finish_decl ($<ttype>5, $6, $2); }
1454 | notype_declarator maybeasm maybe_attribute
1455 { tree d = start_decl ($1, current_declspecs, 0,
1456 chainon ($3, all_prefix_attributes));
1457 finish_decl (d, NULL_TREE, $2); }
1459 /* the * rules are dummies to accept the Apollo extended syntax
1460 so that the header files compile. */
1471 | attributes attribute
1472 { $$ = chainon ($1, $2); }
1476 ATTRIBUTE '(' '(' attribute_list ')' ')'
1483 | attribute_list ',' attrib
1484 { $$ = chainon ($1, $3); }
1491 { $$ = build_tree_list ($1, NULL_TREE); }
1492 | any_word '(' IDENTIFIER ')'
1493 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
1494 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1495 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
1496 | any_word '(' exprlist ')'
1497 { $$ = build_tree_list ($1, $3); }
1500 /* This still leaves out most reserved keywords,
1501 shouldn't we include them? */
1515 /* Initializers. `init' is the entry point. */
1520 { really_start_incremental_init (NULL_TREE); }
1521 initlist_maybe_comma '}'
1522 { $$ = pop_init_level (0); }
1524 { $$ = error_mark_node; }
1527 /* `initlist_maybe_comma' is the guts of an initializer in braces. */
1528 initlist_maybe_comma:
1531 pedwarn ("ISO C forbids empty initializer braces"); }
1532 | initlist1 maybecomma
1537 | initlist1 ',' initelt
1540 /* `initelt' is a single element of an initializer.
1541 It may use braces. */
1543 designator_list '=' initval
1544 { if (pedantic && ! flag_isoc99)
1545 pedwarn ("ISO C89 forbids specifying subobject to initialize"); }
1546 | designator initval
1548 pedwarn ("obsolete use of designated initializer without `='"); }
1550 { set_init_label ($1);
1552 pedwarn ("obsolete use of designated initializer with `:'"); }
1560 { push_init_level (0); }
1561 initlist_maybe_comma '}'
1562 { process_init_element (pop_init_level (0)); }
1564 { process_init_element ($1); }
1570 | designator_list designator
1575 { set_init_label ($2); }
1576 | '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1577 { set_init_index ($2, $4);
1579 pedwarn ("ISO C forbids specifying range of elements to initialize"); }
1580 | '[' expr_no_commas ']'
1581 { set_init_index ($2, NULL_TREE); }
1587 pedwarn ("ISO C forbids nested functions");
1589 push_function_context ();
1590 if (! start_function (current_declspecs, $1,
1591 all_prefix_attributes))
1593 pop_function_context ();
1596 parsing_iso_function_signature = false; /* Don't warn about nested functions. */
1598 old_style_parm_decls
1599 { store_parm_decls (); }
1600 /* This used to use compstmt_or_error.
1601 That caused a bug with input `f(g) int g {}',
1602 where the use of YYERROR1 above caused an error
1603 which then was handled by compstmt_or_error.
1604 There followed a repeated execution of that same rule,
1605 which called YYERROR1 again, and so on. */
1606 save_filename save_lineno compstmt
1607 { tree decl = current_function_decl;
1608 DECL_SOURCE_FILE (decl) = $5;
1609 DECL_SOURCE_LINE (decl) = $6;
1610 finish_function (1, 1);
1611 pop_function_context ();
1612 add_decl_stmt (decl); }
1615 notype_nested_function:
1618 pedwarn ("ISO C forbids nested functions");
1620 push_function_context ();
1621 if (! start_function (current_declspecs, $1,
1622 all_prefix_attributes))
1624 pop_function_context ();
1627 parsing_iso_function_signature = false; /* Don't warn about nested functions. */
1629 old_style_parm_decls
1630 { store_parm_decls (); }
1631 /* This used to use compstmt_or_error.
1632 That caused a bug with input `f(g) int g {}',
1633 where the use of YYERROR1 above caused an error
1634 which then was handled by compstmt_or_error.
1635 There followed a repeated execution of that same rule,
1636 which called YYERROR1 again, and so on. */
1637 save_filename save_lineno compstmt
1638 { tree decl = current_function_decl;
1639 DECL_SOURCE_FILE (decl) = $5;
1640 DECL_SOURCE_LINE (decl) = $6;
1641 finish_function (1, 1);
1642 pop_function_context ();
1643 add_decl_stmt (decl); }
1646 /* Any kind of declarator (thus, all declarators allowed
1647 after an explicit typespec). */
1650 after_type_declarator
1654 /* A declarator that is allowed only after an explicit typespec. */
1656 after_type_declarator:
1657 '(' maybe_attribute after_type_declarator ')'
1658 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1659 | after_type_declarator '(' parmlist_or_identifiers %prec '.'
1660 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1661 /* | after_type_declarator '(' error ')' %prec '.'
1662 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1663 poplevel (0, 0, 0); } */
1664 | after_type_declarator array_declarator %prec '.'
1665 { $$ = set_array_declarator_type ($2, $1, 0); }
1666 | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
1667 { $$ = make_pointer_declarator ($2, $3); }
1674 /* Kinds of declarator that can appear in a parameter list
1675 in addition to notype_declarator. This is like after_type_declarator
1676 but does not allow a typedef name in parentheses as an identifier
1677 (because it would conflict with a function with that typedef as arg). */
1679 parm_declarator_starttypename
1680 | parm_declarator_nostarttypename
1683 parm_declarator_starttypename:
1684 parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
1685 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1686 /* | parm_declarator_starttypename '(' error ')' %prec '.'
1687 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1688 poplevel (0, 0, 0); } */
1689 | parm_declarator_starttypename array_declarator %prec '.'
1690 { $$ = set_array_declarator_type ($2, $1, 0); }
1697 parm_declarator_nostarttypename:
1698 parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
1699 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1700 /* | parm_declarator_nostarttypename '(' error ')' %prec '.'
1701 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1702 poplevel (0, 0, 0); } */
1703 | parm_declarator_nostarttypename array_declarator %prec '.'
1704 { $$ = set_array_declarator_type ($2, $1, 0); }
1705 | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
1706 { $$ = make_pointer_declarator ($2, $3); }
1707 | '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY
1708 { $$ = make_pointer_declarator ($2, $3); }
1709 | '(' maybe_attribute parm_declarator_nostarttypename ')'
1710 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1713 /* A declarator allowed whether or not there has been
1714 an explicit typespec. These cannot redeclare a typedef-name. */
1717 notype_declarator '(' parmlist_or_identifiers %prec '.'
1718 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1719 /* | notype_declarator '(' error ')' %prec '.'
1720 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1721 poplevel (0, 0, 0); } */
1722 | '(' maybe_attribute notype_declarator ')'
1723 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1724 | '*' maybe_type_quals_attrs notype_declarator %prec UNARY
1725 { $$ = make_pointer_declarator ($2, $3); }
1726 | notype_declarator array_declarator %prec '.'
1727 { $$ = set_array_declarator_type ($2, $1, 0); }
1752 /* structsp_attr: struct/union/enum specifiers that either
1753 end with attributes, or are such that any following attributes would
1754 be parsed as part of the struct/union/enum specifier.
1756 structsp_nonattr: other struct/union/enum specifiers. */
1759 struct_head identifier '{'
1760 { $$ = start_struct (RECORD_TYPE, $2);
1761 /* Start scope of tag before parsing components. */
1763 component_decl_list '}' maybe_attribute
1764 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1765 | struct_head '{' component_decl_list '}' maybe_attribute
1766 { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1767 $3, chainon ($1, $5));
1769 | union_head identifier '{'
1770 { $$ = start_struct (UNION_TYPE, $2); }
1771 component_decl_list '}' maybe_attribute
1772 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1773 | union_head '{' component_decl_list '}' maybe_attribute
1774 { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1775 $3, chainon ($1, $5));
1777 | enum_head identifier '{'
1778 { $$ = start_enum ($2); }
1779 enumlist maybecomma_warn '}' maybe_attribute
1780 { $$ = finish_enum ($<ttype>4, nreverse ($5),
1781 chainon ($1, $8)); }
1783 { $$ = start_enum (NULL_TREE); }
1784 enumlist maybecomma_warn '}' maybe_attribute
1785 { $$ = finish_enum ($<ttype>3, nreverse ($4),
1786 chainon ($1, $7)); }
1790 struct_head identifier
1791 { $$ = xref_tag (RECORD_TYPE, $2); }
1792 | union_head identifier
1793 { $$ = xref_tag (UNION_TYPE, $2); }
1794 | enum_head identifier
1795 { $$ = xref_tag (ENUMERAL_TYPE, $2);
1796 /* In ISO C, enumerated types can be referred to
1797 only if already defined. */
1798 if (pedantic && !COMPLETE_TYPE_P ($$))
1799 pedwarn ("ISO C forbids forward references to `enum' types"); }
1810 { if (pedantic && ! flag_isoc99)
1811 pedwarn ("comma at end of enumerator list"); }
1814 component_decl_list:
1815 component_decl_list2
1817 | component_decl_list2 component_decl
1818 { $$ = chainon ($1, $2);
1819 pedwarn ("no semicolon at end of struct or union"); }
1822 component_decl_list2: /* empty */
1824 | component_decl_list2 component_decl ';'
1825 { $$ = chainon ($1, $2); }
1826 | component_decl_list2 ';'
1828 pedwarn ("extra semicolon in struct or union specified"); }
1830 /* foo(sizeof(struct{ @defs(ClassName)})); */
1831 | DEFS '(' CLASSNAME ')'
1833 tree interface = lookup_interface ($3);
1836 $$ = get_class_ivars (interface);
1839 error ("cannot find interface declaration for `%s'",
1840 IDENTIFIER_POINTER ($3));
1848 declspecs_nosc_ts setspecs components
1850 POP_DECLSPEC_STACK; }
1851 | declspecs_nosc_ts setspecs save_filename save_lineno
1853 /* Support for unnamed structs or unions as members of
1854 structs or unions (which is [a] useful and [b] supports
1857 pedwarn ("ISO C doesn't support unnamed structs/unions");
1859 $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE);
1860 POP_DECLSPEC_STACK; }
1861 | declspecs_nosc_nots setspecs components_notype
1863 POP_DECLSPEC_STACK; }
1864 | declspecs_nosc_nots
1866 pedwarn ("ISO C forbids member declarations with no members");
1871 | extension component_decl
1873 RESTORE_EXT_FLAGS ($1); }
1877 component_declarator
1878 | components ',' maybe_resetattrs component_declarator
1879 { $$ = chainon ($1, $4); }
1883 component_notype_declarator
1884 | components_notype ',' maybe_resetattrs component_notype_declarator
1885 { $$ = chainon ($1, $4); }
1888 component_declarator:
1889 save_filename save_lineno declarator maybe_attribute
1890 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1891 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1892 | save_filename save_lineno
1893 declarator ':' expr_no_commas maybe_attribute
1894 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1895 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1896 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1897 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1898 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1901 component_notype_declarator:
1902 save_filename save_lineno notype_declarator maybe_attribute
1903 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1904 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1905 | save_filename save_lineno
1906 notype_declarator ':' expr_no_commas maybe_attribute
1907 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1908 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1909 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1910 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1911 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1914 /* We chain the enumerators in reverse order.
1915 They are put in forward order where enumlist is used.
1916 (The order used to be significant, but no longer is so.
1917 However, we still maintain the order, just to be clean.) */
1921 | enumlist ',' enumerator
1922 { if ($1 == error_mark_node)
1925 $$ = chainon ($3, $1); }
1927 { $$ = error_mark_node; }
1933 { $$ = build_enumerator ($1, NULL_TREE); }
1934 | identifier '=' expr_no_commas
1935 { $$ = build_enumerator ($1, $3); }
1940 { pending_xref_error ();
1943 { $$ = build_tree_list ($<ttype>2, $3); }
1946 absdcl: /* an absolute declarator */
1952 absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */
1954 { $$ = build_tree_list (build_tree_list (current_declspecs,
1956 all_prefix_attributes); }
1958 { $$ = build_tree_list (build_tree_list (current_declspecs,
1960 all_prefix_attributes); }
1961 | absdcl1_noea attributes
1962 { $$ = build_tree_list (build_tree_list (current_declspecs,
1964 chainon ($2, all_prefix_attributes)); }
1967 absdcl1: /* a nonempty absolute declarator */
1974 | '*' maybe_type_quals_attrs absdcl1_noea
1975 { $$ = make_pointer_declarator ($2, $3); }
1979 '*' maybe_type_quals_attrs
1980 { $$ = make_pointer_declarator ($2, NULL_TREE); }
1981 | '*' maybe_type_quals_attrs absdcl1_ea
1982 { $$ = make_pointer_declarator ($2, $3); }
1986 '(' maybe_attribute absdcl1 ')'
1987 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1988 | direct_absdcl1 '(' parmlist
1989 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1990 | direct_absdcl1 array_declarator
1991 { $$ = set_array_declarator_type ($2, $1, 1); }
1993 { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
1995 { $$ = set_array_declarator_type ($1, NULL_TREE, 1); }
1998 /* The [...] part of a declarator for an array type. */
2001 '[' maybe_type_quals_attrs expr ']'
2002 { $$ = build_array_declarator ($3, $2, 0, 0); }
2003 | '[' maybe_type_quals_attrs ']'
2004 { $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
2005 | '[' maybe_type_quals_attrs '*' ']'
2006 { $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
2007 | '[' STATIC maybe_type_quals_attrs expr ']'
2008 { $$ = build_array_declarator ($4, $3, 1, 0); }
2009 /* declspecs_nosc_nots is a synonym for type_quals_attrs. */
2010 | '[' declspecs_nosc_nots STATIC expr ']'
2011 { $$ = build_array_declarator ($4, $2, 1, 0); }
2014 /* A nonempty series of declarations and statements (possibly followed by
2015 some labels) that can form the body of a compound statement.
2016 NOTE: we don't allow labels on declarations; this might seem like a
2017 natural extension, but there would be a conflict between attributes
2018 on the label and prefix attributes on the declaration. */
2021 lineno_stmt_decl_or_labels_ending_stmt
2022 | lineno_stmt_decl_or_labels_ending_decl
2023 | lineno_stmt_decl_or_labels_ending_label
2025 pedwarn ("deprecated use of label at end of compound statement");
2027 | lineno_stmt_decl_or_labels_ending_error
2030 lineno_stmt_decl_or_labels_ending_stmt:
2032 | lineno_stmt_decl_or_labels_ending_stmt lineno_stmt
2033 | lineno_stmt_decl_or_labels_ending_decl lineno_stmt
2034 | lineno_stmt_decl_or_labels_ending_label lineno_stmt
2035 | lineno_stmt_decl_or_labels_ending_error lineno_stmt
2038 lineno_stmt_decl_or_labels_ending_decl:
2040 | lineno_stmt_decl_or_labels_ending_stmt lineno_decl
2041 { if (pedantic && !flag_isoc99)
2042 pedwarn ("ISO C89 forbids mixed declarations and code"); }
2043 | lineno_stmt_decl_or_labels_ending_decl lineno_decl
2044 | lineno_stmt_decl_or_labels_ending_error lineno_decl
2047 lineno_stmt_decl_or_labels_ending_label:
2049 | lineno_stmt_decl_or_labels_ending_stmt lineno_label
2050 | lineno_stmt_decl_or_labels_ending_decl lineno_label
2051 | lineno_stmt_decl_or_labels_ending_label lineno_label
2052 | lineno_stmt_decl_or_labels_ending_error lineno_label
2055 lineno_stmt_decl_or_labels_ending_error:
2057 | lineno_stmt_decl_or_labels errstmt
2060 lineno_stmt_decl_or_labels:
2061 lineno_stmt_decl_or_labels_ending_stmt
2062 | lineno_stmt_decl_or_labels_ending_decl
2063 | lineno_stmt_decl_or_labels_ending_label
2064 | lineno_stmt_decl_or_labels_ending_error
2070 pushlevel: /* empty */
2073 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2075 if (objc_method_context)
2081 poplevel: /* empty */
2082 { $$ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); }
2085 /* Start and end blocks created for the new scopes of C99. */
2086 c99_block_start: /* empty */
2089 $$ = c_begin_compound_stmt ();
2092 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2094 if (objc_method_context)
2103 /* Productions using c99_block_start and c99_block_end will need to do what's
2104 in compstmt: RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); $$ = $2; where
2105 $1 is the value of c99_block_start and $2 of c99_block_end. */
2106 c99_block_end: /* empty */
2109 tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
2110 $$ = poplevel (kept_level_p (), 0, 0);
2111 SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
2112 = SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
2119 /* Read zero or more forward-declarations for labels
2120 that nested functions can jump to. */
2125 pedwarn ("ISO C forbids label declarations"); }
2130 | label_decls label_decl
2134 LABEL identifiers_or_typenames ';'
2136 for (link = $2; link; link = TREE_CHAIN (link))
2138 tree label = shadow_label (TREE_VALUE (link));
2139 C_DECLARED_LABEL_FLAG (label) = 1;
2140 add_decl_stmt (label);
2145 /* This is the body of a function definition.
2146 It causes syntax errors to ignore to the next openbrace. */
2153 compstmt_start: '{' { compstmt_count++;
2154 $$ = c_begin_compound_stmt (); }
2157 compstmt_nostart: '}'
2158 { $$ = convert (void_type_node, integer_zero_node); }
2159 | pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel
2160 { $$ = poplevel (kept_level_p (), 1, 0);
2161 SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
2162 = SCOPE_STMT_BLOCK (TREE_VALUE ($5))
2166 compstmt_contents_nonempty:
2171 compstmt_primary_start:
2173 { if (current_function_decl == 0)
2175 error ("braced-group within expression allowed only inside a function");
2178 /* We must force a BLOCK for this level
2179 so that, if it is not expanded later,
2180 there is a way to turn off the entire subtree of blocks
2181 that are contained in it. */
2183 push_label_level ();
2185 $$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree));
2189 compstmt: compstmt_start compstmt_nostart
2190 { RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2191 last_expr_type = NULL_TREE;
2195 /* Value is number of statements counted as of the closeparen. */
2197 if_prefix c99_block_lineno_labeled_stmt
2198 { c_finish_then (); }
2199 /* Make sure c_expand_end_cond is run once
2200 for each call to c_expand_start_cond.
2201 Otherwise a crash is likely. */
2206 /* We must build the IF_STMT node before parsing its
2207 condition so that STMT_LINENO refers to the line
2208 containing the "if", and not the line containing
2209 the close-parenthesis.
2211 c_begin_if_stmt returns the IF_STMT node, which
2212 we later pass to c_expand_start_cond to fill
2213 in the condition and other tidbits. */
2215 { $<ttype>$ = c_begin_if_stmt (); }
2217 { c_expand_start_cond (c_common_truthvalue_conversion ($4),
2218 compstmt_count,$<ttype>2);
2219 $<itype>$ = stmt_count;
2220 if_stmt_file = $<filename>-2;
2221 if_stmt_line = $<lineno>-1; }
2224 /* This is a subroutine of stmt.
2225 It is used twice, once for valid DO statements
2226 and once for catching errors in parsing the end test. */
2232 = add_stmt (build_stmt (DO_STMT, NULL_TREE,
2234 /* In the event that a parse error prevents
2235 parsing the complete do-statement, set the
2236 condition now. Otherwise, we can get crashes at
2237 RTL-generation time. */
2238 DO_COND ($<ttype>$) = error_mark_node; }
2239 c99_block_lineno_labeled_stmt WHILE
2241 RECHAIN_STMTS ($$, DO_BODY ($$)); }
2244 /* The forced readahead in here is because we might be at the end of a
2245 line, and the line and file won't be bumped until yylex absorbs the
2246 first token on the next line. */
2248 { if (yychar == YYEMPTY)
2250 $$ = input_filename; }
2254 { if (yychar == YYEMPTY)
2259 lineno_labeled_stmt:
2261 | lineno_label lineno_labeled_stmt
2264 /* Like lineno_labeled_stmt, but a block in C99. */
2265 c99_block_lineno_labeled_stmt:
2266 c99_block_start lineno_labeled_stmt c99_block_end
2268 RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); }
2272 save_filename save_lineno stmt
2275 STMT_LINENO ($3) = $2;
2276 /* ??? We currently have no way of recording
2277 the filename for a statement. This probably
2278 matters little in practice at the moment,
2279 but I suspect that problems will occur when
2280 doing inlining at the tree level. */
2286 save_filename save_lineno label
2289 STMT_LINENO ($3) = $2;
2294 select_or_iter_stmt:
2296 { c_expand_start_else ();
2297 $<itype>1 = stmt_count; }
2298 c99_block_lineno_labeled_stmt
2300 c_expand_end_cond ();
2301 if (extra_warnings && stmt_count == $<itype>1)
2302 warning ("empty body in an else-statement"); }
2303 | simple_if %prec IF
2304 { c_expand_end_cond ();
2305 /* This warning is here instead of in simple_if, because we
2306 do not want a warning if an empty if is followed by an
2307 else statement. Increment stmt_count so we don't
2308 give a second error if this is a nested `if'. */
2309 if (extra_warnings && stmt_count++ == $<itype>1)
2310 warning_with_file_and_line (if_stmt_file, if_stmt_line,
2311 "empty body in an if-statement"); }
2312 /* Make sure c_expand_end_cond is run once
2313 for each call to c_expand_start_cond.
2314 Otherwise a crash is likely. */
2315 | simple_if ELSE error
2316 { c_expand_end_cond (); }
2317 /* We must build the WHILE_STMT node before parsing its
2318 condition so that STMT_LINENO refers to the line
2319 containing the "while", and not the line containing
2320 the close-parenthesis.
2322 c_begin_while_stmt returns the WHILE_STMT node, which
2323 we later pass to c_finish_while_stmt_cond to fill
2324 in the condition and other tidbits. */
2327 $<ttype>$ = c_begin_while_stmt (); }
2329 { $4 = c_common_truthvalue_conversion ($4);
2330 c_finish_while_stmt_cond
2331 (c_common_truthvalue_conversion ($4), $<ttype>2);
2332 $<ttype>$ = add_stmt ($<ttype>2); }
2333 c99_block_lineno_labeled_stmt
2334 { RECHAIN_STMTS ($<ttype>6, WHILE_BODY ($<ttype>6)); }
2337 { DO_COND ($1) = c_common_truthvalue_conversion ($3); }
2338 | do_stmt_start error
2341 { $<ttype>$ = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
2342 NULL_TREE, NULL_TREE);
2343 add_stmt ($<ttype>$); }
2346 RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
2349 FOR_COND ($<ttype>2)
2350 = c_common_truthvalue_conversion ($6); }
2352 { FOR_EXPR ($<ttype>2) = $9; }
2353 c99_block_lineno_labeled_stmt
2354 { RECHAIN_STMTS ($<ttype>2, FOR_BODY ($<ttype>2)); }
2355 | SWITCH '(' expr ')'
2357 $<ttype>$ = c_start_case ($3); }
2358 c99_block_lineno_labeled_stmt
2359 { c_finish_case (); }
2364 { add_stmt (build_stmt (EXPR_STMT, $1)); }
2366 { check_for_loop_decls (); }
2369 /* Parse a single real statement, not including any labels. */
2372 { stmt_count++; $$ = $1; }
2375 $$ = c_expand_expr_stmt ($1); }
2376 | c99_block_start select_or_iter_stmt c99_block_end
2378 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2382 $$ = add_stmt (build_break_stmt ()); }
2385 $$ = add_stmt (build_continue_stmt ()); }
2388 $$ = c_expand_return (NULL_TREE); }
2391 $$ = c_expand_return ($2); }
2392 | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
2394 $$ = simple_asm_stmt ($4); }
2395 /* This is the case with just output operands. */
2396 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
2398 $$ = build_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
2399 /* This is the case with input operands as well. */
2400 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2401 asm_operands ')' ';'
2403 $$ = build_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
2404 /* This is the case with clobbered registers as well. */
2405 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2406 asm_operands ':' asm_clobbers ')' ';'
2408 $$ = build_asm_stmt ($2, $4, $6, $8, $10); }
2409 | GOTO identifier ';'
2412 decl = lookup_label ($2);
2415 TREE_USED (decl) = 1;
2416 $$ = add_stmt (build_stmt (GOTO_STMT, decl));
2423 pedwarn ("ISO C forbids `goto *expr;'");
2425 $3 = convert (ptr_type_node, $3);
2426 $$ = add_stmt (build_stmt (GOTO_STMT, $3)); }
2431 /* Any kind of label, including jump labels and case labels.
2432 ANSI C accepts labels only before statements, but we allow them
2433 also at the end of a compound statement. */
2435 label: CASE expr_no_commas ':'
2437 $$ = do_case ($2, NULL_TREE); }
2438 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
2440 $$ = do_case ($2, $4); }
2443 $$ = do_case (NULL_TREE, NULL_TREE); }
2444 | identifier save_filename save_lineno ':' maybe_attribute
2445 { tree label = define_label ($2, $3, $1);
2449 decl_attributes (&label, $5, 0);
2450 $$ = add_stmt (build_stmt (LABEL_STMT, label));
2457 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
2461 { emit_line_note (input_filename, lineno);
2464 { emit_line_note (input_filename, lineno); }
2473 /* These are the operands other than the first string and colon
2474 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
2475 asm_operands: /* empty */
2477 | nonnull_asm_operands
2480 nonnull_asm_operands:
2482 | nonnull_asm_operands ',' asm_operand
2483 { $$ = chainon ($1, $3); }
2488 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
2489 | '[' identifier ']' STRING '(' expr ')'
2490 { $2 = build_string (IDENTIFIER_LENGTH ($2),
2491 IDENTIFIER_POINTER ($2));
2492 $$ = build_tree_list (build_tree_list ($2, $4), $6); }
2497 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
2498 | asm_clobbers ',' STRING
2499 { $$ = tree_cons (NULL_TREE, $3, $1); }
2502 /* This is what appears inside the parens in a function declarator.
2503 Its value is a list of ..._TYPE nodes. Attributes must appear here
2504 to avoid a conflict with their appearance after an open parenthesis
2505 in an abstract declarator, as in
2506 "void bar (int (__attribute__((__mode__(SI))) int foo));". */
2510 clear_parm_order ();
2511 declare_parm_level (0); }
2514 parmlist_tags_warning ();
2515 poplevel (0, 0, 0); }
2523 pedwarn ("ISO C forbids forward parameter declarations");
2524 /* Mark the forward decls as such. */
2525 for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
2526 TREE_ASM_WRITTEN (parm) = 1;
2527 clear_parm_order (); }
2529 { /* Dummy action so attributes are in known place
2530 on parser stack. */ }
2534 { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
2537 /* This is what appears inside the parens in a function declarator.
2538 Is value is represented in the format that grokdeclarator expects. */
2539 parmlist_2: /* empty */
2540 { $$ = get_parm_info (0); }
2542 { $$ = get_parm_info (0);
2543 /* Gcc used to allow this as an extension. However, it does
2544 not work for all targets, and thus has been disabled.
2545 Also, since func (...) and func () are indistinguishable,
2546 it caused problems with the code in expand_builtin which
2547 tries to verify that BUILT_IN_NEXT_ARG is being used
2549 error ("ISO C requires a named argument before `...'");
2552 { $$ = get_parm_info (1);
2553 parsing_iso_function_signature = true;
2555 | parms ',' ELLIPSIS
2556 { $$ = get_parm_info (0); }
2561 { push_parm_decl ($1); }
2563 { push_parm_decl ($3); }
2566 /* A single parameter declaration or parameter type name,
2567 as found in a parmlist. */
2569 declspecs_ts setspecs parm_declarator maybe_attribute
2570 { $$ = build_tree_list (build_tree_list (current_declspecs,
2572 chainon ($4, all_prefix_attributes));
2573 POP_DECLSPEC_STACK; }
2574 | declspecs_ts setspecs notype_declarator maybe_attribute
2575 { $$ = build_tree_list (build_tree_list (current_declspecs,
2577 chainon ($4, all_prefix_attributes));
2578 POP_DECLSPEC_STACK; }
2579 | declspecs_ts setspecs absdcl_maybe_attribute
2581 POP_DECLSPEC_STACK; }
2582 | declspecs_nots setspecs notype_declarator maybe_attribute
2583 { $$ = build_tree_list (build_tree_list (current_declspecs,
2585 chainon ($4, all_prefix_attributes));
2586 POP_DECLSPEC_STACK; }
2588 | declspecs_nots setspecs absdcl_maybe_attribute
2590 POP_DECLSPEC_STACK; }
2593 /* The first parm, which must suck attributes from off the top of the parser
2596 declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute
2597 { $$ = build_tree_list (build_tree_list (current_declspecs,
2599 chainon ($4, all_prefix_attributes));
2600 POP_DECLSPEC_STACK; }
2601 | declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
2602 { $$ = build_tree_list (build_tree_list (current_declspecs,
2604 chainon ($4, all_prefix_attributes));
2605 POP_DECLSPEC_STACK; }
2606 | declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
2608 POP_DECLSPEC_STACK; }
2609 | declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute
2610 { $$ = build_tree_list (build_tree_list (current_declspecs,
2612 chainon ($4, all_prefix_attributes));
2613 POP_DECLSPEC_STACK; }
2615 | declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute
2617 POP_DECLSPEC_STACK; }
2622 { prefix_attributes = chainon (prefix_attributes, $<ttype>-2);
2623 all_prefix_attributes = prefix_attributes; }
2626 /* This is used in a function definition
2627 where either a parmlist or an identifier list is ok.
2628 Its value is a list of ..._TYPE nodes or a list of identifiers. */
2629 parmlist_or_identifiers:
2632 clear_parm_order ();
2633 declare_parm_level (1); }
2634 parmlist_or_identifiers_1
2636 parmlist_tags_warning ();
2637 poplevel (0, 0, 0); }
2640 parmlist_or_identifiers_1:
2644 for (t = $1; t; t = TREE_CHAIN (t))
2645 if (TREE_VALUE (t) == NULL_TREE)
2646 error ("`...' in old-style identifier list");
2647 $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
2649 /* Make sure we have a parmlist after attributes. */
2651 && (TREE_CODE ($$) != TREE_LIST
2652 || TREE_PURPOSE ($$) == 0
2653 || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
2658 /* A nonempty list of identifiers. */
2661 { $$ = build_tree_list (NULL_TREE, $1); }
2662 | identifiers ',' IDENTIFIER
2663 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2666 /* A nonempty list of identifiers, including typenames. */
2667 identifiers_or_typenames:
2669 { $$ = build_tree_list (NULL_TREE, $1); }
2670 | identifiers_or_typenames ',' identifier
2671 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2676 { $$ = SAVE_EXT_FLAGS();
2678 warn_pointer_arith = 0;
2679 warn_traditional = 0;
2684 /* Objective-C productions. */
2694 if (objc_implementation_context)
2696 finish_class (objc_implementation_context);
2697 objc_ivar_chain = NULL_TREE;
2698 objc_implementation_context = NULL_TREE;
2701 warning ("`@end' must appear in an implementation context");
2705 /* A nonempty list of identifiers. */
2708 { $$ = build_tree_list (NULL_TREE, $1); }
2709 | identifier_list ',' identifier
2710 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2714 CLASS identifier_list ';'
2716 objc_declare_class ($2);
2721 ALIAS identifier identifier ';'
2723 objc_declare_alias ($2, $3);
2728 INTERFACE identifier protocolrefs '{'
2730 objc_interface_context = objc_ivar_context
2731 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2732 objc_public_flag = 0;
2736 continue_class (objc_interface_context);
2741 finish_class (objc_interface_context);
2742 objc_interface_context = NULL_TREE;
2745 | INTERFACE identifier protocolrefs
2747 objc_interface_context
2748 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2749 continue_class (objc_interface_context);
2754 finish_class (objc_interface_context);
2755 objc_interface_context = NULL_TREE;
2758 | INTERFACE identifier ':' identifier protocolrefs '{'
2760 objc_interface_context = objc_ivar_context
2761 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2762 objc_public_flag = 0;
2766 continue_class (objc_interface_context);
2771 finish_class (objc_interface_context);
2772 objc_interface_context = NULL_TREE;
2775 | INTERFACE identifier ':' identifier protocolrefs
2777 objc_interface_context
2778 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2779 continue_class (objc_interface_context);
2784 finish_class (objc_interface_context);
2785 objc_interface_context = NULL_TREE;
2788 | IMPLEMENTATION identifier '{'
2790 objc_implementation_context = objc_ivar_context
2791 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2792 objc_public_flag = 0;
2797 = continue_class (objc_implementation_context);
2800 | IMPLEMENTATION identifier
2802 objc_implementation_context
2803 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2805 = continue_class (objc_implementation_context);
2808 | IMPLEMENTATION identifier ':' identifier '{'
2810 objc_implementation_context = objc_ivar_context
2811 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2812 objc_public_flag = 0;
2817 = continue_class (objc_implementation_context);
2820 | IMPLEMENTATION identifier ':' identifier
2822 objc_implementation_context
2823 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2825 = continue_class (objc_implementation_context);
2828 | INTERFACE identifier '(' identifier ')' protocolrefs
2830 objc_interface_context
2831 = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6);
2832 continue_class (objc_interface_context);
2837 finish_class (objc_interface_context);
2838 objc_interface_context = NULL_TREE;
2841 | IMPLEMENTATION identifier '(' identifier ')'
2843 objc_implementation_context
2844 = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2846 = continue_class (objc_implementation_context);
2851 PROTOCOL identifier protocolrefs
2853 objc_pq_context = 1;
2854 objc_interface_context
2855 = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
2859 objc_pq_context = 0;
2860 finish_protocol(objc_interface_context);
2861 objc_interface_context = NULL_TREE;
2863 /* The @protocol forward-declaration production introduces a
2864 reduce/reduce conflict on ';', which should be resolved in
2865 favor of the production 'identifier_list -> identifier'. */
2866 | PROTOCOL identifier_list ';'
2868 objc_declare_protocols ($2);
2877 | non_empty_protocolrefs
2880 non_empty_protocolrefs:
2881 ARITHCOMPARE identifier_list ARITHCOMPARE
2883 if ($1 == LT_EXPR && $3 == GT_EXPR)
2891 ivar_decl_list visibility_spec ivar_decls
2896 PRIVATE { objc_public_flag = 2; }
2897 | PROTECTED { objc_public_flag = 0; }
2898 | PUBLIC { objc_public_flag = 1; }
2906 | ivar_decls ivar_decl ';'
2910 pedwarn ("extra semicolon in struct or union specified");
2915 /* There is a shift-reduce conflict here, because `components' may
2916 start with a `typename'. It happens that shifting (the default resolution)
2917 does the right thing, because it treats the `typename' as part of
2918 a `typed_typespecs'.
2920 It is possible that this same technique would allow the distinction
2921 between `notype_initdecls' and `initdecls' to be eliminated.
2922 But I am being cautious and not trying it. */
2925 declspecs_nosc_ts setspecs ivars
2927 POP_DECLSPEC_STACK; }
2928 | declspecs_nosc_nots setspecs ivars
2930 POP_DECLSPEC_STACK; }
2939 | ivars ',' maybe_resetattrs ivar_declarator
2945 $$ = add_instance_variable (objc_ivar_context,
2947 $1, current_declspecs,
2950 | declarator ':' expr_no_commas
2952 $$ = add_instance_variable (objc_ivar_context,
2954 $1, current_declspecs, $3);
2956 | ':' expr_no_commas
2958 $$ = add_instance_variable (objc_ivar_context,
2961 current_declspecs, $2);
2967 { objc_inherit_code = CLASS_METHOD_DECL; }
2969 { objc_inherit_code = INSTANCE_METHOD_DECL; }
2975 objc_pq_context = 1;
2976 if (!objc_implementation_context)
2977 fatal_error ("method definition not in class context");
2981 objc_pq_context = 0;
2982 if (objc_inherit_code == CLASS_METHOD_DECL)
2983 add_class_method (objc_implementation_context, $3);
2985 add_instance_method (objc_implementation_context, $3);
2986 start_method_def ($3);
2990 continue_method_def ();
2994 finish_method_def ();
2998 /* the reason for the strange actions in this rule
2999 is so that notype_initdecls when reached via datadef
3000 can find a valid list of type and sc specs in $0. */
3004 | {$<ttype>$ = NULL_TREE; } methodprotolist2
3007 methodprotolist2: /* eliminates a shift/reduce conflict */
3010 | methodprotolist2 methodproto
3011 | methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef
3022 /* Remember protocol qualifiers in prototypes. */
3023 objc_pq_context = 1;
3027 /* Forget protocol qualifiers here. */
3028 objc_pq_context = 0;
3029 if (objc_inherit_code == CLASS_METHOD_DECL)
3030 add_class_method (objc_interface_context, $3);
3032 add_instance_method (objc_interface_context, $3);
3038 '(' typename ')' unaryselector
3040 $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);
3045 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);
3048 | '(' typename ')' keywordselector optparmlist
3050 $$ = build_method_decl (objc_inherit_code, $2, $4, $5);
3053 | keywordselector optparmlist
3055 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);
3059 /* "optarglist" assumes that start_method_def has already been called...
3060 if it is not, the "xdecls" will not be placed in the proper scope */
3067 /* to get around the following situation: "int foo (int a) int b; {}" that
3068 is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */
3083 declspecs_ts setspecs myparms ';'
3084 { POP_DECLSPEC_STACK; }
3086 { shadow_tag ($1); }
3087 | declspecs_nots ';'
3088 { pedwarn ("empty declaration"); }
3093 { push_parm_decl ($1); }
3094 | myparms ',' myparm
3095 { push_parm_decl ($3); }
3098 /* A single parameter declaration or parameter type name,
3099 as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
3102 parm_declarator maybe_attribute
3103 { $$ = build_tree_list (build_tree_list (current_declspecs,
3105 chainon ($2, all_prefix_attributes)); }
3106 | notype_declarator maybe_attribute
3107 { $$ = build_tree_list (build_tree_list (current_declspecs,
3109 chainon ($2, all_prefix_attributes)); }
3110 | absdcl_maybe_attribute
3121 /* oh what a kludge! */
3122 $$ = objc_ellipsis_node;
3130 /* returns a tree list node generated by get_parm_info */
3143 | keywordselector keyworddecl
3145 $$ = chainon ($1, $2);
3158 ENUM | STRUCT | UNION | IF | ELSE | WHILE | DO | FOR
3159 | SWITCH | CASE | DEFAULT | BREAK | CONTINUE | RETURN
3160 | GOTO | ASM_KEYWORD | SIZEOF | TYPEOF | ALIGNOF
3161 | TYPESPEC | TYPE_QUAL
3165 selector ':' '(' typename ')' identifier
3167 $$ = build_keyword_decl ($1, $4, $6);
3170 | selector ':' identifier
3172 $$ = build_keyword_decl ($1, NULL_TREE, $3);
3175 | ':' '(' typename ')' identifier
3177 $$ = build_keyword_decl (NULL_TREE, $3, $5);
3182 $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
3193 | keywordarglist keywordarg
3195 $$ = chainon ($1, $2);
3203 if (TREE_CHAIN ($1) == NULL_TREE)
3204 /* just return the expr., remove a level of indirection */
3205 $$ = TREE_VALUE ($1);
3207 /* we have a comma expr., we will collapse later */
3213 selector ':' keywordexpr
3215 $$ = build_tree_list ($1, $3);
3219 $$ = build_tree_list (NULL_TREE, $2);
3227 $$ = get_class_reference ($1);
3232 '[' receiver messageargs ']'
3233 { $$ = build_tree_list ($2, $3); }
3243 | keywordnamelist keywordname
3245 $$ = chainon ($1, $2);
3252 $$ = build_tree_list ($1, NULL_TREE);
3256 $$ = build_tree_list (NULL_TREE, NULL_TREE);
3261 SELECTOR '(' selectorarg ')'
3268 PROTOCOL '(' identifier ')'
3274 /* extension to support C-structures in the archiver */
3277 ENCODE '(' typename ')'
3279 $$ = groktypename ($3);
3286 /* yylex() is a thin wrapper around c_lex(), all it does is translate
3287 cpplib.h's token codes into yacc's token codes. */
3289 static enum cpp_ttype last_token;
3291 /* The reserved keyword table. */
3295 ENUM_BITFIELD(rid) rid : 16;
3296 unsigned int disable : 16;
3299 /* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
3301 #define D_C89 0x01 /* not in C89 */
3302 #define D_EXT 0x02 /* GCC extension */
3303 #define D_EXT89 0x04 /* GCC extension incorporated in C99 */
3304 #define D_OBJC 0x08 /* Objective C only */
3306 static const struct resword reswords[] =
3308 { "_Bool", RID_BOOL, 0 },
3309 { "_Complex", RID_COMPLEX, 0 },
3310 { "__FUNCTION__", RID_FUNCTION_NAME, 0 },
3311 { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
3312 { "__alignof", RID_ALIGNOF, 0 },
3313 { "__alignof__", RID_ALIGNOF, 0 },
3314 { "__asm", RID_ASM, 0 },
3315 { "__asm__", RID_ASM, 0 },
3316 { "__attribute", RID_ATTRIBUTE, 0 },
3317 { "__attribute__", RID_ATTRIBUTE, 0 },
3318 { "__bounded", RID_BOUNDED, 0 },
3319 { "__bounded__", RID_BOUNDED, 0 },
3320 { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
3321 { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
3322 { "__builtin_va_arg", RID_VA_ARG, 0 },
3323 { "__complex", RID_COMPLEX, 0 },
3324 { "__complex__", RID_COMPLEX, 0 },
3325 { "__const", RID_CONST, 0 },
3326 { "__const__", RID_CONST, 0 },
3327 { "__extension__", RID_EXTENSION, 0 },
3328 { "__func__", RID_C99_FUNCTION_NAME, 0 },
3329 { "__imag", RID_IMAGPART, 0 },
3330 { "__imag__", RID_IMAGPART, 0 },
3331 { "__inline", RID_INLINE, 0 },
3332 { "__inline__", RID_INLINE, 0 },
3333 { "__label__", RID_LABEL, 0 },
3334 { "__ptrbase", RID_PTRBASE, 0 },
3335 { "__ptrbase__", RID_PTRBASE, 0 },
3336 { "__ptrextent", RID_PTREXTENT, 0 },
3337 { "__ptrextent__", RID_PTREXTENT, 0 },
3338 { "__ptrvalue", RID_PTRVALUE, 0 },
3339 { "__ptrvalue__", RID_PTRVALUE, 0 },
3340 { "__real", RID_REALPART, 0 },
3341 { "__real__", RID_REALPART, 0 },
3342 { "__restrict", RID_RESTRICT, 0 },
3343 { "__restrict__", RID_RESTRICT, 0 },
3344 { "__signed", RID_SIGNED, 0 },
3345 { "__signed__", RID_SIGNED, 0 },
3346 { "__thread", RID_THREAD, 0 },
3347 { "__typeof", RID_TYPEOF, 0 },
3348 { "__typeof__", RID_TYPEOF, 0 },
3349 { "__unbounded", RID_UNBOUNDED, 0 },
3350 { "__unbounded__", RID_UNBOUNDED, 0 },
3351 { "__volatile", RID_VOLATILE, 0 },
3352 { "__volatile__", RID_VOLATILE, 0 },
3353 { "asm", RID_ASM, D_EXT },
3354 { "auto", RID_AUTO, 0 },
3355 { "break", RID_BREAK, 0 },
3356 { "case", RID_CASE, 0 },
3357 { "char", RID_CHAR, 0 },
3358 { "const", RID_CONST, 0 },
3359 { "continue", RID_CONTINUE, 0 },
3360 { "default", RID_DEFAULT, 0 },
3361 { "do", RID_DO, 0 },
3362 { "double", RID_DOUBLE, 0 },
3363 { "else", RID_ELSE, 0 },
3364 { "enum", RID_ENUM, 0 },
3365 { "extern", RID_EXTERN, 0 },
3366 { "float", RID_FLOAT, 0 },
3367 { "for", RID_FOR, 0 },
3368 { "goto", RID_GOTO, 0 },
3369 { "if", RID_IF, 0 },
3370 { "inline", RID_INLINE, D_EXT89 },
3371 { "int", RID_INT, 0 },
3372 { "long", RID_LONG, 0 },
3373 { "register", RID_REGISTER, 0 },
3374 { "restrict", RID_RESTRICT, D_C89 },
3375 { "return", RID_RETURN, 0 },
3376 { "short", RID_SHORT, 0 },
3377 { "signed", RID_SIGNED, 0 },
3378 { "sizeof", RID_SIZEOF, 0 },
3379 { "static", RID_STATIC, 0 },
3380 { "struct", RID_STRUCT, 0 },
3381 { "switch", RID_SWITCH, 0 },
3382 { "typedef", RID_TYPEDEF, 0 },
3383 { "typeof", RID_TYPEOF, D_EXT },
3384 { "union", RID_UNION, 0 },
3385 { "unsigned", RID_UNSIGNED, 0 },
3386 { "void", RID_VOID, 0 },
3387 { "volatile", RID_VOLATILE, 0 },
3388 { "while", RID_WHILE, 0 },
3390 { "id", RID_ID, D_OBJC },
3392 /* These objc keywords are recognized only immediately after
3394 { "class", RID_AT_CLASS, D_OBJC },
3395 { "compatibility_alias", RID_AT_ALIAS, D_OBJC },
3396 { "defs", RID_AT_DEFS, D_OBJC },
3397 { "encode", RID_AT_ENCODE, D_OBJC },
3398 { "end", RID_AT_END, D_OBJC },
3399 { "implementation", RID_AT_IMPLEMENTATION, D_OBJC },
3400 { "interface", RID_AT_INTERFACE, D_OBJC },
3401 { "private", RID_AT_PRIVATE, D_OBJC },
3402 { "protected", RID_AT_PROTECTED, D_OBJC },
3403 { "protocol", RID_AT_PROTOCOL, D_OBJC },
3404 { "public", RID_AT_PUBLIC, D_OBJC },
3405 { "selector", RID_AT_SELECTOR, D_OBJC },
3407 /* These are recognized only in protocol-qualifier context
3409 { "bycopy", RID_BYCOPY, D_OBJC },
3410 { "byref", RID_BYREF, D_OBJC },
3411 { "in", RID_IN, D_OBJC },
3412 { "inout", RID_INOUT, D_OBJC },
3413 { "oneway", RID_ONEWAY, D_OBJC },
3414 { "out", RID_OUT, D_OBJC },
3417 #define N_reswords (sizeof reswords / sizeof (struct resword))
3419 /* Table mapping from RID_* constants to yacc token numbers.
3420 Unfortunately we have to have entries for all the keywords in all
3422 static const short rid_to_yy[RID_MAX] =
3424 /* RID_STATIC */ STATIC,
3425 /* RID_UNSIGNED */ TYPESPEC,
3426 /* RID_LONG */ TYPESPEC,
3427 /* RID_CONST */ TYPE_QUAL,
3428 /* RID_EXTERN */ SCSPEC,
3429 /* RID_REGISTER */ SCSPEC,
3430 /* RID_TYPEDEF */ SCSPEC,
3431 /* RID_SHORT */ TYPESPEC,
3432 /* RID_INLINE */ SCSPEC,
3433 /* RID_VOLATILE */ TYPE_QUAL,
3434 /* RID_SIGNED */ TYPESPEC,
3435 /* RID_AUTO */ SCSPEC,
3436 /* RID_RESTRICT */ TYPE_QUAL,
3439 /* RID_BOUNDED */ TYPE_QUAL,
3440 /* RID_UNBOUNDED */ TYPE_QUAL,
3441 /* RID_COMPLEX */ TYPESPEC,
3442 /* RID_THREAD */ SCSPEC,
3446 /* RID_VIRTUAL */ 0,
3447 /* RID_EXPLICIT */ 0,
3449 /* RID_MUTABLE */ 0,
3452 /* RID_IN */ TYPE_QUAL,
3453 /* RID_OUT */ TYPE_QUAL,
3454 /* RID_INOUT */ TYPE_QUAL,
3455 /* RID_BYCOPY */ TYPE_QUAL,
3456 /* RID_BYREF */ TYPE_QUAL,
3457 /* RID_ONEWAY */ TYPE_QUAL,
3460 /* RID_INT */ TYPESPEC,
3461 /* RID_CHAR */ TYPESPEC,
3462 /* RID_FLOAT */ TYPESPEC,
3463 /* RID_DOUBLE */ TYPESPEC,
3464 /* RID_VOID */ TYPESPEC,
3465 /* RID_ENUM */ ENUM,
3466 /* RID_STRUCT */ STRUCT,
3467 /* RID_UNION */ UNION,
3469 /* RID_ELSE */ ELSE,
3470 /* RID_WHILE */ WHILE,
3473 /* RID_SWITCH */ SWITCH,
3474 /* RID_CASE */ CASE,
3475 /* RID_DEFAULT */ DEFAULT,
3476 /* RID_BREAK */ BREAK,
3477 /* RID_CONTINUE */ CONTINUE,
3478 /* RID_RETURN */ RETURN,
3479 /* RID_GOTO */ GOTO,
3480 /* RID_SIZEOF */ SIZEOF,
3483 /* RID_ASM */ ASM_KEYWORD,
3484 /* RID_TYPEOF */ TYPEOF,
3485 /* RID_ALIGNOF */ ALIGNOF,
3486 /* RID_ATTRIBUTE */ ATTRIBUTE,
3487 /* RID_VA_ARG */ VA_ARG,
3488 /* RID_EXTENSION */ EXTENSION,
3489 /* RID_IMAGPART */ IMAGPART,
3490 /* RID_REALPART */ REALPART,
3491 /* RID_LABEL */ LABEL,
3492 /* RID_PTRBASE */ PTR_BASE,
3493 /* RID_PTREXTENT */ PTR_EXTENT,
3494 /* RID_PTRVALUE */ PTR_VALUE,
3496 /* RID_CHOOSE_EXPR */ CHOOSE_EXPR,
3497 /* RID_TYPES_COMPATIBLE_P */ TYPES_COMPATIBLE_P,
3499 /* RID_FUNCTION_NAME */ STRING_FUNC_NAME,
3500 /* RID_PRETTY_FUNCTION_NAME */ STRING_FUNC_NAME,
3501 /* RID_C99_FUNCTION_NAME */ VAR_FUNC_NAME,
3504 /* RID_BOOL */ TYPESPEC,
3508 /* RID_PRIVATE */ 0,
3509 /* RID_PROTECTED */ 0,
3510 /* RID_TEMPLATE */ 0,
3515 /* RID_NAMESPACE */ 0,
3517 /* RID_OPERATOR */ 0,
3522 /* RID_TYPENAME */ 0,
3527 /* RID_CONSTCAST */ 0,
3528 /* RID_DYNCAST */ 0,
3529 /* RID_REINTCAST */ 0,
3530 /* RID_STATCAST */ 0,
3533 /* RID_ID */ OBJECTNAME,
3534 /* RID_AT_ENCODE */ ENCODE,
3535 /* RID_AT_END */ END,
3536 /* RID_AT_CLASS */ CLASS,
3537 /* RID_AT_ALIAS */ ALIAS,
3538 /* RID_AT_DEFS */ DEFS,
3539 /* RID_AT_PRIVATE */ PRIVATE,
3540 /* RID_AT_PROTECTED */ PROTECTED,
3541 /* RID_AT_PUBLIC */ PUBLIC,
3542 /* RID_AT_PROTOCOL */ PROTOCOL,
3543 /* RID_AT_SELECTOR */ SELECTOR,
3544 /* RID_AT_INTERFACE */ INTERFACE,
3545 /* RID_AT_IMPLEMENTATION */ IMPLEMENTATION
3553 int mask = (flag_isoc99 ? 0 : D_C89)
3554 | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
3559 ridpointers = (tree *) ggc_calloc ((int) RID_MAX, sizeof (tree));
3560 for (i = 0; i < N_reswords; i++)
3562 /* If a keyword is disabled, do not enter it into the table
3563 and so create a canonical spelling that isn't a keyword. */
3564 if (reswords[i].disable & mask)
3567 id = get_identifier (reswords[i].word);
3568 C_RID_CODE (id) = reswords[i].rid;
3569 C_IS_RESERVED_WORD (id) = 1;
3570 ridpointers [(int) reswords[i].rid] = id;
3574 #define NAME(type) cpp_type2name (type)
3580 const char *string = _(msgid);
3582 if (last_token == CPP_EOF)
3583 error ("%s at end of input", string);
3584 else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
3586 unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
3587 const char *const ell = (last_token == CPP_CHAR) ? "" : "L";
3588 if (val <= UCHAR_MAX && ISGRAPH (val))
3589 error ("%s before %s'%c'", string, ell, val);
3591 error ("%s before %s'\\x%x'", string, ell, val);
3593 else if (last_token == CPP_STRING
3594 || last_token == CPP_WSTRING)
3595 error ("%s before string constant", string);
3596 else if (last_token == CPP_NUMBER)
3597 error ("%s before numeric constant", string);
3598 else if (last_token == CPP_NAME)
3599 error ("%s before \"%s\"", string, IDENTIFIER_POINTER (yylval.ttype));
3601 error ("%s before '%s' token", string, NAME(last_token));
3610 int objc_force_identifier = objc_need_raw_identifier;
3611 OBJC_NEED_RAW_IDENTIFIER (0);
3614 if (C_IS_RESERVED_WORD (yylval.ttype))
3616 enum rid rid_code = C_RID_CODE (yylval.ttype);
3619 /* Turn non-typedefed refs to "id" into plain identifiers; this
3620 allows constructs like "void foo(id id);" to work. */
3621 if (rid_code == RID_ID)
3623 decl = lookup_name (yylval.ttype);
3624 if (decl == NULL_TREE || TREE_CODE (decl) != TYPE_DECL)
3628 if (!OBJC_IS_AT_KEYWORD (rid_code)
3629 && (!OBJC_IS_PQ_KEYWORD (rid_code) || objc_pq_context))
3632 int yycode = rid_to_yy[(int) rid_code];
3633 if (yycode == STRING_FUNC_NAME)
3635 /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
3636 to string constants. */
3637 const char *name = fname_string (rid_code);
3639 yylval.ttype = build_string (strlen (name) + 1, name);
3640 C_ARTIFICIAL_STRING_P (yylval.ttype) = 1;
3641 last_token = CPP_STRING; /* so yyerror won't choke */
3645 /* Return the canonical spelling for this keyword. */
3646 yylval.ttype = ridpointers[(int) rid_code];
3651 decl = lookup_name (yylval.ttype);
3654 if (TREE_CODE (decl) == TYPE_DECL)
3660 tree objc_interface_decl = is_class_name (yylval.ttype);
3661 /* ObjC class names are in the same namespace as variables and
3662 typedefs, and hence are shadowed by local declarations. */
3663 if (objc_interface_decl
3664 && (global_bindings_p ()
3665 || (!objc_force_identifier && !decl)))
3667 yylval.ttype = objc_interface_decl;
3676 /* Concatenate strings before returning them to the parser. This isn't quite
3677 as good as having it done in the lexer, but it's better than nothing. */
3682 enum cpp_ttype next_type;
3683 tree orig = yylval.ttype;
3685 next_type = c_lex (&yylval.ttype);
3686 if (next_type == CPP_STRING
3687 || next_type == CPP_WSTRING
3688 || (next_type == CPP_NAME && yylexname () == STRING))
3690 varray_type strings;
3693 static int last_lineno = 0;
3694 static const char *last_input_filename = 0;
3695 if (warn_traditional && !in_system_header
3696 && (lineno != last_lineno || !last_input_filename ||
3697 strcmp (last_input_filename, input_filename)))
3699 warning ("traditional C rejects string concatenation");
3700 last_lineno = lineno;
3701 last_input_filename = input_filename;
3705 VARRAY_TREE_INIT (strings, 32, "strings");
3706 VARRAY_PUSH_TREE (strings, orig);
3710 VARRAY_PUSH_TREE (strings, yylval.ttype);
3711 next_type = c_lex (&yylval.ttype);
3713 while (next_type == CPP_STRING
3714 || next_type == CPP_WSTRING
3715 || (next_type == CPP_NAME && yylexname () == STRING));
3717 yylval.ttype = combine_strings (strings);
3720 yylval.ttype = orig;
3722 /* We will have always read one token too many. */
3723 _cpp_backup_tokens (parse_in, 1);
3732 last_token = c_lex (&yylval.ttype);
3735 case CPP_EQ: return '=';
3736 case CPP_NOT: return '!';
3737 case CPP_GREATER: yylval.code = GT_EXPR; return ARITHCOMPARE;
3738 case CPP_LESS: yylval.code = LT_EXPR; return ARITHCOMPARE;
3739 case CPP_PLUS: yylval.code = PLUS_EXPR; return '+';
3740 case CPP_MINUS: yylval.code = MINUS_EXPR; return '-';
3741 case CPP_MULT: yylval.code = MULT_EXPR; return '*';
3742 case CPP_DIV: yylval.code = TRUNC_DIV_EXPR; return '/';
3743 case CPP_MOD: yylval.code = TRUNC_MOD_EXPR; return '%';
3744 case CPP_AND: yylval.code = BIT_AND_EXPR; return '&';
3745 case CPP_OR: yylval.code = BIT_IOR_EXPR; return '|';
3746 case CPP_XOR: yylval.code = BIT_XOR_EXPR; return '^';
3747 case CPP_RSHIFT: yylval.code = RSHIFT_EXPR; return RSHIFT;
3748 case CPP_LSHIFT: yylval.code = LSHIFT_EXPR; return LSHIFT;
3750 case CPP_COMPL: return '~';
3751 case CPP_AND_AND: return ANDAND;
3752 case CPP_OR_OR: return OROR;
3753 case CPP_QUERY: return '?';
3754 case CPP_OPEN_PAREN: return '(';
3755 case CPP_EQ_EQ: yylval.code = EQ_EXPR; return EQCOMPARE;
3756 case CPP_NOT_EQ: yylval.code = NE_EXPR; return EQCOMPARE;
3757 case CPP_GREATER_EQ:yylval.code = GE_EXPR; return ARITHCOMPARE;
3758 case CPP_LESS_EQ: yylval.code = LE_EXPR; return ARITHCOMPARE;
3760 case CPP_PLUS_EQ: yylval.code = PLUS_EXPR; return ASSIGN;
3761 case CPP_MINUS_EQ: yylval.code = MINUS_EXPR; return ASSIGN;
3762 case CPP_MULT_EQ: yylval.code = MULT_EXPR; return ASSIGN;
3763 case CPP_DIV_EQ: yylval.code = TRUNC_DIV_EXPR; return ASSIGN;
3764 case CPP_MOD_EQ: yylval.code = TRUNC_MOD_EXPR; return ASSIGN;
3765 case CPP_AND_EQ: yylval.code = BIT_AND_EXPR; return ASSIGN;
3766 case CPP_OR_EQ: yylval.code = BIT_IOR_EXPR; return ASSIGN;
3767 case CPP_XOR_EQ: yylval.code = BIT_XOR_EXPR; return ASSIGN;
3768 case CPP_RSHIFT_EQ: yylval.code = RSHIFT_EXPR; return ASSIGN;
3769 case CPP_LSHIFT_EQ: yylval.code = LSHIFT_EXPR; return ASSIGN;
3771 case CPP_OPEN_SQUARE: return '[';
3772 case CPP_CLOSE_SQUARE: return ']';
3773 case CPP_OPEN_BRACE: return '{';
3774 case CPP_CLOSE_BRACE: return '}';
3775 case CPP_ELLIPSIS: return ELLIPSIS;
3777 case CPP_PLUS_PLUS: return PLUSPLUS;
3778 case CPP_MINUS_MINUS: return MINUSMINUS;
3779 case CPP_DEREF: return POINTSAT;
3780 case CPP_DOT: return '.';
3782 /* The following tokens may affect the interpretation of any
3783 identifiers following, if doing Objective-C. */
3784 case CPP_COLON: OBJC_NEED_RAW_IDENTIFIER (0); return ':';
3785 case CPP_COMMA: OBJC_NEED_RAW_IDENTIFIER (0); return ',';
3786 case CPP_CLOSE_PAREN: OBJC_NEED_RAW_IDENTIFIER (0); return ')';
3787 case CPP_SEMICOLON: OBJC_NEED_RAW_IDENTIFIER (0); return ';';
3794 int ret = yylexname ();
3796 return yylexstring ();
3808 return yylexstring ();
3810 /* This token is Objective-C specific. It gives the next token
3811 special significance. */
3816 enum cpp_ttype after_at_type;
3818 after_at_type = c_lex (&after_at);
3820 if (after_at_type == CPP_NAME
3821 && C_IS_RESERVED_WORD (after_at)
3822 && OBJC_IS_AT_KEYWORD (C_RID_CODE (after_at)))
3824 yylval.ttype = after_at;
3825 last_token = after_at_type;
3826 return rid_to_yy [(int) C_RID_CODE (after_at)];
3828 _cpp_backup_tokens (parse_in, 1);
3833 /* These tokens are C++ specific (and will not be generated
3834 in C mode, but let's be cautious). */
3836 case CPP_DEREF_STAR:
3842 /* These tokens should not survive translation phase 4. */
3845 error ("syntax error at '%s' token", NAME(last_token));
3858 timevar_push (TV_LEX);
3860 timevar_pop (TV_LEX);
3864 /* Function used when yydebug is set, to print a token in more detail. */
3867 yyprint (file, yychar, yyl)
3874 fprintf (file, " [%s]", NAME(last_token));
3885 if (IDENTIFIER_POINTER (t))
3886 fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
3890 fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
3891 if (TREE_CODE (t) == INTEGER_CST)
3894 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
3895 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
3901 /* This is not the ideal place to put these, but we have to get them out
3902 of c-lex.c because cp/lex.c has its own versions. */
3904 /* Free malloced parser stacks if necessary. */
3907 free_parser_stacks ()
3911 free (malloced_yyss);
3912 free (malloced_yyvs);
3916 #include "gt-c-parse.h"