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 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 31 /* shift/reduce conflicts, and 1 reduce/reduce conflict. */
35 %expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts. */
46 #include "c-lex.h" /* Gets YYDEBUG macro. */
54 #ifdef MULTIBYTE_CHARS
62 /* Like YYERROR but do call yyerror. */
63 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
65 /* Like the default stack expander, except (1) use realloc when possible,
66 and (2) impose no hard maxiumum on stack size. */
67 #define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \
72 newsize = *(YYSSZ) *= 2; \
76 really_call_realloc (*(SS), newsize * sizeof (short)); \
78 really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \
82 newss = (short *) really_call_malloc (newsize * sizeof (short)); \
84 memcpy (newss, *(SS), (SSSIZE)); \
85 newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \
87 memcpy (newvs, *(VS), (VSSIZE)); \
89 if (!newss || !newvs) \
103 %union {long itype; tree ttype; enum tree_code code;
104 const char *filename; int lineno; }
106 /* All identifiers that are not reserved words
107 and are not declared typedefs in the current block */
110 /* All identifiers that are declared typedefs in the current block.
111 In some contexts, they are treated just like IDENTIFIER,
112 but they can also serve as typespecs in declarations. */
115 /* Reserved words that specify storage class.
116 yylval contains an IDENTIFIER_NODE which indicates which one. */
117 %token SCSPEC /* Storage class other than static. */
118 %token STATIC /* Static storage class. */
120 /* Reserved words that specify type.
121 yylval contains an IDENTIFIER_NODE which indicates which one. */
124 /* Reserved words that qualify type: "const", "volatile", or "restrict".
125 yylval contains an IDENTIFIER_NODE which indicates which one. */
128 /* Character or numeric constants.
129 yylval is the node for the constant. */
132 /* String constants in raw form.
133 yylval is a STRING_CST node. */
136 /* "...", used for functions with variable arglists. */
139 /* the reserved words */
140 /* SCO include files test "ASM", so use something else. */
141 %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
142 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
143 %token ATTRIBUTE EXTENSION LABEL
144 %token REALPART IMAGPART VA_ARG CHOOSE_EXPR TYPES_COMPATIBLE_P
145 %token PTR_VALUE PTR_BASE PTR_EXTENT
147 /* function name can be a string const or a var decl. */
148 %token STRING_FUNC_NAME VAR_FUNC_NAME
150 /* Add precedence rules to solve dangling else s/r conflict */
154 /* Define the operator tokens and their precedences.
155 The value is an integer because, if used, it is the tree code
156 to use in the expression made from the operator. */
158 %right <code> ASSIGN '='
159 %right <code> '?' ':'
165 %left <code> EQCOMPARE
166 %left <code> ARITHCOMPARE
167 %left <code> LSHIFT RSHIFT
169 %left <code> '*' '/' '%'
170 %right <code> UNARY PLUSPLUS MINUSMINUS
172 %left <code> POINTSAT '.' '(' '['
174 /* The Objective-C keywords. These are included in C and in
175 Objective C, so that the token codes are the same in both. */
176 %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
177 %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
180 %type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
181 %type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
183 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
184 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
185 %type <ttype> declspecs_nosc_nots_nosa_noea declspecs_nosc_nots_nosa_ea
186 %type <ttype> declspecs_nosc_nots_sa_noea declspecs_nosc_nots_sa_ea
187 %type <ttype> declspecs_nosc_ts_nosa_noea declspecs_nosc_ts_nosa_ea
188 %type <ttype> declspecs_nosc_ts_sa_noea declspecs_nosc_ts_sa_ea
189 %type <ttype> declspecs_sc_nots_nosa_noea declspecs_sc_nots_nosa_ea
190 %type <ttype> declspecs_sc_nots_sa_noea declspecs_sc_nots_sa_ea
191 %type <ttype> declspecs_sc_ts_nosa_noea declspecs_sc_ts_nosa_ea
192 %type <ttype> declspecs_sc_ts_sa_noea declspecs_sc_ts_sa_ea
193 %type <ttype> declspecs_ts declspecs_nots
194 %type <ttype> declspecs_ts_nosa declspecs_nots_nosa
195 %type <ttype> declspecs_nosc_ts declspecs_nosc_nots declspecs_nosc declspecs
196 %type <ttype> maybe_type_quals_attrs typespec_nonattr typespec_attr
197 %type <ttype> typespec_reserved_nonattr typespec_reserved_attr
198 %type <ttype> typespec_nonreserved_nonattr
200 %type <ttype> scspec SCSPEC STATIC TYPESPEC TYPE_QUAL maybe_type_qual
201 %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
202 %type <ttype> init maybeasm
203 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
204 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
205 %type <ttype> any_word extension
207 %type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
208 %type <ttype> do_stmt_start poplevel stmt label
210 %type <ttype> c99_block_start c99_block_end
211 %type <ttype> declarator
212 %type <ttype> notype_declarator after_type_declarator
213 %type <ttype> parm_declarator
214 %type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename
215 %type <ttype> array_declarator
217 %type <ttype> structsp_attr structsp_nonattr
218 %type <ttype> component_decl_list component_decl_list2
219 %type <ttype> component_decl components components_notype component_declarator
220 %type <ttype> component_notype_declarator
221 %type <ttype> enumlist enumerator
222 %type <ttype> struct_head union_head enum_head
223 %type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea
224 %type <ttype> direct_absdcl1 absdcl_maybe_attribute
225 %type <ttype> xexpr parms parm firstparm identifiers
227 %type <ttype> parmlist parmlist_1 parmlist_2
228 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
229 %type <ttype> identifiers_or_typenames
231 %type <itype> setspecs setspecs_fp
233 %type <filename> save_filename
234 %type <lineno> save_lineno
237 /* the Objective-C nonterminals */
239 %type <ttype> ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator
240 %type <ttype> methoddecl unaryselector keywordselector selector
241 %type <ttype> keyworddecl receiver objcmessageexpr messageargs
242 %type <ttype> keywordexpr keywordarglist keywordarg
243 %type <ttype> myparms myparm optparmlist reservedwords objcselectorexpr
244 %type <ttype> selectorarg keywordnamelist keywordname objcencodeexpr
245 %type <ttype> objc_string non_empty_protocolrefs protocolrefs identifier_list objcprotocolexpr
247 %type <ttype> CLASSNAME OBJECTNAME
251 /* Number of statements (loosely speaking) and compound statements
253 static int stmt_count;
254 static int compstmt_count;
256 /* Input file and line number of the end of the body of last simple_if;
257 used by the stmt-rule immediately after simple_if returns. */
258 static const char *if_stmt_file;
259 static int if_stmt_line;
261 /* List of types and structure classes of the current declaration. */
262 static tree current_declspecs = NULL_TREE;
263 static tree prefix_attributes = NULL_TREE;
265 /* List of all the attributes applying to the identifier currently being
266 declared; includes prefix_attributes and possibly some more attributes
267 just after a comma. */
268 static tree all_prefix_attributes = NULL_TREE;
270 /* Stack of saved values of current_declspecs, prefix_attributes and
271 all_prefix_attributes. */
272 static tree declspec_stack;
274 /* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
275 should be called from the productions making use of setspecs. */
276 #define PUSH_DECLSPEC_STACK \
278 declspec_stack = tree_cons (build_tree_list (prefix_attributes, \
279 all_prefix_attributes), \
284 #define POP_DECLSPEC_STACK \
286 current_declspecs = TREE_VALUE (declspec_stack); \
287 prefix_attributes = TREE_PURPOSE (TREE_PURPOSE (declspec_stack)); \
288 all_prefix_attributes = TREE_VALUE (TREE_PURPOSE (declspec_stack)); \
289 declspec_stack = TREE_CHAIN (declspec_stack); \
292 /* For __extension__, save/restore the warning flags which are
293 controlled by __extension__. */
294 #define SAVE_WARN_FLAGS() \
296 | (warn_pointer_arith << 1) \
297 | (warn_traditional << 2))
299 #define RESTORE_WARN_FLAGS(tval) \
301 int val = tree_low_cst (tval, 0); \
302 pedantic = val & 1; \
303 warn_pointer_arith = (val >> 1) & 1; \
304 warn_traditional = (val >> 2) & 1; \
308 /* Objective-C specific parser/lexer information */
310 static enum tree_code objc_inherit_code;
311 static int objc_pq_context = 0, objc_public_flag = 0;
313 /* The following flag is needed to contextualize ObjC lexical analysis.
314 In some cases (e.g., 'int NSObject;'), it is undesirable to bind
315 an identifier to an ObjC class, even if a class with that name
317 static int objc_need_raw_identifier;
318 #define OBJC_NEED_RAW_IDENTIFIER(VAL) objc_need_raw_identifier = VAL
322 #define OBJC_NEED_RAW_IDENTIFIER(VAL) /* nothing */
325 /* Tell yyparse how to print a token's value, if yydebug is set. */
327 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
329 static void yyprint PARAMS ((FILE *, int, YYSTYPE));
330 static void yyerror PARAMS ((const char *));
331 static int yylexname PARAMS ((void));
332 static inline int _yylex PARAMS ((void));
333 static int yylex PARAMS ((void));
334 static void init_reswords PARAMS ((void));
336 /* Add GC roots for variables local to this file. */
342 ggc_add_tree_root (&declspec_stack, 1);
343 ggc_add_tree_root (¤t_declspecs, 1);
344 ggc_add_tree_root (&prefix_attributes, 1);
345 ggc_add_tree_root (&all_prefix_attributes, 1);
353 pedwarn ("ISO C forbids an empty source file");
358 /* In case there were missing closebraces,
359 get us back to the global binding level. */
360 while (! global_bindings_p ())
362 /* __FUNCTION__ is defined at file scope (""). This
363 call may not be necessary as my tests indicate it
364 still works without it. */
365 finish_fname_decls ();
370 /* the reason for the strange actions in this rule
371 is so that notype_initdecls when reached via datadef
372 can find a valid list of type and sc specs in $0. */
375 {$<ttype>$ = NULL_TREE; } extdef
376 | extdefs {$<ttype>$ = NULL_TREE; ggc_collect(); } extdef
385 | ASM_KEYWORD '(' expr ')' ';'
387 if ((TREE_CODE ($3) == ADDR_EXPR
388 && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
389 || TREE_CODE ($3) == STRING_CST)
392 error ("argument of `asm' is not a constant string"); }
394 { RESTORE_WARN_FLAGS ($1); }
398 setspecs notype_initdecls ';'
400 error ("ISO C forbids data definition with no type or storage class");
402 warning ("data definition has no type or storage class");
404 POP_DECLSPEC_STACK; }
405 | declspecs_nots setspecs notype_initdecls ';'
406 { POP_DECLSPEC_STACK; }
407 | declspecs_ts setspecs initdecls ';'
408 { POP_DECLSPEC_STACK; }
415 pedwarn ("ISO C does not allow extra `;' outside of a function"); }
419 declspecs_ts setspecs declarator
420 { if (! start_function (current_declspecs, $3,
421 all_prefix_attributes))
425 { store_parm_decls (); }
426 save_filename save_lineno compstmt_or_error
427 { DECL_SOURCE_FILE (current_function_decl) = $7;
428 DECL_SOURCE_LINE (current_function_decl) = $8;
429 finish_function (0, 1);
430 POP_DECLSPEC_STACK; }
431 | declspecs_ts setspecs declarator error
432 { POP_DECLSPEC_STACK; }
433 | declspecs_nots setspecs notype_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_nots setspecs notype_declarator error
446 { POP_DECLSPEC_STACK; }
447 | setspecs notype_declarator
448 { if (! start_function (NULL_TREE, $2,
449 all_prefix_attributes))
453 { store_parm_decls (); }
454 save_filename save_lineno compstmt_or_error
455 { DECL_SOURCE_FILE (current_function_decl) = $6;
456 DECL_SOURCE_LINE (current_function_decl) = $7;
457 finish_function (0, 1);
458 POP_DECLSPEC_STACK; }
459 | setspecs notype_declarator error
460 { POP_DECLSPEC_STACK; }
475 { $$ = NEGATE_EXPR; }
479 if (warn_traditional && !in_system_header)
480 warning ("traditional C rejects the unary plus operator");
484 { $$ = PREINCREMENT_EXPR; }
486 { $$ = PREDECREMENT_EXPR; }
488 { $$ = BIT_NOT_EXPR; }
490 { $$ = TRUTH_NOT_EXPR; }
493 expr: nonnull_exprlist
494 { $$ = build_compound_expr ($1); }
505 { $$ = build_tree_list (NULL_TREE, $1); }
506 | nonnull_exprlist ',' expr_no_commas
507 { chainon ($1, build_tree_list (NULL_TREE, $3)); }
512 | '*' cast_expr %prec UNARY
513 { $$ = build_indirect_ref ($2, "unary *"); }
514 /* __extension__ turns off -pedantic for following primary. */
515 | extension cast_expr %prec UNARY
517 RESTORE_WARN_FLAGS ($1); }
518 | unop cast_expr %prec UNARY
519 { $$ = build_unary_op ($1, $2, 0);
520 overflow_warning ($$); }
521 /* Refer to the address of a label as a pointer. */
523 { $$ = finish_label_address_expr ($2); }
524 /* This seems to be impossible on some machines, so let's turn it off.
525 You can use __builtin_next_arg to find the anonymous stack args.
527 { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
528 $$ = error_mark_node;
529 if (TREE_VALUE (tree_last (types)) == void_type_node)
530 error ("`&...' used in function with fixed number of arguments");
534 pedwarn ("ISO C forbids `&...'");
535 $$ = tree_last (DECL_ARGUMENTS (current_function_decl));
536 $$ = build_unary_op (ADDR_EXPR, $$, 0);
539 | sizeof unary_expr %prec UNARY
541 if (TREE_CODE ($2) == COMPONENT_REF
542 && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
543 error ("`sizeof' applied to a bit-field");
544 $$ = c_sizeof (TREE_TYPE ($2)); }
545 | sizeof '(' typename ')' %prec HYPERUNARY
547 $$ = c_sizeof (groktypename ($3)); }
548 | alignof unary_expr %prec UNARY
550 $$ = c_alignof_expr ($2); }
551 | alignof '(' typename ')' %prec HYPERUNARY
553 $$ = c_alignof (groktypename ($3)); }
554 | REALPART cast_expr %prec UNARY
555 { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
556 | IMAGPART cast_expr %prec UNARY
557 { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
561 SIZEOF { skip_evaluation++; }
565 ALIGNOF { skip_evaluation++; }
570 | '(' typename ')' cast_expr %prec UNARY
571 { $$ = c_cast_expr ($2, $4); }
576 | expr_no_commas '+' expr_no_commas
577 { $$ = parser_build_binary_op ($2, $1, $3); }
578 | expr_no_commas '-' expr_no_commas
579 { $$ = parser_build_binary_op ($2, $1, $3); }
580 | expr_no_commas '*' expr_no_commas
581 { $$ = parser_build_binary_op ($2, $1, $3); }
582 | expr_no_commas '/' expr_no_commas
583 { $$ = parser_build_binary_op ($2, $1, $3); }
584 | expr_no_commas '%' expr_no_commas
585 { $$ = parser_build_binary_op ($2, $1, $3); }
586 | expr_no_commas LSHIFT expr_no_commas
587 { $$ = parser_build_binary_op ($2, $1, $3); }
588 | expr_no_commas RSHIFT expr_no_commas
589 { $$ = parser_build_binary_op ($2, $1, $3); }
590 | expr_no_commas ARITHCOMPARE expr_no_commas
591 { $$ = parser_build_binary_op ($2, $1, $3); }
592 | expr_no_commas EQCOMPARE expr_no_commas
593 { $$ = parser_build_binary_op ($2, $1, $3); }
594 | expr_no_commas '&' expr_no_commas
595 { $$ = parser_build_binary_op ($2, $1, $3); }
596 | expr_no_commas '|' expr_no_commas
597 { $$ = parser_build_binary_op ($2, $1, $3); }
598 | expr_no_commas '^' expr_no_commas
599 { $$ = parser_build_binary_op ($2, $1, $3); }
600 | expr_no_commas ANDAND
601 { $1 = c_common_truthvalue_conversion
602 (default_conversion ($1));
603 skip_evaluation += $1 == boolean_false_node; }
605 { skip_evaluation -= $1 == boolean_false_node;
606 $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
607 | expr_no_commas OROR
608 { $1 = c_common_truthvalue_conversion
609 (default_conversion ($1));
610 skip_evaluation += $1 == boolean_true_node; }
612 { skip_evaluation -= $1 == boolean_true_node;
613 $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
615 { $1 = c_common_truthvalue_conversion
616 (default_conversion ($1));
617 skip_evaluation += $1 == boolean_false_node; }
619 { skip_evaluation += (($1 == boolean_true_node)
620 - ($1 == boolean_false_node)); }
622 { skip_evaluation -= $1 == boolean_true_node;
623 $$ = build_conditional_expr ($1, $4, $7); }
626 pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
627 /* Make sure first operand is calculated only once. */
628 $<ttype>2 = save_expr ($1);
629 $1 = c_common_truthvalue_conversion
630 (default_conversion ($<ttype>2));
631 skip_evaluation += $1 == boolean_true_node; }
633 { skip_evaluation -= $1 == boolean_true_node;
634 $$ = build_conditional_expr ($1, $<ttype>2, $5); }
635 | expr_no_commas '=' expr_no_commas
637 $$ = build_modify_expr ($1, NOP_EXPR, $3);
638 class = TREE_CODE_CLASS (TREE_CODE ($$));
639 if (IS_EXPR_CODE_CLASS (class))
640 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
642 | expr_no_commas ASSIGN expr_no_commas
644 $$ = build_modify_expr ($1, $2, $3);
645 /* This inhibits warnings in
646 c_common_truthvalue_conversion. */
647 class = TREE_CODE_CLASS (TREE_CODE ($$));
648 if (IS_EXPR_CODE_CLASS (class))
649 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
656 if (yychar == YYEMPTY)
658 $$ = build_external_ref ($1, yychar == '(');
662 { $$ = combine_strings ($1); }
664 { $$ = fname_decl (C_RID_CODE ($$), $$); }
665 | '(' typename ')' '{'
666 { start_init (NULL_TREE, NULL, 0);
667 $2 = groktypename ($2);
668 really_start_incremental_init ($2); }
669 initlist_maybe_comma '}' %prec UNARY
670 { tree constructor = pop_init_level (0);
674 if (pedantic && ! flag_isoc99)
675 pedwarn ("ISO C89 forbids compound literals");
676 $$ = build_compound_literal (type, constructor);
679 { char class = TREE_CODE_CLASS (TREE_CODE ($2));
680 if (IS_EXPR_CODE_CLASS (class))
681 C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
684 { $$ = error_mark_node; }
685 | compstmt_primary_start compstmt_nostart ')'
686 { tree saved_last_tree;
689 pedwarn ("ISO C forbids braced-groups within expressions");
692 saved_last_tree = COMPOUND_BODY ($1);
693 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
694 last_tree = saved_last_tree;
695 TREE_CHAIN (last_tree) = NULL_TREE;
697 last_expr_type = void_type_node;
698 $$ = build1 (STMT_EXPR, last_expr_type, $1);
699 TREE_SIDE_EFFECTS ($$) = 1;
701 | compstmt_primary_start error ')'
704 last_tree = COMPOUND_BODY ($1);
705 TREE_CHAIN (last_tree) = NULL_TREE;
706 $$ = error_mark_node;
708 | primary '(' exprlist ')' %prec '.'
709 { $$ = build_function_call ($1, $3); }
710 | VA_ARG '(' expr_no_commas ',' typename ')'
711 { $$ = build_va_arg ($3, groktypename ($5)); }
713 | CHOOSE_EXPR '(' expr_no_commas ',' expr_no_commas ',' expr_no_commas ')'
719 if (TREE_CODE (c) != INTEGER_CST)
720 error ("first argument to __builtin_choose_expr not a constant");
721 $$ = integer_zerop (c) ? $7 : $5;
723 | TYPES_COMPATIBLE_P '(' typename ',' typename ')'
727 e1 = TYPE_MAIN_VARIANT (groktypename ($3));
728 e2 = TYPE_MAIN_VARIANT (groktypename ($5));
730 $$ = comptypes (e1, e2)
731 ? build_int_2 (1, 0) : build_int_2 (0, 0);
733 | primary '[' expr ']' %prec '.'
734 { $$ = build_array_ref ($1, $3); }
735 | primary '.' identifier
738 if (!is_public ($1, $3))
739 $$ = error_mark_node;
742 $$ = build_component_ref ($1, $3);
744 | primary POINTSAT identifier
746 tree expr = build_indirect_ref ($1, "->");
749 if (!is_public (expr, $3))
750 $$ = error_mark_node;
753 $$ = build_component_ref (expr, $3);
756 { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
758 { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
761 { $$ = build_message_expr ($1); }
763 { $$ = build_selector_expr ($1); }
765 { $$ = build_protocol_expr ($1); }
767 { $$ = build_encode_expr ($1); }
769 { $$ = build_objc_string_object ($1); }
773 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
779 static int last_lineno = 0;
780 static const char *last_input_filename = 0;
782 $$ = chainon ($1, $2);
784 if (warn_traditional && !in_system_header
785 && (lineno != last_lineno || !last_input_filename ||
786 strcmp (last_input_filename, input_filename)))
788 warning ("traditional C rejects string concatenation");
789 last_lineno = lineno;
790 last_input_filename = input_filename;
797 /* Produces an STRING_CST with perhaps more STRING_CSTs chained
798 onto it, which is to be read as an ObjC string object. */
802 | objc_string '@' STRING
803 { $$ = chainon ($1, $3); }
807 old_style_parm_decls:
811 /* ... is used here to indicate a varargs function. */
814 pedwarn ("ISO C does not permit use of `varargs.h'"); }
817 /* The following are analogous to lineno_decl, decls and decl
818 except that they do not allow nested functions.
819 They are used for old-style parm decls. */
821 save_filename save_lineno datadecl
828 | datadecls lineno_datadecl
829 | lineno_datadecl errstmt
832 /* We don't allow prefix attributes here because they cause reduce/reduce
833 conflicts: we can't know whether we're parsing a function decl with
834 attribute suffix, or function defn with attribute prefix on first old
837 declspecs_ts_nosa setspecs initdecls ';'
838 { POP_DECLSPEC_STACK; }
839 | declspecs_nots_nosa setspecs notype_initdecls ';'
840 { POP_DECLSPEC_STACK; }
841 | declspecs_ts_nosa ';'
842 { shadow_tag_warned ($1, 1);
843 pedwarn ("empty declaration"); }
844 | declspecs_nots_nosa ';'
845 { pedwarn ("empty declaration"); }
848 /* This combination which saves a lineno before a decl
849 is the normal thing to use, rather than decl itself.
850 This is to avoid shift/reduce conflicts in contexts
851 where statement labels are allowed. */
853 save_filename save_lineno decl
857 /* records the type and storage class specs to use for processing
858 the declarators that follow.
859 Maintains a stack of outer-level values of current_declspecs,
860 for the sake of parm declarations nested in function declarators. */
861 setspecs: /* empty */
862 { pending_xref_error ();
864 split_specs_attrs ($<ttype>0,
865 ¤t_declspecs, &prefix_attributes);
866 all_prefix_attributes = prefix_attributes; }
869 /* Possibly attributes after a comma, which should reset all_prefix_attributes
870 to prefix_attributes with these ones chained on the front. */
873 { all_prefix_attributes = chainon ($1, prefix_attributes); }
877 declspecs_ts setspecs initdecls ';'
878 { POP_DECLSPEC_STACK; }
879 | declspecs_nots setspecs notype_initdecls ';'
880 { POP_DECLSPEC_STACK; }
881 | declspecs_ts setspecs nested_function
882 { POP_DECLSPEC_STACK; }
883 | declspecs_nots setspecs notype_nested_function
884 { POP_DECLSPEC_STACK; }
888 { RESTORE_WARN_FLAGS ($1); }
891 /* A list of declaration specifiers. These are:
893 - Storage class specifiers (scspec), which for GCC currently includes
894 function specifiers ("inline").
896 - Type specifiers (typespec_*).
898 - Type qualifiers (TYPE_QUAL).
900 - Attribute specifier lists (attributes).
902 These are stored as a TREE_LIST; the head of the list is the last
903 item in the specifier list. Each entry in the list has either a
904 TREE_PURPOSE that is an attribute specifier list, or a TREE_VALUE that
905 is a single other specifier or qualifier; and a TREE_CHAIN that is the
906 rest of the list. TREE_STATIC is set on the list if something other
907 than a storage class specifier or attribute has been seen; this is used
908 to warn for the obsolescent usage of storage class specifiers other than
909 at the start of the list. (Doing this properly would require function
910 specifiers to be handled separately from storage class specifiers.)
912 The various cases below are classified according to:
914 (a) Whether a storage class specifier is included or not; some
915 places in the grammar disallow storage class specifiers (_sc or _nosc).
917 (b) Whether a type specifier has been seen; after a type specifier,
918 a typedef name is an identifier to redeclare (_ts or _nots).
920 (c) Whether the list starts with an attribute; in certain places,
921 the grammar requires specifiers that don't start with an attribute
924 (d) Whether the list ends with an attribute (or a specifier such that
925 any following attribute would have been parsed as part of that specifier);
926 this avoids shift-reduce conflicts in the parsing of attributes
931 (i) Distinguish between function specifiers and storage class specifiers,
932 at least for the purpose of warnings about obsolescent usage.
934 (ii) Halve the number of productions here by eliminating the _sc/_nosc
935 distinction and instead checking where required that storage class
936 specifiers aren't present. */
938 /* Declspecs which contain at least one type specifier or typedef name.
939 (Just `const' or `volatile' is not enough.)
940 A typedef'd name following these is taken as a name to be declared.
941 Declspecs have a non-NULL TREE_VALUE, attributes do not. */
943 declspecs_nosc_nots_nosa_noea:
945 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
946 TREE_STATIC ($$) = 1; }
947 | declspecs_nosc_nots_nosa_noea TYPE_QUAL
948 { $$ = tree_cons (NULL_TREE, $2, $1);
949 TREE_STATIC ($$) = 1; }
950 | declspecs_nosc_nots_nosa_ea TYPE_QUAL
951 { $$ = tree_cons (NULL_TREE, $2, $1);
952 TREE_STATIC ($$) = 1; }
955 declspecs_nosc_nots_nosa_ea:
956 declspecs_nosc_nots_nosa_noea attributes
957 { $$ = tree_cons ($2, NULL_TREE, $1);
958 TREE_STATIC ($$) = TREE_STATIC ($1); }
961 declspecs_nosc_nots_sa_noea:
962 declspecs_nosc_nots_sa_noea TYPE_QUAL
963 { $$ = tree_cons (NULL_TREE, $2, $1);
964 TREE_STATIC ($$) = 1; }
965 | declspecs_nosc_nots_sa_ea TYPE_QUAL
966 { $$ = tree_cons (NULL_TREE, $2, $1);
967 TREE_STATIC ($$) = 1; }
970 declspecs_nosc_nots_sa_ea:
972 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE);
973 TREE_STATIC ($$) = 0; }
974 | declspecs_nosc_nots_sa_noea attributes
975 { $$ = tree_cons ($2, NULL_TREE, $1);
976 TREE_STATIC ($$) = TREE_STATIC ($1); }
979 declspecs_nosc_ts_nosa_noea:
981 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
982 TREE_STATIC ($$) = 1; }
983 | declspecs_nosc_ts_nosa_noea TYPE_QUAL
984 { $$ = tree_cons (NULL_TREE, $2, $1);
985 TREE_STATIC ($$) = 1; }
986 | declspecs_nosc_ts_nosa_ea TYPE_QUAL
987 { $$ = tree_cons (NULL_TREE, $2, $1);
988 TREE_STATIC ($$) = 1; }
989 | declspecs_nosc_ts_nosa_noea typespec_reserved_nonattr
990 { $$ = tree_cons (NULL_TREE, $2, $1);
991 TREE_STATIC ($$) = 1; }
992 | declspecs_nosc_ts_nosa_ea typespec_reserved_nonattr
993 { $$ = tree_cons (NULL_TREE, $2, $1);
994 TREE_STATIC ($$) = 1; }
995 | declspecs_nosc_nots_nosa_noea typespec_nonattr
996 { $$ = tree_cons (NULL_TREE, $2, $1);
997 TREE_STATIC ($$) = 1; }
998 | declspecs_nosc_nots_nosa_ea typespec_nonattr
999 { $$ = tree_cons (NULL_TREE, $2, $1);
1000 TREE_STATIC ($$) = 1; }
1003 declspecs_nosc_ts_nosa_ea:
1005 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
1006 TREE_STATIC ($$) = 1; }
1007 | declspecs_nosc_ts_nosa_noea attributes
1008 { $$ = tree_cons ($2, NULL_TREE, $1);
1009 TREE_STATIC ($$) = TREE_STATIC ($1); }
1010 | declspecs_nosc_ts_nosa_noea typespec_reserved_attr
1011 { $$ = tree_cons (NULL_TREE, $2, $1);
1012 TREE_STATIC ($$) = 1; }
1013 | declspecs_nosc_ts_nosa_ea typespec_reserved_attr
1014 { $$ = tree_cons (NULL_TREE, $2, $1);
1015 TREE_STATIC ($$) = 1; }
1016 | declspecs_nosc_nots_nosa_noea typespec_attr
1017 { $$ = tree_cons (NULL_TREE, $2, $1);
1018 TREE_STATIC ($$) = 1; }
1019 | declspecs_nosc_nots_nosa_ea typespec_attr
1020 { $$ = tree_cons (NULL_TREE, $2, $1);
1021 TREE_STATIC ($$) = 1; }
1024 declspecs_nosc_ts_sa_noea:
1025 declspecs_nosc_ts_sa_noea TYPE_QUAL
1026 { $$ = tree_cons (NULL_TREE, $2, $1);
1027 TREE_STATIC ($$) = 1; }
1028 | declspecs_nosc_ts_sa_ea TYPE_QUAL
1029 { $$ = tree_cons (NULL_TREE, $2, $1);
1030 TREE_STATIC ($$) = 1; }
1031 | declspecs_nosc_ts_sa_noea typespec_reserved_nonattr
1032 { $$ = tree_cons (NULL_TREE, $2, $1);
1033 TREE_STATIC ($$) = 1; }
1034 | declspecs_nosc_ts_sa_ea typespec_reserved_nonattr
1035 { $$ = tree_cons (NULL_TREE, $2, $1);
1036 TREE_STATIC ($$) = 1; }
1037 | declspecs_nosc_nots_sa_noea typespec_nonattr
1038 { $$ = tree_cons (NULL_TREE, $2, $1);
1039 TREE_STATIC ($$) = 1; }
1040 | declspecs_nosc_nots_sa_ea typespec_nonattr
1041 { $$ = tree_cons (NULL_TREE, $2, $1);
1042 TREE_STATIC ($$) = 1; }
1045 declspecs_nosc_ts_sa_ea:
1046 declspecs_nosc_ts_sa_noea attributes
1047 { $$ = tree_cons ($2, NULL_TREE, $1);
1048 TREE_STATIC ($$) = TREE_STATIC ($1); }
1049 | declspecs_nosc_ts_sa_noea typespec_reserved_attr
1050 { $$ = tree_cons (NULL_TREE, $2, $1);
1051 TREE_STATIC ($$) = 1; }
1052 | declspecs_nosc_ts_sa_ea typespec_reserved_attr
1053 { $$ = tree_cons (NULL_TREE, $2, $1);
1054 TREE_STATIC ($$) = 1; }
1055 | declspecs_nosc_nots_sa_noea typespec_attr
1056 { $$ = tree_cons (NULL_TREE, $2, $1);
1057 TREE_STATIC ($$) = 1; }
1058 | declspecs_nosc_nots_sa_ea typespec_attr
1059 { $$ = tree_cons (NULL_TREE, $2, $1);
1060 TREE_STATIC ($$) = 1; }
1063 declspecs_sc_nots_nosa_noea:
1065 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
1066 TREE_STATIC ($$) = 0; }
1067 | declspecs_sc_nots_nosa_noea TYPE_QUAL
1068 { $$ = tree_cons (NULL_TREE, $2, $1);
1069 TREE_STATIC ($$) = 1; }
1070 | declspecs_sc_nots_nosa_ea TYPE_QUAL
1071 { $$ = tree_cons (NULL_TREE, $2, $1);
1072 TREE_STATIC ($$) = 1; }
1073 | declspecs_nosc_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_nosc_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); }
1085 | declspecs_sc_nots_nosa_noea scspec
1086 { if (extra_warnings && TREE_STATIC ($1))
1087 warning ("`%s' is not at beginning of declaration",
1088 IDENTIFIER_POINTER ($2));
1089 $$ = tree_cons (NULL_TREE, $2, $1);
1090 TREE_STATIC ($$) = TREE_STATIC ($1); }
1091 | declspecs_sc_nots_nosa_ea scspec
1092 { if (extra_warnings && TREE_STATIC ($1))
1093 warning ("`%s' is not at beginning of declaration",
1094 IDENTIFIER_POINTER ($2));
1095 $$ = tree_cons (NULL_TREE, $2, $1);
1096 TREE_STATIC ($$) = TREE_STATIC ($1); }
1099 declspecs_sc_nots_nosa_ea:
1100 declspecs_sc_nots_nosa_noea attributes
1101 { $$ = tree_cons ($2, NULL_TREE, $1);
1102 TREE_STATIC ($$) = TREE_STATIC ($1); }
1105 declspecs_sc_nots_sa_noea:
1106 declspecs_sc_nots_sa_noea TYPE_QUAL
1107 { $$ = tree_cons (NULL_TREE, $2, $1);
1108 TREE_STATIC ($$) = 1; }
1109 | declspecs_sc_nots_sa_ea TYPE_QUAL
1110 { $$ = tree_cons (NULL_TREE, $2, $1);
1111 TREE_STATIC ($$) = 1; }
1112 | declspecs_nosc_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_nosc_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); }
1124 | declspecs_sc_nots_sa_noea scspec
1125 { if (extra_warnings && TREE_STATIC ($1))
1126 warning ("`%s' is not at beginning of declaration",
1127 IDENTIFIER_POINTER ($2));
1128 $$ = tree_cons (NULL_TREE, $2, $1);
1129 TREE_STATIC ($$) = TREE_STATIC ($1); }
1130 | declspecs_sc_nots_sa_ea scspec
1131 { if (extra_warnings && TREE_STATIC ($1))
1132 warning ("`%s' is not at beginning of declaration",
1133 IDENTIFIER_POINTER ($2));
1134 $$ = tree_cons (NULL_TREE, $2, $1);
1135 TREE_STATIC ($$) = TREE_STATIC ($1); }
1138 declspecs_sc_nots_sa_ea:
1139 declspecs_sc_nots_sa_noea attributes
1140 { $$ = tree_cons ($2, NULL_TREE, $1);
1141 TREE_STATIC ($$) = TREE_STATIC ($1); }
1144 declspecs_sc_ts_nosa_noea:
1145 declspecs_sc_ts_nosa_noea TYPE_QUAL
1146 { $$ = tree_cons (NULL_TREE, $2, $1);
1147 TREE_STATIC ($$) = 1; }
1148 | declspecs_sc_ts_nosa_ea TYPE_QUAL
1149 { $$ = tree_cons (NULL_TREE, $2, $1);
1150 TREE_STATIC ($$) = 1; }
1151 | declspecs_sc_ts_nosa_noea typespec_reserved_nonattr
1152 { $$ = tree_cons (NULL_TREE, $2, $1);
1153 TREE_STATIC ($$) = 1; }
1154 | declspecs_sc_ts_nosa_ea typespec_reserved_nonattr
1155 { $$ = tree_cons (NULL_TREE, $2, $1);
1156 TREE_STATIC ($$) = 1; }
1157 | declspecs_sc_nots_nosa_noea typespec_nonattr
1158 { $$ = tree_cons (NULL_TREE, $2, $1);
1159 TREE_STATIC ($$) = 1; }
1160 | declspecs_sc_nots_nosa_ea typespec_nonattr
1161 { $$ = tree_cons (NULL_TREE, $2, $1);
1162 TREE_STATIC ($$) = 1; }
1163 | declspecs_nosc_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_nosc_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); }
1175 | declspecs_sc_ts_nosa_noea scspec
1176 { if (extra_warnings && TREE_STATIC ($1))
1177 warning ("`%s' is not at beginning of declaration",
1178 IDENTIFIER_POINTER ($2));
1179 $$ = tree_cons (NULL_TREE, $2, $1);
1180 TREE_STATIC ($$) = TREE_STATIC ($1); }
1181 | declspecs_sc_ts_nosa_ea scspec
1182 { if (extra_warnings && TREE_STATIC ($1))
1183 warning ("`%s' is not at beginning of declaration",
1184 IDENTIFIER_POINTER ($2));
1185 $$ = tree_cons (NULL_TREE, $2, $1);
1186 TREE_STATIC ($$) = TREE_STATIC ($1); }
1189 declspecs_sc_ts_nosa_ea:
1190 declspecs_sc_ts_nosa_noea attributes
1191 { $$ = tree_cons ($2, NULL_TREE, $1);
1192 TREE_STATIC ($$) = TREE_STATIC ($1); }
1193 | declspecs_sc_ts_nosa_noea typespec_reserved_attr
1194 { $$ = tree_cons (NULL_TREE, $2, $1);
1195 TREE_STATIC ($$) = 1; }
1196 | declspecs_sc_ts_nosa_ea typespec_reserved_attr
1197 { $$ = tree_cons (NULL_TREE, $2, $1);
1198 TREE_STATIC ($$) = 1; }
1199 | declspecs_sc_nots_nosa_noea typespec_attr
1200 { $$ = tree_cons (NULL_TREE, $2, $1);
1201 TREE_STATIC ($$) = 1; }
1202 | declspecs_sc_nots_nosa_ea typespec_attr
1203 { $$ = tree_cons (NULL_TREE, $2, $1);
1204 TREE_STATIC ($$) = 1; }
1207 declspecs_sc_ts_sa_noea:
1208 declspecs_sc_ts_sa_noea TYPE_QUAL
1209 { $$ = tree_cons (NULL_TREE, $2, $1);
1210 TREE_STATIC ($$) = 1; }
1211 | declspecs_sc_ts_sa_ea TYPE_QUAL
1212 { $$ = tree_cons (NULL_TREE, $2, $1);
1213 TREE_STATIC ($$) = 1; }
1214 | declspecs_sc_ts_sa_noea typespec_reserved_nonattr
1215 { $$ = tree_cons (NULL_TREE, $2, $1);
1216 TREE_STATIC ($$) = 1; }
1217 | declspecs_sc_ts_sa_ea typespec_reserved_nonattr
1218 { $$ = tree_cons (NULL_TREE, $2, $1);
1219 TREE_STATIC ($$) = 1; }
1220 | declspecs_sc_nots_sa_noea typespec_nonattr
1221 { $$ = tree_cons (NULL_TREE, $2, $1);
1222 TREE_STATIC ($$) = 1; }
1223 | declspecs_sc_nots_sa_ea typespec_nonattr
1224 { $$ = tree_cons (NULL_TREE, $2, $1);
1225 TREE_STATIC ($$) = 1; }
1226 | declspecs_nosc_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_nosc_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); }
1238 | declspecs_sc_ts_sa_noea scspec
1239 { if (extra_warnings && TREE_STATIC ($1))
1240 warning ("`%s' is not at beginning of declaration",
1241 IDENTIFIER_POINTER ($2));
1242 $$ = tree_cons (NULL_TREE, $2, $1);
1243 TREE_STATIC ($$) = TREE_STATIC ($1); }
1244 | declspecs_sc_ts_sa_ea scspec
1245 { if (extra_warnings && TREE_STATIC ($1))
1246 warning ("`%s' is not at beginning of declaration",
1247 IDENTIFIER_POINTER ($2));
1248 $$ = tree_cons (NULL_TREE, $2, $1);
1249 TREE_STATIC ($$) = TREE_STATIC ($1); }
1252 declspecs_sc_ts_sa_ea:
1253 declspecs_sc_ts_sa_noea attributes
1254 { $$ = tree_cons ($2, NULL_TREE, $1);
1255 TREE_STATIC ($$) = TREE_STATIC ($1); }
1256 | declspecs_sc_ts_sa_noea typespec_reserved_attr
1257 { $$ = tree_cons (NULL_TREE, $2, $1);
1258 TREE_STATIC ($$) = 1; }
1259 | declspecs_sc_ts_sa_ea typespec_reserved_attr
1260 { $$ = tree_cons (NULL_TREE, $2, $1);
1261 TREE_STATIC ($$) = 1; }
1262 | declspecs_sc_nots_sa_noea typespec_attr
1263 { $$ = tree_cons (NULL_TREE, $2, $1);
1264 TREE_STATIC ($$) = 1; }
1265 | declspecs_sc_nots_sa_ea typespec_attr
1266 { $$ = tree_cons (NULL_TREE, $2, $1);
1267 TREE_STATIC ($$) = 1; }
1270 /* Particular useful classes of declspecs. */
1272 declspecs_nosc_ts_nosa_noea
1273 | declspecs_nosc_ts_nosa_ea
1274 | declspecs_nosc_ts_sa_noea
1275 | declspecs_nosc_ts_sa_ea
1276 | declspecs_sc_ts_nosa_noea
1277 | declspecs_sc_ts_nosa_ea
1278 | declspecs_sc_ts_sa_noea
1279 | declspecs_sc_ts_sa_ea
1283 declspecs_nosc_nots_nosa_noea
1284 | declspecs_nosc_nots_nosa_ea
1285 | declspecs_nosc_nots_sa_noea
1286 | declspecs_nosc_nots_sa_ea
1287 | declspecs_sc_nots_nosa_noea
1288 | declspecs_sc_nots_nosa_ea
1289 | declspecs_sc_nots_sa_noea
1290 | declspecs_sc_nots_sa_ea
1294 declspecs_nosc_ts_nosa_noea
1295 | declspecs_nosc_ts_nosa_ea
1296 | declspecs_sc_ts_nosa_noea
1297 | declspecs_sc_ts_nosa_ea
1300 declspecs_nots_nosa:
1301 declspecs_nosc_nots_nosa_noea
1302 | declspecs_nosc_nots_nosa_ea
1303 | declspecs_sc_nots_nosa_noea
1304 | declspecs_sc_nots_nosa_ea
1308 declspecs_nosc_ts_nosa_noea
1309 | declspecs_nosc_ts_nosa_ea
1310 | declspecs_nosc_ts_sa_noea
1311 | declspecs_nosc_ts_sa_ea
1314 declspecs_nosc_nots:
1315 declspecs_nosc_nots_nosa_noea
1316 | declspecs_nosc_nots_nosa_ea
1317 | declspecs_nosc_nots_sa_noea
1318 | declspecs_nosc_nots_sa_ea
1322 declspecs_nosc_ts_nosa_noea
1323 | declspecs_nosc_ts_nosa_ea
1324 | declspecs_nosc_ts_sa_noea
1325 | declspecs_nosc_ts_sa_ea
1326 | declspecs_nosc_nots_nosa_noea
1327 | declspecs_nosc_nots_nosa_ea
1328 | declspecs_nosc_nots_sa_noea
1329 | declspecs_nosc_nots_sa_ea
1333 declspecs_nosc_nots_nosa_noea
1334 | declspecs_nosc_nots_nosa_ea
1335 | declspecs_nosc_nots_sa_noea
1336 | declspecs_nosc_nots_sa_ea
1337 | declspecs_nosc_ts_nosa_noea
1338 | declspecs_nosc_ts_nosa_ea
1339 | declspecs_nosc_ts_sa_noea
1340 | declspecs_nosc_ts_sa_ea
1341 | declspecs_sc_nots_nosa_noea
1342 | declspecs_sc_nots_nosa_ea
1343 | declspecs_sc_nots_sa_noea
1344 | declspecs_sc_nots_sa_ea
1345 | declspecs_sc_ts_nosa_noea
1346 | declspecs_sc_ts_nosa_ea
1347 | declspecs_sc_ts_sa_noea
1348 | declspecs_sc_ts_sa_ea
1351 /* A (possibly empty) sequence of type qualifiers and attributes. */
1352 maybe_type_quals_attrs:
1355 | declspecs_nosc_nots
1359 /* A type specifier (but not a type qualifier).
1360 Once we have seen one of these in a declaration,
1361 if a typedef name appears then it is being redeclared.
1363 The _reserved versions start with a reserved word and may appear anywhere
1364 in the declaration specifiers; the _nonreserved versions may only
1365 appear before any other type specifiers, and after that are (if names)
1368 FIXME: should the _nonreserved version be restricted to names being
1369 redeclared only? The other entries there relate only the GNU extensions
1370 and Objective C, and are historically parsed thus, and don't make sense
1371 after other type specifiers, but it might be cleaner to count them as
1374 _attr means: specifiers that either end with attributes,
1375 or are such that any following attributes would
1376 be parsed as part of the specifier.
1378 _nonattr: specifiers. */
1381 typespec_reserved_nonattr
1382 | typespec_nonreserved_nonattr
1386 typespec_reserved_attr
1389 typespec_reserved_nonattr:
1391 { OBJC_NEED_RAW_IDENTIFIER (1); }
1395 typespec_reserved_attr:
1399 typespec_nonreserved_nonattr:
1401 { /* For a typedef name, record the meaning, not the name.
1402 In case of `foo foo, bar;'. */
1403 $$ = lookup_name ($1); }
1405 | CLASSNAME protocolrefs
1406 { $$ = get_static_reference ($1, $2); }
1407 | OBJECTNAME protocolrefs
1408 { $$ = get_object_reference ($2); }
1410 /* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>"
1411 - nisse@lysator.liu.se */
1412 | non_empty_protocolrefs
1413 { $$ = get_object_reference ($1); }
1415 | TYPEOF '(' expr ')'
1416 { $$ = TREE_TYPE ($3); }
1417 | TYPEOF '(' typename ')'
1418 { $$ = groktypename ($3); }
1421 /* typespec_nonreserved_attr does not exist. */
1425 | initdecls ',' maybe_resetattrs initdcl
1430 | notype_initdecls ',' maybe_resetattrs notype_initdcl
1436 | ASM_KEYWORD '(' string ')'
1437 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
1443 declarator maybeasm maybe_attribute '='
1444 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1445 chainon ($3, all_prefix_attributes));
1446 start_init ($<ttype>$, $2, global_bindings_p ()); }
1448 /* Note how the declaration of the variable is in effect while its init is parsed! */
1450 finish_decl ($<ttype>5, $6, $2); }
1451 | declarator maybeasm maybe_attribute
1452 { tree d = start_decl ($1, current_declspecs, 0,
1453 chainon ($3, all_prefix_attributes));
1454 finish_decl (d, NULL_TREE, $2);
1459 notype_declarator maybeasm maybe_attribute '='
1460 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
1461 chainon ($3, all_prefix_attributes));
1462 start_init ($<ttype>$, $2, global_bindings_p ()); }
1464 /* Note how the declaration of the variable is in effect while its init is parsed! */
1466 finish_decl ($<ttype>5, $6, $2); }
1467 | notype_declarator maybeasm maybe_attribute
1468 { tree d = start_decl ($1, current_declspecs, 0,
1469 chainon ($3, all_prefix_attributes));
1470 finish_decl (d, NULL_TREE, $2); }
1472 /* the * rules are dummies to accept the Apollo extended syntax
1473 so that the header files compile. */
1484 | attributes attribute
1485 { $$ = chainon ($1, $2); }
1489 ATTRIBUTE '(' '(' attribute_list ')' ')'
1496 | attribute_list ',' attrib
1497 { $$ = chainon ($1, $3); }
1504 { $$ = build_tree_list ($1, NULL_TREE); }
1505 | any_word '(' IDENTIFIER ')'
1506 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
1507 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1508 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
1509 | any_word '(' exprlist ')'
1510 { $$ = build_tree_list ($1, $3); }
1513 /* This still leaves out most reserved keywords,
1514 shouldn't we include them? */
1528 /* Initializers. `init' is the entry point. */
1533 { really_start_incremental_init (NULL_TREE); }
1534 initlist_maybe_comma '}'
1535 { $$ = pop_init_level (0); }
1537 { $$ = error_mark_node; }
1540 /* `initlist_maybe_comma' is the guts of an initializer in braces. */
1541 initlist_maybe_comma:
1544 pedwarn ("ISO C forbids empty initializer braces"); }
1545 | initlist1 maybecomma
1550 | initlist1 ',' initelt
1553 /* `initelt' is a single element of an initializer.
1554 It may use braces. */
1556 designator_list '=' initval
1557 { if (pedantic && ! flag_isoc99)
1558 pedwarn ("ISO C89 forbids specifying subobject to initialize"); }
1559 | designator initval
1561 pedwarn ("obsolete use of designated initializer without `='"); }
1563 { set_init_label ($1);
1565 pedwarn ("obsolete use of designated initializer with `:'"); }
1572 { push_init_level (0); }
1573 initlist_maybe_comma '}'
1574 { process_init_element (pop_init_level (0)); }
1576 { process_init_element ($1); }
1582 | designator_list designator
1587 { set_init_label ($2); }
1588 /* These are for labeled elements. The syntax for an array element
1589 initializer conflicts with the syntax for an Objective-C message,
1590 so don't include these productions in the Objective-C grammar. */
1592 | '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1593 { set_init_index ($2, $4);
1595 pedwarn ("ISO C forbids specifying range of elements to initialize"); }
1596 | '[' expr_no_commas ']'
1597 { set_init_index ($2, NULL_TREE); }
1604 pedwarn ("ISO C forbids nested functions");
1606 push_function_context ();
1607 if (! start_function (current_declspecs, $1,
1608 all_prefix_attributes))
1610 pop_function_context ();
1614 old_style_parm_decls
1615 { store_parm_decls (); }
1616 /* This used to use compstmt_or_error.
1617 That caused a bug with input `f(g) int g {}',
1618 where the use of YYERROR1 above caused an error
1619 which then was handled by compstmt_or_error.
1620 There followed a repeated execution of that same rule,
1621 which called YYERROR1 again, and so on. */
1622 save_filename save_lineno compstmt
1623 { tree decl = current_function_decl;
1624 DECL_SOURCE_FILE (decl) = $5;
1625 DECL_SOURCE_LINE (decl) = $6;
1626 finish_function (1, 1);
1627 pop_function_context ();
1628 add_decl_stmt (decl); }
1631 notype_nested_function:
1634 pedwarn ("ISO C forbids nested functions");
1636 push_function_context ();
1637 if (! start_function (current_declspecs, $1,
1638 all_prefix_attributes))
1640 pop_function_context ();
1644 old_style_parm_decls
1645 { store_parm_decls (); }
1646 /* This used to use compstmt_or_error.
1647 That caused a bug with input `f(g) int g {}',
1648 where the use of YYERROR1 above caused an error
1649 which then was handled by compstmt_or_error.
1650 There followed a repeated execution of that same rule,
1651 which called YYERROR1 again, and so on. */
1652 save_filename save_lineno compstmt
1653 { tree decl = current_function_decl;
1654 DECL_SOURCE_FILE (decl) = $5;
1655 DECL_SOURCE_LINE (decl) = $6;
1656 finish_function (1, 1);
1657 pop_function_context ();
1658 add_decl_stmt (decl); }
1661 /* Any kind of declarator (thus, all declarators allowed
1662 after an explicit typespec). */
1665 after_type_declarator
1669 /* A declarator that is allowed only after an explicit typespec. */
1671 after_type_declarator:
1672 '(' maybe_attribute after_type_declarator ')'
1673 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1674 | after_type_declarator '(' parmlist_or_identifiers %prec '.'
1675 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1676 /* | after_type_declarator '(' error ')' %prec '.'
1677 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1678 poplevel (0, 0, 0); } */
1679 | after_type_declarator array_declarator %prec '.'
1680 { $$ = set_array_declarator_type ($2, $1, 0); }
1681 | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
1682 { $$ = make_pointer_declarator ($2, $3); }
1689 /* Kinds of declarator that can appear in a parameter list
1690 in addition to notype_declarator. This is like after_type_declarator
1691 but does not allow a typedef name in parentheses as an identifier
1692 (because it would conflict with a function with that typedef as arg). */
1694 parm_declarator_starttypename
1695 | parm_declarator_nostarttypename
1698 parm_declarator_starttypename:
1699 parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
1700 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1701 /* | parm_declarator_starttypename '(' error ')' %prec '.'
1702 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1703 poplevel (0, 0, 0); } */
1704 | parm_declarator_starttypename array_declarator %prec '.'
1705 { $$ = set_array_declarator_type ($2, $1, 0); }
1712 parm_declarator_nostarttypename:
1713 parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
1714 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1715 /* | parm_declarator_nostarttypename '(' error ')' %prec '.'
1716 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1717 poplevel (0, 0, 0); } */
1718 | parm_declarator_nostarttypename array_declarator %prec '.'
1719 { $$ = set_array_declarator_type ($2, $1, 0); }
1720 | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
1721 { $$ = make_pointer_declarator ($2, $3); }
1722 | '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY
1723 { $$ = make_pointer_declarator ($2, $3); }
1724 | '(' maybe_attribute parm_declarator_nostarttypename ')'
1725 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1728 /* A declarator allowed whether or not there has been
1729 an explicit typespec. These cannot redeclare a typedef-name. */
1732 notype_declarator '(' parmlist_or_identifiers %prec '.'
1733 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1734 /* | notype_declarator '(' error ')' %prec '.'
1735 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1736 poplevel (0, 0, 0); } */
1737 | '(' maybe_attribute notype_declarator ')'
1738 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
1739 | '*' maybe_type_quals_attrs notype_declarator %prec UNARY
1740 { $$ = make_pointer_declarator ($2, $3); }
1741 | notype_declarator array_declarator %prec '.'
1742 { $$ = set_array_declarator_type ($2, $1, 0); }
1767 /* structsp_attr: struct/union/enum specifiers that either
1768 end with attributes, or are such that any following attributes would
1769 be parsed as part of the struct/union/enum specifier.
1771 structsp_nonattr: other struct/union/enum specifiers. */
1774 struct_head identifier '{'
1775 { $$ = start_struct (RECORD_TYPE, $2);
1776 /* Start scope of tag before parsing components. */
1778 component_decl_list '}' maybe_attribute
1779 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1780 | struct_head '{' component_decl_list '}' maybe_attribute
1781 { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1782 $3, chainon ($1, $5));
1784 | union_head identifier '{'
1785 { $$ = start_struct (UNION_TYPE, $2); }
1786 component_decl_list '}' maybe_attribute
1787 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1788 | union_head '{' component_decl_list '}' maybe_attribute
1789 { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1790 $3, chainon ($1, $5));
1792 | enum_head identifier '{'
1793 { $$ = start_enum ($2); }
1794 enumlist maybecomma_warn '}' maybe_attribute
1795 { $$ = finish_enum ($<ttype>4, nreverse ($5),
1796 chainon ($1, $8)); }
1798 { $$ = start_enum (NULL_TREE); }
1799 enumlist maybecomma_warn '}' maybe_attribute
1800 { $$ = finish_enum ($<ttype>3, nreverse ($4),
1801 chainon ($1, $7)); }
1805 struct_head identifier
1806 { $$ = xref_tag (RECORD_TYPE, $2); }
1807 | union_head identifier
1808 { $$ = xref_tag (UNION_TYPE, $2); }
1809 | enum_head identifier
1810 { $$ = xref_tag (ENUMERAL_TYPE, $2);
1811 /* In ISO C, enumerated types can be referred to
1812 only if already defined. */
1813 if (pedantic && !COMPLETE_TYPE_P ($$))
1814 pedwarn ("ISO C forbids forward references to `enum' types"); }
1825 { if (pedantic && ! flag_isoc99)
1826 pedwarn ("comma at end of enumerator list"); }
1829 component_decl_list:
1830 component_decl_list2
1832 | component_decl_list2 component_decl
1833 { $$ = chainon ($1, $2);
1834 pedwarn ("no semicolon at end of struct or union"); }
1837 component_decl_list2: /* empty */
1839 | component_decl_list2 component_decl ';'
1840 { $$ = chainon ($1, $2); }
1841 | component_decl_list2 ';'
1843 pedwarn ("extra semicolon in struct or union specified"); }
1845 /* foo(sizeof(struct{ @defs(ClassName)})); */
1846 | DEFS '(' CLASSNAME ')'
1848 tree interface = lookup_interface ($3);
1851 $$ = get_class_ivars (interface);
1854 error ("cannot find interface declaration for `%s'",
1855 IDENTIFIER_POINTER ($3));
1863 declspecs_nosc_ts setspecs components
1865 POP_DECLSPEC_STACK; }
1866 | declspecs_nosc_ts setspecs save_filename save_lineno
1868 /* Support for unnamed structs or unions as members of
1869 structs or unions (which is [a] useful and [b] supports
1872 pedwarn ("ISO C doesn't support unnamed structs/unions");
1874 $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE);
1875 POP_DECLSPEC_STACK; }
1876 | declspecs_nosc_nots setspecs components_notype
1878 POP_DECLSPEC_STACK; }
1879 | declspecs_nosc_nots
1881 pedwarn ("ISO C forbids member declarations with no members");
1886 | extension component_decl
1888 RESTORE_WARN_FLAGS ($1); }
1892 component_declarator
1893 | components ',' maybe_resetattrs component_declarator
1894 { $$ = chainon ($1, $4); }
1898 component_notype_declarator
1899 | components_notype ',' maybe_resetattrs component_notype_declarator
1900 { $$ = chainon ($1, $4); }
1903 component_declarator:
1904 save_filename save_lineno declarator maybe_attribute
1905 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1906 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1907 | save_filename save_lineno
1908 declarator ':' expr_no_commas maybe_attribute
1909 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1910 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1911 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1912 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1913 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1916 component_notype_declarator:
1917 save_filename save_lineno notype_declarator maybe_attribute
1918 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1919 decl_attributes (&$$, chainon ($4, all_prefix_attributes), 0); }
1920 | save_filename save_lineno
1921 notype_declarator ':' expr_no_commas maybe_attribute
1922 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1923 decl_attributes (&$$, chainon ($6, all_prefix_attributes), 0); }
1924 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1925 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1926 decl_attributes (&$$, chainon ($5, all_prefix_attributes), 0); }
1929 /* We chain the enumerators in reverse order.
1930 They are put in forward order where enumlist is used.
1931 (The order used to be significant, but no longer is so.
1932 However, we still maintain the order, just to be clean.) */
1936 | enumlist ',' enumerator
1937 { if ($1 == error_mark_node)
1940 $$ = chainon ($3, $1); }
1942 { $$ = error_mark_node; }
1948 { $$ = build_enumerator ($1, NULL_TREE); }
1949 | identifier '=' expr_no_commas
1950 { $$ = build_enumerator ($1, $3); }
1955 { pending_xref_error ();
1958 { $$ = build_tree_list ($<ttype>2, $3); }
1961 absdcl: /* an absolute declarator */
1967 absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */
1969 { $$ = build_tree_list (build_tree_list (current_declspecs,
1971 all_prefix_attributes); }
1973 { $$ = build_tree_list (build_tree_list (current_declspecs,
1975 all_prefix_attributes); }
1976 | absdcl1_noea attributes
1977 { $$ = build_tree_list (build_tree_list (current_declspecs,
1979 chainon ($2, all_prefix_attributes)); }
1982 absdcl1: /* a nonempty absolute declarator */
1989 | '*' maybe_type_quals_attrs absdcl1_noea
1990 { $$ = make_pointer_declarator ($2, $3); }
1994 '*' maybe_type_quals_attrs
1995 { $$ = make_pointer_declarator ($2, NULL_TREE); }
1996 | '*' maybe_type_quals_attrs absdcl1_ea
1997 { $$ = make_pointer_declarator ($2, $3); }
2001 '(' maybe_attribute absdcl1 ')'
2002 { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
2003 | direct_absdcl1 '(' parmlist
2004 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
2005 | direct_absdcl1 array_declarator
2006 { $$ = set_array_declarator_type ($2, $1, 1); }
2008 { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
2010 { $$ = set_array_declarator_type ($1, NULL_TREE, 1); }
2013 /* The [...] part of a declarator for an array type. */
2016 '[' maybe_type_quals_attrs expr ']'
2017 { $$ = build_array_declarator ($3, $2, 0, 0); }
2018 | '[' maybe_type_quals_attrs ']'
2019 { $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
2020 | '[' maybe_type_quals_attrs '*' ']'
2021 { $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
2022 | '[' STATIC maybe_type_quals_attrs expr ']'
2023 { $$ = build_array_declarator ($4, $3, 1, 0); }
2024 /* declspecs_nosc_nots is a synonym for type_quals_attrs. */
2025 | '[' declspecs_nosc_nots STATIC expr ']'
2026 { $$ = build_array_declarator ($4, $2, 1, 0); }
2029 /* A nonempty series of declarations and statements (possibly followed by
2030 some labels) that can form the body of a compound statement.
2031 NOTE: we don't allow labels on declarations; this might seem like a
2032 natural extension, but there would be a conflict between attributes
2033 on the label and prefix attributes on the declaration. */
2036 lineno_stmt_decl_or_labels_ending_stmt
2037 | lineno_stmt_decl_or_labels_ending_decl
2038 | lineno_stmt_decl_or_labels_ending_label
2040 pedwarn ("deprecated use of label at end of compound statement");
2042 | lineno_stmt_decl_or_labels_ending_error
2045 lineno_stmt_decl_or_labels_ending_stmt:
2047 | lineno_stmt_decl_or_labels_ending_stmt lineno_stmt
2048 | lineno_stmt_decl_or_labels_ending_decl lineno_stmt
2049 | lineno_stmt_decl_or_labels_ending_label lineno_stmt
2050 | lineno_stmt_decl_or_labels_ending_error lineno_stmt
2053 lineno_stmt_decl_or_labels_ending_decl:
2055 | lineno_stmt_decl_or_labels_ending_stmt lineno_decl
2056 { if (pedantic && !flag_isoc99)
2057 pedwarn ("ISO C89 forbids mixed declarations and code"); }
2058 | lineno_stmt_decl_or_labels_ending_decl lineno_decl
2059 | lineno_stmt_decl_or_labels_ending_error lineno_decl
2062 lineno_stmt_decl_or_labels_ending_label:
2064 | lineno_stmt_decl_or_labels_ending_stmt lineno_label
2065 | lineno_stmt_decl_or_labels_ending_decl lineno_label
2066 | lineno_stmt_decl_or_labels_ending_label lineno_label
2067 | lineno_stmt_decl_or_labels_ending_error lineno_label
2070 lineno_stmt_decl_or_labels_ending_error:
2072 | lineno_stmt_decl_or_labels errstmt
2075 lineno_stmt_decl_or_labels:
2076 lineno_stmt_decl_or_labels_ending_stmt
2077 | lineno_stmt_decl_or_labels_ending_decl
2078 | lineno_stmt_decl_or_labels_ending_label
2079 | lineno_stmt_decl_or_labels_ending_error
2085 pushlevel: /* empty */
2088 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2090 if (objc_method_context)
2096 poplevel: /* empty */
2097 { $$ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); }
2100 /* Start and end blocks created for the new scopes of C99. */
2101 c99_block_start: /* empty */
2104 $$ = c_begin_compound_stmt ();
2107 add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
2109 if (objc_method_context)
2118 /* Productions using c99_block_start and c99_block_end will need to do what's
2119 in compstmt: RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); $$ = $2; where
2120 $1 is the value of c99_block_start and $2 of c99_block_end. */
2121 c99_block_end: /* empty */
2124 tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
2125 $$ = poplevel (kept_level_p (), 0, 0);
2126 SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
2127 = SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
2134 /* Read zero or more forward-declarations for labels
2135 that nested functions can jump to. */
2140 pedwarn ("ISO C forbids label declarations"); }
2145 | label_decls label_decl
2149 LABEL identifiers_or_typenames ';'
2151 for (link = $2; link; link = TREE_CHAIN (link))
2153 tree label = shadow_label (TREE_VALUE (link));
2154 C_DECLARED_LABEL_FLAG (label) = 1;
2155 add_decl_stmt (label);
2160 /* This is the body of a function definition.
2161 It causes syntax errors to ignore to the next openbrace. */
2168 compstmt_start: '{' { compstmt_count++;
2169 $$ = c_begin_compound_stmt (); }
2172 compstmt_nostart: '}'
2173 { $$ = convert (void_type_node, integer_zero_node); }
2174 | pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel
2175 { $$ = poplevel (kept_level_p (), 1, 0);
2176 SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
2177 = SCOPE_STMT_BLOCK (TREE_VALUE ($5))
2181 compstmt_contents_nonempty:
2186 compstmt_primary_start:
2188 { if (current_function_decl == 0)
2190 error ("braced-group within expression allowed only inside a function");
2193 /* We must force a BLOCK for this level
2194 so that, if it is not expanded later,
2195 there is a way to turn off the entire subtree of blocks
2196 that are contained in it. */
2198 push_label_level ();
2200 $$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree));
2204 compstmt: compstmt_start compstmt_nostart
2205 { RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2206 last_expr_type = NULL_TREE;
2210 /* Value is number of statements counted as of the closeparen. */
2212 if_prefix c99_block_lineno_labeled_stmt
2213 { c_finish_then (); }
2214 /* Make sure c_expand_end_cond is run once
2215 for each call to c_expand_start_cond.
2216 Otherwise a crash is likely. */
2221 /* We must build the IF_STMT node before parsing its
2222 condition so that STMT_LINENO refers to the line
2223 containing the "if", and not the line containing
2224 the close-parenthesis.
2226 c_begin_if_stmt returns the IF_STMT node, which
2227 we later pass to c_expand_start_cond to fill
2228 in the condition and other tidbits. */
2230 { $<ttype>$ = c_begin_if_stmt (); }
2232 { c_expand_start_cond (c_common_truthvalue_conversion ($4),
2233 compstmt_count,$<ttype>2);
2234 $<itype>$ = stmt_count;
2235 if_stmt_file = $<filename>-2;
2236 if_stmt_line = $<lineno>-1; }
2239 /* This is a subroutine of stmt.
2240 It is used twice, once for valid DO statements
2241 and once for catching errors in parsing the end test. */
2247 = add_stmt (build_stmt (DO_STMT, NULL_TREE,
2249 /* In the event that a parse error prevents
2250 parsing the complete do-statement, set the
2251 condition now. Otherwise, we can get crashes at
2252 RTL-generation time. */
2253 DO_COND ($<ttype>$) = error_mark_node; }
2254 c99_block_lineno_labeled_stmt WHILE
2256 RECHAIN_STMTS ($$, DO_BODY ($$)); }
2259 /* The forced readahead in here is because we might be at the end of a
2260 line, and the line and file won't be bumped until yylex absorbs the
2261 first token on the next line. */
2263 { if (yychar == YYEMPTY)
2265 $$ = input_filename; }
2269 { if (yychar == YYEMPTY)
2274 lineno_labeled_stmt:
2276 | lineno_label lineno_labeled_stmt
2279 /* Like lineno_labeled_stmt, but a block in C99. */
2280 c99_block_lineno_labeled_stmt:
2281 c99_block_start lineno_labeled_stmt c99_block_end
2283 RECHAIN_STMTS ($1, COMPOUND_BODY ($1)); }
2287 save_filename save_lineno stmt
2290 STMT_LINENO ($3) = $2;
2291 /* ??? We currently have no way of recording
2292 the filename for a statement. This probably
2293 matters little in practice at the moment,
2294 but I suspect that problems will occur when
2295 doing inlining at the tree level. */
2301 save_filename save_lineno label
2304 STMT_LINENO ($3) = $2;
2309 select_or_iter_stmt:
2311 { c_expand_start_else ();
2312 $<itype>1 = stmt_count; }
2313 c99_block_lineno_labeled_stmt
2315 c_expand_end_cond ();
2316 if (extra_warnings && stmt_count == $<itype>1)
2317 warning ("empty body in an else-statement"); }
2318 | simple_if %prec IF
2319 { c_expand_end_cond ();
2320 /* This warning is here instead of in simple_if, because we
2321 do not want a warning if an empty if is followed by an
2322 else statement. Increment stmt_count so we don't
2323 give a second error if this is a nested `if'. */
2324 if (extra_warnings && stmt_count++ == $<itype>1)
2325 warning_with_file_and_line (if_stmt_file, if_stmt_line,
2326 "empty body in an if-statement"); }
2327 /* Make sure c_expand_end_cond is run once
2328 for each call to c_expand_start_cond.
2329 Otherwise a crash is likely. */
2330 | simple_if ELSE error
2331 { c_expand_end_cond (); }
2332 /* We must build the WHILE_STMT node before parsing its
2333 condition so that STMT_LINENO refers to the line
2334 containing the "while", and not the line containing
2335 the close-parenthesis.
2337 c_begin_while_stmt returns the WHILE_STMT node, which
2338 we later pass to c_finish_while_stmt_cond to fill
2339 in the condition and other tidbits. */
2342 $<ttype>$ = c_begin_while_stmt (); }
2344 { $4 = c_common_truthvalue_conversion ($4);
2345 c_finish_while_stmt_cond
2346 (c_common_truthvalue_conversion ($4), $<ttype>2);
2347 $<ttype>$ = add_stmt ($<ttype>2); }
2348 c99_block_lineno_labeled_stmt
2349 { RECHAIN_STMTS ($<ttype>6, WHILE_BODY ($<ttype>6)); }
2352 { DO_COND ($1) = c_common_truthvalue_conversion ($3); }
2353 | do_stmt_start error
2356 { $<ttype>$ = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
2357 NULL_TREE, NULL_TREE);
2358 add_stmt ($<ttype>$); }
2361 RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
2364 FOR_COND ($<ttype>2)
2365 = c_common_truthvalue_conversion ($6); }
2367 { FOR_EXPR ($<ttype>2) = $9; }
2368 c99_block_lineno_labeled_stmt
2369 { RECHAIN_STMTS ($<ttype>2, FOR_BODY ($<ttype>2)); }
2370 | SWITCH '(' expr ')'
2372 $<ttype>$ = c_start_case ($3); }
2373 c99_block_lineno_labeled_stmt
2374 { c_finish_case (); }
2379 { add_stmt (build_stmt (EXPR_STMT, $1)); }
2381 { check_for_loop_decls (); }
2384 /* Parse a single real statement, not including any labels. */
2387 { stmt_count++; $$ = $1; }
2390 $$ = c_expand_expr_stmt ($1); }
2391 | c99_block_start select_or_iter_stmt c99_block_end
2393 RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
2397 $$ = add_stmt (build_break_stmt ()); }
2400 $$ = add_stmt (build_continue_stmt ()); }
2403 $$ = c_expand_return (NULL_TREE); }
2406 $$ = c_expand_return ($2); }
2407 | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
2409 $$ = simple_asm_stmt ($4); }
2410 /* This is the case with just output operands. */
2411 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
2413 $$ = build_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
2414 /* This is the case with input operands as well. */
2415 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2416 asm_operands ')' ';'
2418 $$ = build_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
2419 /* This is the case with clobbered registers as well. */
2420 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
2421 asm_operands ':' asm_clobbers ')' ';'
2423 $$ = build_asm_stmt ($2, $4, $6, $8, $10); }
2424 | GOTO identifier ';'
2427 decl = lookup_label ($2);
2430 TREE_USED (decl) = 1;
2431 $$ = add_stmt (build_stmt (GOTO_STMT, decl));
2438 pedwarn ("ISO C forbids `goto *expr;'");
2440 $3 = convert (ptr_type_node, $3);
2441 $$ = add_stmt (build_stmt (GOTO_STMT, $3)); }
2446 /* Any kind of label, including jump labels and case labels.
2447 ANSI C accepts labels only before statements, but we allow them
2448 also at the end of a compound statement. */
2450 label: CASE expr_no_commas ':'
2452 $$ = do_case ($2, NULL_TREE); }
2453 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
2455 $$ = do_case ($2, $4); }
2458 $$ = do_case (NULL_TREE, NULL_TREE); }
2459 | identifier save_filename save_lineno ':' maybe_attribute
2460 { tree label = define_label ($2, $3, $1);
2464 decl_attributes (&label, $5, 0);
2465 $$ = add_stmt (build_stmt (LABEL_STMT, label));
2472 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
2476 { emit_line_note (input_filename, lineno);
2479 { emit_line_note (input_filename, lineno); }
2488 /* These are the operands other than the first string and colon
2489 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
2490 asm_operands: /* empty */
2492 | nonnull_asm_operands
2495 nonnull_asm_operands:
2497 | nonnull_asm_operands ',' asm_operand
2498 { $$ = chainon ($1, $3); }
2503 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
2504 | '[' identifier ']' STRING '(' expr ')'
2505 { $2 = build_string (IDENTIFIER_LENGTH ($2),
2506 IDENTIFIER_POINTER ($2));
2507 $$ = build_tree_list (build_tree_list ($2, $4), $6); }
2512 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); }
2513 | asm_clobbers ',' string
2514 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
2517 /* This is what appears inside the parens in a function declarator.
2518 Its value is a list of ..._TYPE nodes. Attributes must appear here
2519 to avoid a conflict with their appearance after an open parenthesis
2520 in an abstract declarator, as in
2521 "void bar (int (__attribute__((__mode__(SI))) int foo));". */
2525 clear_parm_order ();
2526 declare_parm_level (0); }
2529 parmlist_tags_warning ();
2530 poplevel (0, 0, 0); }
2538 pedwarn ("ISO C forbids forward parameter declarations");
2539 /* Mark the forward decls as such. */
2540 for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
2541 TREE_ASM_WRITTEN (parm) = 1;
2542 clear_parm_order (); }
2544 { /* Dummy action so attributes are in known place
2545 on parser stack. */ }
2549 { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
2552 /* This is what appears inside the parens in a function declarator.
2553 Is value is represented in the format that grokdeclarator expects. */
2554 parmlist_2: /* empty */
2555 { $$ = get_parm_info (0); }
2557 { $$ = get_parm_info (0);
2558 /* Gcc used to allow this as an extension. However, it does
2559 not work for all targets, and thus has been disabled.
2560 Also, since func (...) and func () are indistinguishable,
2561 it caused problems with the code in expand_builtin which
2562 tries to verify that BUILT_IN_NEXT_ARG is being used
2564 error ("ISO C requires a named argument before `...'");
2567 { $$ = get_parm_info (1); }
2568 | parms ',' ELLIPSIS
2569 { $$ = get_parm_info (0); }
2574 { push_parm_decl ($1); }
2576 { push_parm_decl ($3); }
2579 /* A single parameter declaration or parameter type name,
2580 as found in a parmlist. */
2582 declspecs_ts setspecs parm_declarator maybe_attribute
2583 { $$ = build_tree_list (build_tree_list (current_declspecs,
2585 chainon ($4, all_prefix_attributes));
2586 POP_DECLSPEC_STACK; }
2587 | declspecs_ts setspecs notype_declarator maybe_attribute
2588 { $$ = build_tree_list (build_tree_list (current_declspecs,
2590 chainon ($4, all_prefix_attributes));
2591 POP_DECLSPEC_STACK; }
2592 | declspecs_ts setspecs absdcl_maybe_attribute
2594 POP_DECLSPEC_STACK; }
2595 | declspecs_nots setspecs notype_declarator maybe_attribute
2596 { $$ = build_tree_list (build_tree_list (current_declspecs,
2598 chainon ($4, all_prefix_attributes));
2599 POP_DECLSPEC_STACK; }
2601 | declspecs_nots setspecs absdcl_maybe_attribute
2603 POP_DECLSPEC_STACK; }
2606 /* The first parm, which must suck attributes from off the top of the parser
2609 declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute
2610 { $$ = build_tree_list (build_tree_list (current_declspecs,
2612 chainon ($4, all_prefix_attributes));
2613 POP_DECLSPEC_STACK; }
2614 | declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
2615 { $$ = build_tree_list (build_tree_list (current_declspecs,
2617 chainon ($4, all_prefix_attributes));
2618 POP_DECLSPEC_STACK; }
2619 | declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
2621 POP_DECLSPEC_STACK; }
2622 | declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute
2623 { $$ = build_tree_list (build_tree_list (current_declspecs,
2625 chainon ($4, all_prefix_attributes));
2626 POP_DECLSPEC_STACK; }
2628 | declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute
2630 POP_DECLSPEC_STACK; }
2635 { prefix_attributes = chainon (prefix_attributes, $<ttype>-2);
2636 all_prefix_attributes = prefix_attributes; }
2639 /* This is used in a function definition
2640 where either a parmlist or an identifier list is ok.
2641 Its value is a list of ..._TYPE nodes or a list of identifiers. */
2642 parmlist_or_identifiers:
2645 clear_parm_order ();
2646 declare_parm_level (1); }
2647 parmlist_or_identifiers_1
2649 parmlist_tags_warning ();
2650 poplevel (0, 0, 0); }
2653 parmlist_or_identifiers_1:
2657 for (t = $1; t; t = TREE_CHAIN (t))
2658 if (TREE_VALUE (t) == NULL_TREE)
2659 error ("`...' in old-style identifier list");
2660 $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
2662 /* Make sure we have a parmlist after attributes. */
2664 && (TREE_CODE ($$) != TREE_LIST
2665 || TREE_PURPOSE ($$) == 0
2666 || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
2671 /* A nonempty list of identifiers. */
2674 { $$ = build_tree_list (NULL_TREE, $1); }
2675 | identifiers ',' IDENTIFIER
2676 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2679 /* A nonempty list of identifiers, including typenames. */
2680 identifiers_or_typenames:
2682 { $$ = build_tree_list (NULL_TREE, $1); }
2683 | identifiers_or_typenames ',' identifier
2684 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2689 { $$ = SAVE_WARN_FLAGS();
2691 warn_pointer_arith = 0;
2692 warn_traditional = 0; }
2696 /* Objective-C productions. */
2706 if (objc_implementation_context)
2708 finish_class (objc_implementation_context);
2709 objc_ivar_chain = NULL_TREE;
2710 objc_implementation_context = NULL_TREE;
2713 warning ("`@end' must appear in an implementation context");
2717 /* A nonempty list of identifiers. */
2720 { $$ = build_tree_list (NULL_TREE, $1); }
2721 | identifier_list ',' identifier
2722 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2726 CLASS identifier_list ';'
2728 objc_declare_class ($2);
2732 ALIAS identifier identifier ';'
2734 objc_declare_alias ($2, $3);
2738 INTERFACE identifier protocolrefs '{'
2740 objc_interface_context = objc_ivar_context
2741 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2742 objc_public_flag = 0;
2746 continue_class (objc_interface_context);
2751 finish_class (objc_interface_context);
2752 objc_interface_context = NULL_TREE;
2755 | INTERFACE identifier protocolrefs
2757 objc_interface_context
2758 = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2759 continue_class (objc_interface_context);
2764 finish_class (objc_interface_context);
2765 objc_interface_context = NULL_TREE;
2768 | INTERFACE identifier ':' identifier protocolrefs '{'
2770 objc_interface_context = objc_ivar_context
2771 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2772 objc_public_flag = 0;
2776 continue_class (objc_interface_context);
2781 finish_class (objc_interface_context);
2782 objc_interface_context = NULL_TREE;
2785 | INTERFACE identifier ':' identifier protocolrefs
2787 objc_interface_context
2788 = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2789 continue_class (objc_interface_context);
2794 finish_class (objc_interface_context);
2795 objc_interface_context = NULL_TREE;
2798 | IMPLEMENTATION identifier '{'
2800 objc_implementation_context = objc_ivar_context
2801 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2802 objc_public_flag = 0;
2807 = continue_class (objc_implementation_context);
2810 | IMPLEMENTATION identifier
2812 objc_implementation_context
2813 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2815 = continue_class (objc_implementation_context);
2818 | IMPLEMENTATION identifier ':' identifier '{'
2820 objc_implementation_context = objc_ivar_context
2821 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2822 objc_public_flag = 0;
2827 = continue_class (objc_implementation_context);
2830 | IMPLEMENTATION identifier ':' identifier
2832 objc_implementation_context
2833 = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2835 = continue_class (objc_implementation_context);
2838 | INTERFACE identifier '(' identifier ')' protocolrefs
2840 objc_interface_context
2841 = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6);
2842 continue_class (objc_interface_context);
2847 finish_class (objc_interface_context);
2848 objc_interface_context = NULL_TREE;
2851 | IMPLEMENTATION identifier '(' identifier ')'
2853 objc_implementation_context
2854 = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2856 = continue_class (objc_implementation_context);
2861 PROTOCOL identifier protocolrefs
2863 objc_pq_context = 1;
2864 objc_interface_context
2865 = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
2869 objc_pq_context = 0;
2870 finish_protocol(objc_interface_context);
2871 objc_interface_context = NULL_TREE;
2873 /* The @protocol forward-declaration production introduces a
2874 reduce/reduce conflict on ';', which should be resolved in
2875 favor of the production 'identifier_list -> identifier'. */
2876 | PROTOCOL identifier_list ';'
2878 objc_declare_protocols ($2);
2887 | non_empty_protocolrefs
2890 non_empty_protocolrefs:
2891 ARITHCOMPARE identifier_list ARITHCOMPARE
2893 if ($1 == LT_EXPR && $3 == GT_EXPR)
2901 ivar_decl_list visibility_spec ivar_decls
2906 PRIVATE { objc_public_flag = 2; }
2907 | PROTECTED { objc_public_flag = 0; }
2908 | PUBLIC { objc_public_flag = 1; }
2916 | ivar_decls ivar_decl ';'
2920 pedwarn ("extra semicolon in struct or union specified");
2925 /* There is a shift-reduce conflict here, because `components' may
2926 start with a `typename'. It happens that shifting (the default resolution)
2927 does the right thing, because it treats the `typename' as part of
2928 a `typed_typespecs'.
2930 It is possible that this same technique would allow the distinction
2931 between `notype_initdecls' and `initdecls' to be eliminated.
2932 But I am being cautious and not trying it. */
2935 declspecs_nosc_ts setspecs ivars
2937 POP_DECLSPEC_STACK; }
2938 | declspecs_nosc_nots setspecs ivars
2940 POP_DECLSPEC_STACK; }
2949 | ivars ',' maybe_resetattrs ivar_declarator
2955 $$ = add_instance_variable (objc_ivar_context,
2957 $1, current_declspecs,
2960 | declarator ':' expr_no_commas
2962 $$ = add_instance_variable (objc_ivar_context,
2964 $1, current_declspecs, $3);
2966 | ':' expr_no_commas
2968 $$ = add_instance_variable (objc_ivar_context,
2971 current_declspecs, $2);
2977 { objc_inherit_code = CLASS_METHOD_DECL; }
2979 { objc_inherit_code = INSTANCE_METHOD_DECL; }
2985 objc_pq_context = 1;
2986 if (!objc_implementation_context)
2987 fatal_error ("method definition not in class context");
2991 objc_pq_context = 0;
2992 if (objc_inherit_code == CLASS_METHOD_DECL)
2993 add_class_method (objc_implementation_context, $3);
2995 add_instance_method (objc_implementation_context, $3);
2996 start_method_def ($3);
3000 continue_method_def ();
3004 finish_method_def ();
3008 /* the reason for the strange actions in this rule
3009 is so that notype_initdecls when reached via datadef
3010 can find a valid list of type and sc specs in $0. */
3014 | {$<ttype>$ = NULL_TREE; } methodprotolist2
3017 methodprotolist2: /* eliminates a shift/reduce conflict */
3020 | methodprotolist2 methodproto
3021 | methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef
3032 /* Remember protocol qualifiers in prototypes. */
3033 objc_pq_context = 1;
3037 /* Forget protocol qualifiers here. */
3038 objc_pq_context = 0;
3039 if (objc_inherit_code == CLASS_METHOD_DECL)
3040 add_class_method (objc_interface_context, $3);
3042 add_instance_method (objc_interface_context, $3);
3048 '(' typename ')' unaryselector
3050 $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);
3055 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);
3058 | '(' typename ')' keywordselector optparmlist
3060 $$ = build_method_decl (objc_inherit_code, $2, $4, $5);
3063 | keywordselector optparmlist
3065 $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);
3069 /* "optarglist" assumes that start_method_def has already been called...
3070 if it is not, the "xdecls" will not be placed in the proper scope */
3077 /* to get around the following situation: "int foo (int a) int b; {}" that
3078 is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */
3093 declspecs_ts setspecs myparms ';'
3094 { POP_DECLSPEC_STACK; }
3096 { shadow_tag ($1); }
3097 | declspecs_nots ';'
3098 { pedwarn ("empty declaration"); }
3103 { push_parm_decl ($1); }
3104 | myparms ',' myparm
3105 { push_parm_decl ($3); }
3108 /* A single parameter declaration or parameter type name,
3109 as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
3112 parm_declarator maybe_attribute
3113 { $$ = build_tree_list (build_tree_list (current_declspecs,
3115 chainon ($2, all_prefix_attributes)); }
3116 | notype_declarator maybe_attribute
3117 { $$ = build_tree_list (build_tree_list (current_declspecs,
3119 chainon ($2, all_prefix_attributes)); }
3120 | absdcl_maybe_attribute
3131 /* oh what a kludge! */
3132 $$ = objc_ellipsis_node;
3140 /* returns a tree list node generated by get_parm_info */
3153 | keywordselector keyworddecl
3155 $$ = chainon ($1, $2);
3168 ENUM | STRUCT | UNION | IF | ELSE | WHILE | DO | FOR
3169 | SWITCH | CASE | DEFAULT | BREAK | CONTINUE | RETURN
3170 | GOTO | ASM_KEYWORD | SIZEOF | TYPEOF | ALIGNOF
3171 | TYPESPEC | TYPE_QUAL
3175 selector ':' '(' typename ')' identifier
3177 $$ = build_keyword_decl ($1, $4, $6);
3180 | selector ':' identifier
3182 $$ = build_keyword_decl ($1, NULL_TREE, $3);
3185 | ':' '(' typename ')' identifier
3187 $$ = build_keyword_decl (NULL_TREE, $3, $5);
3192 $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
3203 | keywordarglist keywordarg
3205 $$ = chainon ($1, $2);
3213 if (TREE_CHAIN ($1) == NULL_TREE)
3214 /* just return the expr., remove a level of indirection */
3215 $$ = TREE_VALUE ($1);
3217 /* we have a comma expr., we will collapse later */
3223 selector ':' keywordexpr
3225 $$ = build_tree_list ($1, $3);
3229 $$ = build_tree_list (NULL_TREE, $2);
3237 $$ = get_class_reference ($1);
3243 { objc_receiver_context = 1; }
3245 { objc_receiver_context = 0; }
3248 $$ = build_tree_list ($3, $5);
3259 | keywordnamelist keywordname
3261 $$ = chainon ($1, $2);
3268 $$ = build_tree_list ($1, NULL_TREE);
3272 $$ = build_tree_list (NULL_TREE, NULL_TREE);
3277 SELECTOR '(' selectorarg ')'
3284 PROTOCOL '(' identifier ')'
3290 /* extension to support C-structures in the archiver */
3293 ENCODE '(' typename ')'
3295 $$ = groktypename ($3);
3302 /* yylex() is a thin wrapper around c_lex(), all it does is translate
3303 cpplib.h's token codes into yacc's token codes. */
3305 static enum cpp_ttype last_token;
3307 /* The reserved keyword table. */
3311 ENUM_BITFIELD(rid) rid : 16;
3312 unsigned int disable : 16;
3315 /* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
3317 #define D_C89 0x01 /* not in C89 */
3318 #define D_EXT 0x02 /* GCC extension */
3319 #define D_EXT89 0x04 /* GCC extension incorporated in C99 */
3320 #define D_OBJC 0x08 /* Objective C only */
3322 static const struct resword reswords[] =
3324 { "_Bool", RID_BOOL, 0 },
3325 { "_Complex", RID_COMPLEX, 0 },
3326 { "__FUNCTION__", RID_FUNCTION_NAME, 0 },
3327 { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
3328 { "__alignof", RID_ALIGNOF, 0 },
3329 { "__alignof__", RID_ALIGNOF, 0 },
3330 { "__asm", RID_ASM, 0 },
3331 { "__asm__", RID_ASM, 0 },
3332 { "__attribute", RID_ATTRIBUTE, 0 },
3333 { "__attribute__", RID_ATTRIBUTE, 0 },
3334 { "__bounded", RID_BOUNDED, 0 },
3335 { "__bounded__", RID_BOUNDED, 0 },
3336 { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
3337 { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
3338 { "__builtin_va_arg", RID_VA_ARG, 0 },
3339 { "__complex", RID_COMPLEX, 0 },
3340 { "__complex__", RID_COMPLEX, 0 },
3341 { "__const", RID_CONST, 0 },
3342 { "__const__", RID_CONST, 0 },
3343 { "__extension__", RID_EXTENSION, 0 },
3344 { "__func__", RID_C99_FUNCTION_NAME, 0 },
3345 { "__imag", RID_IMAGPART, 0 },
3346 { "__imag__", RID_IMAGPART, 0 },
3347 { "__inline", RID_INLINE, 0 },
3348 { "__inline__", RID_INLINE, 0 },
3349 { "__label__", RID_LABEL, 0 },
3350 { "__ptrbase", RID_PTRBASE, 0 },
3351 { "__ptrbase__", RID_PTRBASE, 0 },
3352 { "__ptrextent", RID_PTREXTENT, 0 },
3353 { "__ptrextent__", RID_PTREXTENT, 0 },
3354 { "__ptrvalue", RID_PTRVALUE, 0 },
3355 { "__ptrvalue__", RID_PTRVALUE, 0 },
3356 { "__real", RID_REALPART, 0 },
3357 { "__real__", RID_REALPART, 0 },
3358 { "__restrict", RID_RESTRICT, 0 },
3359 { "__restrict__", RID_RESTRICT, 0 },
3360 { "__signed", RID_SIGNED, 0 },
3361 { "__signed__", RID_SIGNED, 0 },
3362 { "__typeof", RID_TYPEOF, 0 },
3363 { "__typeof__", RID_TYPEOF, 0 },
3364 { "__unbounded", RID_UNBOUNDED, 0 },
3365 { "__unbounded__", RID_UNBOUNDED, 0 },
3366 { "__volatile", RID_VOLATILE, 0 },
3367 { "__volatile__", RID_VOLATILE, 0 },
3368 { "asm", RID_ASM, D_EXT },
3369 { "auto", RID_AUTO, 0 },
3370 { "break", RID_BREAK, 0 },
3371 { "case", RID_CASE, 0 },
3372 { "char", RID_CHAR, 0 },
3373 { "const", RID_CONST, 0 },
3374 { "continue", RID_CONTINUE, 0 },
3375 { "default", RID_DEFAULT, 0 },
3376 { "do", RID_DO, 0 },
3377 { "double", RID_DOUBLE, 0 },
3378 { "else", RID_ELSE, 0 },
3379 { "enum", RID_ENUM, 0 },
3380 { "extern", RID_EXTERN, 0 },
3381 { "float", RID_FLOAT, 0 },
3382 { "for", RID_FOR, 0 },
3383 { "goto", RID_GOTO, 0 },
3384 { "if", RID_IF, 0 },
3385 { "inline", RID_INLINE, D_EXT89 },
3386 { "int", RID_INT, 0 },
3387 { "long", RID_LONG, 0 },
3388 { "register", RID_REGISTER, 0 },
3389 { "restrict", RID_RESTRICT, D_C89 },
3390 { "return", RID_RETURN, 0 },
3391 { "short", RID_SHORT, 0 },
3392 { "signed", RID_SIGNED, 0 },
3393 { "sizeof", RID_SIZEOF, 0 },
3394 { "static", RID_STATIC, 0 },
3395 { "struct", RID_STRUCT, 0 },
3396 { "switch", RID_SWITCH, 0 },
3397 { "typedef", RID_TYPEDEF, 0 },
3398 { "typeof", RID_TYPEOF, D_EXT },
3399 { "union", RID_UNION, 0 },
3400 { "unsigned", RID_UNSIGNED, 0 },
3401 { "void", RID_VOID, 0 },
3402 { "volatile", RID_VOLATILE, 0 },
3403 { "while", RID_WHILE, 0 },
3405 { "id", RID_ID, D_OBJC },
3407 /* These objc keywords are recognized only immediately after
3409 { "class", RID_AT_CLASS, D_OBJC },
3410 { "compatibility_alias", RID_AT_ALIAS, D_OBJC },
3411 { "defs", RID_AT_DEFS, D_OBJC },
3412 { "encode", RID_AT_ENCODE, D_OBJC },
3413 { "end", RID_AT_END, D_OBJC },
3414 { "implementation", RID_AT_IMPLEMENTATION, D_OBJC },
3415 { "interface", RID_AT_INTERFACE, D_OBJC },
3416 { "private", RID_AT_PRIVATE, D_OBJC },
3417 { "protected", RID_AT_PROTECTED, D_OBJC },
3418 { "protocol", RID_AT_PROTOCOL, D_OBJC },
3419 { "public", RID_AT_PUBLIC, D_OBJC },
3420 { "selector", RID_AT_SELECTOR, D_OBJC },
3422 /* These are recognized only in protocol-qualifier context
3424 { "bycopy", RID_BYCOPY, D_OBJC },
3425 { "byref", RID_BYREF, D_OBJC },
3426 { "in", RID_IN, D_OBJC },
3427 { "inout", RID_INOUT, D_OBJC },
3428 { "oneway", RID_ONEWAY, D_OBJC },
3429 { "out", RID_OUT, D_OBJC },
3432 #define N_reswords (sizeof reswords / sizeof (struct resword))
3434 /* Table mapping from RID_* constants to yacc token numbers.
3435 Unfortunately we have to have entries for all the keywords in all
3437 static const short rid_to_yy[RID_MAX] =
3439 /* RID_STATIC */ STATIC,
3440 /* RID_UNSIGNED */ TYPESPEC,
3441 /* RID_LONG */ TYPESPEC,
3442 /* RID_CONST */ TYPE_QUAL,
3443 /* RID_EXTERN */ SCSPEC,
3444 /* RID_REGISTER */ SCSPEC,
3445 /* RID_TYPEDEF */ SCSPEC,
3446 /* RID_SHORT */ TYPESPEC,
3447 /* RID_INLINE */ SCSPEC,
3448 /* RID_VOLATILE */ TYPE_QUAL,
3449 /* RID_SIGNED */ TYPESPEC,
3450 /* RID_AUTO */ SCSPEC,
3451 /* RID_RESTRICT */ TYPE_QUAL,
3454 /* RID_BOUNDED */ TYPE_QUAL,
3455 /* RID_UNBOUNDED */ TYPE_QUAL,
3456 /* RID_COMPLEX */ TYPESPEC,
3460 /* RID_VIRTUAL */ 0,
3461 /* RID_EXPLICIT */ 0,
3463 /* RID_MUTABLE */ 0,
3466 /* RID_IN */ TYPE_QUAL,
3467 /* RID_OUT */ TYPE_QUAL,
3468 /* RID_INOUT */ TYPE_QUAL,
3469 /* RID_BYCOPY */ TYPE_QUAL,
3470 /* RID_BYREF */ TYPE_QUAL,
3471 /* RID_ONEWAY */ TYPE_QUAL,
3474 /* RID_INT */ TYPESPEC,
3475 /* RID_CHAR */ TYPESPEC,
3476 /* RID_FLOAT */ TYPESPEC,
3477 /* RID_DOUBLE */ TYPESPEC,
3478 /* RID_VOID */ TYPESPEC,
3479 /* RID_ENUM */ ENUM,
3480 /* RID_STRUCT */ STRUCT,
3481 /* RID_UNION */ UNION,
3483 /* RID_ELSE */ ELSE,
3484 /* RID_WHILE */ WHILE,
3487 /* RID_SWITCH */ SWITCH,
3488 /* RID_CASE */ CASE,
3489 /* RID_DEFAULT */ DEFAULT,
3490 /* RID_BREAK */ BREAK,
3491 /* RID_CONTINUE */ CONTINUE,
3492 /* RID_RETURN */ RETURN,
3493 /* RID_GOTO */ GOTO,
3494 /* RID_SIZEOF */ SIZEOF,
3497 /* RID_ASM */ ASM_KEYWORD,
3498 /* RID_TYPEOF */ TYPEOF,
3499 /* RID_ALIGNOF */ ALIGNOF,
3500 /* RID_ATTRIBUTE */ ATTRIBUTE,
3501 /* RID_VA_ARG */ VA_ARG,
3502 /* RID_EXTENSION */ EXTENSION,
3503 /* RID_IMAGPART */ IMAGPART,
3504 /* RID_REALPART */ REALPART,
3505 /* RID_LABEL */ LABEL,
3506 /* RID_PTRBASE */ PTR_BASE,
3507 /* RID_PTREXTENT */ PTR_EXTENT,
3508 /* RID_PTRVALUE */ PTR_VALUE,
3510 /* RID_CHOOSE_EXPR */ CHOOSE_EXPR,
3511 /* RID_TYPES_COMPATIBLE_P */ TYPES_COMPATIBLE_P,
3513 /* RID_FUNCTION_NAME */ STRING_FUNC_NAME,
3514 /* RID_PRETTY_FUNCTION_NAME */ STRING_FUNC_NAME,
3515 /* RID_C99_FUNCTION_NAME */ VAR_FUNC_NAME,
3518 /* RID_BOOL */ TYPESPEC,
3522 /* RID_PRIVATE */ 0,
3523 /* RID_PROTECTED */ 0,
3524 /* RID_TEMPLATE */ 0,
3529 /* RID_NAMESPACE */ 0,
3531 /* RID_OPERATOR */ 0,
3536 /* RID_TYPENAME */ 0,
3541 /* RID_CONSTCAST */ 0,
3542 /* RID_DYNCAST */ 0,
3543 /* RID_REINTCAST */ 0,
3544 /* RID_STATCAST */ 0,
3546 /* alternate spellings */
3560 /* RID_ID */ OBJECTNAME,
3561 /* RID_AT_ENCODE */ ENCODE,
3562 /* RID_AT_END */ END,
3563 /* RID_AT_CLASS */ CLASS,
3564 /* RID_AT_ALIAS */ ALIAS,
3565 /* RID_AT_DEFS */ DEFS,
3566 /* RID_AT_PRIVATE */ PRIVATE,
3567 /* RID_AT_PROTECTED */ PROTECTED,
3568 /* RID_AT_PUBLIC */ PUBLIC,
3569 /* RID_AT_PROTOCOL */ PROTOCOL,
3570 /* RID_AT_SELECTOR */ SELECTOR,
3571 /* RID_AT_INTERFACE */ INTERFACE,
3572 /* RID_AT_IMPLEMENTATION */ IMPLEMENTATION
3580 int mask = (flag_isoc99 ? 0 : D_C89)
3581 | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
3583 if (c_language != clk_objective_c)
3586 /* It is not necessary to register ridpointers as a GC root, because
3587 all the trees it points to are permanently interned in the
3588 get_identifier hash anyway. */
3589 ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
3590 for (i = 0; i < N_reswords; i++)
3592 /* If a keyword is disabled, do not enter it into the table
3593 and so create a canonical spelling that isn't a keyword. */
3594 if (reswords[i].disable & mask)
3597 id = get_identifier (reswords[i].word);
3598 C_RID_CODE (id) = reswords[i].rid;
3599 C_IS_RESERVED_WORD (id) = 1;
3600 ridpointers [(int) reswords[i].rid] = id;
3604 #define NAME(type) cpp_type2name (type)
3610 const char *string = _(msgid);
3612 if (last_token == CPP_EOF)
3613 error ("%s at end of input", string);
3614 else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
3616 unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
3617 const char *const ell = (last_token == CPP_CHAR) ? "" : "L";
3618 if (val <= UCHAR_MAX && ISGRAPH (val))
3619 error ("%s before %s'%c'", string, ell, val);
3621 error ("%s before %s'\\x%x'", string, ell, val);
3623 else if (last_token == CPP_STRING
3624 || last_token == CPP_WSTRING)
3625 error ("%s before string constant", string);
3626 else if (last_token == CPP_NUMBER)
3627 error ("%s before numeric constant", string);
3628 else if (last_token == CPP_NAME)
3629 error ("%s before \"%s\"", string, IDENTIFIER_POINTER (yylval.ttype));
3631 error ("%s before '%s' token", string, NAME(last_token));
3640 int objc_force_identifier = objc_need_raw_identifier;
3641 OBJC_NEED_RAW_IDENTIFIER (0);
3644 if (C_IS_RESERVED_WORD (yylval.ttype))
3646 enum rid rid_code = C_RID_CODE (yylval.ttype);
3649 /* Turn non-typedefed refs to "id" into plain identifiers; this
3650 allows constructs like "void foo(id id);" to work. */
3651 if (rid_code == RID_ID)
3653 decl = lookup_name (yylval.ttype);
3654 if (decl == NULL_TREE || TREE_CODE (decl) != TYPE_DECL)
3658 if (!OBJC_IS_AT_KEYWORD (rid_code)
3659 && (!OBJC_IS_PQ_KEYWORD (rid_code) || objc_pq_context))
3662 int yycode = rid_to_yy[(int) rid_code];
3663 if (yycode == STRING_FUNC_NAME)
3665 /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
3666 to string constants. */
3667 const char *name = fname_string (rid_code);
3669 yylval.ttype = build_string (strlen (name) + 1, name);
3670 C_ARTIFICIAL_STRING_P (yylval.ttype) = 1;
3671 last_token = CPP_STRING; /* so yyerror won't choke */
3675 /* Return the canonical spelling for this keyword. */
3676 yylval.ttype = ridpointers[(int) rid_code];
3681 decl = lookup_name (yylval.ttype);
3684 if (TREE_CODE (decl) == TYPE_DECL)
3690 tree objc_interface_decl = is_class_name (yylval.ttype);
3691 /* ObjC class names are in the same namespace as variables and
3692 typedefs, and hence are shadowed by local declarations. */
3693 if (objc_interface_decl
3694 && (global_bindings_p ()
3695 || (!objc_force_identifier && !decl)))
3697 yylval.ttype = objc_interface_decl;
3711 last_token = c_lex (&yylval.ttype);
3714 case CPP_EQ: return '=';
3715 case CPP_NOT: return '!';
3716 case CPP_GREATER: yylval.code = GT_EXPR; return ARITHCOMPARE;
3717 case CPP_LESS: yylval.code = LT_EXPR; return ARITHCOMPARE;
3718 case CPP_PLUS: yylval.code = PLUS_EXPR; return '+';
3719 case CPP_MINUS: yylval.code = MINUS_EXPR; return '-';
3720 case CPP_MULT: yylval.code = MULT_EXPR; return '*';
3721 case CPP_DIV: yylval.code = TRUNC_DIV_EXPR; return '/';
3722 case CPP_MOD: yylval.code = TRUNC_MOD_EXPR; return '%';
3723 case CPP_AND: yylval.code = BIT_AND_EXPR; return '&';
3724 case CPP_OR: yylval.code = BIT_IOR_EXPR; return '|';
3725 case CPP_XOR: yylval.code = BIT_XOR_EXPR; return '^';
3726 case CPP_RSHIFT: yylval.code = RSHIFT_EXPR; return RSHIFT;
3727 case CPP_LSHIFT: yylval.code = LSHIFT_EXPR; return LSHIFT;
3729 case CPP_COMPL: return '~';
3730 case CPP_AND_AND: return ANDAND;
3731 case CPP_OR_OR: return OROR;
3732 case CPP_QUERY: return '?';
3733 case CPP_OPEN_PAREN: return '(';
3734 case CPP_EQ_EQ: yylval.code = EQ_EXPR; return EQCOMPARE;
3735 case CPP_NOT_EQ: yylval.code = NE_EXPR; return EQCOMPARE;
3736 case CPP_GREATER_EQ:yylval.code = GE_EXPR; return ARITHCOMPARE;
3737 case CPP_LESS_EQ: yylval.code = LE_EXPR; return ARITHCOMPARE;
3739 case CPP_PLUS_EQ: yylval.code = PLUS_EXPR; return ASSIGN;
3740 case CPP_MINUS_EQ: yylval.code = MINUS_EXPR; return ASSIGN;
3741 case CPP_MULT_EQ: yylval.code = MULT_EXPR; return ASSIGN;
3742 case CPP_DIV_EQ: yylval.code = TRUNC_DIV_EXPR; return ASSIGN;
3743 case CPP_MOD_EQ: yylval.code = TRUNC_MOD_EXPR; return ASSIGN;
3744 case CPP_AND_EQ: yylval.code = BIT_AND_EXPR; return ASSIGN;
3745 case CPP_OR_EQ: yylval.code = BIT_IOR_EXPR; return ASSIGN;
3746 case CPP_XOR_EQ: yylval.code = BIT_XOR_EXPR; return ASSIGN;
3747 case CPP_RSHIFT_EQ: yylval.code = RSHIFT_EXPR; return ASSIGN;
3748 case CPP_LSHIFT_EQ: yylval.code = LSHIFT_EXPR; return ASSIGN;
3750 case CPP_OPEN_SQUARE: return '[';
3751 case CPP_CLOSE_SQUARE: return ']';
3752 case CPP_OPEN_BRACE: return '{';
3753 case CPP_CLOSE_BRACE: return '}';
3754 case CPP_ELLIPSIS: return ELLIPSIS;
3756 case CPP_PLUS_PLUS: return PLUSPLUS;
3757 case CPP_MINUS_MINUS: return MINUSMINUS;
3758 case CPP_DEREF: return POINTSAT;
3759 case CPP_DOT: return '.';
3761 /* The following tokens may affect the interpretation of any
3762 identifiers following, if doing Objective-C. */
3763 case CPP_COLON: OBJC_NEED_RAW_IDENTIFIER (0); return ':';
3764 case CPP_COMMA: OBJC_NEED_RAW_IDENTIFIER (0); return ',';
3765 case CPP_CLOSE_PAREN: OBJC_NEED_RAW_IDENTIFIER (0); return ')';
3766 case CPP_SEMICOLON: OBJC_NEED_RAW_IDENTIFIER (0); return ';';
3772 return yylexname ();
3783 /* This token is Objective-C specific. It gives the next token
3784 special significance. */
3789 enum cpp_ttype after_at_type;
3791 after_at_type = c_lex (&after_at);
3793 if (after_at_type == CPP_NAME
3794 && C_IS_RESERVED_WORD (after_at)
3795 && OBJC_IS_AT_KEYWORD (C_RID_CODE (after_at)))
3797 yylval.ttype = after_at;
3798 last_token = after_at_type;
3799 return rid_to_yy [(int) C_RID_CODE (after_at)];
3801 _cpp_backup_tokens (parse_in, 1);
3806 /* These tokens are C++ specific (and will not be generated
3807 in C mode, but let's be cautious). */
3809 case CPP_DEREF_STAR:
3815 /* These tokens should not survive translation phase 4. */
3818 error ("syntax error at '%s' token", NAME(last_token));
3831 timevar_push (TV_LEX);
3833 timevar_pop (TV_LEX);
3837 /* Function used when yydebug is set, to print a token in more detail. */
3840 yyprint (file, yychar, yyl)
3847 fprintf (file, " [%s]", NAME(last_token));
3858 if (IDENTIFIER_POINTER (t))
3859 fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
3863 fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
3864 if (TREE_CODE (t) == INTEGER_CST)
3866 #if HOST_BITS_PER_WIDE_INT == 64
3867 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
3870 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
3877 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
3883 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
3888 /* This is not the ideal place to put these, but we have to get them out
3889 of c-lex.c because cp/lex.c has its own versions. */
3891 /* Return something to represent absolute declarators containing a *.
3892 TARGET is the absolute declarator that the * contains.
3893 TYPE_QUALS_ATTRS is a list of modifiers such as const or volatile
3894 to apply to the pointer type, represented as identifiers, possible mixed
3897 We return an INDIRECT_REF whose "contents" are TARGET (inside a TREE_LIST,
3898 if attributes are present) and whose type is the modifier list. */
3901 make_pointer_declarator (type_quals_attrs, target)
3902 tree type_quals_attrs, target;
3905 tree itarget = target;
3906 split_specs_attrs (type_quals_attrs, &quals, &attrs);
3907 if (attrs != NULL_TREE)
3908 itarget = tree_cons (attrs, target, NULL_TREE);
3909 return build1 (INDIRECT_REF, quals, itarget);