2000-07-12 Bryce McKinlay <bryce@albatross.co.nz>
[official-gcc.git] / gcc / c-parse.y
blob11b06569acda8a07dc94057e0aaded03a7bc48cd
1 /*WARNING: This file is automatically generated!*/
2 /* YACC parser for C syntax and for Objective C. -*-c-*-
3 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996,
4 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* This file defines the grammar of C and that of Objective C.
24 ifobjc ... end ifobjc conditionals contain code for Objective C only.
25 ifc ... end ifc conditionals contain code for C only.
26 Sed commands in Makefile.in are used to convert this file into
27 c-parse.y and into objc-parse.y. */
29 /* To whomever it may concern: I have heard that such a thing was once
30 written by AT&T, but I have never seen it. */
32 %expect 53
35 #include "config.h"
36 #include "system.h"
37 #include <setjmp.h>
38 #include "tree.h"
39 #include "input.h"
40 #include "c-lex.h"
41 #include "c-tree.h"
42 #include "flags.h"
43 #include "output.h"
44 #include "toplev.h"
45 #include "ggc.h"
47 #ifdef MULTIBYTE_CHARS
48 #include <locale.h>
49 #endif
52 /* Since parsers are distinct for each language, put the language string
53 definition here. */
54 const char * const language_string = "GNU C";
56 /* Like YYERROR but do call yyerror. */
57 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
59 /* Cause the `yydebug' variable to be defined. */
60 #define YYDEBUG 1
63 %start program
65 %union {long itype; tree ttype; enum tree_code code;
66 const char *filename; int lineno; int ends_in_label; }
68 /* All identifiers that are not reserved words
69 and are not declared typedefs in the current block */
70 %token IDENTIFIER
72 /* All identifiers that are declared typedefs in the current block.
73 In some contexts, they are treated just like IDENTIFIER,
74 but they can also serve as typespecs in declarations. */
75 %token TYPENAME
77 /* Reserved words that specify storage class.
78 yylval contains an IDENTIFIER_NODE which indicates which one. */
79 %token SCSPEC
81 /* Reserved words that specify type.
82 yylval contains an IDENTIFIER_NODE which indicates which one. */
83 %token TYPESPEC
85 /* Reserved words that qualify type: "const", "volatile", or "restrict".
86 yylval contains an IDENTIFIER_NODE which indicates which one. */
87 %token TYPE_QUAL
89 /* Character or numeric constants.
90 yylval is the node for the constant. */
91 %token CONSTANT
93 /* String constants in raw form.
94 yylval is a STRING_CST node. */
95 %token STRING
97 /* "...", used for functions with variable arglists. */
98 %token ELLIPSIS
100 /* the reserved words */
101 /* SCO include files test "ASM", so use something else. */
102 %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
103 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
104 %token ATTRIBUTE EXTENSION LABEL
105 %token REALPART IMAGPART VA_ARG
106 %token PTR_VALUE PTR_BASE PTR_EXTENT
108 /* Used in c-lex.c for parsing pragmas. */
109 %token END_OF_LINE
111 /* Add precedence rules to solve dangling else s/r conflict */
112 %nonassoc IF
113 %nonassoc ELSE
115 /* Define the operator tokens and their precedences.
116 The value is an integer because, if used, it is the tree code
117 to use in the expression made from the operator. */
119 %right <code> ASSIGN '='
120 %right <code> '?' ':'
121 %left <code> OROR
122 %left <code> ANDAND
123 %left <code> '|'
124 %left <code> '^'
125 %left <code> '&'
126 %left <code> EQCOMPARE
127 %left <code> ARITHCOMPARE
128 %left <code> LSHIFT RSHIFT
129 %left <code> '+' '-'
130 %left <code> '*' '/' '%'
131 %right <code> UNARY PLUSPLUS MINUSMINUS
132 %left HYPERUNARY
133 %left <code> POINTSAT '.' '(' '['
135 /* The Objective-C keywords. These are included in C and in
136 Objective C, so that the token codes are the same in both. */
137 %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
138 %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
140 /* Objective-C string constants in raw form.
141 yylval is an OBJC_STRING_CST node. */
142 %token OBJC_STRING
145 %type <code> unop
147 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
148 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
149 %type <ttype> typed_declspecs reserved_declspecs
150 %type <ttype> typed_typespecs reserved_typespecquals
151 %type <ttype> declmods typespec typespecqual_reserved
152 %type <ttype> typed_declspecs_no_prefix_attr reserved_declspecs_no_prefix_attr
153 %type <ttype> declmods_no_prefix_attr
154 %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
155 %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
156 %type <ttype> init maybeasm
157 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
158 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
159 %type <ttype> any_word extension
161 %type <ttype> compstmt compstmt_nostart compstmt_primary_start
163 %type <ttype> declarator
164 %type <ttype> notype_declarator after_type_declarator
165 %type <ttype> parm_declarator
167 %type <ttype> structsp component_decl_list component_decl_list2
168 %type <ttype> component_decl components component_declarator
169 %type <ttype> enumlist enumerator
170 %type <ttype> struct_head union_head enum_head
171 %type <ttype> typename absdcl absdcl1 type_quals
172 %type <ttype> xexpr parms parm identifiers
174 %type <ttype> parmlist parmlist_1 parmlist_2
175 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
176 %type <ttype> identifiers_or_typenames
178 %type <itype> setspecs
180 %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
182 %type <filename> save_filename
183 %type <lineno> save_lineno
187 /* Number of statements (loosely speaking) and compound statements
188 seen so far. */
189 static int stmt_count;
190 static int compstmt_count;
192 /* Input file and line number of the end of the body of last simple_if;
193 used by the stmt-rule immediately after simple_if returns. */
194 static const char *if_stmt_file;
195 static int if_stmt_line;
197 /* List of types and structure classes of the current declaration. */
198 static tree current_declspecs = NULL_TREE;
199 static tree prefix_attributes = NULL_TREE;
201 /* Stack of saved values of current_declspecs and prefix_attributes. */
202 static tree declspec_stack;
204 /* For __extension__, save/restore the warning flags which are
205 controlled by __extension__. */
206 #define SAVE_WARN_FLAGS() \
207 size_int (pedantic | (warn_pointer_arith << 1))
208 #define RESTORE_WARN_FLAGS(tval) \
209 do { \
210 int val = tree_low_cst (tval, 0); \
211 pedantic = val & 1; \
212 warn_pointer_arith = (val >> 1) & 1; \
213 } while (0)
216 /* Tell yyparse how to print a token's value, if yydebug is set. */
218 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
219 extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
221 /* Add GC roots for variables local to this file. */
222 void
223 c_parse_init ()
225 ggc_add_tree_root (&declspec_stack, 1);
226 ggc_add_tree_root (&current_declspecs, 1);
227 ggc_add_tree_root (&prefix_attributes, 1);
233 program: /* empty */
234 { if (pedantic)
235 pedwarn ("ANSI C forbids an empty source file");
236 finish_file ();
238 | extdefs
240 /* In case there were missing closebraces,
241 get us back to the global binding level. */
242 while (! global_bindings_p ())
243 poplevel (0, 0, 0);
244 finish_file ();
248 /* the reason for the strange actions in this rule
249 is so that notype_initdecls when reached via datadef
250 can find a valid list of type and sc specs in $0. */
252 extdefs:
253 {$<ttype>$ = NULL_TREE; } extdef
254 | extdefs {$<ttype>$ = NULL_TREE; } extdef
257 extdef:
258 fndef
259 | datadef
260 | ASM_KEYWORD '(' expr ')' ';'
261 { STRIP_NOPS ($3);
262 if ((TREE_CODE ($3) == ADDR_EXPR
263 && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
264 || TREE_CODE ($3) == STRING_CST)
265 assemble_asm ($3);
266 else
267 error ("argument of `asm' is not a constant string"); }
268 | extension extdef
269 { RESTORE_WARN_FLAGS ($1); }
272 datadef:
273 setspecs notype_initdecls ';'
274 { if (pedantic)
275 error ("ANSI C forbids data definition with no type or storage class");
276 else if (!flag_traditional)
277 warning ("data definition has no type or storage class");
279 current_declspecs = TREE_VALUE (declspec_stack);
280 prefix_attributes = TREE_PURPOSE (declspec_stack);
281 declspec_stack = TREE_CHAIN (declspec_stack); }
282 | declmods setspecs notype_initdecls ';'
283 { current_declspecs = TREE_VALUE (declspec_stack);
284 prefix_attributes = TREE_PURPOSE (declspec_stack);
285 declspec_stack = TREE_CHAIN (declspec_stack); }
286 | typed_declspecs setspecs initdecls ';'
287 { current_declspecs = TREE_VALUE (declspec_stack);
288 prefix_attributes = TREE_PURPOSE (declspec_stack);
289 declspec_stack = TREE_CHAIN (declspec_stack); }
290 | declmods ';'
291 { pedwarn ("empty declaration"); }
292 | typed_declspecs ';'
293 { shadow_tag ($1); }
294 | error ';'
295 | error '}'
296 | ';'
297 { if (pedantic)
298 pedwarn ("ANSI C does not allow extra `;' outside of a function"); }
301 fndef:
302 typed_declspecs setspecs declarator
303 { if (! start_function (current_declspecs, $3,
304 prefix_attributes, NULL_TREE))
305 YYERROR1;
306 reinit_parse_for_function (); }
307 old_style_parm_decls
308 { store_parm_decls (); }
309 compstmt_or_error
310 { finish_function (0);
311 current_declspecs = TREE_VALUE (declspec_stack);
312 prefix_attributes = TREE_PURPOSE (declspec_stack);
313 declspec_stack = TREE_CHAIN (declspec_stack); }
314 | typed_declspecs setspecs declarator error
315 { current_declspecs = TREE_VALUE (declspec_stack);
316 prefix_attributes = TREE_PURPOSE (declspec_stack);
317 declspec_stack = TREE_CHAIN (declspec_stack); }
318 | declmods setspecs notype_declarator
319 { if (! start_function (current_declspecs, $3,
320 prefix_attributes, NULL_TREE))
321 YYERROR1;
322 reinit_parse_for_function (); }
323 old_style_parm_decls
324 { store_parm_decls (); }
325 compstmt_or_error
326 { finish_function (0);
327 current_declspecs = TREE_VALUE (declspec_stack);
328 prefix_attributes = TREE_PURPOSE (declspec_stack);
329 declspec_stack = TREE_CHAIN (declspec_stack); }
330 | declmods setspecs notype_declarator error
331 { current_declspecs = TREE_VALUE (declspec_stack);
332 prefix_attributes = TREE_PURPOSE (declspec_stack);
333 declspec_stack = TREE_CHAIN (declspec_stack); }
334 | setspecs notype_declarator
335 { if (! start_function (NULL_TREE, $2,
336 prefix_attributes, NULL_TREE))
337 YYERROR1;
338 reinit_parse_for_function (); }
339 old_style_parm_decls
340 { store_parm_decls (); }
341 compstmt_or_error
342 { finish_function (0);
343 current_declspecs = TREE_VALUE (declspec_stack);
344 prefix_attributes = TREE_PURPOSE (declspec_stack);
345 declspec_stack = TREE_CHAIN (declspec_stack); }
346 | setspecs notype_declarator error
347 { current_declspecs = TREE_VALUE (declspec_stack);
348 prefix_attributes = TREE_PURPOSE (declspec_stack);
349 declspec_stack = TREE_CHAIN (declspec_stack); }
352 identifier:
353 IDENTIFIER
354 | TYPENAME
357 unop: '&'
358 { $$ = ADDR_EXPR; }
359 | '-'
360 { $$ = NEGATE_EXPR; }
361 | '+'
362 { $$ = CONVERT_EXPR; }
363 | PLUSPLUS
364 { $$ = PREINCREMENT_EXPR; }
365 | MINUSMINUS
366 { $$ = PREDECREMENT_EXPR; }
367 | '~'
368 { $$ = BIT_NOT_EXPR; }
369 | '!'
370 { $$ = TRUTH_NOT_EXPR; }
373 expr: nonnull_exprlist
374 { $$ = build_compound_expr ($1); }
377 exprlist:
378 /* empty */
379 { $$ = NULL_TREE; }
380 | nonnull_exprlist
383 nonnull_exprlist:
384 expr_no_commas
385 { $$ = build_tree_list (NULL_TREE, $1); }
386 | nonnull_exprlist ',' expr_no_commas
387 { chainon ($1, build_tree_list (NULL_TREE, $3)); }
390 unary_expr:
391 primary
392 | '*' cast_expr %prec UNARY
393 { $$ = build_indirect_ref ($2, "unary *"); }
394 /* __extension__ turns off -pedantic for following primary. */
395 | extension cast_expr %prec UNARY
396 { $$ = $2;
397 RESTORE_WARN_FLAGS ($1); }
398 | unop cast_expr %prec UNARY
399 { $$ = build_unary_op ($1, $2, 0);
400 overflow_warning ($$); }
401 /* Refer to the address of a label as a pointer. */
402 | ANDAND identifier
403 { tree label = lookup_label ($2);
404 if (pedantic)
405 pedwarn ("ANSI C forbids `&&'");
406 if (label == 0)
407 $$ = null_pointer_node;
408 else
410 TREE_USED (label) = 1;
411 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
412 TREE_CONSTANT ($$) = 1;
415 /* This seems to be impossible on some machines, so let's turn it off.
416 You can use __builtin_next_arg to find the anonymous stack args.
417 | '&' ELLIPSIS
418 { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
419 $$ = error_mark_node;
420 if (TREE_VALUE (tree_last (types)) == void_type_node)
421 error ("`&...' used in function with fixed number of arguments");
422 else
424 if (pedantic)
425 pedwarn ("ANSI C forbids `&...'");
426 $$ = tree_last (DECL_ARGUMENTS (current_function_decl));
427 $$ = build_unary_op (ADDR_EXPR, $$, 0);
430 | sizeof unary_expr %prec UNARY
431 { skip_evaluation--;
432 if (TREE_CODE ($2) == COMPONENT_REF
433 && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
434 error ("`sizeof' applied to a bit-field");
435 $$ = c_sizeof (TREE_TYPE ($2)); }
436 | sizeof '(' typename ')' %prec HYPERUNARY
437 { skip_evaluation--;
438 $$ = c_sizeof (groktypename ($3)); }
439 | alignof unary_expr %prec UNARY
440 { skip_evaluation--;
441 $$ = c_alignof_expr ($2); }
442 | alignof '(' typename ')' %prec HYPERUNARY
443 { skip_evaluation--;
444 $$ = c_alignof (groktypename ($3)); }
445 | REALPART cast_expr %prec UNARY
446 { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
447 | IMAGPART cast_expr %prec UNARY
448 { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
449 | VA_ARG '(' expr_no_commas ',' typename ')'
450 { $$ = build_va_arg ($3, groktypename ($5)); }
453 sizeof:
454 SIZEOF { skip_evaluation++; }
457 alignof:
458 ALIGNOF { skip_evaluation++; }
461 cast_expr:
462 unary_expr
463 | '(' typename ')' cast_expr %prec UNARY
464 { tree type = groktypename ($2);
465 $$ = build_c_cast (type, $4); }
466 | '(' typename ')' '{'
467 { start_init (NULL_TREE, NULL, 0);
468 $2 = groktypename ($2);
469 really_start_incremental_init ($2); }
470 initlist_maybe_comma '}' %prec UNARY
471 { const char *name;
472 tree result = pop_init_level (0);
473 tree type = $2;
474 finish_init ();
476 if (pedantic && ! flag_isoc99)
477 pedwarn ("ANSI C forbids constructor expressions");
478 if (TYPE_NAME (type) != 0)
480 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
481 name = IDENTIFIER_POINTER (TYPE_NAME (type));
482 else
483 name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
485 else
486 name = "";
487 $$ = result;
488 if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
490 int failure = complete_array_type (type, $$, 1);
491 if (failure)
492 abort ();
497 expr_no_commas:
498 cast_expr
499 | expr_no_commas '+' expr_no_commas
500 { $$ = parser_build_binary_op ($2, $1, $3); }
501 | expr_no_commas '-' expr_no_commas
502 { $$ = parser_build_binary_op ($2, $1, $3); }
503 | expr_no_commas '*' expr_no_commas
504 { $$ = parser_build_binary_op ($2, $1, $3); }
505 | expr_no_commas '/' expr_no_commas
506 { $$ = parser_build_binary_op ($2, $1, $3); }
507 | expr_no_commas '%' expr_no_commas
508 { $$ = parser_build_binary_op ($2, $1, $3); }
509 | expr_no_commas LSHIFT expr_no_commas
510 { $$ = parser_build_binary_op ($2, $1, $3); }
511 | expr_no_commas RSHIFT expr_no_commas
512 { $$ = parser_build_binary_op ($2, $1, $3); }
513 | expr_no_commas ARITHCOMPARE expr_no_commas
514 { $$ = parser_build_binary_op ($2, $1, $3); }
515 | expr_no_commas EQCOMPARE expr_no_commas
516 { $$ = parser_build_binary_op ($2, $1, $3); }
517 | expr_no_commas '&' expr_no_commas
518 { $$ = parser_build_binary_op ($2, $1, $3); }
519 | expr_no_commas '|' expr_no_commas
520 { $$ = parser_build_binary_op ($2, $1, $3); }
521 | expr_no_commas '^' expr_no_commas
522 { $$ = parser_build_binary_op ($2, $1, $3); }
523 | expr_no_commas ANDAND
524 { $1 = truthvalue_conversion (default_conversion ($1));
525 skip_evaluation += $1 == boolean_false_node; }
526 expr_no_commas
527 { skip_evaluation -= $1 == boolean_false_node;
528 $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
529 | expr_no_commas OROR
530 { $1 = truthvalue_conversion (default_conversion ($1));
531 skip_evaluation += $1 == boolean_true_node; }
532 expr_no_commas
533 { skip_evaluation -= $1 == boolean_true_node;
534 $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
535 | expr_no_commas '?'
536 { $1 = truthvalue_conversion (default_conversion ($1));
537 skip_evaluation += $1 == boolean_false_node; }
538 expr ':'
539 { skip_evaluation += (($1 == boolean_true_node)
540 - ($1 == boolean_false_node)); }
541 expr_no_commas
542 { skip_evaluation -= $1 == boolean_true_node;
543 $$ = build_conditional_expr ($1, $4, $7); }
544 | expr_no_commas '?'
545 { if (pedantic)
546 pedwarn ("ANSI C forbids omitting the middle term of a ?: expression");
547 /* Make sure first operand is calculated only once. */
548 $<ttype>2 = save_expr ($1);
549 $1 = truthvalue_conversion (default_conversion ($<ttype>2));
550 skip_evaluation += $1 == boolean_true_node; }
551 ':' expr_no_commas
552 { skip_evaluation -= $1 == boolean_true_node;
553 $$ = build_conditional_expr ($1, $<ttype>2, $5); }
554 | expr_no_commas '=' expr_no_commas
555 { char class;
556 $$ = build_modify_expr ($1, NOP_EXPR, $3);
557 class = TREE_CODE_CLASS (TREE_CODE ($$));
558 if (class == 'e' || class == '1'
559 || class == '2' || class == '<')
560 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR);
562 | expr_no_commas ASSIGN expr_no_commas
563 { char class;
564 $$ = build_modify_expr ($1, $2, $3);
565 /* This inhibits warnings in truthvalue_conversion. */
566 class = TREE_CODE_CLASS (TREE_CODE ($$));
567 if (class == 'e' || class == '1'
568 || class == '2' || class == '<')
569 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK);
573 primary:
574 IDENTIFIER
576 if (yychar == YYEMPTY)
577 yychar = YYLEX;
578 $$ = build_external_ref ($1, yychar == '(');
580 | CONSTANT
581 | string
582 { $$ = combine_strings ($1); }
583 | '(' expr ')'
584 { char class = TREE_CODE_CLASS (TREE_CODE ($2));
585 if (class == 'e' || class == '1'
586 || class == '2' || class == '<')
587 C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
588 $$ = $2; }
589 | '(' error ')'
590 { $$ = error_mark_node; }
591 | compstmt_primary_start compstmt_nostart ')'
592 { tree rtl_exp;
593 if (pedantic)
594 pedwarn ("ANSI C forbids braced-groups within expressions");
595 pop_iterator_stack ();
596 pop_label_level ();
597 rtl_exp = expand_end_stmt_expr ($1);
598 /* The statements have side effects, so the group does. */
599 TREE_SIDE_EFFECTS (rtl_exp) = 1;
601 if (TREE_CODE ($2) == BLOCK)
603 /* Make a BIND_EXPR for the BLOCK already made. */
604 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
605 NULL_TREE, rtl_exp, $2);
606 /* Remove the block from the tree at this point.
607 It gets put back at the proper place
608 when the BIND_EXPR is expanded. */
609 delete_block ($2);
611 else
612 $$ = $2;
614 | compstmt_primary_start error ')'
616 /* Make sure we call expand_end_stmt_expr. Otherwise
617 we are likely to lose sequences and crash later. */
618 pop_iterator_stack ();
619 pop_label_level ();
620 expand_end_stmt_expr ($1);
621 $$ = error_mark_node;
623 | primary '(' exprlist ')' %prec '.'
624 { $$ = build_function_call ($1, $3); }
625 | primary '[' expr ']' %prec '.'
626 { $$ = build_array_ref ($1, $3); }
627 | primary '.' identifier
629 $$ = build_component_ref ($1, $3);
631 | primary POINTSAT identifier
633 tree expr = build_indirect_ref ($1, "->");
635 $$ = build_component_ref (expr, $3);
637 | primary PLUSPLUS
638 { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
639 | primary MINUSMINUS
640 { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
643 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
644 string:
645 STRING
646 | string STRING
647 { $$ = chainon ($1, $2);
648 if (warn_traditional && !in_system_header)
649 warning ("Use of ANSI string concatenation");
654 old_style_parm_decls:
655 /* empty */
656 | datadecls
657 | datadecls ELLIPSIS
658 /* ... is used here to indicate a varargs function. */
659 { c_mark_varargs ();
660 if (pedantic)
661 pedwarn ("ANSI C does not permit use of `varargs.h'"); }
664 /* The following are analogous to lineno_decl, decls and decl
665 except that they do not allow nested functions.
666 They are used for old-style parm decls. */
667 lineno_datadecl:
668 save_filename save_lineno datadecl
672 datadecls:
673 lineno_datadecl
674 | errstmt
675 | datadecls lineno_datadecl
676 | lineno_datadecl errstmt
679 /* We don't allow prefix attributes here because they cause reduce/reduce
680 conflicts: we can't know whether we're parsing a function decl with
681 attribute suffix, or function defn with attribute prefix on first old
682 style parm. */
683 datadecl:
684 typed_declspecs_no_prefix_attr setspecs initdecls ';'
685 { current_declspecs = TREE_VALUE (declspec_stack);
686 prefix_attributes = TREE_PURPOSE (declspec_stack);
687 declspec_stack = TREE_CHAIN (declspec_stack); }
688 | declmods_no_prefix_attr setspecs notype_initdecls ';'
689 { current_declspecs = TREE_VALUE (declspec_stack);
690 prefix_attributes = TREE_PURPOSE (declspec_stack);
691 declspec_stack = TREE_CHAIN (declspec_stack); }
692 | typed_declspecs_no_prefix_attr ';'
693 { shadow_tag_warned ($1, 1);
694 pedwarn ("empty declaration"); }
695 | declmods_no_prefix_attr ';'
696 { pedwarn ("empty declaration"); }
699 /* This combination which saves a lineno before a decl
700 is the normal thing to use, rather than decl itself.
701 This is to avoid shift/reduce conflicts in contexts
702 where statement labels are allowed. */
703 lineno_decl:
704 save_filename save_lineno decl
708 decls:
709 lineno_decl
710 | errstmt
711 | decls lineno_decl
712 | lineno_decl errstmt
715 /* records the type and storage class specs to use for processing
716 the declarators that follow.
717 Maintains a stack of outer-level values of current_declspecs,
718 for the sake of parm declarations nested in function declarators. */
719 setspecs: /* empty */
720 { pending_xref_error ();
721 declspec_stack = tree_cons (prefix_attributes,
722 current_declspecs,
723 declspec_stack);
724 split_specs_attrs ($<ttype>0,
725 &current_declspecs, &prefix_attributes); }
728 /* ??? Yuck. See after_type_declarator. */
729 setattrs: /* empty */
730 { prefix_attributes = chainon (prefix_attributes, $<ttype>0); }
733 decl:
734 typed_declspecs setspecs initdecls ';'
735 { current_declspecs = TREE_VALUE (declspec_stack);
736 prefix_attributes = TREE_PURPOSE (declspec_stack);
737 declspec_stack = TREE_CHAIN (declspec_stack); }
738 | declmods setspecs notype_initdecls ';'
739 { current_declspecs = TREE_VALUE (declspec_stack);
740 prefix_attributes = TREE_PURPOSE (declspec_stack);
741 declspec_stack = TREE_CHAIN (declspec_stack); }
742 | typed_declspecs setspecs nested_function
743 { current_declspecs = TREE_VALUE (declspec_stack);
744 prefix_attributes = TREE_PURPOSE (declspec_stack);
745 declspec_stack = TREE_CHAIN (declspec_stack); }
746 | declmods setspecs notype_nested_function
747 { current_declspecs = TREE_VALUE (declspec_stack);
748 prefix_attributes = TREE_PURPOSE (declspec_stack);
749 declspec_stack = TREE_CHAIN (declspec_stack); }
750 | typed_declspecs ';'
751 { shadow_tag ($1); }
752 | declmods ';'
753 { pedwarn ("empty declaration"); }
754 | extension decl
755 { RESTORE_WARN_FLAGS ($1); }
758 /* Declspecs which contain at least one type specifier or typedef name.
759 (Just `const' or `volatile' is not enough.)
760 A typedef'd name following these is taken as a name to be declared.
761 Declspecs have a non-NULL TREE_VALUE, attributes do not. */
763 typed_declspecs:
764 typespec reserved_declspecs
765 { $$ = tree_cons (NULL_TREE, $1, $2); }
766 | declmods typespec reserved_declspecs
767 { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
770 reserved_declspecs: /* empty */
771 { $$ = NULL_TREE; }
772 | reserved_declspecs typespecqual_reserved
773 { $$ = tree_cons (NULL_TREE, $2, $1); }
774 | reserved_declspecs SCSPEC
775 { if (extra_warnings)
776 warning ("`%s' is not at beginning of declaration",
777 IDENTIFIER_POINTER ($2));
778 $$ = tree_cons (NULL_TREE, $2, $1); }
779 | reserved_declspecs attributes
780 { $$ = tree_cons ($2, NULL_TREE, $1); }
783 typed_declspecs_no_prefix_attr:
784 typespec reserved_declspecs_no_prefix_attr
785 { $$ = tree_cons (NULL_TREE, $1, $2); }
786 | declmods_no_prefix_attr typespec reserved_declspecs_no_prefix_attr
787 { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
790 reserved_declspecs_no_prefix_attr:
791 /* empty */
792 { $$ = NULL_TREE; }
793 | reserved_declspecs_no_prefix_attr typespecqual_reserved
794 { $$ = tree_cons (NULL_TREE, $2, $1); }
795 | reserved_declspecs_no_prefix_attr SCSPEC
796 { if (extra_warnings)
797 warning ("`%s' is not at beginning of declaration",
798 IDENTIFIER_POINTER ($2));
799 $$ = tree_cons (NULL_TREE, $2, $1); }
802 /* List of just storage classes, type modifiers, and prefix attributes.
803 A declaration can start with just this, but then it cannot be used
804 to redeclare a typedef-name.
805 Declspecs have a non-NULL TREE_VALUE, attributes do not. */
807 declmods:
808 declmods_no_prefix_attr
809 { $$ = $1; }
810 | attributes
811 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
812 | declmods declmods_no_prefix_attr
813 { $$ = chainon ($2, $1); }
814 | declmods attributes
815 { $$ = tree_cons ($2, NULL_TREE, $1); }
818 declmods_no_prefix_attr:
819 TYPE_QUAL
820 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
821 TREE_STATIC ($$) = 1; }
822 | SCSPEC
823 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
824 | declmods_no_prefix_attr TYPE_QUAL
825 { $$ = tree_cons (NULL_TREE, $2, $1);
826 TREE_STATIC ($$) = 1; }
827 | declmods_no_prefix_attr SCSPEC
828 { if (extra_warnings && TREE_STATIC ($1))
829 warning ("`%s' is not at beginning of declaration",
830 IDENTIFIER_POINTER ($2));
831 $$ = tree_cons (NULL_TREE, $2, $1);
832 TREE_STATIC ($$) = TREE_STATIC ($1); }
836 /* Used instead of declspecs where storage classes are not allowed
837 (that is, for typenames and structure components).
838 Don't accept a typedef-name if anything but a modifier precedes it. */
840 typed_typespecs:
841 typespec reserved_typespecquals
842 { $$ = tree_cons (NULL_TREE, $1, $2); }
843 | nonempty_type_quals typespec reserved_typespecquals
844 { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
847 reserved_typespecquals: /* empty */
848 { $$ = NULL_TREE; }
849 | reserved_typespecquals typespecqual_reserved
850 { $$ = tree_cons (NULL_TREE, $2, $1); }
853 /* A typespec (but not a type qualifier).
854 Once we have seen one of these in a declaration,
855 if a typedef name appears then it is being redeclared. */
857 typespec: TYPESPEC
858 | structsp
859 | TYPENAME
860 { /* For a typedef name, record the meaning, not the name.
861 In case of `foo foo, bar;'. */
862 $$ = lookup_name ($1); }
863 | TYPEOF '(' expr ')'
864 { $$ = TREE_TYPE ($3); }
865 | TYPEOF '(' typename ')'
866 { $$ = groktypename ($3); }
869 /* A typespec that is a reserved word, or a type qualifier. */
871 typespecqual_reserved: TYPESPEC
872 | TYPE_QUAL
873 | structsp
876 initdecls:
877 initdcl
878 | initdecls ',' initdcl
881 notype_initdecls:
882 notype_initdcl
883 | notype_initdecls ',' initdcl
886 maybeasm:
887 /* empty */
888 { $$ = NULL_TREE; }
889 | ASM_KEYWORD '(' string ')'
890 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
891 $$ = $3;
895 initdcl:
896 declarator maybeasm maybe_attribute '='
897 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
898 $3, prefix_attributes);
899 start_init ($<ttype>$, $2, global_bindings_p ()); }
900 init
901 /* Note how the declaration of the variable is in effect while its init is parsed! */
902 { finish_init ();
903 finish_decl ($<ttype>5, $6, $2); }
904 | declarator maybeasm maybe_attribute
905 { tree d = start_decl ($1, current_declspecs, 0,
906 $3, prefix_attributes);
907 finish_decl (d, NULL_TREE, $2);
911 notype_initdcl:
912 notype_declarator maybeasm maybe_attribute '='
913 { $<ttype>$ = start_decl ($1, current_declspecs, 1,
914 $3, prefix_attributes);
915 start_init ($<ttype>$, $2, global_bindings_p ()); }
916 init
917 /* Note how the declaration of the variable is in effect while its init is parsed! */
918 { finish_init ();
919 decl_attributes ($<ttype>5, $3, prefix_attributes);
920 finish_decl ($<ttype>5, $6, $2); }
921 | notype_declarator maybeasm maybe_attribute
922 { tree d = start_decl ($1, current_declspecs, 0,
923 $3, prefix_attributes);
924 finish_decl (d, NULL_TREE, $2); }
926 /* the * rules are dummies to accept the Apollo extended syntax
927 so that the header files compile. */
928 maybe_attribute:
929 /* empty */
930 { $$ = NULL_TREE; }
931 | attributes
932 { $$ = $1; }
935 attributes:
936 attribute
937 { $$ = $1; }
938 | attributes attribute
939 { $$ = chainon ($1, $2); }
942 attribute:
943 ATTRIBUTE '(' '(' attribute_list ')' ')'
944 { $$ = $4; }
947 attribute_list:
948 attrib
949 { $$ = $1; }
950 | attribute_list ',' attrib
951 { $$ = chainon ($1, $3); }
954 attrib:
955 /* empty */
956 { $$ = NULL_TREE; }
957 | any_word
958 { $$ = build_tree_list ($1, NULL_TREE); }
959 | any_word '(' IDENTIFIER ')'
960 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
961 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
962 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
963 | any_word '(' exprlist ')'
964 { $$ = build_tree_list ($1, $3); }
967 /* This still leaves out most reserved keywords,
968 shouldn't we include them? */
970 any_word:
971 identifier
972 | SCSPEC
973 | TYPESPEC
974 | TYPE_QUAL
977 /* Initializers. `init' is the entry point. */
979 init:
980 expr_no_commas
981 | '{'
982 { really_start_incremental_init (NULL_TREE); }
983 initlist_maybe_comma '}'
984 { $$ = pop_init_level (0); }
985 | error
986 { $$ = error_mark_node; }
989 /* `initlist_maybe_comma' is the guts of an initializer in braces. */
990 initlist_maybe_comma:
991 /* empty */
992 { if (pedantic)
993 pedwarn ("ANSI C forbids empty initializer braces"); }
994 | initlist1 maybecomma
997 initlist1:
998 initelt
999 | initlist1 ',' initelt
1002 /* `initelt' is a single element of an initializer.
1003 It may use braces. */
1004 initelt:
1005 designator_list '=' initval
1006 | designator initval
1007 | identifier ':'
1008 { set_init_label ($1); }
1009 initval
1010 | initval
1013 initval:
1015 { push_init_level (0); }
1016 initlist_maybe_comma '}'
1017 { process_init_element (pop_init_level (0)); }
1018 | expr_no_commas
1019 { process_init_element ($1); }
1020 | error
1023 designator_list:
1024 designator
1025 | designator_list designator
1028 designator:
1029 '.' identifier
1030 { set_init_label ($2); }
1031 /* These are for labeled elements. The syntax for an array element
1032 initializer conflicts with the syntax for an Objective-C message,
1033 so don't include these productions in the Objective-C grammar. */
1034 | '[' expr_no_commas ELLIPSIS expr_no_commas ']'
1035 { set_init_index ($2, $4); }
1036 | '[' expr_no_commas ']'
1037 { set_init_index ($2, NULL_TREE); }
1040 nested_function:
1041 declarator
1042 { if (pedantic)
1043 pedwarn ("ANSI C forbids nested functions");
1045 push_function_context ();
1046 if (! start_function (current_declspecs, $1,
1047 prefix_attributes, NULL_TREE))
1049 pop_function_context ();
1050 YYERROR1;
1052 reinit_parse_for_function (); }
1053 old_style_parm_decls
1054 { store_parm_decls (); }
1055 /* This used to use compstmt_or_error.
1056 That caused a bug with input `f(g) int g {}',
1057 where the use of YYERROR1 above caused an error
1058 which then was handled by compstmt_or_error.
1059 There followed a repeated execution of that same rule,
1060 which called YYERROR1 again, and so on. */
1061 compstmt
1062 { finish_function (1);
1063 pop_function_context (); }
1066 notype_nested_function:
1067 notype_declarator
1068 { if (pedantic)
1069 pedwarn ("ANSI C forbids nested functions");
1071 push_function_context ();
1072 if (! start_function (current_declspecs, $1,
1073 prefix_attributes, NULL_TREE))
1075 pop_function_context ();
1076 YYERROR1;
1078 reinit_parse_for_function (); }
1079 old_style_parm_decls
1080 { store_parm_decls (); }
1081 /* This used to use compstmt_or_error.
1082 That caused a bug with input `f(g) int g {}',
1083 where the use of YYERROR1 above caused an error
1084 which then was handled by compstmt_or_error.
1085 There followed a repeated execution of that same rule,
1086 which called YYERROR1 again, and so on. */
1087 compstmt
1088 { finish_function (1);
1089 pop_function_context (); }
1092 /* Any kind of declarator (thus, all declarators allowed
1093 after an explicit typespec). */
1095 declarator:
1096 after_type_declarator
1097 | notype_declarator
1100 /* A declarator that is allowed only after an explicit typespec. */
1102 after_type_declarator:
1103 '(' after_type_declarator ')'
1104 { $$ = $2; }
1105 | after_type_declarator '(' parmlist_or_identifiers %prec '.'
1106 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1107 /* | after_type_declarator '(' error ')' %prec '.'
1108 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1109 poplevel (0, 0, 0); } */
1110 | after_type_declarator '[' expr ']' %prec '.'
1111 { $$ = build_nt (ARRAY_REF, $1, $3); }
1112 | after_type_declarator '[' ']' %prec '.'
1113 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1114 | '*' type_quals after_type_declarator %prec UNARY
1115 { $$ = make_pointer_declarator ($2, $3); }
1116 /* ??? Yuck. setattrs is a quick hack. We can't use
1117 prefix_attributes because $1 only applies to this
1118 declarator. We assume setspecs has already been done.
1119 setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
1120 attributes could be recognized here or in `attributes'). */
1121 | attributes setattrs after_type_declarator
1122 { $$ = $3; }
1123 | TYPENAME
1126 /* Kinds of declarator that can appear in a parameter list
1127 in addition to notype_declarator. This is like after_type_declarator
1128 but does not allow a typedef name in parentheses as an identifier
1129 (because it would conflict with a function with that typedef as arg). */
1131 parm_declarator:
1132 parm_declarator '(' parmlist_or_identifiers %prec '.'
1133 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1134 /* | parm_declarator '(' error ')' %prec '.'
1135 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1136 poplevel (0, 0, 0); } */
1137 | parm_declarator '[' '*' ']' %prec '.'
1138 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE);
1139 if (! flag_isoc99)
1140 error ("`[*]' in parameter declaration only allowed in ISO C 99");
1142 | parm_declarator '[' expr ']' %prec '.'
1143 { $$ = build_nt (ARRAY_REF, $1, $3); }
1144 | parm_declarator '[' ']' %prec '.'
1145 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1146 | '*' type_quals parm_declarator %prec UNARY
1147 { $$ = make_pointer_declarator ($2, $3); }
1148 /* ??? Yuck. setattrs is a quick hack. We can't use
1149 prefix_attributes because $1 only applies to this
1150 declarator. We assume setspecs has already been done.
1151 setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
1152 attributes could be recognized here or in `attributes'). */
1153 | attributes setattrs parm_declarator
1154 { $$ = $3; }
1155 | TYPENAME
1158 /* A declarator allowed whether or not there has been
1159 an explicit typespec. These cannot redeclare a typedef-name. */
1161 notype_declarator:
1162 notype_declarator '(' parmlist_or_identifiers %prec '.'
1163 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1164 /* | notype_declarator '(' error ')' %prec '.'
1165 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1166 poplevel (0, 0, 0); } */
1167 | '(' notype_declarator ')'
1168 { $$ = $2; }
1169 | '*' type_quals notype_declarator %prec UNARY
1170 { $$ = make_pointer_declarator ($2, $3); }
1171 | notype_declarator '[' '*' ']' %prec '.'
1172 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE);
1173 if (! flag_isoc99)
1174 error ("`[*]' in parameter declaration only allowed in ISO C 99");
1176 | notype_declarator '[' expr ']' %prec '.'
1177 { $$ = build_nt (ARRAY_REF, $1, $3); }
1178 | notype_declarator '[' ']' %prec '.'
1179 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1180 /* ??? Yuck. setattrs is a quick hack. We can't use
1181 prefix_attributes because $1 only applies to this
1182 declarator. We assume setspecs has already been done.
1183 setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
1184 attributes could be recognized here or in `attributes'). */
1185 | attributes setattrs notype_declarator
1186 { $$ = $3; }
1187 | IDENTIFIER
1190 struct_head:
1191 STRUCT
1192 { $$ = NULL_TREE; }
1193 | STRUCT attributes
1194 { $$ = $2; }
1197 union_head:
1198 UNION
1199 { $$ = NULL_TREE; }
1200 | UNION attributes
1201 { $$ = $2; }
1204 enum_head:
1205 ENUM
1206 { $$ = NULL_TREE; }
1207 | ENUM attributes
1208 { $$ = $2; }
1211 structsp:
1212 struct_head identifier '{'
1213 { $$ = start_struct (RECORD_TYPE, $2);
1214 /* Start scope of tag before parsing components. */
1216 component_decl_list '}' maybe_attribute
1217 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1218 | struct_head '{' component_decl_list '}' maybe_attribute
1219 { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1220 $3, chainon ($1, $5));
1222 | struct_head identifier
1223 { $$ = xref_tag (RECORD_TYPE, $2); }
1224 | union_head identifier '{'
1225 { $$ = start_struct (UNION_TYPE, $2); }
1226 component_decl_list '}' maybe_attribute
1227 { $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
1228 | union_head '{' component_decl_list '}' maybe_attribute
1229 { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1230 $3, chainon ($1, $5));
1232 | union_head identifier
1233 { $$ = xref_tag (UNION_TYPE, $2); }
1234 | enum_head identifier '{'
1235 { $$ = start_enum ($2); }
1236 enumlist maybecomma_warn '}' maybe_attribute
1237 { $$ = finish_enum ($<ttype>4, nreverse ($5),
1238 chainon ($1, $8)); }
1239 | enum_head '{'
1240 { $$ = start_enum (NULL_TREE); }
1241 enumlist maybecomma_warn '}' maybe_attribute
1242 { $$ = finish_enum ($<ttype>3, nreverse ($4),
1243 chainon ($1, $7)); }
1244 | enum_head identifier
1245 { $$ = xref_tag (ENUMERAL_TYPE, $2); }
1248 maybecomma:
1249 /* empty */
1250 | ','
1253 maybecomma_warn:
1254 /* empty */
1255 | ','
1256 { if (pedantic && ! flag_isoc99)
1257 pedwarn ("comma at end of enumerator list"); }
1260 component_decl_list:
1261 component_decl_list2
1262 { $$ = $1; }
1263 | component_decl_list2 component_decl
1264 { $$ = chainon ($1, $2);
1265 pedwarn ("no semicolon at end of struct or union"); }
1268 component_decl_list2: /* empty */
1269 { $$ = NULL_TREE; }
1270 | component_decl_list2 component_decl ';'
1271 { $$ = chainon ($1, $2); }
1272 | component_decl_list2 ';'
1273 { if (pedantic)
1274 pedwarn ("extra semicolon in struct or union specified"); }
1277 /* There is a shift-reduce conflict here, because `components' may
1278 start with a `typename'. It happens that shifting (the default resolution)
1279 does the right thing, because it treats the `typename' as part of
1280 a `typed_typespecs'.
1282 It is possible that this same technique would allow the distinction
1283 between `notype_initdecls' and `initdecls' to be eliminated.
1284 But I am being cautious and not trying it. */
1286 component_decl:
1287 typed_typespecs setspecs components
1288 { $$ = $3;
1289 current_declspecs = TREE_VALUE (declspec_stack);
1290 prefix_attributes = TREE_PURPOSE (declspec_stack);
1291 declspec_stack = TREE_CHAIN (declspec_stack); }
1292 | typed_typespecs setspecs save_filename save_lineno maybe_attribute
1294 /* Support for unnamed structs or unions as members of
1295 structs or unions (which is [a] useful and [b] supports
1296 MS P-SDK). */
1297 if (pedantic)
1298 pedwarn ("ANSI C doesn't support unnamed structs/unions");
1300 $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE);
1301 current_declspecs = TREE_VALUE (declspec_stack);
1302 prefix_attributes = TREE_PURPOSE (declspec_stack);
1303 declspec_stack = TREE_CHAIN (declspec_stack);
1305 | nonempty_type_quals setspecs components
1306 { $$ = $3;
1307 current_declspecs = TREE_VALUE (declspec_stack);
1308 prefix_attributes = TREE_PURPOSE (declspec_stack);
1309 declspec_stack = TREE_CHAIN (declspec_stack); }
1310 | nonempty_type_quals
1311 { if (pedantic)
1312 pedwarn ("ANSI C forbids member declarations with no members");
1313 shadow_tag($1);
1314 $$ = NULL_TREE; }
1315 | error
1316 { $$ = NULL_TREE; }
1317 | extension component_decl
1318 { $$ = $2;
1319 RESTORE_WARN_FLAGS ($1); }
1322 components:
1323 component_declarator
1324 | components ',' component_declarator
1325 { $$ = chainon ($1, $3); }
1328 component_declarator:
1329 save_filename save_lineno declarator maybe_attribute
1330 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1331 decl_attributes ($$, $4, prefix_attributes); }
1332 | save_filename save_lineno
1333 declarator ':' expr_no_commas maybe_attribute
1334 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1335 decl_attributes ($$, $6, prefix_attributes); }
1336 | save_filename save_lineno ':' expr_no_commas maybe_attribute
1337 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1338 decl_attributes ($$, $5, prefix_attributes); }
1341 /* We chain the enumerators in reverse order.
1342 They are put in forward order where enumlist is used.
1343 (The order used to be significant, but no longer is so.
1344 However, we still maintain the order, just to be clean.) */
1346 enumlist:
1347 enumerator
1348 | enumlist ',' enumerator
1349 { if ($1 == error_mark_node)
1350 $$ = $1;
1351 else
1352 $$ = chainon ($3, $1); }
1353 | error
1354 { $$ = error_mark_node; }
1358 enumerator:
1359 identifier
1360 { $$ = build_enumerator ($1, NULL_TREE); }
1361 | identifier '=' expr_no_commas
1362 { $$ = build_enumerator ($1, $3); }
1365 typename:
1366 typed_typespecs absdcl
1367 { $$ = build_tree_list ($1, $2); }
1368 | nonempty_type_quals absdcl
1369 { $$ = build_tree_list ($1, $2); }
1372 absdcl: /* an absolute declarator */
1373 /* empty */
1374 { $$ = NULL_TREE; }
1375 | absdcl1
1378 nonempty_type_quals:
1379 TYPE_QUAL
1380 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
1381 | nonempty_type_quals TYPE_QUAL
1382 { $$ = tree_cons (NULL_TREE, $2, $1); }
1385 type_quals:
1386 /* empty */
1387 { $$ = NULL_TREE; }
1388 | type_quals TYPE_QUAL
1389 { $$ = tree_cons (NULL_TREE, $2, $1); }
1392 absdcl1: /* a nonempty absolute declarator */
1393 '(' absdcl1 ')'
1394 { $$ = $2; }
1395 /* `(typedef)1' is `int'. */
1396 | '*' type_quals absdcl1 %prec UNARY
1397 { $$ = make_pointer_declarator ($2, $3); }
1398 | '*' type_quals %prec UNARY
1399 { $$ = make_pointer_declarator ($2, NULL_TREE); }
1400 | absdcl1 '(' parmlist %prec '.'
1401 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1402 | absdcl1 '[' expr ']' %prec '.'
1403 { $$ = build_nt (ARRAY_REF, $1, $3); }
1404 | absdcl1 '[' ']' %prec '.'
1405 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1406 | '(' parmlist %prec '.'
1407 { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
1408 | '[' expr ']' %prec '.'
1409 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
1410 | '[' ']' %prec '.'
1411 { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
1412 /* ??? It appears we have to support attributes here, however
1413 using prefix_attributes is wrong. */
1414 | attributes setattrs absdcl1
1415 { $$ = $3; }
1418 /* at least one statement, the first of which parses without error. */
1419 /* stmts is used only after decls, so an invalid first statement
1420 is actually regarded as an invalid decl and part of the decls. */
1422 stmts:
1423 lineno_stmt_or_labels
1425 if (pedantic && $1)
1426 pedwarn ("ANSI C forbids label at end of compound statement");
1430 lineno_stmt_or_labels:
1431 lineno_stmt_or_label
1432 | lineno_stmt_or_labels lineno_stmt_or_label
1433 { $$ = $2; }
1434 | lineno_stmt_or_labels errstmt
1435 { $$ = 0; }
1438 xstmts:
1439 /* empty */
1440 | stmts
1443 errstmt: error ';'
1446 pushlevel: /* empty */
1447 { emit_line_note (input_filename, lineno);
1448 pushlevel (0);
1449 clear_last_expr ();
1450 expand_start_bindings (0);
1454 /* Read zero or more forward-declarations for labels
1455 that nested functions can jump to. */
1456 maybe_label_decls:
1457 /* empty */
1458 | label_decls
1459 { if (pedantic)
1460 pedwarn ("ANSI C forbids label declarations"); }
1463 label_decls:
1464 label_decl
1465 | label_decls label_decl
1468 label_decl:
1469 LABEL identifiers_or_typenames ';'
1470 { tree link;
1471 for (link = $2; link; link = TREE_CHAIN (link))
1473 tree label = shadow_label (TREE_VALUE (link));
1474 C_DECLARED_LABEL_FLAG (label) = 1;
1475 declare_nonlocal_label (label);
1480 /* This is the body of a function definition.
1481 It causes syntax errors to ignore to the next openbrace. */
1482 compstmt_or_error:
1483 compstmt
1485 | error compstmt
1488 compstmt_start: '{' { compstmt_count++; }
1490 compstmt_nostart: '}'
1491 { $$ = convert (void_type_node, integer_zero_node); }
1492 | pushlevel maybe_label_decls decls xstmts '}'
1493 { emit_line_note (input_filename, lineno);
1494 expand_end_bindings (getdecls (), 1, 0);
1495 $$ = poplevel (1, 1, 0); }
1496 | pushlevel maybe_label_decls error '}'
1497 { emit_line_note (input_filename, lineno);
1498 expand_end_bindings (getdecls (), kept_level_p (), 0);
1499 $$ = poplevel (kept_level_p (), 0, 0); }
1500 | pushlevel maybe_label_decls stmts '}'
1501 { emit_line_note (input_filename, lineno);
1502 expand_end_bindings (getdecls (), kept_level_p (), 0);
1503 $$ = poplevel (kept_level_p (), 0, 0); }
1506 compstmt_primary_start:
1507 '(' '{'
1508 { if (current_function_decl == 0)
1510 error ("braced-group within expression allowed only inside a function");
1511 YYERROR;
1513 /* We must force a BLOCK for this level
1514 so that, if it is not expanded later,
1515 there is a way to turn off the entire subtree of blocks
1516 that are contained in it. */
1517 keep_next_level ();
1518 push_iterator_stack ();
1519 push_label_level ();
1520 $$ = expand_start_stmt_expr ();
1521 compstmt_count++;
1524 compstmt: compstmt_start compstmt_nostart
1525 { $$ = $2; }
1528 /* Value is number of statements counted as of the closeparen. */
1529 simple_if:
1530 if_prefix lineno_labeled_stmt
1531 /* Make sure c_expand_end_cond is run once
1532 for each call to c_expand_start_cond.
1533 Otherwise a crash is likely. */
1534 | if_prefix error
1537 if_prefix:
1538 IF '(' expr ')'
1539 { emit_line_note ($<filename>-1, $<lineno>0);
1540 c_expand_start_cond (truthvalue_conversion ($3), 0,
1541 compstmt_count);
1542 $<itype>$ = stmt_count;
1543 if_stmt_file = $<filename>-1;
1544 if_stmt_line = $<lineno>0;
1545 position_after_white_space (); }
1548 /* This is a subroutine of stmt.
1549 It is used twice, once for valid DO statements
1550 and once for catching errors in parsing the end test. */
1551 do_stmt_start:
1553 { stmt_count++;
1554 compstmt_count++;
1555 emit_line_note ($<filename>-1, $<lineno>0);
1556 /* See comment in `while' alternative, above. */
1557 emit_nop ();
1558 expand_start_loop_continue_elsewhere (1);
1559 position_after_white_space (); }
1560 lineno_labeled_stmt WHILE
1561 { expand_loop_continue_here (); }
1564 save_filename:
1565 { $$ = input_filename; }
1568 save_lineno:
1569 { $$ = lineno; }
1572 lineno_labeled_stmt:
1573 save_filename save_lineno stmt
1575 /* | save_filename save_lineno error
1578 | save_filename save_lineno label lineno_labeled_stmt
1582 lineno_stmt_or_label:
1583 save_filename save_lineno stmt_or_label
1584 { $$ = $3; }
1587 stmt_or_label:
1588 stmt
1589 { $$ = 0; }
1590 | label
1591 { $$ = 1; }
1594 /* Parse a single real statement, not including any labels. */
1595 stmt:
1596 compstmt
1597 { stmt_count++; }
1598 | all_iter_stmt
1599 | expr ';'
1600 { stmt_count++;
1601 emit_line_note ($<filename>-1, $<lineno>0);
1602 /* It appears that this should not be done--that a non-lvalue array
1603 shouldn't get an error if the value isn't used.
1604 Section 3.2.2.1 says that an array lvalue gets converted to a pointer
1605 if it appears as a top-level expression,
1606 but says nothing about non-lvalue arrays. */
1607 #if 0
1608 /* Call default_conversion to get an error
1609 on referring to a register array if pedantic. */
1610 if (TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE
1611 || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE)
1612 $1 = default_conversion ($1);
1613 #endif
1614 iterator_expand ($1); }
1615 | simple_if ELSE
1616 { c_expand_start_else ();
1617 $<itype>1 = stmt_count;
1618 position_after_white_space (); }
1619 lineno_labeled_stmt
1620 { c_expand_end_cond ();
1621 if (extra_warnings && stmt_count == $<itype>1)
1622 warning ("empty body in an else-statement"); }
1623 | simple_if %prec IF
1624 { c_expand_end_cond ();
1625 /* This warning is here instead of in simple_if, because we
1626 do not want a warning if an empty if is followed by an
1627 else statement. Increment stmt_count so we don't
1628 give a second error if this is a nested `if'. */
1629 if (extra_warnings && stmt_count++ == $<itype>1)
1630 warning_with_file_and_line (if_stmt_file, if_stmt_line,
1631 "empty body in an if-statement"); }
1632 /* Make sure c_expand_end_cond is run once
1633 for each call to c_expand_start_cond.
1634 Otherwise a crash is likely. */
1635 | simple_if ELSE error
1636 { c_expand_end_cond (); }
1637 | WHILE
1638 { stmt_count++;
1639 emit_line_note ($<filename>-1, $<lineno>0);
1640 /* The emit_nop used to come before emit_line_note,
1641 but that made the nop seem like part of the preceding line.
1642 And that was confusing when the preceding line was
1643 inside of an if statement and was not really executed.
1644 I think it ought to work to put the nop after the line number.
1645 We will see. --rms, July 15, 1991. */
1646 emit_nop (); }
1647 '(' expr ')'
1648 { /* Don't start the loop till we have succeeded
1649 in parsing the end test. This is to make sure
1650 that we end every loop we start. */
1651 expand_start_loop (1);
1652 emit_line_note (input_filename, lineno);
1653 expand_exit_loop_if_false (NULL_PTR,
1654 truthvalue_conversion ($4));
1655 position_after_white_space (); }
1656 lineno_labeled_stmt
1657 { expand_end_loop (); }
1658 | do_stmt_start
1659 '(' expr ')' ';'
1660 { emit_line_note (input_filename, lineno);
1661 expand_exit_loop_if_false (NULL_PTR,
1662 truthvalue_conversion ($3));
1663 expand_end_loop (); }
1664 /* This rule is needed to make sure we end every loop we start. */
1665 | do_stmt_start error
1666 { expand_end_loop (); }
1667 | FOR
1668 '(' xexpr ';'
1669 { stmt_count++;
1670 emit_line_note ($<filename>-1, $<lineno>0);
1671 /* See comment in `while' alternative, above. */
1672 emit_nop ();
1673 if ($3) c_expand_expr_stmt ($3);
1674 /* Next step is to call expand_start_loop_continue_elsewhere,
1675 but wait till after we parse the entire for (...).
1676 Otherwise, invalid input might cause us to call that
1677 fn without calling expand_end_loop. */
1679 xexpr ';'
1680 /* Can't emit now; wait till after expand_start_loop... */
1681 { $<lineno>7 = lineno;
1682 $<filename>$ = input_filename; }
1683 xexpr ')'
1685 /* Start the loop. Doing this after parsing
1686 all the expressions ensures we will end the loop. */
1687 expand_start_loop_continue_elsewhere (1);
1688 /* Emit the end-test, with a line number. */
1689 emit_line_note ($<filename>8, $<lineno>7);
1690 if ($6)
1691 expand_exit_loop_if_false (NULL_PTR,
1692 truthvalue_conversion ($6));
1693 $<lineno>7 = lineno;
1694 $<filename>8 = input_filename;
1695 position_after_white_space (); }
1696 lineno_labeled_stmt
1697 { /* Emit the increment expression, with a line number. */
1698 emit_line_note ($<filename>8, $<lineno>7);
1699 expand_loop_continue_here ();
1700 if ($9)
1701 c_expand_expr_stmt ($9);
1702 expand_end_loop (); }
1703 | SWITCH '(' expr ')'
1704 { stmt_count++;
1705 emit_line_note ($<filename>-1, $<lineno>0);
1706 c_expand_start_case ($3);
1707 position_after_white_space (); }
1708 lineno_labeled_stmt
1709 { expand_end_case ($3); }
1710 | BREAK ';'
1711 { tree break_stmt = build_break_stmt ();
1712 stmt_count++;
1713 genrtl_break_stmt (); }
1714 | CONTINUE ';'
1715 { tree continue_stmt = build_continue_stmt ();
1716 stmt_count++;
1717 genrtl_continue_stmt (); }
1718 | RETURN ';'
1719 { tree return_stmt = build_return_stmt (NULL_TREE);
1720 stmt_count++;
1721 genrtl_return_stmt (RETURN_EXPR(return_stmt)); }
1722 | RETURN expr ';'
1723 { tree return_stmt = build_return_stmt ($2);
1724 stmt_count++;
1725 genrtl_return_stmt (RETURN_EXPR(return_stmt)); }
1726 | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
1727 { stmt_count++;
1728 emit_line_note ($<filename>-1, $<lineno>0);
1729 STRIP_NOPS ($4);
1730 if ((TREE_CODE ($4) == ADDR_EXPR
1731 && TREE_CODE (TREE_OPERAND ($4, 0)) == STRING_CST)
1732 || TREE_CODE ($4) == STRING_CST)
1733 expand_asm ($4);
1734 else
1735 error ("argument of `asm' is not a constant string"); }
1736 /* This is the case with just output operands. */
1737 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
1738 { stmt_count++;
1739 emit_line_note ($<filename>-1, $<lineno>0);
1740 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
1741 $2 == ridpointers[(int)RID_VOLATILE],
1742 input_filename, lineno); }
1743 /* This is the case with input operands as well. */
1744 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';'
1745 { stmt_count++;
1746 emit_line_note ($<filename>-1, $<lineno>0);
1747 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
1748 $2 == ridpointers[(int)RID_VOLATILE],
1749 input_filename, lineno); }
1750 /* This is the case with clobbered registers as well. */
1751 | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
1752 asm_operands ':' asm_clobbers ')' ';'
1753 { stmt_count++;
1754 emit_line_note ($<filename>-1, $<lineno>0);
1755 c_expand_asm_operands ($4, $6, $8, $10,
1756 $2 == ridpointers[(int)RID_VOLATILE],
1757 input_filename, lineno); }
1758 | GOTO identifier ';'
1759 { tree decl;
1760 stmt_count++;
1761 emit_line_note ($<filename>-1, $<lineno>0);
1762 decl = lookup_label ($2);
1763 if (decl != 0)
1765 TREE_USED (decl) = 1;
1766 expand_goto (decl);
1769 | GOTO '*' expr ';'
1770 { if (pedantic)
1771 pedwarn ("ANSI C forbids `goto *expr;'");
1772 stmt_count++;
1773 emit_line_note ($<filename>-1, $<lineno>0);
1774 expand_computed_goto (convert (ptr_type_node, $3)); }
1775 | ';'
1778 all_iter_stmt:
1779 all_iter_stmt_simple
1780 /* | all_iter_stmt_with_decl */
1783 all_iter_stmt_simple:
1784 FOR '(' primary ')'
1786 /* The value returned by this action is */
1787 /* 1 if everything is OK */
1788 /* 0 in case of error or already bound iterator */
1790 $<itype>$ = 0;
1791 if (TREE_CODE ($3) != VAR_DECL)
1792 error ("invalid `for (ITERATOR)' syntax");
1793 else if (! ITERATOR_P ($3))
1794 error ("`%s' is not an iterator",
1795 IDENTIFIER_POINTER (DECL_NAME ($3)));
1796 else if (ITERATOR_BOUND_P ($3))
1797 error ("`for (%s)' inside expansion of same iterator",
1798 IDENTIFIER_POINTER (DECL_NAME ($3)));
1799 else
1801 $<itype>$ = 1;
1802 iterator_for_loop_start ($3);
1805 lineno_labeled_stmt
1807 if ($<itype>5)
1808 iterator_for_loop_end ($3);
1811 /* This really should allow any kind of declaration,
1812 for generality. Fix it before turning it back on.
1814 all_iter_stmt_with_decl:
1815 FOR '(' ITERATOR pushlevel setspecs iterator_spec ')'
1817 */ /* The value returned by this action is */
1818 /* 1 if everything is OK */
1819 /* 0 in case of error or already bound iterator */
1821 iterator_for_loop_start ($6);
1823 lineno_labeled_stmt
1825 iterator_for_loop_end ($6);
1826 emit_line_note (input_filename, lineno);
1827 expand_end_bindings (getdecls (), 1, 0);
1828 $<ttype>$ = poplevel (1, 1, 0);
1832 /* Any kind of label, including jump labels and case labels.
1833 ANSI C accepts labels only before statements, but we allow them
1834 also at the end of a compound statement. */
1836 label: CASE expr_no_commas ':'
1837 { tree case_label_tree = build_case_label ($2, NULL_TREE);
1838 stmt_count++;
1839 genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
1840 position_after_white_space ();
1842 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
1843 { tree case_label_tree = build_case_label ($2, $4);
1844 stmt_count++;
1845 genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
1846 position_after_white_space ();
1848 | DEFAULT ':'
1849 { tree case_label_tree = build_case_label (NULL_TREE, NULL_TREE);
1850 stmt_count++;
1851 genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
1852 position_after_white_space ();
1854 | identifier ':' maybe_attribute
1855 { tree label = define_label (input_filename, lineno, $1);
1856 stmt_count++;
1857 emit_nop ();
1858 if (label)
1860 expand_label (label);
1861 decl_attributes (label, $3, NULL_TREE);
1863 position_after_white_space (); }
1866 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
1868 maybe_type_qual:
1869 /* empty */
1870 { emit_line_note (input_filename, lineno);
1871 $$ = NULL_TREE; }
1872 | TYPE_QUAL
1873 { emit_line_note (input_filename, lineno); }
1876 xexpr:
1877 /* empty */
1878 { $$ = NULL_TREE; }
1879 | expr
1882 /* These are the operands other than the first string and colon
1883 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
1884 asm_operands: /* empty */
1885 { $$ = NULL_TREE; }
1886 | nonnull_asm_operands
1889 nonnull_asm_operands:
1890 asm_operand
1891 | nonnull_asm_operands ',' asm_operand
1892 { $$ = chainon ($1, $3); }
1895 asm_operand:
1896 STRING '(' expr ')'
1897 { $$ = build_tree_list ($1, $3); }
1900 asm_clobbers:
1901 string
1902 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); }
1903 | asm_clobbers ',' string
1904 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
1907 /* This is what appears inside the parens in a function declarator.
1908 Its value is a list of ..._TYPE nodes. */
1909 parmlist:
1910 { pushlevel (0);
1911 clear_parm_order ();
1912 declare_parm_level (0); }
1913 parmlist_1
1914 { $$ = $2;
1915 parmlist_tags_warning ();
1916 poplevel (0, 0, 0); }
1919 parmlist_1:
1920 parmlist_2 ')'
1921 | parms ';'
1922 { tree parm;
1923 if (pedantic)
1924 pedwarn ("ANSI C forbids forward parameter declarations");
1925 /* Mark the forward decls as such. */
1926 for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
1927 TREE_ASM_WRITTEN (parm) = 1;
1928 clear_parm_order (); }
1929 parmlist_1
1930 { $$ = $4; }
1931 | error ')'
1932 { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
1935 /* This is what appears inside the parens in a function declarator.
1936 Is value is represented in the format that grokdeclarator expects. */
1937 parmlist_2: /* empty */
1938 { $$ = get_parm_info (0); }
1939 | ELLIPSIS
1940 { $$ = get_parm_info (0);
1941 /* Gcc used to allow this as an extension. However, it does
1942 not work for all targets, and thus has been disabled.
1943 Also, since func (...) and func () are indistinguishable,
1944 it caused problems with the code in expand_builtin which
1945 tries to verify that BUILT_IN_NEXT_ARG is being used
1946 correctly. */
1947 error ("ANSI C requires a named argument before `...'");
1949 | parms
1950 { $$ = get_parm_info (1); }
1951 | parms ',' ELLIPSIS
1952 { $$ = get_parm_info (0); }
1955 parms:
1956 parm
1957 { push_parm_decl ($1); }
1958 | parms ',' parm
1959 { push_parm_decl ($3); }
1962 /* A single parameter declaration or parameter type name,
1963 as found in a parmlist. */
1964 parm:
1965 typed_declspecs setspecs parm_declarator maybe_attribute
1966 { $$ = build_tree_list (build_tree_list (current_declspecs,
1967 $3),
1968 build_tree_list (prefix_attributes,
1969 $4));
1970 current_declspecs = TREE_VALUE (declspec_stack);
1971 prefix_attributes = TREE_PURPOSE (declspec_stack);
1972 declspec_stack = TREE_CHAIN (declspec_stack); }
1973 | typed_declspecs setspecs notype_declarator maybe_attribute
1974 { $$ = build_tree_list (build_tree_list (current_declspecs,
1975 $3),
1976 build_tree_list (prefix_attributes,
1977 $4));
1978 current_declspecs = TREE_VALUE (declspec_stack);
1979 prefix_attributes = TREE_PURPOSE (declspec_stack);
1980 declspec_stack = TREE_CHAIN (declspec_stack); }
1981 | typed_declspecs setspecs absdcl maybe_attribute
1982 { $$ = build_tree_list (build_tree_list (current_declspecs,
1983 $3),
1984 build_tree_list (prefix_attributes,
1985 $4));
1986 current_declspecs = TREE_VALUE (declspec_stack);
1987 prefix_attributes = TREE_PURPOSE (declspec_stack);
1988 declspec_stack = TREE_CHAIN (declspec_stack); }
1989 | declmods setspecs notype_declarator maybe_attribute
1990 { $$ = build_tree_list (build_tree_list (current_declspecs,
1991 $3),
1992 build_tree_list (prefix_attributes,
1993 $4));
1994 current_declspecs = TREE_VALUE (declspec_stack);
1995 prefix_attributes = TREE_PURPOSE (declspec_stack);
1996 declspec_stack = TREE_CHAIN (declspec_stack); }
1998 | declmods setspecs absdcl maybe_attribute
1999 { $$ = build_tree_list (build_tree_list (current_declspecs,
2000 $3),
2001 build_tree_list (prefix_attributes,
2002 $4));
2003 current_declspecs = TREE_VALUE (declspec_stack);
2004 prefix_attributes = TREE_PURPOSE (declspec_stack);
2005 declspec_stack = TREE_CHAIN (declspec_stack); }
2008 /* This is used in a function definition
2009 where either a parmlist or an identifier list is ok.
2010 Its value is a list of ..._TYPE nodes or a list of identifiers. */
2011 parmlist_or_identifiers:
2012 { pushlevel (0);
2013 clear_parm_order ();
2014 declare_parm_level (1); }
2015 parmlist_or_identifiers_1
2016 { $$ = $2;
2017 parmlist_tags_warning ();
2018 poplevel (0, 0, 0); }
2021 parmlist_or_identifiers_1:
2022 parmlist_1
2023 | identifiers ')'
2024 { tree t;
2025 for (t = $1; t; t = TREE_CHAIN (t))
2026 if (TREE_VALUE (t) == NULL_TREE)
2027 error ("`...' in old-style identifier list");
2028 $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }
2031 /* A nonempty list of identifiers. */
2032 identifiers:
2033 IDENTIFIER
2034 { $$ = build_tree_list (NULL_TREE, $1); }
2035 | identifiers ',' IDENTIFIER
2036 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2039 /* A nonempty list of identifiers, including typenames. */
2040 identifiers_or_typenames:
2041 identifier
2042 { $$ = build_tree_list (NULL_TREE, $1); }
2043 | identifiers_or_typenames ',' identifier
2044 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2047 extension:
2048 EXTENSION
2049 { $$ = SAVE_WARN_FLAGS();
2050 pedantic = 0;
2051 warn_pointer_arith = 0; }