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. */
55 #ifdef MULTIBYTE_CHARS
63 /* Like YYERROR but do call yyerror. */
64 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
66 /* Like the default stack expander, except (1) use realloc when possible,
67 (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca.
69 Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot
70 give malloced_yyvs its proper type. This is ok since all we need from
71 it is to be able to free it. */
73 static short *malloced_yyss;
74 static void *malloced_yyvs;
76 #define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \
81 newsize = *(YYSSZ) *= 2; \
85 really_call_realloc (*(SS), newsize * sizeof (short)); \
87 really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \
91 newss = (short *) really_call_malloc (newsize * sizeof (short)); \
92 newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \
94 memcpy (newss, *(SS), (SSSIZE)); \
96 memcpy (newvs, *(VS), (VSSIZE)); \
98 if (!newss || !newvs) \
105 malloced_yyss = newss; \
106 malloced_yyvs = (void *) newvs; \
112 %union {long itype; tree ttype; enum tree_code code;
113 const char *filename; int lineno; }
115 /* All identifiers that are not reserved words
116 and are not declared typedefs in the current block */
119 /* All identifiers that are declared typedefs in the current block.
120 In some contexts, they are treated just like IDENTIFIER,
121 but they can also serve as typespecs in declarations. */
124 /* Reserved words that specify storage class.
125 yylval contains an IDENTIFIER_NODE which indicates which one. */
126 %token SCSPEC /* Storage class other than static. */
127 %token STATIC /* Static storage class. */
129 /* Reserved words that specify type.
130 yylval contains an IDENTIFIER_NODE which indicates which one. */
133 /* Reserved words that qualify type: "const", "volatile", or "restrict".
134 yylval contains an IDENTIFIER_NODE which indicates which one. */
137 /* Character or numeric constants.
138 yylval is the node for the constant. */
141 /* String constants in raw form.
142 yylval is a STRING_CST node. */
145 /* "...", used for functions with variable arglists. */
148 /* the reserved words */
149 /* SCO include files test "ASM", so use something else. */
150 %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
151 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
152 %token ATTRIBUTE EXTENSION LABEL
153 %token REALPART IMAGPART VA_ARG CHOOSE_EXPR TYPES_COMPATIBLE_P
154 %token PTR_VALUE PTR_BASE PTR_EXTENT
156 /* function name can be a string const or a var decl. */
157 %token STRING_FUNC_NAME VAR_FUNC_NAME
159 /* Add precedence rules to solve dangling else s/r conflict */
163 /* Define the operator tokens and their precedences.
164 The value is an integer because, if used, it is the tree code
165 to use in the expression made from the operator. */
167 %right <code> ASSIGN '='
168 %right <code> '?' ':'
174 %left <code> EQCOMPARE
175 %left <code> ARITHCOMPARE
176 %left <code> LSHIFT RSHIFT
178 %left <code> '*' '/' '%'
179 %right <code> UNARY PLUSPLUS MINUSMINUS
181 %left <code> POINTSAT '.' '(' '['
183 /* The Objective-C keywords. These are included in C and in
184 Objective C, so that the token codes are the same in both. */
185 %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
186 %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
189 %type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
190 %type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
192 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
193 %type <ttype> expr_no_commas cast_expr unary_expr primary STRING
194 %type <ttype> declspecs_nosc_nots_nosa_noea declspecs_nosc_nots_nosa_ea
195 %type <ttype> declspecs_nosc_nots_sa_noea declspecs_nosc_nots_sa_ea
196 %type <ttype> declspecs_nosc_ts_nosa_noea declspecs_nosc_ts_nosa_ea
197 %type <ttype> declspecs_nosc_ts_sa_noea declspecs_nosc_ts_sa_ea
198 %type <ttype> declspecs_sc_nots_nosa_noea declspecs_sc_nots_nosa_ea
199 %type <ttype> declspecs_sc_nots_sa_noea declspecs_sc_nots_sa_ea
200 %type <ttype> declspecs_sc_ts_nosa_noea declspecs_sc_ts_nosa_ea
201 %type <ttype> declspecs_sc_ts_sa_noea declspecs_sc_ts_sa_ea
202 %type <ttype> declspecs_ts declspecs_nots
203 %type <ttype> declspecs_ts_nosa declspecs_nots_nosa
204 %type <ttype> declspecs_nosc_ts declspecs_nosc_nots declspecs_nosc declspecs
205 %type <ttype> maybe_type_quals_attrs typespec_nonattr typespec_attr
206 %type <ttype> typespec_reserved_nonattr typespec_reserved_attr
207 %type <ttype> typespec_nonreserved_nonattr
209 %type <ttype> scspec SCSPEC STATIC TYPESPEC TYPE_QUAL maybe_type_qual
210 %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
211 %type <ttype> init maybeasm
212 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
213 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
214 %type <ttype> any_word extension
216 %type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
217 %type <ttype> do_stmt_start poplevel stmt label
219 %type <ttype> c99_block_start c99_block_end
220 %type <ttype> declarator
221 %type <ttype> notype_declarator after_type_declarator
222 %type <ttype> parm_declarator
223 %type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename
224 %type <ttype> array_declarator
226 %type <ttype> structsp_attr structsp_nonattr
227 %type <ttype> component_decl_list component_decl_list2
228 %type <ttype> component_decl components components_notype component_declarator
229 %type <ttype> component_notype_declarator
230 %type <ttype> enumlist enumerator
231 %type <ttype> struct_head union_head enum_head
232 %type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea
233 %type <ttype> direct_absdcl1 absdcl_maybe_attribute
234 %type <ttype> xexpr parms parm firstparm identifiers
236 %type <ttype> parmlist parmlist_1 parmlist_2
237 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
238 %type <ttype> identifiers_or_typenames
240 %type <itype> setspecs setspecs_fp
242 %type <filename> save_filename
243 %type <lineno> save_lineno
246 /* the Objective-C nonterminals */
248 %type <ttype> ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator
249 %type <ttype> methoddecl unaryselector keywordselector selector
250 %type <ttype> keyworddecl receiver objcmessageexpr messageargs
251 %type <ttype> keywordexpr keywordarglist keywordarg
252 %type <ttype> myparms myparm optparmlist reservedwords objcselectorexpr
253 %type <ttype> selectorarg keywordnamelist keywordname objcencodeexpr
254 %type <ttype> objc_string non_empty_protocolrefs protocolrefs identifier_list objcprotocolexpr
256 %type <ttype> CLASSNAME OBJECTNAME
260 /* Number of statements (loosely speaking) and compound statements
262 static int stmt_count;
263 static int compstmt_count;
265 /* Input file and line number of the end of the body of last simple_if;
266 used by the stmt-rule immediately after simple_if returns. */
267 static const char *if_stmt_file;
268 static int if_stmt_line;
270 /* List of types and structure classes of the current declaration. */
271 static GTY(()) tree current_declspecs;
272 static GTY(()) tree prefix_attributes;
274 /* List of all the attributes applying to the identifier currently being
275 declared; includes prefix_attributes and possibly some more attributes
276 just after a comma. */
277 static GTY(()) tree all_prefix_attributes;
279 /* Stack of saved values of current_declspecs, prefix_attributes and
280 all_prefix_attributes. */
281 static GTY(()) tree declspec_stack;
283 /* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
284 should be called from the productions making use of setspecs. */
285 #define PUSH_DECLSPEC_STACK \
287 declspec_stack = tree_cons (build_tree_list (prefix_attributes, \
288 all_prefix_attributes), \
293 #define POP_DECLSPEC_STACK \
295 current_declspecs = TREE_VALUE (declspec_stack); \
296 prefix_attributes = TREE_PURPOSE (TREE_PURPOSE (declspec_stack)); \
297 all_prefix_attributes = TREE_VALUE (TREE_PURPOSE (declspec_stack)); \
298 declspec_stack = TREE_CHAIN (declspec_stack); \
301 /* For __extension__, save/restore the warning flags which are
302 controlled by __extension__. */
303 #define SAVE_EXT_FLAGS() \
305 | (warn_pointer_arith << 1) \
306 | (warn_traditional << 2) \
309 #define RESTORE_EXT_FLAGS(tval) \
311 int val = tree_low_cst (tval, 0); \
312 pedantic = val & 1; \
313 warn_pointer_arith = (val >> 1) & 1; \
314 warn_traditional = (val >> 2) & 1; \
315 flag_iso = (val >> 3) & 1; \
319 /* Objective-C specific parser/lexer information */
321 static enum tree_code objc_inherit_code;
322 static int objc_pq_context = 0, objc_public_flag = 0;
324 /* The following flag is needed to contextualize ObjC lexical analysis.
325 In some cases (e.g., 'int NSObject;'), it is undesirable to bind
326 an identifier to an ObjC class, even if a class with that name
328 static int objc_need_raw_identifier;
329 #define OBJC_NEED_RAW_IDENTIFIER(VAL) objc_need_raw_identifier = VAL
333 #define OBJC_NEED_RAW_IDENTIFIER(VAL) /* nothing */
336 static bool parsing_iso_function_signature;
338 /* Tell yyparse how to print a token's value, if yydebug is set. */
340 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
342 static void yyprint PARAMS ((FILE *, int, YYSTYPE));
343 static void yyerror PARAMS ((const char *));
344 static int yylexname PARAMS ((void));
345 static int yylexstring PARAMS ((void));
346 static inline int _yylex PARAMS ((void));
347 static int yylex PARAMS ((void));
348 static void init_reswords PARAMS ((void));
350 /* Initialisation routine for this file. */
362 pedwarn ("ISO C forbids an empty source file");
367 /* In case there were missing closebraces,
368 get us back to the global binding level. */
369 while (! global_bindings_p ())
371 /* __FUNCTION__ is defined at file scope (""). This
372 call may not be necessary as my tests indicate it
373 still works without it. */
374 finish_fname_decls ();
379 /* the reason for the strange actions in this rule
380 is so that notype_initdecls when reached via datadef
381 can find a valid list of type and sc specs in $0. */
384 {$<ttype>$ = NULL_TREE; } extdef
385 | extdefs {$<ttype>$ = NULL_TREE; ggc_collect(); } extdef
390 { parsing_iso_function_signature = false; } /* Reset after any external definition. */
399 | ASM_KEYWORD '(' expr ')' ';'
401 if ((TREE_CODE ($3) == ADDR_EXPR
402 && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
403 || TREE_CODE ($3) == STRING_CST)
406 error ("argument of `asm' is not a constant string"); }
408 { RESTORE_EXT_FLAGS ($1); }
412 setspecs notype_initdecls ';'
414 error ("ISO C forbids data definition with no type or storage class");
416 warning ("data definition has no type or storage class");
418 POP_DECLSPEC_STACK; }
419 | declspecs_nots setspecs notype_initdecls ';'
420 { POP_DECLSPEC_STACK; }
421 | declspecs_ts setspecs initdecls ';'
422 { POP_DECLSPEC_STACK; }
429 pedwarn ("ISO C does not allow extra `;' outside of a function"); }
433 declspecs_ts setspecs declarator
434 { if (! start_function (current_declspecs, $3,
435 all_prefix_attributes))
439 { store_parm_decls (); }
440 save_filename save_lineno compstmt_or_error
441 { DECL_SOURCE_FILE (current_function_decl) = $7;
442 DECL_SOURCE_LINE (current_function_decl) = $8;
443 finish_function (0, 1);
444 POP_DECLSPEC_STACK; }
445 | declspecs_ts setspecs declarator error
446 { POP_DECLSPEC_STACK; }
447 | declspecs_nots setspecs notype_declarator
448 { if (! start_function (current_declspecs, $3,
449 all_prefix_attributes))
453 { store_parm_decls (); }
454 save_filename save_lineno compstmt_or_error
455 { DECL_SOURCE_FILE (current_function_decl) = $7;
456 DECL_SOURCE_LINE (current_function_decl) = $8;
457 finish_function (0, 1);
458 POP_DECLSPEC_STACK; }
459 | declspecs_nots setspecs notype_declarator error
460 { POP_DECLSPEC_STACK; }
461 | setspecs notype_declarator
462 { if (! start_function (NULL_TREE, $2,
463 all_prefix_attributes))
467 { store_parm_decls (); }
468 save_filename save_lineno compstmt_or_error
469 { DECL_SOURCE_FILE (current_function_decl) = $6;
470 DECL_SOURCE_LINE (current_function_decl) = $7;
471 finish_function (0, 1);
472 POP_DECLSPEC_STACK; }
473 | setspecs notype_declarator error
474 { POP_DECLSPEC_STACK; }
489 { $$ = NEGATE_EXPR; }
493 if (warn_traditional && !in_system_header)
494 warning ("traditional C rejects the unary plus operator");
498 { $$ = PREINCREMENT_EXPR; }
500 { $$ = PREDECREMENT_EXPR; }
502 { $$ = BIT_NOT_EXPR; }
504 { $$ = TRUTH_NOT_EXPR; }
507 expr: nonnull_exprlist
508 { $$ = build_compound_expr ($1); }
519 { $$ = build_tree_list (NULL_TREE, $1); }
520 | nonnull_exprlist ',' expr_no_commas
521 { chainon ($1, build_tree_list (NULL_TREE, $3)); }
526 | '*' cast_expr %prec UNARY
527 { $$ = build_indirect_ref ($2, "unary *"); }
528 /* __extension__ turns off -pedantic for following primary. */
529 | extension cast_expr %prec UNARY
531 RESTORE_EXT_FLAGS ($1); }
532 | unop cast_expr %prec UNARY
533 { $$ = build_unary_op ($1, $2, 0);
534 overflow_warning ($$); }
535 /* Refer to the address of a label as a pointer. */
537 { $$ = finish_label_address_expr ($2); }
538 | sizeof unary_expr %prec UNARY
540 if (TREE_CODE ($2) == COMPONENT_REF
541 && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
542 error ("`sizeof' applied to a bit-field");
543 $$ = c_sizeof (TREE_TYPE ($2)); }
544 | sizeof '(' typename ')' %prec HYPERUNARY
546 $$ = c_sizeof (groktypename ($3)); }
547 | alignof unary_expr %prec UNARY
549 $$ = c_alignof_expr ($2); }
550 | alignof '(' typename ')' %prec HYPERUNARY
552 $$ = c_alignof (groktypename ($3)); }
553 | REALPART cast_expr %prec UNARY
554 { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
555 | IMAGPART cast_expr %prec UNARY
556 { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
560 SIZEOF { skip_evaluation++; }
564 ALIGNOF { skip_evaluation++; }
568 TYPEOF { skip_evaluation++; }
573 | '(' typename ')' cast_expr %prec UNARY
574 { $$ = c_cast_expr ($2, $4); }
579 | expr_no_commas '+' expr_no_commas
580 { $$ = parser_build_binary_op ($2, $1, $3); }
581 | expr_no_commas '-' expr_no_commas
582 { $$ = parser_build_binary_op ($2, $1, $3); }
583 | expr_no_commas '*' expr_no_commas
584 { $$ = parser_build_binary_op ($2, $1, $3); }
585 | expr_no_commas '/' expr_no_commas
586 { $$ = parser_build_binary_op ($2, $1, $3); }
587 | expr_no_commas '%' expr_no_commas
588 { $$ = parser_build_binary_op ($2, $1, $3); }
589 | expr_no_commas LSHIFT expr_no_commas
590 { $$ = parser_build_binary_op ($2, $1, $3); }
591 | expr_no_commas RSHIFT expr_no_commas
592 { $$ = parser_build_binary_op ($2, $1, $3); }
593 | expr_no_commas ARITHCOMPARE expr_no_commas
594 { $$ = parser_build_binary_op ($2, $1, $3); }
595 | expr_no_commas EQCOMPARE expr_no_commas
596 { $$ = parser_build_binary_op ($2, $1, $3); }
597 | expr_no_commas '&' expr_no_commas
598 { $$ = parser_build_binary_op ($2, $1, $3); }
599 | expr_no_commas '|' expr_no_commas
600 { $$ = parser_build_binary_op ($2, $1, $3); }
601 | expr_no_commas '^' expr_no_commas
602 { $$ = parser_build_binary_op ($2, $1, $3); }
603 | expr_no_commas ANDAND
604 { $1 = c_common_truthvalue_conversion
605 (default_conversion ($1));
606 skip_evaluation += $1 == boolean_false_node; }
608 { skip_evaluation -= $1 == boolean_false_node;
609 $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
610 | expr_no_commas OROR
611 { $1 = c_common_truthvalue_conversion
612 (default_conversion ($1));
613 skip_evaluation += $1 == boolean_true_node; }
615 { skip_evaluation -= $1 == boolean_true_node;
616 $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
618 { $1 = c_common_truthvalue_conversion
619 (default_conversion ($1));
620 skip_evaluation += $1 == boolean_false_node; }
622 { skip_evaluation += (($1 == boolean_true_node)
623 - ($1 == boolean_false_node)); }
625 { skip_evaluation -= $1 == boolean_true_node;
626 $$ = build_conditional_expr ($1, $4, $7); }
629 pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
630 /* Make sure first operand is calculated only once. */
631 $<ttype>2 = save_expr ($1);
632 $1 = c_common_truthvalue_conversion
633 (default_conversion ($<ttype>2));
634 skip_evaluation += $1 == boolean_true_node; }
636 { skip_evaluation -= $1 == boolean_true_node;
637 $$ = build_conditional_expr ($1, $<ttype>2, $5); }
638 | expr_no_commas '=' expr_no_commas
640 $$ = build_modify_expr ($1, NOP_EXPR, $3);
641 class = TREE_CODE_CLASS (TREE_CODE ($$));
642 if (IS_EXPR_CODE_CLASS (class))
643 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
645 | expr_no_commas ASSIGN expr_no_commas
647 $$ = build_modify_expr ($1, $2, $3);
648 /* This inhibits warnings in
649 c_common_truthvalue_conversion. */
650 class = TREE_CODE_CLASS (TREE_CODE ($$));
651 if (IS_EXPR_CODE_CLASS (class))
652 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
659 if (yychar == YYEMPTY)
661 $$ = build_external_ref ($1, yychar == '(');
665 { $$ = fix_string_type ($$); }
667 { $$ = fname_decl (C_RID_CODE ($$), $$); }
668 | '(' typename ')' '{'
669 { start_init (NULL_TREE, NULL, 0);
670 $2 = groktypename ($2);
671 really_start_incremental_init ($2); }
672 initlist_maybe_comma '}' %prec UNARY
673 { tree constructor = pop_init_level (0);
677 if (pedantic && ! flag_isoc99)
678 pedwarn ("ISO C89 forbids compound literals");
679 $$ = build_compound_literal (type, constructor);
682 { char class = TREE_CODE_CLASS (TREE_CODE ($2));
683 if (IS_EXPR_CODE_CLASS (class))
684 C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
687 { $$ = error_mark_node; }
688 | compstmt_primary_start compstmt_nostart ')'
689 { tree saved_last_tree;
692 pedwarn ("ISO C forbids braced-groups within expressions");
695 saved_last_tree = COMPOUND_BODY ($1);
696 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
697 last_tree = saved_last_tree;
698 TREE_CHAIN (last_tree) = NULL_TREE;
700 last_expr_type = void_type_node;
701 $$ = build1 (STMT_EXPR, last_expr_type, $1);
702 TREE_SIDE_EFFECTS ($$) = 1;
704 | compstmt_primary_start error ')'
707 last_tree = COMPOUND_BODY ($1);
708 TREE_CHAIN (last_tree) = NULL_TREE;
709 $$ = error_mark_node;
711 | primary '(' exprlist ')' %prec '.'
712 { $$ = build_function_call ($1, $3); }
713 | VA_ARG '(' expr_no_commas ',' typename ')'
714 { $$ = build_va_arg ($3, groktypename ($5)); }
716 | CHOOSE_EXPR '(' expr_no_commas ',' expr_no_commas ',' expr_no_commas ')'
722 if (TREE_CODE (c) != INTEGER_CST)
723 error ("first argument to __builtin_choose_expr not a constant");
724 $$ = integer_zerop (c) ? $7 : $5;
726 | TYPES_COMPATIBLE_P '(' typename ',' typename ')'
730 e1 = TYPE_MAIN_VARIANT (groktypename ($3));
731 e2 = TYPE_MAIN_VARIANT (groktypename ($5));
733 $$ = comptypes (e1, e2)
734 ? build_int_2 (1, 0) : build_int_2 (0, 0);
736 | primary '[' expr ']' %prec '.'
737 { $$ = build_array_ref ($1, $3); }
738 | primary '.' identifier
741 if (!is_public ($1, $3))
742 $$ = error_mark_node;
745 $$ = build_component_ref ($1, $3);
747 | primary POINTSAT identifier
749 tree expr = build_indirect_ref ($1, "->");
752 if (!is_public (expr, $3))
753 $$ = error_mark_node;
756 $$ = build_component_ref (expr, $3);
759 { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
761 { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
764 { $$ = build_message_expr ($1); }
766 { $$ = build_selector_expr ($1); }
768 { $$ = build_protocol_expr ($1); }
770 { $$ = build_encode_expr ($1); }
772 { $$ = build_objc_string_object ($1); }
777 /* Produces an STRING_CST with perhaps more STRING_CSTs chained
778 onto it, which is to be read as an ObjC string object. */
782 | objc_string '@' STRING
783 { $$ = chainon ($1, $3); }
787 old_style_parm_decls:
788 old_style_parm_decls_1
790 parsing_iso_function_signature = false; /* Reset after decls. */
794 old_style_parm_decls_1:
797 if (warn_traditional && !in_system_header
798 && parsing_iso_function_signature)
799 warning ("traditional C rejects ISO C style function definitions");
800 parsing_iso_function_signature = false; /* Reset after warning. */
805 /* The following are analogous to lineno_decl, decls and decl
806 except that they do not allow nested functions.
807 They are used for old-style parm decls. */
809 save_filename save_lineno datadecl
816 | datadecls lineno_datadecl
817 | lineno_datadecl errstmt
820 /* We don't allow prefix attributes here because they cause reduce/reduce
821 conflicts: we can't know whether we're parsing a function decl with
822 attribute suffix, or function defn with attribute prefix on first old
825 declspecs_ts_nosa setspecs initdecls ';'
826 { POP_DECLSPEC_STACK; }
827 | declspecs_nots_nosa setspecs notype_initdecls ';'
828 { POP_DECLSPEC_STACK; }
829 | declspecs_ts_nosa ';'
830 { shadow_tag_warned ($1, 1);
831 pedwarn ("empty declaration"); }
832 | declspecs_nots_nosa ';'
833 { pedwarn ("empty declaration"); }
836 /* This combination which saves a lineno before a decl
837 is the normal thing to use, rather than decl itself.
838 This is to avoid shift/reduce conflicts in contexts
839 where statement labels are allowed. */
841 save_filename save_lineno decl
845 /* records the type and storage class specs to use for processing
846 the declarators that follow.
847 Maintains a stack of outer-level values of current_declspecs,
848 for the sake of parm declarations nested in function declarators. */
849 setspecs: /* empty */
850 { pending_xref_error ();
852 split_specs_attrs ($<ttype>0,
853 ¤t_declspecs, &prefix_attributes);
854 all_prefix_attributes = prefix_attributes; }
857 /* Possibly attributes after a comma, which should reset all_prefix_attributes
858 to prefix_attributes with these ones chained on the front. */
861 { all_prefix_attributes = chainon ($1, prefix_attributes); }
865 declspecs_ts setspecs initdecls ';'
866 { POP_DECLSPEC_STACK; }
867 | declspecs_nots setspecs notype_initdecls ';'
868 { POP_DECLSPEC_STACK; }
869 | declspecs_ts setspecs nested_function
870 { POP_DECLSPEC_STACK; }
871 | declspecs_nots setspecs notype_nested_function
872 { POP_DECLSPEC_STACK; }
876 { RESTORE_EXT_FLAGS ($1); }
879 /* A list of declaration specifiers. These are:
881 - Storage class specifiers (scspec), which for GCC currently includes
882 function specifiers ("inline").
884 - Type specifiers (typespec_*).
886 - Type qualifiers (TYPE_QUAL).
888 - Attribute specifier lists (attributes).
890 These are stored as a TREE_LIST; the head of the list is the last
891 item in the specifier list. Each entry in the list has either a
892 TREE_PURPOSE that is an attribute specifier list, or a TREE_VALUE that
893 is a single other specifier or qualifier; and a TREE_CHAIN that is the
894 rest of the list. TREE_STATIC is set on the list if something other
895 than a storage class specifier or attribute has been seen; this is used
896 to warn for the obsolescent usage of storage class specifiers other than
897 at the start of the list. (Doing this properly would require function
898 specifiers to be handled separately from storage class specifiers.)
900 The various cases below are classified according to:
902 (a) Whether a storage class specifier is included or not; some
903 places in the grammar disallow storage class specifiers (_sc or _nosc).
905 (b) Whether a type specifier has been seen; after a type specifier,
906 a typedef name is an identifier to redeclare (_ts or _nots).
908 (c) Whether the list starts with an attribute; in certain places,
909 the grammar requires specifiers that don't start with an attribute
912 (d) Whether the list ends with an attribute (or a specifier such that
913 any following attribute would have been parsed as part of that specifier);
914 this avoids shift-reduce conflicts in the parsing of attributes
919 (i) Distinguish between function specifiers and storage class specifiers,
920 at least for the purpose of warnings about obsolescent usage.
922 (ii) Halve the number of productions here by eliminating the _sc/_nosc
923 distinction and instead checking where required that storage class
924 specifiers aren't present. */
926 /* Declspecs which contain at least one type specifier or typedef name.
927 (Just `const' or `volatile' is not enough.)
928 A typedef'd name following these is taken as a name to be declared.
929 Declspecs have a non-NULL TREE_VALUE, attributes do not. */
931 declspecs_nosc_nots_nosa_noea:
933 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
934 TREE_STATIC ($$) = 1; }
935 | declspecs_nosc_nots_nosa_noea TYPE_QUAL
936 { $$ = tree_cons (NULL_TREE, $2, $1);
937 TREE_STATIC ($$) = 1; }
938 | declspecs_nosc_nots_nosa_ea TYPE_QUAL
939 { $$ = tree_cons (NULL_TREE, $2, $1);
940 TREE_STATIC ($$) = 1; }
943 declspecs_nosc_nots_nosa_ea:
944 declspecs_nosc_nots_nosa_noea attributes
945 { $$ = tree_cons ($2, NULL_TREE, $1);
946 TREE_STATIC ($$) = TREE_STATIC ($1); }
949 declspecs_nosc_nots_sa_noea:
950 declspecs_nosc_nots_sa_noea TYPE_QUAL
951 { $$ = tree_cons (NULL_TREE, $2, $1);
952 TREE_STATIC ($$) = 1; }
953 | declspecs_nosc_nots_sa_ea TYPE_QUAL
954 { $$ = tree_cons (NULL_TREE, $2, $1);
955 TREE_STATIC ($$) = 1; }
958 declspecs_nosc_nots_sa_ea:
960 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE);
961 TREE_STATIC ($$) = 0; }
962 | declspecs_nosc_nots_sa_noea attributes
963 { $$ = tree_cons ($2, NULL_TREE, $1);
964 TREE_STATIC ($$) = TREE_STATIC ($1); }
967 declspecs_nosc_ts_nosa_noea:
969 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
970 TREE_STATIC ($$) = 1; }
971 | declspecs_nosc_ts_nosa_noea TYPE_QUAL
972 { $$ = tree_cons (NULL_TREE, $2, $1);
973 TREE_STATIC ($$) = 1; }
974 | declspecs_nosc_ts_nosa_ea TYPE_QUAL
975 { $$ = tree_cons (NULL_TREE, $2, $1);
976 TREE_STATIC ($$) = 1; }
977 | declspecs_nosc_ts_nosa_noea typespec_reserved_nonattr
978 { $$ = tree_cons (NULL_TREE, $2, $1);
979 TREE_STATIC ($$) = 1; }
980 | declspecs_nosc_ts_nosa_ea typespec_reserved_nonattr
981 { $$ = tree_cons (NULL_TREE, $2, $1);
982 TREE_STATIC ($$) = 1; }
983 | declspecs_nosc_nots_nosa_noea typespec_nonattr
984 { $$ = tree_cons (NULL_TREE, $2, $1);
985 TREE_STATIC ($$) = 1; }
986 | declspecs_nosc_nots_nosa_ea typespec_nonattr
987 { $$ = tree_cons (NULL_TREE, $2, $1);
988 TREE_STATIC ($$) = 1; }
991 declspecs_nosc_ts_nosa_ea:
993 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
994 TREE_STATIC ($$) = 1; }
995 | declspecs_nosc_ts_nosa_noea attributes
996 { $$ = tree_cons ($2, NULL_TREE, $1);
997 TREE_STATIC ($$) = TREE_STATIC ($1); }
998 | declspecs_nosc_ts_nosa_noea typespec_reserved_attr
999 { $$ = tree_cons (NULL_TREE, $2, $1);
1000 TREE_STATIC ($$) = 1; }
1001 | declspecs_nosc_ts_nosa_ea typespec_reserved_attr
1002 { $$ = tree_cons (NULL_TREE, $2, $1);
1003 TREE_STATIC ($$) = 1; }
1004 | declspecs_nosc_nots_nosa_noea typespec_attr
1005 { $$ = tree_cons (NULL_TREE, $2, $1);
1006 TREE_STATIC ($$) = 1; }
1007 | declspecs_nosc_nots_nosa_ea typespec_attr
1008 { $$ = tree_cons (NULL_TREE, $2, $1);
1009 TREE_STATIC ($$) = 1; }
1012 declspecs_nosc_ts_sa_noea:
1013 declspecs_nosc_ts_sa_noea TYPE_QUAL
1014 { $$ = tree_cons (NULL_TREE, $2, $1);
1015 TREE_STATIC ($$) = 1; }
1016 | declspecs_nosc_ts_sa_ea TYPE_QUAL
1017 { $$ = tree_cons (NULL_TREE, $2, $1);
1018 TREE_STATIC ($$) = 1; }
1019 | declspecs_nosc_ts_sa_noea typespec_reserved_nonattr
1020 { $$ = tree_cons (NULL_TREE, $2, $1);
1021 TREE_STATIC ($$) = 1; }
1022 | declspecs_nosc_ts_sa_ea typespec_reserved_nonattr
1023 { $$ = tree_cons (NULL_TREE, $2, $1);
1024 TREE_STATIC ($$) = 1; }
1025 | declspecs_nosc_nots_sa_noea typespec_nonattr
1026 { $$ = tree_cons (NULL_TREE, $2, $1);
1027 TREE_STATIC ($$) = 1; }
1028 | declspecs_nosc_nots_sa_ea typespec_nonattr
1029 { $$ = tree_cons (NULL_TREE, $2, $1);
1030 TREE_STATIC ($$) = 1; }
1033 declspecs_nosc_ts_sa_ea:
1034 declspecs_nosc_ts_sa_noea attributes
1035 { $$ = tree_cons ($2, NULL_TREE, $1);
1036 TREE_STATIC ($$) = TREE_STATIC ($1); }
1037 | declspecs_nosc_ts_sa_noea typespec_reserved_attr
1038 { $$ = tree_cons (NULL_TREE, $2, $1);
1039 TREE_STATIC ($$) = 1; }
1040 | declspecs_nosc_ts_sa_ea typespec_reserved_attr
1041 { $$ = tree_cons (NULL_TREE, $2, $1);
1042 TREE_STATIC ($$) = 1; }
1043 | declspecs_nosc_nots_sa_noea typespec_attr
1044 { $$ = tree_cons (NULL_TREE, $2, $1);
1045 TREE_STATIC ($$) = 1; }
1046 | declspecs_nosc_nots_sa_ea typespec_attr
1047 { $$ = tree_cons (NULL_TREE, $2, $1);
1048 TREE_STATIC ($$) = 1; }
1051 declspecs_sc_nots_nosa_noea:
1053 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
1054 TREE_STATIC ($$) = 0; }
1055 | declspecs_sc_nots_nosa_noea TYPE_QUAL
1056 { $$ = tree_cons (NULL_TREE, $2, $1);
1057 TREE_STATIC ($$) = 1; }
1058 | declspecs_sc_nots_nosa_ea TYPE_QUAL
1059 { $$ = tree_cons (NULL_TREE, $2, $1);
1060 TREE_STATIC ($$) = 1; }
1061 | declspecs_nosc_nots_nosa_noea scspec
1062 { if (extra_warnings && TREE_STATIC ($1))
1063 warning ("`%s' is not at beginning of declaration",
1064 IDENTIFIER_POINTER ($2));
1065 $$ = tree_cons (NULL_TREE, $2, $1);
1066 TREE_STATIC ($$) = TREE_STATIC ($1); }
1067 | declspecs_nosc_nots_nosa_ea scspec
1068 { if (extra_warnings && TREE_STATIC ($1))
1069 warning ("`%s' is not at beginning of declaration",
1070 IDENTIFIER_POINTER ($2));
1071 $$ = tree_cons (NULL_TREE, $2, $1);
1072 TREE_STATIC ($$) = TREE_STATIC ($1); }
1073 | declspecs_sc_nots_nosa_noea scspec
1074 { if (extra_warnings && TREE_STATIC ($1))
1075 warning ("`%s' is not at beginning of declaration",
1076 IDENTIFIER_POINTER ($2));
1077 $$ = tree_cons (NULL_TREE, $2, $1);
1078 TREE_STATIC ($$) = TREE_STATIC ($1); }
1079 | declspecs_sc_nots_nosa_ea scspec
1080 { if (extra_warnings && TREE_STATIC ($1))
1081 warning ("`%s' is not at beginning of declaration",
1082 IDENTIFIER_POINTER ($2));
1083 $$ = tree_cons (NULL_TREE, $2, $1);
1084 TREE_STATIC ($$) = TREE_STATIC ($1); }
1087 declspecs_sc_nots_nosa_ea:
1088 declspecs_sc_nots_nosa_noea attributes
1089 { $$ = tree_cons ($2, NULL_TREE, $1);
1090 TREE_STATIC ($$) = TREE_STATIC ($1); }
1093 declspecs_sc_nots_sa_noea:
1094 declspecs_sc_nots_sa_noea TYPE_QUAL
1095 { $$ = tree_cons (NULL_TREE, $2, $1);
1096 TREE_STATIC ($$) = 1; }
1097 | declspecs_sc_nots_sa_ea TYPE_QUAL
1098 { $$ = tree_cons (NULL_TREE, $2, $1);
1099 TREE_STATIC ($$) = 1; }
1100 | declspecs_nosc_nots_sa_noea scspec
1101 { if (extra_warnings && TREE_STATIC ($1))
1102 warning ("`%s' is not at beginning of declaration",
1103 IDENTIFIER_POINTER ($2));
1104 $$ = tree_cons (NULL_TREE, $2, $1);
1105 TREE_STATIC ($$) = TREE_STATIC ($1); }
1106 | declspecs_nosc_nots_sa_ea scspec
1107 { if (extra_warnings && TREE_STATIC ($1))
1108 warning ("`%s' is not at beginning of declaration",
1109 IDENTIFIER_POINTER ($2));
1110 $$ = tree_cons (NULL_TREE, $2, $1);
1111 TREE_STATIC ($$) = TREE_STATIC ($1); }
1112 | declspecs_sc_nots_sa_noea scspec
1113 { if (extra_warnings && TREE_STATIC ($1))
1114 warning ("`%s' is not at beginning of declaration",
1115 IDENTIFIER_POINTER ($2));
1116 $$ = tree_cons (NULL_TREE, $2, $1);
1117 TREE_STATIC ($$) = TREE_STATIC ($1); }
1118 | declspecs_sc_nots_sa_ea scspec
1119 { if (extra_warnings && TREE_STATIC ($1))
1120 warning ("`%s' is not at beginning of declaration",
1121 IDENTIFIER_POINTER ($2));
1122 $$ = tree_cons (NULL_TREE, $2, $1);
1123 TREE_STATIC ($$) = TREE_STATIC ($1); }
1126 declspecs_sc_nots_sa_ea:
1127 declspecs_sc_nots_sa_noea attributes
1128 { $$ = tree_cons ($2, NULL_TREE, $1);
1129 TREE_STATIC ($$) = TREE_STATIC ($1); }
1132 declspecs_sc_ts_nosa_noea:
1133 declspecs_sc_ts_nosa_noea TYPE_QUAL
1134 { $$ = tree_cons (NULL_TREE, $2, $1);
1135 TREE_STATIC ($$) = 1; }
1136 | declspecs_sc_ts_nosa_ea TYPE_QUAL
1137 { $$ = tree_cons (NULL_TREE, $2, $1);
1138 TREE_STATIC ($$) = 1; }
1139 | declspecs_sc_ts_nosa_noea typespec_reserved_nonattr
1140 { $$ = tree_cons (NULL_TREE, $2, $1);
1141 TREE_STATIC ($$) = 1; }
1142 | declspecs_sc_ts_nosa_ea typespec_reserved_nonattr
1143 { $$ = tree_cons (NULL_TREE, $2, $1);
1144 TREE_STATIC ($$) = 1; }
1145 | declspecs_sc_nots_nosa_noea typespec_nonattr
1146 { $$ = tree_cons (NULL_TREE, $2, $1);
1147 TREE_STATIC ($$) = 1; }
1148 | declspecs_sc_nots_nosa_ea typespec_nonattr
1149 { $$ = tree_cons (NULL_TREE, $2, $1);
1150 TREE_STATIC ($$) = 1; }
1151 | declspecs_nosc_ts_nosa_noea scspec
1152 { if (extra_warnings && TREE_STATIC ($1))
1153 warning ("`%s' is not at beginning of declaration",
1154 IDENTIFIER_POINTER ($2));
1155 $$ = tree_cons (NULL_TREE, $2, $1);
1156 TREE_STATIC ($$) = TREE_STATIC ($1); }
1157 | declspecs_nosc_ts_nosa_ea scspec
1158 { if (extra_warnings && TREE_STATIC ($1))
1159 warning ("`%s' is not at beginning of declaration",
1160 IDENTIFIER_POINTER ($2));
1161 $$ = tree_cons (NULL_TREE, $2, $1);
1162 TREE_STATIC ($$) = TREE_STATIC ($1); }
1163 | declspecs_sc_ts_nosa_noea scspec
1164 { if (extra_warnings && TREE_STATIC ($1))
1165 warning ("`%s' is not at beginning of declaration",
1166 IDENTIFIER_POINTER ($2));
1167 $$ = tree_cons (NULL_TREE, $2, $1);
1168 TREE_STATIC ($$) = TREE_STATIC ($1); }
1169 | declspecs_sc_ts_nosa_ea scspec
1170 { if (extra_warnings && TREE_STATIC ($1))
1171 warning ("`%s' is not at beginning of declaration",
1172 IDENTIFIER_POINTER ($2));
1173 $$ = tree_cons (NULL_TREE, $2, $1);
1174 TREE_STATIC ($$) = TREE_STATIC ($1); }
1177 declspecs_sc_ts_nosa_ea:
1178 declspecs_sc_ts_nosa_noea attributes
1179 { $$ = tree_cons ($2, NULL_TREE, $1);
1180 TREE_STATIC ($$) = TREE_STATIC ($1); }
1181 | declspecs_sc_ts_nosa_noea typespec_reserved_attr
1182 { $$ = tree_cons (NULL_TREE, $2, $1);
1183 TREE_STATIC ($$) = 1; }
1184 | declspecs_sc_ts_nosa_ea typespec_reserved_attr
1185 { $$ = tree_cons (NULL_TREE, $2, $1);
1186 TREE_STATIC ($$) = 1; }
1187 | declspecs_sc_nots_nosa_noea typespec_attr
1188 { $$ = tree_cons (NULL_TREE, $2, $1);
1189 TREE_STATIC ($$) = 1; }
1190 | declspecs_sc_nots_nosa_ea typespec_attr
1191 { $$ = tree_cons (NULL_TREE, $2, $1);
1192 TREE_STATIC ($$) = 1; }
1195 declspecs_sc_ts_sa_noea:
1196 declspecs_sc_ts_sa_noea TYPE_QUAL
1197 { $$ = tree_cons (NULL_TREE, $2, $1);
1198 TREE_STATIC ($$) = 1; }
1199 | declspecs_sc_ts_sa_ea TYPE_QUAL
1200 { $$ = tree_cons (NULL_TREE, $2, $1);
1201 TREE_STATIC ($$) = 1; }
1202 | declspecs_sc_ts_sa_noea typespec_reserved_nonattr
1203 { $$ = tree_cons (NULL_TREE, $2, $1);
1204 TREE_STATIC ($$) = 1; }
1205 | declspecs_sc_ts_sa_ea typespec_reserved_nonattr
1206 { $$ = tree_cons (NULL_TREE, $2, $1);
1207 TREE_STATIC ($$) = 1; }
1208 | declspecs_sc_nots_sa_noea typespec_nonattr
1209 { $$ = tree_cons (NULL_TREE, $2, $1);
1210 TREE_STATIC ($$) = 1; }
1211 | declspecs_sc_nots_sa_ea typespec_nonattr
1212 { $$ = tree_cons (NULL_TREE, $2, $1);
1213 TREE_STATIC ($$) = 1; }
1214 | declspecs_nosc_ts_sa_noea scspec
1215 { if (extra_warnings && TREE_STATIC ($1))
1216 warning ("`%s' is not at beginning of declaration",
1217 IDENTIFIER_POINTER ($2));
1218 $$ = tree_cons (NULL_TREE, $2, $1);
1219 TREE_STATIC ($$) = TREE_STATIC ($1); }
1220 | declspecs_nosc_ts_sa_ea scspec
1221 { if (extra_warnings && TREE_STATIC ($1))
1222 warning ("`%s' is not at beginning of declaration",
1223 IDENTIFIER_POINTER ($2));
1224 $$ = tree_cons (NULL_TREE, $2, $1);
1225 TREE_STATIC ($$) = TREE_STATIC ($1); }
1226 | declspecs_sc_ts_sa_noea scspec
1227 { if (extra_warnings && TREE_STATIC ($1))
1228 warning ("`%s' is not at beginning of declaration",
1229 IDENTIFIER_POINTER ($2));
1230 $$ = tree_cons (NULL_TREE, $2, $1);
1231 TREE_STATIC ($$) = TREE_STATIC ($1); }
1232 | declspecs_sc_ts_sa_ea scspec
1233 { if (extra_warnings && TREE_STATIC ($1))
1234 warning ("`%s' is not at beginning of declaration",
1235 IDENTIFIER_POINTER ($2));
1236 $$ = tree_cons (NULL_TREE, $2, $1);
1237 TREE_STATIC ($$) = TREE_STATIC ($1); }
1240 declspecs_sc_ts_sa_ea:
1241 declspecs_sc_ts_sa_noea attributes
1242 { $$ = tree_cons ($2, NULL_TREE, $1);
1243 TREE_STATIC ($$) = TREE_STATIC ($1); }
1244 | declspecs_sc_ts_sa_noea typespec_reserved_attr
1245 { $$ = tree_cons (NULL_TREE, $2, $1);
1246 TREE_STATIC ($$) = 1; }
1247 | declspecs_sc_ts_sa_ea typespec_reserved_attr
1248 { $$ = tree_cons (NULL_TREE, $2, $1);
1249 TREE_STATIC ($$) = 1; }
1250 | declspecs_sc_nots_sa_noea typespec_attr
1251 { $$ = tree_cons (NULL_TREE, $2, $1);
1252 TREE_STATIC ($$) = 1; }
1253 | declspecs_sc_nots_sa_ea typespec_attr
1254 { $$ = tree_cons (NULL_TREE, $2, $1);
1255 TREE_STATIC ($$) = 1; }
1258 /* Particular useful classes of declspecs. */
1260 declspecs_nosc_ts_nosa_noea
1261 | declspecs_nosc_ts_nosa_ea
1262 | declspecs_nosc_ts_sa_noea
1263 | declspecs_nosc_ts_sa_ea
1264 | declspecs_sc_ts_nosa_noea
1265 | declspecs_sc_ts_nosa_ea
1266 | declspecs_sc_ts_sa_noea
1267 | declspecs_sc_ts_sa_ea
1271 declspecs_nosc_nots_nosa_noea
1272 | declspecs_nosc_nots_nosa_ea
1273 | declspecs_nosc_nots_sa_noea
1274 | declspecs_nosc_nots_sa_ea
1275 | declspecs_sc_nots_nosa_noea
1276 | declspecs_sc_nots_nosa_ea
1277 | declspecs_sc_nots_sa_noea
1278 | declspecs_sc_nots_sa_ea
1282 declspecs_nosc_ts_nosa_noea
1283 | declspecs_nosc_ts_nosa_ea
1284 | declspecs_sc_ts_nosa_noea
1285 | declspecs_sc_ts_nosa_ea
1288 declspecs_nots_nosa:
1289 declspecs_nosc_nots_nosa_noea
1290 | declspecs_nosc_nots_nosa_ea
1291 | declspecs_sc_nots_nosa_noea
1292 | declspecs_sc_nots_nosa_ea
1296 declspecs_nosc_ts_nosa_noea
1297 | declspecs_nosc_ts_nosa_ea
1298 | declspecs_nosc_ts_sa_noea
1299 | declspecs_nosc_ts_sa_ea
1302 declspecs_nosc_nots:
1303 declspecs_nosc_nots_nosa_noea
1304 | declspecs_nosc_nots_nosa_ea
1305 | declspecs_nosc_nots_sa_noea
1306 | declspecs_nosc_nots_sa_ea
1310 declspecs_nosc_ts_nosa_noea
1311 | declspecs_nosc_ts_nosa_ea
1312 | declspecs_nosc_ts_sa_noea
1313 | declspecs_nosc_ts_sa_ea
1314 | declspecs_nosc_nots_nosa_noea
1315 | declspecs_nosc_nots_nosa_ea
1316 | declspecs_nosc_nots_sa_noea
1317 | declspecs_nosc_nots_sa_ea
1321 declspecs_nosc_nots_nosa_noea
1322 | declspecs_nosc_nots_nosa_ea
1323 | declspecs_nosc_nots_sa_noea
1324 | declspecs_nosc_nots_sa_ea
1325 | declspecs_nosc_ts_nosa_noea
1326 | declspecs_nosc_ts_nosa_ea
1327 | declspecs_nosc_ts_sa_noea
1328 | declspecs_nosc_ts_sa_ea
1329 | declspecs_sc_nots_nosa_noea
1330 | declspecs_sc_nots_nosa_ea
1331 | declspecs_sc_nots_sa_noea
1332 | declspecs_sc_nots_sa_ea
1333 | declspecs_sc_ts_nosa_noea
1334 | declspecs_sc_ts_nosa_ea
1335 | declspecs_sc_ts_sa_noea
1336 | declspecs_sc_ts_sa_ea
1339 /* A (possibly empty) sequence of type qualifiers and attributes. */
1340 maybe_type_quals_attrs:
1343 | declspecs_nosc_nots
1347 /* A type specifier (but not a type qualifier).
1348 Once we have seen one of these in a declaration,
1349 if a typedef name appears then it is being redeclared.
1351 The _reserved versions start with a reserved word and may appear anywhere
1352 in the declaration specifiers; the _nonreserved versions may only
1353 appear before any other type specifiers, and after that are (if names)
1356 FIXME: should the _nonreserved version be restricted to names being
1357 redeclared only? The other entries there relate only the GNU extensions
1358 and Objective C, and are historically parsed thus, and don't make sense
1359 after other type specifiers, but it might be cleaner to count them as
1362 _attr means: specifiers that either end with attributes,
1363 or are such that any following attributes would
1364 be parsed as part of the specifier.
1366 _nonattr: specifiers. */
1369 typespec_reserved_nonattr
1370 | typespec_nonreserved_nonattr
1374 typespec_reserved_attr
1377 typespec_reserved_nonattr:
1379 { OBJC_NEED_RAW_IDENTIFIER (1); }
1383 typespec_reserved_attr:
1387 typespec_nonreserved_nonattr:
1389 { /* For a typedef name, record the meaning, not the name.
1390 In case of `foo foo, bar;'. */
1391 $$ = lookup_name ($1); }
1393 | CLASSNAME protocolrefs
1394 { $$ = get_static_reference ($1, $2); }
1395 | OBJECTNAME protocolrefs
1396 { $$ = get_object_reference ($2); }
1398 /* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>"
1399 - nisse@lysator.liu.se */
1400 | non_empty_protocolrefs
1401 { $$ = get_object_reference ($1); }
1403 | typeof '(' expr ')'
1404 { skip_evaluation--; $$ = TREE_TYPE ($3); }
1405 | typeof '(' typename ')'
1406 { skip_evaluation--; $$ = groktypename ($3); }
1409 /* typespec_nonreserved_attr does not exist. */
1413 | initdecls ',' maybe_resetattrs initdcl
1418 | notype_initdecls ',' maybe_resetattrs notype_initdcl
1424 | ASM_KEYWORD '(' STRING ')'
1429 declarator maybeasm maybe_attribute '='
1430 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1431 chainon ($3, all_prefix_attributes));
1432 start_init ($<ttype>$, $2, global_bindings_p ()); }
1434 /* Note how the declaration of the variable is in effect while its init is parsed! */
1436 finish_decl ($<ttype>5, $6, $2); }
1437 | declarator maybeasm maybe_attribute
1438 { tree d = start_decl ($1, current_declspecs, 0,
1439 chainon ($3, all_prefix_attributes));
1440 finish_decl (d, NULL_TREE, $2);
1445 notype_declarator maybeasm maybe_attribute '='
1446 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1447 chainon ($3, all_prefix_attributes));
1448 start_init ($<ttype>$, $2, global_bindings_p ()); }
1450 /* Note how the declaration of the variable is in effect while its init is parsed! */
1452 finish_decl ($<ttype>5, $6, $2); }
1453 | notype_declarator maybeasm maybe_attribute
1454 { tree d = start_decl ($1, current_declspecs, 0,
1455 chainon ($3, all_prefix_attributes));
1456 finish_decl (d, NULL_TREE, $2); }
1458 /* the * rules are dummies to accept the Apollo extended syntax
1459 so that the header files compile. */
1470 | attributes attribute
1471 { $$ = chainon ($1, $2); }
1475 ATTRIBUTE '(' '(' attribute_list ')' ')'
1482 | attribute_list ',' attrib
1483 { $$ = chainon ($1, $3); }
1490 { $$ = build_tree_list ($1, NULL_TREE); }
1491 | any_word '(' IDENTIFIER ')'
1492 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
1493 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1494 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
1495 | any_word '(' exprlist ')'
1496 { $$ = build_tree_list ($1, $3); }
1499 /* This still leaves out most reserved keywords,
1500 shouldn't we include them? */
1514 /* Initializers. `init' is the entry point. */
1519 { really_start_incremental_init (NULL_TREE); }
1520 initlist_maybe_comma '}'
1521 { $$ = pop_init_level (0); }
1523 { $$ = error_mark_node; }
1526 /* `initlist_maybe_comma' is the guts of an initializer in braces. */
1527 initlist_maybe_comma:
1530 pedwarn ("ISO C forbids empty initializer braces"); }
1531 | initlist1 maybecomma
1536 | initlist1 ',' initelt
1539 /* `initelt' is a single element of an initializer.
1540 It may use braces. */
1542 designator_list '=' initval
1543 { if (pedantic && ! flag_isoc99)
1544 pedwarn ("ISO C89 forbids specifying subobject to initialize"); }
1545 | designator initval
1547 pedwarn ("obsolete use of designated initializer without `='"); }
1549 { set_init_label ($1);
1551 pedwarn ("obsolete use of designated initializer with `:'"); }
1559 { push_init_level (0); }
1560 initlist_maybe_comma '}'
1561 { process_init_element (pop_init_level (0)); }
1563 { process_init_element ($1); }
1569 | designator_list designator
1574 { set_init_label ($2); }
1575 | '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1576 { set_init_index ($2, $4);
1578 pedwarn ("ISO C forbids specifying range of elements to initialize"); }
1579 | '[' expr_no_commas ']'
1580 { set_init_index ($2, NULL_TREE); }
1586 pedwarn ("ISO C forbids nested functions");
1588 push_function_context ();
1589 if (! start_function (current_declspecs, $1,
1590 all_prefix_attributes))
1592 pop_function_context ();
1595 parsing_iso_function_signature = false; /* Don't warn about nested functions. */
1597 old_style_parm_decls
1598 { store_parm_decls (); }
1599 /* This used to use compstmt_or_error.
1600 That caused a bug with input `f(g) int g {}',
1601 where the use of YYERROR1 above caused an error
1602 which then was handled by compstmt_or_error.
1603 There followed a repeated execution of that same rule,
1604 which called YYERROR1 again, and so on. */
1605 save_filename save_lineno compstmt
1606 { tree decl = current_function_decl;
1607 DECL_SOURCE_FILE (decl) = $5;
1608 DECL_SOURCE_LINE (decl) = $6;
1609 finish_function (1, 1);
1610 pop_function_context ();
1611 add_decl_stmt (decl); }
1614 notype_nested_function:
1617 pedwarn ("ISO C forbids nested functions");
1619 push_function_context ();
1620 if (! start_function (current_declspecs, $1,
1621 all_prefix_attributes))
1623 pop_function_context ();
1626 parsing_iso_function_signature = false; /* Don't warn about nested functions. */
1628 old_style_parm_decls
1629 { store_parm_decls (); }
1630 /* This used to use compstmt_or_error.
1631 That caused a bug with input `f(g) int g {}',
1632 where the use of YYERROR1 above caused an error
1633 which then was handled by compstmt_or_error.
1634 There followed a repeated execution of that same rule,
1635 which called YYERROR1 again, and so on. */
1636 save_filename save_lineno compstmt
1637 { tree decl = current_function_decl;
1638 DECL_SOURCE_FILE (decl) = $5;
1639 DECL_SOURCE_LINE (decl) = $6;
1640 finish_function (1, 1);
1641 pop_function_context ();
1642 add_decl_stmt (decl); }
1645 /* Any kind of declarator (thus, all declarators allowed
1646 after an explicit typespec). */
1649 after_type_declarator
1653 /* A declarator that is allowed only after an explicit typespec. */
1655 after_type_declarator:
1656 '(' maybe_attribute after_type_declarator ')'
1657 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1658 | after_type_declarator '(' parmlist_or_identifiers %prec '.'
1659 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1660 /* | after_type_declarator '(' error ')' %prec '.'
1661 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1662 poplevel (0, 0, 0); } */
1663 | after_type_declarator array_declarator %prec '.'
1664 { $$ = set_array_declarator_type ($2, $1, 0); }
1665 | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
1666 { $$ = make_pointer_declarator ($2, $3); }
1673 /* Kinds of declarator that can appear in a parameter list
1674 in addition to notype_declarator. This is like after_type_declarator
1675 but does not allow a typedef name in parentheses as an identifier
1676 (because it would conflict with a function with that typedef as arg). */
1678 parm_declarator_starttypename
1679 | parm_declarator_nostarttypename
1682 parm_declarator_starttypename:
1683 parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
1684 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1685 /* | parm_declarator_starttypename '(' error ')' %prec '.'
1686 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1687 poplevel (0, 0, 0); } */
1688 | parm_declarator_starttypename array_declarator %prec '.'
1689 { $$ = set_array_declarator_type ($2, $1, 0); }
1696 parm_declarator_nostarttypename:
1697 parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
1698 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1699 /* | parm_declarator_nostarttypename '(' error ')' %prec '.'
1700 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1701 poplevel (0, 0, 0); } */
1702 | parm_declarator_nostarttypename array_declarator %prec '.'
1703 { $$ = set_array_declarator_type ($2, $1, 0); }
1704 | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
1705 { $$ = make_pointer_declarator ($2, $3); }
1706 | '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY
1707 { $$ = make_pointer_declarator ($2, $3); }
1708 | '(' maybe_attribute parm_declarator_nostarttypename ')'
1709 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1712 /* A declarator allowed whether or not there has been
1713 an explicit typespec. These cannot redeclare a typedef-name. */
1716 notype_declarator '(' parmlist_or_identifiers %prec '.'
1717 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1718 /* | notype_declarator '(' error ')' %prec '.'
1719 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1720 poplevel (0, 0, 0); } */
1721 | '(' maybe_attribute notype_declarator ')'
1722 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1723 | '*' maybe_type_quals_attrs notype_declarator %prec UNARY
1724 { $$ = make_pointer_declarator ($2, $3); }
1725 | notype_declarator array_declarator %prec '.'
1726 { $$ = set_array_declarator_type ($2, $1, 0); }
1751 /* structsp_attr: struct/union/enum specifiers that either
1752 end with attributes, or are such that any following attributes would
1753 be parsed as part of the struct/union/enum specifier.
1755 structsp_nonattr: other struct/union/enum specifiers. */
1758 struct_head identifier '{'
1759 { $$ = start_struct (RECORD_TYPE, $2);
1760 /* Start scope of tag before parsing components. */
1762 component_decl_list '}' maybe_attribute
1763 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1764 | struct_head '{' component_decl_list '}' maybe_attribute
1765 { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1766 $3, chainon ($1, $5));
1768 | union_head identifier '{'
1769 { $$ = start_struct (UNION_TYPE, $2); }
1770 component_decl_list '}' maybe_attribute
1771 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1772 | union_head '{' component_decl_list '}' maybe_attribute
1773 { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1774 $3, chainon ($1, $5));
1776 | enum_head identifier '{'
1777 { $$ = start_enum ($2); }
1778 enumlist maybecomma_warn '}' maybe_attribute
1779 { $$ = finish_enum ($<ttype>4, nreverse ($5),
1780 chainon ($1, $8)); }
1782 { $$ = start_enum (NULL_TREE); }
1783 enumlist maybecomma_warn '}' maybe_attribute
1784 { $$ = finish_enum ($<ttype>3, nreverse ($4),
1785 chainon ($1, $7)); }
1789 struct_head identifier
1790 { $$ = xref_tag (RECORD_TYPE, $2); }
1791 | union_head identifier
1792 { $$ = xref_tag (UNION_TYPE, $2); }
1793 | enum_head identifier
1794 { $$ = xref_tag (ENUMERAL_TYPE, $2);
1795 /* In ISO C, enumerated types can be referred to
1796 only if already defined. */
1797 if (pedantic && !COMPLETE_TYPE_P ($$))
1798 pedwarn ("ISO C forbids forward references to `enum' types"); }
1809 { if (pedantic && ! flag_isoc99)
1810 pedwarn ("comma at end of enumerator list"); }
1813 component_decl_list:
1814 component_decl_list2
1816 | component_decl_list2 component_decl
1817 { $$ = chainon ($1, $2);
1818 pedwarn ("no semicolon at end of struct or union"); }
1821 component_decl_list2: /* empty */
1823 | component_decl_list2 component_decl ';'
1824 { $$ = chainon ($1, $2); }
1825 | component_decl_list2 ';'
1827 pedwarn ("extra semicolon in struct or union specified"); }
1829 /* foo(sizeof(struct{ @defs(ClassName)})); */
1830 | DEFS '(' CLASSNAME ')'
1832 tree interface = lookup_interface ($3);
1835 $$ = get_class_ivars (interface);
1838 error ("cannot find interface declaration for `%s'",
1839 IDENTIFIER_POINTER ($3));
1847 declspecs_nosc_ts setspecs components
1849 POP_DECLSPEC_STACK; }
1850 | declspecs_nosc_ts setspecs save_filename save_lineno
1852 /* Support for unnamed structs or unions as members of
1853 structs or unions (which is [a] useful and [b] supports
1856 pedwarn ("ISO C doesn't support unnamed structs/unions");
1858 $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE);
1859 POP_DECLSPEC_STACK; }
1860 | declspecs_nosc_nots setspecs components_notype
1862 POP_DECLSPEC_STACK; }
1863 | declspecs_nosc_nots
1865 pedwarn ("ISO C forbids member declarations with no members");
1870 | extension component_decl
1872 RESTORE_EXT_FLAGS ($1); }
1876 component_declarator
1877 | components ',' maybe_resetattrs component_declarator
1878 { $$ = chainon ($1, $4); }
1882 component_notype_declarator
1883 | components_notype ',' maybe_resetattrs component_notype_declarator
1884 { $$ = chainon ($1, $4); }
1887 component_declarator:
1888 save_filename save_lineno declarator maybe_attribute
1889 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1890 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1891 | save_filename save_lineno
1892 declarator ':' expr_no_commas maybe_attribute
1893 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1894 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1895 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1896 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1897 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1900 component_notype_declarator:
1901 save_filename save_lineno notype_declarator maybe_attribute
1902 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1903 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1904 | save_filename save_lineno
1905 notype_declarator ':' expr_no_commas maybe_attribute
1906 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1907 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1908 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1909 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1910 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1913 /* We chain the enumerators in reverse order.
1914 They are put in forward order where enumlist is used.
1915 (The order used to be significant, but no longer is so.
1916 However, we still maintain the order, just to be clean.) */
1920 | enumlist ',' enumerator
1921 { if ($1 == error_mark_node)
1924 $$ = chainon ($3, $1); }
1926 { $$ = error_mark_node; }
1932 { $$ = build_enumerator ($1, NULL_TREE); }
1933 | identifier '=' expr_no_commas
1934 { $$ = build_enumerator ($1, $3); }
1939 { pending_xref_error ();
1942 { $$ = build_tree_list ($<ttype>2, $3); }
1945 absdcl: /* an absolute declarator */
1951 absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */
1953 { $$ = build_tree_list (build_tree_list (current_declspecs,
1955 all_prefix_attributes); }
1957 { $$ = build_tree_list (build_tree_list (current_declspecs,
1959 all_prefix_attributes); }
1960 | absdcl1_noea attributes
1961 { $$ = build_tree_list (build_tree_list (current_declspecs,
1963 chainon ($2, all_prefix_attributes)); }
1966 absdcl1: /* a nonempty absolute declarator */
1973 | '*' maybe_type_quals_attrs absdcl1_noea
1974 { $$ = make_pointer_declarator ($2, $3); }
1978 '*' maybe_type_quals_attrs
1979 { $$ = make_pointer_declarator ($2, NULL_TREE); }
1980 | '*' maybe_type_quals_attrs absdcl1_ea
1981 { $$ = make_pointer_declarator ($2, $3); }
1985 '(' maybe_attribute absdcl1 ')'
1986 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1987 | direct_absdcl1 '(' parmlist
1988 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1989 | direct_absdcl1 array_declarator
1990 { $$ = set_array_declarator_type ($2, $1, 1); }
1992 { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
1994 { $$ = set_array_declarator_type ($1, NULL_TREE, 1); }
1997 /* The [...] part of a declarator for an array type. */
2000 '[' maybe_type_quals_attrs expr ']'
2001 { $$ = build_array_declarator ($3, $2, 0, 0); }
2002 | '[' maybe_type_quals_attrs ']'
2003 { $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
2004 | '[' maybe_type_quals_attrs '*' ']'
2005 { $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
2006 | '[' STATIC maybe_type_quals_attrs expr ']'
2007 { $$ = build_array_declarator ($4, $3, 1, 0); }
2008 /* declspecs_nosc_nots is a synonym for type_quals_attrs. */
2009 | '[' declspecs_nosc_nots STATIC expr ']'
2010 { $$ = build_array_declarator ($4, $2, 1, 0); }
2013 /* A nonempty series of declarations and statements (possibly followed by
2014 some labels) that can form the body of a compound statement.
2015 NOTE: we don't allow labels on declarations; this might seem like a
2016 natural extension, but there would be a conflict between attributes
2017 on the label and prefix attributes on the declaration. */
2020 lineno_stmt_decl_or_labels_ending_stmt
2021 | lineno_stmt_decl_or_labels_ending_decl
2022 | lineno_stmt_decl_or_labels_ending_label
2024 pedwarn ("deprecated use of label at end of compound statement");
2026 | lineno_stmt_decl_or_labels_ending_error
2029 lineno_stmt_decl_or_labels_ending_stmt:
2031 | lineno_stmt_decl_or_labels_ending_stmt lineno_stmt
2032 | lineno_stmt_decl_or_labels_ending_decl lineno_stmt
2033 | lineno_stmt_decl_or_labels_ending_label lineno_stmt
2034 | lineno_stmt_decl_or_labels_ending_error lineno_stmt
2037 lineno_stmt_decl_or_labels_ending_decl:
2039 | lineno_stmt_decl_or_labels_ending_stmt lineno_decl
2040 { if (pedantic && !flag_isoc99)
2041 pedwarn ("ISO C89 forbids mixed declarations and code"); }
2042 | lineno_stmt_decl_or_labels_ending_decl lineno_decl
2043 | lineno_stmt_decl_or_labels_ending_error lineno_decl
2046 lineno_stmt_decl_or_labels_ending_label:
2048 | lineno_stmt_decl_or_labels_ending_stmt lineno_label
2049 | lineno_stmt_decl_or_labels_ending_decl lineno_label
2050 | lineno_stmt_decl_or_labels_ending_label lineno_label
2051 | lineno_stmt_decl_or_labels_ending_error lineno_label
2054 lineno_stmt_decl_or_labels_ending_error:
2056 | lineno_stmt_decl_or_labels errstmt
2059 lineno_stmt_decl_or_labels:
2060 lineno_stmt_decl_or_labels_ending_stmt
2061 | lineno_stmt_decl_or_labels_ending_decl
2062 | lineno_stmt_decl_or_labels_ending_label
2063 | lineno_stmt_decl_or_labels_ending_error
2069 pushlevel: /* empty */
2072 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2074 if (objc_method_context)
2080 poplevel: /* empty */
2081 { $$ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); }
2084 /* Start and end blocks created for the new scopes of C99. */
2085 c99_block_start: /* empty */
2088 $$ = c_begin_compound_stmt ();
2091 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2093 if (objc_method_context)
2102 /* Productions using c99_block_start and c99_block_end will need to do what's
2103 in compstmt: RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); $$ = $2; where
2104 $1 is the value of c99_block_start and $2 of c99_block_end. */
2105 c99_block_end: /* empty */
2108 tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
2109 $$ = poplevel (kept_level_p (), 0, 0);
2110 SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
2111 = SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
2118 /* Read zero or more forward-declarations for labels
2119 that nested functions can jump to. */
2124 pedwarn ("ISO C forbids label declarations"); }
2129 | label_decls label_decl
2133 LABEL identifiers_or_typenames ';'
2135 for (link = $2; link; link = TREE_CHAIN (link))
2137 tree label = shadow_label (TREE_VALUE (link));
2138 C_DECLARED_LABEL_FLAG (label) = 1;
2139 add_decl_stmt (label);
2144 /* This is the body of a function definition.
2145 It causes syntax errors to ignore to the next openbrace. */
2152 compstmt_start: '{' { compstmt_count++;
2153 $$ = c_begin_compound_stmt (); }
2156 compstmt_nostart: '}'
2157 { $$ = convert (void_type_node, integer_zero_node); }
2158 | pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel
2159 { $$ = poplevel (kept_level_p (), 1, 0);
2160 SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
2161 = SCOPE_STMT_BLOCK (TREE_VALUE ($5))
2165 compstmt_contents_nonempty:
2170 compstmt_primary_start:
2172 { if (current_function_decl == 0)
2174 error ("braced-group within expression allowed only inside a function");
2177 /* We must force a BLOCK for this level
2178 so that, if it is not expanded later,
2179 there is a way to turn off the entire subtree of blocks
2180 that are contained in it. */
2182 push_label_level ();
2184 $$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree));
2188 compstmt: compstmt_start compstmt_nostart
2189 { RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2190 last_expr_type = NULL_TREE;
2194 /* Value is number of statements counted as of the closeparen. */
2196 if_prefix c99_block_lineno_labeled_stmt
2197 { c_finish_then (); }
2198 /* Make sure c_expand_end_cond is run once
2199 for each call to c_expand_start_cond.
2200 Otherwise a crash is likely. */
2205 /* We must build the IF_STMT node before parsing its
2206 condition so that STMT_LINENO refers to the line
2207 containing the "if", and not the line containing
2208 the close-parenthesis.
2210 c_begin_if_stmt returns the IF_STMT node, which
2211 we later pass to c_expand_start_cond to fill
2212 in the condition and other tidbits. */
2214 { $<ttype>$ = c_begin_if_stmt (); }
2216 { c_expand_start_cond (c_common_truthvalue_conversion ($4),
2217 compstmt_count,$<ttype>2);
2218 $<itype>$ = stmt_count;
2219 if_stmt_file = $<filename>-2;
2220 if_stmt_line = $<lineno>-1; }
2223 /* This is a subroutine of stmt.
2224 It is used twice, once for valid DO statements
2225 and once for catching errors in parsing the end test. */
2231 = add_stmt (build_stmt (DO_STMT, NULL_TREE,
2233 /* In the event that a parse error prevents
2234 parsing the complete do-statement, set the
2235 condition now. Otherwise, we can get crashes at
2236 RTL-generation time. */
2237 DO_COND ($<ttype>$) = error_mark_node; }
2238 c99_block_lineno_labeled_stmt WHILE
2240 RECHAIN_STMTS ($$, DO_BODY ($$)); }
2243 /* The forced readahead in here is because we might be at the end of a
2244 line, and the line and file won't be bumped until yylex absorbs the
2245 first token on the next line. */
2247 { if (yychar == YYEMPTY)
2249 $$ = input_filename; }
2253 { if (yychar == YYEMPTY)
2258 lineno_labeled_stmt:
2260 | lineno_label lineno_labeled_stmt
2263 /* Like lineno_labeled_stmt, but a block in C99. */
2264 c99_block_lineno_labeled_stmt:
2265 c99_block_start lineno_labeled_stmt c99_block_end
2267 RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); }
2271 save_filename save_lineno stmt
2274 STMT_LINENO ($3) = $2;
2275 /* ??? We currently have no way of recording
2276 the filename for a statement. This probably
2277 matters little in practice at the moment,
2278 but I suspect that problems will occur when
2279 doing inlining at the tree level. */
2285 save_filename save_lineno label
2288 STMT_LINENO ($3) = $2;
2293 select_or_iter_stmt:
2295 { c_expand_start_else ();
2296 $<itype>1 = stmt_count; }
2297 c99_block_lineno_labeled_stmt
2299 c_expand_end_cond ();
2300 if (extra_warnings && stmt_count == $<itype>1)
2301 warning ("empty body in an else-statement"); }
2302 | simple_if %prec IF
2303 { c_expand_end_cond ();
2304 /* This warning is here instead of in simple_if, because we
2305 do not want a warning if an empty if is followed by an
2306 else statement. Increment stmt_count so we don't
2307 give a second error if this is a nested `if'. */
2308 if (extra_warnings && stmt_count++ == $<itype>1)
2309 warning_with_file_and_line (if_stmt_file, if_stmt_line,
2310 "empty body in an if-statement"); }
2311 /* Make sure c_expand_end_cond is run once
2312 for each call to c_expand_start_cond.
2313 Otherwise a crash is likely. */
2314 | simple_if ELSE error
2315 { c_expand_end_cond (); }
2316 /* We must build the WHILE_STMT node before parsing its
2317 condition so that STMT_LINENO refers to the line
2318 containing the "while", and not the line containing
2319 the close-parenthesis.
2321 c_begin_while_stmt returns the WHILE_STMT node, which
2322 we later pass to c_finish_while_stmt_cond to fill
2323 in the condition and other tidbits. */
2326 $<ttype>$ = c_begin_while_stmt (); }
2328 { $4 = c_common_truthvalue_conversion ($4);
2329 c_finish_while_stmt_cond
2330 (c_common_truthvalue_conversion ($4), $<ttype>2);
2331 $<ttype>$ = add_stmt ($<ttype>2); }
2332 c99_block_lineno_labeled_stmt
2333 { RECHAIN_STMTS ($<ttype>6, WHILE_BODY ($<ttype>6)); }
2336 { DO_COND ($1) = c_common_truthvalue_conversion ($3); }
2337 | do_stmt_start error
2340 { $<ttype>$ = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
2341 NULL_TREE, NULL_TREE);
2342 add_stmt ($<ttype>$); }
2345 RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
2348 FOR_COND ($<ttype>2)
2349 = c_common_truthvalue_conversion ($6); }
2351 { FOR_EXPR ($<ttype>2) = $9; }
2352 c99_block_lineno_labeled_stmt
2353 { RECHAIN_STMTS ($<ttype>2, FOR_BODY ($<ttype>2)); }
2354 | SWITCH '(' expr ')'
2356 $<ttype>$ = c_start_case ($3); }
2357 c99_block_lineno_labeled_stmt
2358 { c_finish_case (); }
2363 { add_stmt (build_stmt (EXPR_STMT, $1)); }
2365 { check_for_loop_decls (); }
2368 /* Parse a single real statement, not including any labels. */
2371 { stmt_count++; $$ = $1; }
2374 $$ = c_expand_expr_stmt ($1); }
2375 | c99_block_start select_or_iter_stmt c99_block_end
2377 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2381 $$ = add_stmt (build_break_stmt ()); }
2384 $$ = add_stmt (build_continue_stmt ()); }
2387 $$ = c_expand_return (NULL_TREE); }
2390 $$ = c_expand_return ($2); }
2391 | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
2393 $$ = simple_asm_stmt ($4); }
2394 /* This is the case with just output operands. */
2395 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
2397 $$ = build_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
2398 /* This is the case with input operands as well. */
2399 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2400 asm_operands ')' ';'
2402 $$ = build_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
2403 /* This is the case with clobbered registers as well. */
2404 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2405 asm_operands ':' asm_clobbers ')' ';'
2407 $$ = build_asm_stmt ($2, $4, $6, $8, $10); }
2408 | GOTO identifier ';'
2411 decl = lookup_label ($2);
2414 TREE_USED (decl) = 1;
2415 $$ = add_stmt (build_stmt (GOTO_STMT, decl));
2422 pedwarn ("ISO C forbids `goto *expr;'");
2424 $3 = convert (ptr_type_node, $3);
2425 $$ = add_stmt (build_stmt (GOTO_STMT, $3)); }
2430 /* Any kind of label, including jump labels and case labels.
2431 ANSI C accepts labels only before statements, but we allow them
2432 also at the end of a compound statement. */
2434 label: CASE expr_no_commas ':'
2436 $$ = do_case ($2, NULL_TREE); }
2437 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
2439 $$ = do_case ($2, $4); }
2442 $$ = do_case (NULL_TREE, NULL_TREE); }
2443 | identifier save_filename save_lineno ':' maybe_attribute
2444 { tree label = define_label ($2, $3, $1);
2448 decl_attributes (&label, $5, 0);
2449 $$ = add_stmt (build_stmt (LABEL_STMT, label));
2456 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
2460 { emit_line_note (input_filename, lineno);
2463 { emit_line_note (input_filename, lineno); }
2472 /* These are the operands other than the first string and colon
2473 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
2474 asm_operands: /* empty */
2476 | nonnull_asm_operands
2479 nonnull_asm_operands:
2481 | nonnull_asm_operands ',' asm_operand
2482 { $$ = chainon ($1, $3); }
2487 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
2488 | '[' identifier ']' STRING '(' expr ')'
2489 { $2 = build_string (IDENTIFIER_LENGTH ($2),
2490 IDENTIFIER_POINTER ($2));
2491 $$ = build_tree_list (build_tree_list ($2, $4), $6); }
2496 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
2497 | asm_clobbers ',' STRING
2498 { $$ = tree_cons (NULL_TREE, $3, $1); }
2501 /* This is what appears inside the parens in a function declarator.
2502 Its value is a list of ..._TYPE nodes. Attributes must appear here
2503 to avoid a conflict with their appearance after an open parenthesis
2504 in an abstract declarator, as in
2505 "void bar (int (__attribute__((__mode__(SI))) int foo));". */
2509 clear_parm_order ();
2510 declare_parm_level (0); }
2513 parmlist_tags_warning ();
2514 poplevel (0, 0, 0); }
2522 pedwarn ("ISO C forbids forward parameter declarations");
2523 /* Mark the forward decls as such. */
2524 for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
2525 TREE_ASM_WRITTEN (parm) = 1;
2526 clear_parm_order (); }
2528 { /* Dummy action so attributes are in known place
2529 on parser stack. */ }
2533 { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
2536 /* This is what appears inside the parens in a function declarator.
2537 Is value is represented in the format that grokdeclarator expects. */
2538 parmlist_2: /* empty */
2539 { $$ = get_parm_info (0); }
2541 { $$ = get_parm_info (0);
2542 /* Gcc used to allow this as an extension. However, it does
2543 not work for all targets, and thus has been disabled.
2544 Also, since func (...) and func () are indistinguishable,
2545 it caused problems with the code in expand_builtin which
2546 tries to verify that BUILT_IN_NEXT_ARG is being used
2548 error ("ISO C requires a named argument before `...'");
2551 { $$ = get_parm_info (1);
2552 parsing_iso_function_signature = true;
2554 | parms ',' ELLIPSIS
2555 { $$ = get_parm_info (0); }
2560 { push_parm_decl ($1); }
2562 { push_parm_decl ($3); }
2565 /* A single parameter declaration or parameter type name,
2566 as found in a parmlist. */
2568 declspecs_ts setspecs parm_declarator maybe_attribute
2569 { $$ = build_tree_list (build_tree_list (current_declspecs,
2571 chainon ($4, all_prefix_attributes));
2572 POP_DECLSPEC_STACK; }
2573 | declspecs_ts setspecs notype_declarator maybe_attribute
2574 { $$ = build_tree_list (build_tree_list (current_declspecs,
2576 chainon ($4, all_prefix_attributes));
2577 POP_DECLSPEC_STACK; }
2578 | declspecs_ts setspecs absdcl_maybe_attribute
2580 POP_DECLSPEC_STACK; }
2581 | declspecs_nots setspecs notype_declarator maybe_attribute
2582 { $$ = build_tree_list (build_tree_list (current_declspecs,
2584 chainon ($4, all_prefix_attributes));
2585 POP_DECLSPEC_STACK; }
2587 | declspecs_nots setspecs absdcl_maybe_attribute
2589 POP_DECLSPEC_STACK; }
2592 /* The first parm, which must suck attributes from off the top of the parser
2595 declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute
2596 { $$ = build_tree_list (build_tree_list (current_declspecs,
2598 chainon ($4, all_prefix_attributes));
2599 POP_DECLSPEC_STACK; }
2600 | declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
2601 { $$ = build_tree_list (build_tree_list (current_declspecs,
2603 chainon ($4, all_prefix_attributes));
2604 POP_DECLSPEC_STACK; }
2605 | declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
2607 POP_DECLSPEC_STACK; }
2608 | declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute
2609 { $$ = build_tree_list (build_tree_list (current_declspecs,
2611 chainon ($4, all_prefix_attributes));
2612 POP_DECLSPEC_STACK; }
2614 | declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute
2616 POP_DECLSPEC_STACK; }
2621 { prefix_attributes = chainon (prefix_attributes, $<ttype>-2);
2622 all_prefix_attributes = prefix_attributes; }
2625 /* This is used in a function definition
2626 where either a parmlist or an identifier list is ok.
2627 Its value is a list of ..._TYPE nodes or a list of identifiers. */
2628 parmlist_or_identifiers:
2631 clear_parm_order ();
2632 declare_parm_level (1); }
2633 parmlist_or_identifiers_1
2635 parmlist_tags_warning ();
2636 poplevel (0, 0, 0); }
2639 parmlist_or_identifiers_1:
2643 for (t = $1; t; t = TREE_CHAIN (t))
2644 if (TREE_VALUE (t) == NULL_TREE)
2645 error ("`...' in old-style identifier list");
2646 $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
2648 /* Make sure we have a parmlist after attributes. */
2650 && (TREE_CODE ($$) != TREE_LIST
2651 || TREE_PURPOSE ($$) == 0
2652 || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
2657 /* A nonempty list of identifiers. */
2660 { $$ = build_tree_list (NULL_TREE, $1); }
2661 | identifiers ',' IDENTIFIER
2662 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2665 /* A nonempty list of identifiers, including typenames. */
2666 identifiers_or_typenames:
2668 { $$ = build_tree_list (NULL_TREE, $1); }
2669 | identifiers_or_typenames ',' identifier
2670 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2675 { $$ = SAVE_EXT_FLAGS();
2677 warn_pointer_arith = 0;
2678 warn_traditional = 0;
2683 /* Objective-C productions. */
2693 if (objc_implementation_context)
2695 finish_class (objc_implementation_context);
2696 objc_ivar_chain = NULL_TREE;
2697 objc_implementation_context = NULL_TREE;
2700 warning ("`@end' must appear in an implementation context");
2704 /* A nonempty list of identifiers. */
2707 { $$ = build_tree_list (NULL_TREE, $1); }
2708 | identifier_list ',' identifier
2709 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2713 CLASS identifier_list ';'
2715 objc_declare_class ($2);
2720 ALIAS identifier identifier ';'
2722 objc_declare_alias ($2, $3);
2727 INTERFACE identifier protocolrefs '{'
2729 objc_interface_context = objc_ivar_context
2730 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2731 objc_public_flag = 0;
2735 continue_class (objc_interface_context);
2740 finish_class (objc_interface_context);
2741 objc_interface_context = NULL_TREE;
2744 | INTERFACE identifier protocolrefs
2746 objc_interface_context
2747 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2748 continue_class (objc_interface_context);
2753 finish_class (objc_interface_context);
2754 objc_interface_context = NULL_TREE;
2757 | INTERFACE identifier ':' identifier protocolrefs '{'
2759 objc_interface_context = objc_ivar_context
2760 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2761 objc_public_flag = 0;
2765 continue_class (objc_interface_context);
2770 finish_class (objc_interface_context);
2771 objc_interface_context = NULL_TREE;
2774 | INTERFACE identifier ':' identifier protocolrefs
2776 objc_interface_context
2777 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2778 continue_class (objc_interface_context);
2783 finish_class (objc_interface_context);
2784 objc_interface_context = NULL_TREE;
2787 | IMPLEMENTATION identifier '{'
2789 objc_implementation_context = objc_ivar_context
2790 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2791 objc_public_flag = 0;
2796 = continue_class (objc_implementation_context);
2799 | IMPLEMENTATION identifier
2801 objc_implementation_context
2802 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2804 = continue_class (objc_implementation_context);
2807 | IMPLEMENTATION identifier ':' identifier '{'
2809 objc_implementation_context = objc_ivar_context
2810 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2811 objc_public_flag = 0;
2816 = continue_class (objc_implementation_context);
2819 | IMPLEMENTATION identifier ':' identifier
2821 objc_implementation_context
2822 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2824 = continue_class (objc_implementation_context);
2827 | INTERFACE identifier '(' identifier ')' protocolrefs
2829 objc_interface_context
2830 = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6);
2831 continue_class (objc_interface_context);
2836 finish_class (objc_interface_context);
2837 objc_interface_context = NULL_TREE;
2840 | IMPLEMENTATION identifier '(' identifier ')'
2842 objc_implementation_context
2843 = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2845 = continue_class (objc_implementation_context);
2850 PROTOCOL identifier protocolrefs
2852 objc_pq_context = 1;
2853 objc_interface_context
2854 = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
2858 objc_pq_context = 0;
2859 finish_protocol(objc_interface_context);
2860 objc_interface_context = NULL_TREE;
2862 /* The @protocol forward-declaration production introduces a
2863 reduce/reduce conflict on ';', which should be resolved in
2864 favor of the production 'identifier_list -> identifier'. */
2865 | PROTOCOL identifier_list ';'
2867 objc_declare_protocols ($2);
2876 | non_empty_protocolrefs
2879 non_empty_protocolrefs:
2880 ARITHCOMPARE identifier_list ARITHCOMPARE
2882 if ($1 == LT_EXPR && $3 == GT_EXPR)
2890 ivar_decl_list visibility_spec ivar_decls
2895 PRIVATE { objc_public_flag = 2; }
2896 | PROTECTED { objc_public_flag = 0; }
2897 | PUBLIC { objc_public_flag = 1; }
2905 | ivar_decls ivar_decl ';'
2909 pedwarn ("extra semicolon in struct or union specified");
2914 /* There is a shift-reduce conflict here, because `components' may
2915 start with a `typename'. It happens that shifting (the default resolution)
2916 does the right thing, because it treats the `typename' as part of
2917 a `typed_typespecs'.
2919 It is possible that this same technique would allow the distinction
2920 between `notype_initdecls' and `initdecls' to be eliminated.
2921 But I am being cautious and not trying it. */
2924 declspecs_nosc_ts setspecs ivars
2926 POP_DECLSPEC_STACK; }
2927 | declspecs_nosc_nots setspecs ivars
2929 POP_DECLSPEC_STACK; }
2938 | ivars ',' maybe_resetattrs ivar_declarator
2944 $$ = add_instance_variable (objc_ivar_context,
2946 $1, current_declspecs,
2949 | declarator ':' expr_no_commas
2951 $$ = add_instance_variable (objc_ivar_context,
2953 $1, current_declspecs, $3);
2955 | ':' expr_no_commas
2957 $$ = add_instance_variable (objc_ivar_context,
2960 current_declspecs, $2);
2966 { objc_inherit_code = CLASS_METHOD_DECL; }
2968 { objc_inherit_code = INSTANCE_METHOD_DECL; }
2974 objc_pq_context = 1;
2975 if (!objc_implementation_context)
2976 fatal_error ("method definition not in class context");
2980 objc_pq_context = 0;
2981 if (objc_inherit_code == CLASS_METHOD_DECL)
2982 add_class_method (objc_implementation_context, $3);
2984 add_instance_method (objc_implementation_context, $3);
2985 start_method_def ($3);
2989 continue_method_def ();
2993 finish_method_def ();
2997 /* the reason for the strange actions in this rule
2998 is so that notype_initdecls when reached via datadef
2999 can find a valid list of type and sc specs in $0. */
3003 | {$<ttype>$ = NULL_TREE; } methodprotolist2
3006 methodprotolist2: /* eliminates a shift/reduce conflict */
3009 | methodprotolist2 methodproto
3010 | methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef
3021 /* Remember protocol qualifiers in prototypes. */
3022 objc_pq_context = 1;
3026 /* Forget protocol qualifiers here. */
3027 objc_pq_context = 0;
3028 if (objc_inherit_code == CLASS_METHOD_DECL)
3029 add_class_method (objc_interface_context, $3);
3031 add_instance_method (objc_interface_context, $3);
3037 '(' typename ')' unaryselector
3039 $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);
3044 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);
3047 | '(' typename ')' keywordselector optparmlist
3049 $$ = build_method_decl (objc_inherit_code, $2, $4, $5);
3052 | keywordselector optparmlist
3054 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);
3058 /* "optarglist" assumes that start_method_def has already been called...
3059 if it is not, the "xdecls" will not be placed in the proper scope */
3066 /* to get around the following situation: "int foo (int a) int b; {}" that
3067 is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */
3082 declspecs_ts setspecs myparms ';'
3083 { POP_DECLSPEC_STACK; }
3085 { shadow_tag ($1); }
3086 | declspecs_nots ';'
3087 { pedwarn ("empty declaration"); }
3092 { push_parm_decl ($1); }
3093 | myparms ',' myparm
3094 { push_parm_decl ($3); }
3097 /* A single parameter declaration or parameter type name,
3098 as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
3101 parm_declarator maybe_attribute
3102 { $$ = build_tree_list (build_tree_list (current_declspecs,
3104 chainon ($2, all_prefix_attributes)); }
3105 | notype_declarator maybe_attribute
3106 { $$ = build_tree_list (build_tree_list (current_declspecs,
3108 chainon ($2, all_prefix_attributes)); }
3109 | absdcl_maybe_attribute
3120 /* oh what a kludge! */
3121 $$ = objc_ellipsis_node;
3129 /* returns a tree list node generated by get_parm_info */
3142 | keywordselector keyworddecl
3144 $$ = chainon ($1, $2);
3157 ENUM | STRUCT | UNION | IF | ELSE | WHILE | DO | FOR
3158 | SWITCH | CASE | DEFAULT | BREAK | CONTINUE | RETURN
3159 | GOTO | ASM_KEYWORD | SIZEOF | TYPEOF | ALIGNOF
3160 | TYPESPEC | TYPE_QUAL
3164 selector ':' '(' typename ')' identifier
3166 $$ = build_keyword_decl ($1, $4, $6);
3169 | selector ':' identifier
3171 $$ = build_keyword_decl ($1, NULL_TREE, $3);
3174 | ':' '(' typename ')' identifier
3176 $$ = build_keyword_decl (NULL_TREE, $3, $5);
3181 $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
3192 | keywordarglist keywordarg
3194 $$ = chainon ($1, $2);
3202 if (TREE_CHAIN ($1) == NULL_TREE)
3203 /* just return the expr., remove a level of indirection */
3204 $$ = TREE_VALUE ($1);
3206 /* we have a comma expr., we will collapse later */
3212 selector ':' keywordexpr
3214 $$ = build_tree_list ($1, $3);
3218 $$ = build_tree_list (NULL_TREE, $2);
3226 $$ = get_class_reference ($1);
3231 '[' receiver messageargs ']'
3232 { $$ = build_tree_list ($2, $3); }
3242 | keywordnamelist keywordname
3244 $$ = chainon ($1, $2);
3251 $$ = build_tree_list ($1, NULL_TREE);
3255 $$ = build_tree_list (NULL_TREE, NULL_TREE);
3260 SELECTOR '(' selectorarg ')'
3267 PROTOCOL '(' identifier ')'
3273 /* extension to support C-structures in the archiver */
3276 ENCODE '(' typename ')'
3278 $$ = groktypename ($3);
3285 /* yylex() is a thin wrapper around c_lex(), all it does is translate
3286 cpplib.h's token codes into yacc's token codes. */
3288 static enum cpp_ttype last_token;
3290 /* The reserved keyword table. */
3294 ENUM_BITFIELD(rid) rid : 16;
3295 unsigned int disable : 16;
3298 /* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
3300 #define D_C89 0x01 /* not in C89 */
3301 #define D_EXT 0x02 /* GCC extension */
3302 #define D_EXT89 0x04 /* GCC extension incorporated in C99 */
3303 #define D_OBJC 0x08 /* Objective C only */
3305 static const struct resword reswords[] =
3307 { "_Bool", RID_BOOL, 0 },
3308 { "_Complex", RID_COMPLEX, 0 },
3309 { "__FUNCTION__", RID_FUNCTION_NAME, 0 },
3310 { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
3311 { "__alignof", RID_ALIGNOF, 0 },
3312 { "__alignof__", RID_ALIGNOF, 0 },
3313 { "__asm", RID_ASM, 0 },
3314 { "__asm__", RID_ASM, 0 },
3315 { "__attribute", RID_ATTRIBUTE, 0 },
3316 { "__attribute__", RID_ATTRIBUTE, 0 },
3317 { "__bounded", RID_BOUNDED, 0 },
3318 { "__bounded__", RID_BOUNDED, 0 },
3319 { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
3320 { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
3321 { "__builtin_va_arg", RID_VA_ARG, 0 },
3322 { "__complex", RID_COMPLEX, 0 },
3323 { "__complex__", RID_COMPLEX, 0 },
3324 { "__const", RID_CONST, 0 },
3325 { "__const__", RID_CONST, 0 },
3326 { "__extension__", RID_EXTENSION, 0 },
3327 { "__func__", RID_C99_FUNCTION_NAME, 0 },
3328 { "__imag", RID_IMAGPART, 0 },
3329 { "__imag__", RID_IMAGPART, 0 },
3330 { "__inline", RID_INLINE, 0 },
3331 { "__inline__", RID_INLINE, 0 },
3332 { "__label__", RID_LABEL, 0 },
3333 { "__ptrbase", RID_PTRBASE, 0 },
3334 { "__ptrbase__", RID_PTRBASE, 0 },
3335 { "__ptrextent", RID_PTREXTENT, 0 },
3336 { "__ptrextent__", RID_PTREXTENT, 0 },
3337 { "__ptrvalue", RID_PTRVALUE, 0 },
3338 { "__ptrvalue__", RID_PTRVALUE, 0 },
3339 { "__real", RID_REALPART, 0 },
3340 { "__real__", RID_REALPART, 0 },
3341 { "__restrict", RID_RESTRICT, 0 },
3342 { "__restrict__", RID_RESTRICT, 0 },
3343 { "__signed", RID_SIGNED, 0 },
3344 { "__signed__", RID_SIGNED, 0 },
3345 { "__thread", RID_THREAD, 0 },
3346 { "__typeof", RID_TYPEOF, 0 },
3347 { "__typeof__", RID_TYPEOF, 0 },
3348 { "__unbounded", RID_UNBOUNDED, 0 },
3349 { "__unbounded__", RID_UNBOUNDED, 0 },
3350 { "__volatile", RID_VOLATILE, 0 },
3351 { "__volatile__", RID_VOLATILE, 0 },
3352 { "asm", RID_ASM, D_EXT },
3353 { "auto", RID_AUTO, 0 },
3354 { "break", RID_BREAK, 0 },
3355 { "case", RID_CASE, 0 },
3356 { "char", RID_CHAR, 0 },
3357 { "const", RID_CONST, 0 },
3358 { "continue", RID_CONTINUE, 0 },
3359 { "default", RID_DEFAULT, 0 },
3360 { "do", RID_DO, 0 },
3361 { "double", RID_DOUBLE, 0 },
3362 { "else", RID_ELSE, 0 },
3363 { "enum", RID_ENUM, 0 },
3364 { "extern", RID_EXTERN, 0 },
3365 { "float", RID_FLOAT, 0 },
3366 { "for", RID_FOR, 0 },
3367 { "goto", RID_GOTO, 0 },
3368 { "if", RID_IF, 0 },
3369 { "inline", RID_INLINE, D_EXT89 },
3370 { "int", RID_INT, 0 },
3371 { "long", RID_LONG, 0 },
3372 { "register", RID_REGISTER, 0 },
3373 { "restrict", RID_RESTRICT, D_C89 },
3374 { "return", RID_RETURN, 0 },
3375 { "short", RID_SHORT, 0 },
3376 { "signed", RID_SIGNED, 0 },
3377 { "sizeof", RID_SIZEOF, 0 },
3378 { "static", RID_STATIC, 0 },
3379 { "struct", RID_STRUCT, 0 },
3380 { "switch", RID_SWITCH, 0 },
3381 { "typedef", RID_TYPEDEF, 0 },
3382 { "typeof", RID_TYPEOF, D_EXT },
3383 { "union", RID_UNION, 0 },
3384 { "unsigned", RID_UNSIGNED, 0 },
3385 { "void", RID_VOID, 0 },
3386 { "volatile", RID_VOLATILE, 0 },
3387 { "while", RID_WHILE, 0 },
3389 { "id", RID_ID, D_OBJC },
3391 /* These objc keywords are recognized only immediately after
3393 { "class", RID_AT_CLASS, D_OBJC },
3394 { "compatibility_alias", RID_AT_ALIAS, D_OBJC },
3395 { "defs", RID_AT_DEFS, D_OBJC },
3396 { "encode", RID_AT_ENCODE, D_OBJC },
3397 { "end", RID_AT_END, D_OBJC },
3398 { "implementation", RID_AT_IMPLEMENTATION, D_OBJC },
3399 { "interface", RID_AT_INTERFACE, D_OBJC },
3400 { "private", RID_AT_PRIVATE, D_OBJC },
3401 { "protected", RID_AT_PROTECTED, D_OBJC },
3402 { "protocol", RID_AT_PROTOCOL, D_OBJC },
3403 { "public", RID_AT_PUBLIC, D_OBJC },
3404 { "selector", RID_AT_SELECTOR, D_OBJC },
3406 /* These are recognized only in protocol-qualifier context
3408 { "bycopy", RID_BYCOPY, D_OBJC },
3409 { "byref", RID_BYREF, D_OBJC },
3410 { "in", RID_IN, D_OBJC },
3411 { "inout", RID_INOUT, D_OBJC },
3412 { "oneway", RID_ONEWAY, D_OBJC },
3413 { "out", RID_OUT, D_OBJC },
3416 #define N_reswords (sizeof reswords / sizeof (struct resword))
3418 /* Table mapping from RID_* constants to yacc token numbers.
3419 Unfortunately we have to have entries for all the keywords in all
3421 static const short rid_to_yy[RID_MAX] =
3423 /* RID_STATIC */ STATIC,
3424 /* RID_UNSIGNED */ TYPESPEC,
3425 /* RID_LONG */ TYPESPEC,
3426 /* RID_CONST */ TYPE_QUAL,
3427 /* RID_EXTERN */ SCSPEC,
3428 /* RID_REGISTER */ SCSPEC,
3429 /* RID_TYPEDEF */ SCSPEC,
3430 /* RID_SHORT */ TYPESPEC,
3431 /* RID_INLINE */ SCSPEC,
3432 /* RID_VOLATILE */ TYPE_QUAL,
3433 /* RID_SIGNED */ TYPESPEC,
3434 /* RID_AUTO */ SCSPEC,
3435 /* RID_RESTRICT */ TYPE_QUAL,
3438 /* RID_BOUNDED */ TYPE_QUAL,
3439 /* RID_UNBOUNDED */ TYPE_QUAL,
3440 /* RID_COMPLEX */ TYPESPEC,
3441 /* RID_THREAD */ SCSPEC,
3445 /* RID_VIRTUAL */ 0,
3446 /* RID_EXPLICIT */ 0,
3448 /* RID_MUTABLE */ 0,
3451 /* RID_IN */ TYPE_QUAL,
3452 /* RID_OUT */ TYPE_QUAL,
3453 /* RID_INOUT */ TYPE_QUAL,
3454 /* RID_BYCOPY */ TYPE_QUAL,
3455 /* RID_BYREF */ TYPE_QUAL,
3456 /* RID_ONEWAY */ TYPE_QUAL,
3459 /* RID_INT */ TYPESPEC,
3460 /* RID_CHAR */ TYPESPEC,
3461 /* RID_FLOAT */ TYPESPEC,
3462 /* RID_DOUBLE */ TYPESPEC,
3463 /* RID_VOID */ TYPESPEC,
3464 /* RID_ENUM */ ENUM,
3465 /* RID_STRUCT */ STRUCT,
3466 /* RID_UNION */ UNION,
3468 /* RID_ELSE */ ELSE,
3469 /* RID_WHILE */ WHILE,
3472 /* RID_SWITCH */ SWITCH,
3473 /* RID_CASE */ CASE,
3474 /* RID_DEFAULT */ DEFAULT,
3475 /* RID_BREAK */ BREAK,
3476 /* RID_CONTINUE */ CONTINUE,
3477 /* RID_RETURN */ RETURN,
3478 /* RID_GOTO */ GOTO,
3479 /* RID_SIZEOF */ SIZEOF,
3482 /* RID_ASM */ ASM_KEYWORD,
3483 /* RID_TYPEOF */ TYPEOF,
3484 /* RID_ALIGNOF */ ALIGNOF,
3485 /* RID_ATTRIBUTE */ ATTRIBUTE,
3486 /* RID_VA_ARG */ VA_ARG,
3487 /* RID_EXTENSION */ EXTENSION,
3488 /* RID_IMAGPART */ IMAGPART,
3489 /* RID_REALPART */ REALPART,
3490 /* RID_LABEL */ LABEL,
3491 /* RID_PTRBASE */ PTR_BASE,
3492 /* RID_PTREXTENT */ PTR_EXTENT,
3493 /* RID_PTRVALUE */ PTR_VALUE,
3495 /* RID_CHOOSE_EXPR */ CHOOSE_EXPR,
3496 /* RID_TYPES_COMPATIBLE_P */ TYPES_COMPATIBLE_P,
3498 /* RID_FUNCTION_NAME */ STRING_FUNC_NAME,
3499 /* RID_PRETTY_FUNCTION_NAME */ STRING_FUNC_NAME,
3500 /* RID_C99_FUNCTION_NAME */ VAR_FUNC_NAME,
3503 /* RID_BOOL */ TYPESPEC,
3507 /* RID_PRIVATE */ 0,
3508 /* RID_PROTECTED */ 0,
3509 /* RID_TEMPLATE */ 0,
3514 /* RID_NAMESPACE */ 0,
3516 /* RID_OPERATOR */ 0,
3521 /* RID_TYPENAME */ 0,
3526 /* RID_CONSTCAST */ 0,
3527 /* RID_DYNCAST */ 0,
3528 /* RID_REINTCAST */ 0,
3529 /* RID_STATCAST */ 0,
3532 /* RID_ID */ OBJECTNAME,
3533 /* RID_AT_ENCODE */ ENCODE,
3534 /* RID_AT_END */ END,
3535 /* RID_AT_CLASS */ CLASS,
3536 /* RID_AT_ALIAS */ ALIAS,
3537 /* RID_AT_DEFS */ DEFS,
3538 /* RID_AT_PRIVATE */ PRIVATE,
3539 /* RID_AT_PROTECTED */ PROTECTED,
3540 /* RID_AT_PUBLIC */ PUBLIC,
3541 /* RID_AT_PROTOCOL */ PROTOCOL,
3542 /* RID_AT_SELECTOR */ SELECTOR,
3543 /* RID_AT_INTERFACE */ INTERFACE,
3544 /* RID_AT_IMPLEMENTATION */ IMPLEMENTATION
3552 int mask = (flag_isoc99 ? 0 : D_C89)
3553 | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
3558 /* It is not necessary to register ridpointers as a GC root, because
3559 all the trees it points to are permanently interned in the
3560 get_identifier hash anyway. */
3561 ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
3562 for (i = 0; i < N_reswords; i++)
3564 /* If a keyword is disabled, do not enter it into the table
3565 and so create a canonical spelling that isn't a keyword. */
3566 if (reswords[i].disable & mask)
3569 id = get_identifier (reswords[i].word);
3570 C_RID_CODE (id) = reswords[i].rid;
3571 C_IS_RESERVED_WORD (id) = 1;
3572 ridpointers [(int) reswords[i].rid] = id;
3576 #define NAME(type) cpp_type2name (type)
3582 const char *string = _(msgid);
3584 if (last_token == CPP_EOF)
3585 error ("%s at end of input", string);
3586 else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
3588 unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
3589 const char *const ell = (last_token == CPP_CHAR) ? "" : "L";
3590 if (val <= UCHAR_MAX && ISGRAPH (val))
3591 error ("%s before %s'%c'", string, ell, val);
3593 error ("%s before %s'\\x%x'", string, ell, val);
3595 else if (last_token == CPP_STRING
3596 || last_token == CPP_WSTRING)
3597 error ("%s before string constant", string);
3598 else if (last_token == CPP_NUMBER)
3599 error ("%s before numeric constant", string);
3600 else if (last_token == CPP_NAME)
3601 error ("%s before \"%s\"", string, IDENTIFIER_POINTER (yylval.ttype));
3603 error ("%s before '%s' token", string, NAME(last_token));
3612 int objc_force_identifier = objc_need_raw_identifier;
3613 OBJC_NEED_RAW_IDENTIFIER (0);
3616 if (C_IS_RESERVED_WORD (yylval.ttype))
3618 enum rid rid_code = C_RID_CODE (yylval.ttype);
3621 /* Turn non-typedefed refs to "id" into plain identifiers; this
3622 allows constructs like "void foo(id id);" to work. */
3623 if (rid_code == RID_ID)
3625 decl = lookup_name (yylval.ttype);
3626 if (decl == NULL_TREE || TREE_CODE (decl) != TYPE_DECL)
3630 if (!OBJC_IS_AT_KEYWORD (rid_code)
3631 && (!OBJC_IS_PQ_KEYWORD (rid_code) || objc_pq_context))
3634 int yycode = rid_to_yy[(int) rid_code];
3635 if (yycode == STRING_FUNC_NAME)
3637 /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
3638 to string constants. */
3639 const char *name = fname_string (rid_code);
3641 yylval.ttype = build_string (strlen (name) + 1, name);
3642 C_ARTIFICIAL_STRING_P (yylval.ttype) = 1;
3643 last_token = CPP_STRING; /* so yyerror won't choke */
3647 /* Return the canonical spelling for this keyword. */
3648 yylval.ttype = ridpointers[(int) rid_code];
3653 decl = lookup_name (yylval.ttype);
3656 if (TREE_CODE (decl) == TYPE_DECL)
3662 tree objc_interface_decl = is_class_name (yylval.ttype);
3663 /* ObjC class names are in the same namespace as variables and
3664 typedefs, and hence are shadowed by local declarations. */
3665 if (objc_interface_decl
3666 && (global_bindings_p ()
3667 || (!objc_force_identifier && !decl)))
3669 yylval.ttype = objc_interface_decl;
3678 /* Concatenate strings before returning them to the parser. This isn't quite
3679 as good as having it done in the lexer, but it's better than nothing. */
3684 enum cpp_ttype next_type;
3685 tree orig = yylval.ttype;
3687 next_type = c_lex (&yylval.ttype);
3688 if (next_type == CPP_STRING
3689 || next_type == CPP_WSTRING
3690 || (next_type == CPP_NAME && yylexname () == STRING))
3692 varray_type strings;
3695 static int last_lineno = 0;
3696 static const char *last_input_filename = 0;
3697 if (warn_traditional && !in_system_header
3698 && (lineno != last_lineno || !last_input_filename ||
3699 strcmp (last_input_filename, input_filename)))
3701 warning ("traditional C rejects string concatenation");
3702 last_lineno = lineno;
3703 last_input_filename = input_filename;
3707 VARRAY_TREE_INIT (strings, 32, "strings");
3708 VARRAY_PUSH_TREE (strings, orig);
3712 VARRAY_PUSH_TREE (strings, yylval.ttype);
3713 next_type = c_lex (&yylval.ttype);
3715 while (next_type == CPP_STRING
3716 || next_type == CPP_WSTRING
3717 || (next_type == CPP_NAME && yylexname () == STRING));
3719 yylval.ttype = combine_strings (strings);
3722 yylval.ttype = orig;
3724 /* We will have always read one token too many. */
3725 _cpp_backup_tokens (parse_in, 1);
3734 last_token = c_lex (&yylval.ttype);
3737 case CPP_EQ: return '=';
3738 case CPP_NOT: return '!';
3739 case CPP_GREATER: yylval.code = GT_EXPR; return ARITHCOMPARE;
3740 case CPP_LESS: yylval.code = LT_EXPR; return ARITHCOMPARE;
3741 case CPP_PLUS: yylval.code = PLUS_EXPR; return '+';
3742 case CPP_MINUS: yylval.code = MINUS_EXPR; return '-';
3743 case CPP_MULT: yylval.code = MULT_EXPR; return '*';
3744 case CPP_DIV: yylval.code = TRUNC_DIV_EXPR; return '/';
3745 case CPP_MOD: yylval.code = TRUNC_MOD_EXPR; return '%';
3746 case CPP_AND: yylval.code = BIT_AND_EXPR; return '&';
3747 case CPP_OR: yylval.code = BIT_IOR_EXPR; return '|';
3748 case CPP_XOR: yylval.code = BIT_XOR_EXPR; return '^';
3749 case CPP_RSHIFT: yylval.code = RSHIFT_EXPR; return RSHIFT;
3750 case CPP_LSHIFT: yylval.code = LSHIFT_EXPR; return LSHIFT;
3752 case CPP_COMPL: return '~';
3753 case CPP_AND_AND: return ANDAND;
3754 case CPP_OR_OR: return OROR;
3755 case CPP_QUERY: return '?';
3756 case CPP_OPEN_PAREN: return '(';
3757 case CPP_EQ_EQ: yylval.code = EQ_EXPR; return EQCOMPARE;
3758 case CPP_NOT_EQ: yylval.code = NE_EXPR; return EQCOMPARE;
3759 case CPP_GREATER_EQ:yylval.code = GE_EXPR; return ARITHCOMPARE;
3760 case CPP_LESS_EQ: yylval.code = LE_EXPR; return ARITHCOMPARE;
3762 case CPP_PLUS_EQ: yylval.code = PLUS_EXPR; return ASSIGN;
3763 case CPP_MINUS_EQ: yylval.code = MINUS_EXPR; return ASSIGN;
3764 case CPP_MULT_EQ: yylval.code = MULT_EXPR; return ASSIGN;
3765 case CPP_DIV_EQ: yylval.code = TRUNC_DIV_EXPR; return ASSIGN;
3766 case CPP_MOD_EQ: yylval.code = TRUNC_MOD_EXPR; return ASSIGN;
3767 case CPP_AND_EQ: yylval.code = BIT_AND_EXPR; return ASSIGN;
3768 case CPP_OR_EQ: yylval.code = BIT_IOR_EXPR; return ASSIGN;
3769 case CPP_XOR_EQ: yylval.code = BIT_XOR_EXPR; return ASSIGN;
3770 case CPP_RSHIFT_EQ: yylval.code = RSHIFT_EXPR; return ASSIGN;
3771 case CPP_LSHIFT_EQ: yylval.code = LSHIFT_EXPR; return ASSIGN;
3773 case CPP_OPEN_SQUARE: return '[';
3774 case CPP_CLOSE_SQUARE: return ']';
3775 case CPP_OPEN_BRACE: return '{';
3776 case CPP_CLOSE_BRACE: return '}';
3777 case CPP_ELLIPSIS: return ELLIPSIS;
3779 case CPP_PLUS_PLUS: return PLUSPLUS;
3780 case CPP_MINUS_MINUS: return MINUSMINUS;
3781 case CPP_DEREF: return POINTSAT;
3782 case CPP_DOT: return '.';
3784 /* The following tokens may affect the interpretation of any
3785 identifiers following, if doing Objective-C. */
3786 case CPP_COLON: OBJC_NEED_RAW_IDENTIFIER (0); return ':';
3787 case CPP_COMMA: OBJC_NEED_RAW_IDENTIFIER (0); return ',';
3788 case CPP_CLOSE_PAREN: OBJC_NEED_RAW_IDENTIFIER (0); return ')';
3789 case CPP_SEMICOLON: OBJC_NEED_RAW_IDENTIFIER (0); return ';';
3796 int ret = yylexname ();
3798 return yylexstring ();
3810 return yylexstring ();
3812 /* This token is Objective-C specific. It gives the next token
3813 special significance. */
3818 enum cpp_ttype after_at_type;
3820 after_at_type = c_lex (&after_at);
3822 if (after_at_type == CPP_NAME
3823 && C_IS_RESERVED_WORD (after_at)
3824 && OBJC_IS_AT_KEYWORD (C_RID_CODE (after_at)))
3826 yylval.ttype = after_at;
3827 last_token = after_at_type;
3828 return rid_to_yy [(int) C_RID_CODE (after_at)];
3830 _cpp_backup_tokens (parse_in, 1);
3835 /* These tokens are C++ specific (and will not be generated
3836 in C mode, but let's be cautious). */
3838 case CPP_DEREF_STAR:
3844 /* These tokens should not survive translation phase 4. */
3847 error ("syntax error at '%s' token", NAME(last_token));
3860 timevar_push (TV_LEX);
3862 timevar_pop (TV_LEX);
3866 /* Function used when yydebug is set, to print a token in more detail. */
3869 yyprint (file, yychar, yyl)
3876 fprintf (file, " [%s]", NAME(last_token));
3887 if (IDENTIFIER_POINTER (t))
3888 fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
3892 fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
3893 if (TREE_CODE (t) == INTEGER_CST)
3896 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
3897 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
3903 /* This is not the ideal place to put these, but we have to get them out
3904 of c-lex.c because cp/lex.c has its own versions. */
3906 /* Free malloced parser stacks if necessary. */
3909 free_parser_stacks ()
3913 free (malloced_yyss);
3914 free (malloced_yyvs);
3918 #include "gt-c-parse.h"