(unary_expr): If -pedantic, give error for &&.
[official-gcc.git] / gcc / c-parse.in
blobbbd565d7149f95738fdcc5a0c2557d8df2bb93ab
1 /* YACC parser for C syntax and for Objective C.  -*-c-*-
2    Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20 /* This file defines the grammar of C and that of Objective C.
21    ifobjc ... end ifobjc  conditionals contain code for Objective C only.
22    ifc ... end ifc  conditionals contain code for C only.
23    Sed commands in Makefile.in are used to convert this file into
24    c-parse.y and into objc-parse.y.  */
26 /* To whomever it may concern: I have heard that such a thing was once
27 written by AT&T, but I have never seen it.  */
29 ifobjc
30 %expect 22
31 end ifobjc
32 ifc
33 %expect 10
35 /* These are the 10 conflicts you should get in parse.output;
36    the state numbers may vary if minor changes in the grammar are made.
38 State 41 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
39 State 97 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
40 State 104 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
41 State 108 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
42 State 124 contains 1 shift/reduce conflict.  (See comment at component_decl.)
43 State 191 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
44 State 204 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
45 State 210 contains 1 shift/reduce conflict.  (Two ways to recover from error.)
46 State 449 contains 2 shift/reduce conflicts.  (Four ways to parse this.)
48 end ifc
51 #include <stdio.h>
52 #include <errno.h>
53 #include <setjmp.h>
55 #include "config.h"
56 #include "tree.h"
57 #include "input.h"
58 #include "c-lex.h"
59 #include "c-tree.h"
60 #include "flags.h"
62 #ifdef MULTIBYTE_CHARS
63 #include <stdlib.h>
64 #include <locale.h>
65 #endif
67 ifobjc
68 #include "objc-act.h"
69 end ifobjc
71 /* Since parsers are distinct for each language, put the language string
72    definition here.  */
73 ifobjc
74 char *language_string = "GNU Obj-C";
75 end ifobjc
76 ifc
77 char *language_string = "GNU C";
78 end ifc
80 #ifndef errno
81 extern int errno;
82 #endif
84 void yyerror ();
86 /* Like YYERROR but do call yyerror.  */
87 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
89 /* Cause the `yydebug' variable to be defined.  */
90 #define YYDEBUG 1
93 %start program
95 %union {long itype; tree ttype; enum tree_code code;
96         char *filename; int lineno; }
98 /* All identifiers that are not reserved words
99    and are not declared typedefs in the current block */
100 %token IDENTIFIER
102 /* All identifiers that are declared typedefs in the current block.
103    In some contexts, they are treated just like IDENTIFIER,
104    but they can also serve as typespecs in declarations.  */
105 %token TYPENAME
107 /* Reserved words that specify storage class.
108    yylval contains an IDENTIFIER_NODE which indicates which one.  */
109 %token SCSPEC
111 /* Reserved words that specify type.
112    yylval contains an IDENTIFIER_NODE which indicates which one.  */
113 %token TYPESPEC
115 /* Reserved words that qualify type: "const" or "volatile".
116    yylval contains an IDENTIFIER_NODE which indicates which one.  */
117 %token TYPE_QUAL
119 /* Character or numeric constants.
120    yylval is the node for the constant.  */
121 %token CONSTANT
123 /* String constants in raw form.
124    yylval is a STRING_CST node.  */
125 %token STRING
127 /* "...", used for functions with variable arglists.  */
128 %token ELLIPSIS
130 /* the reserved words */
131 /* SCO include files test "ASM", so use something else. */
132 %token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
133 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF ALIGN
134 %token ATTRIBUTE EXTENSION LABEL
135 %token REALPART IMAGPART
137 /* Add precedence rules to solve dangling else s/r conflict */
138 %nonassoc IF
139 %nonassoc ELSE
141 /* Define the operator tokens and their precedences.
142    The value is an integer because, if used, it is the tree code
143    to use in the expression made from the operator.  */
145 %right <code> ASSIGN '='
146 %right <code> '?' ':'
147 %left <code> OROR
148 %left <code> ANDAND
149 %left <code> '|'
150 %left <code> '^'
151 %left <code> '&'
152 %left <code> EQCOMPARE
153 %left <code> ARITHCOMPARE
154 %left <code> LSHIFT RSHIFT
155 %left <code> '+' '-'
156 %left <code> '*' '/' '%'
157 %right <code> UNARY PLUSPLUS MINUSMINUS
158 %left HYPERUNARY
159 %left <code> POINTSAT '.' '(' '['
161 /* The Objective-C keywords.  These are included in C and in
162    Objective C, so that the token codes are the same in both.  */
163 %token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
164 %token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
166 /* Objective-C string constants in raw form.
167    yylval is an OBJC_STRING_CST node.  */
168 %token OBJC_STRING
171 %type <code> unop
173 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
174 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
175 %type <ttype> typed_declspecs reserved_declspecs
176 %type <ttype> typed_typespecs reserved_typespecquals
177 %type <ttype> declmods typespec typespecqual_reserved
178 %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
179 %type <ttype> initdecls notype_initdecls initdcl notype_initdcl
180 %type <ttype> init maybeasm
181 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
182 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
183 %type <ttype> any_word
185 %type <ttype> compstmt
187 %type <ttype> declarator
188 %type <ttype> notype_declarator after_type_declarator
189 %type <ttype> parm_declarator
191 %type <ttype> structsp component_decl_list component_decl_list2
192 %type <ttype> component_decl components component_declarator
193 %type <ttype> enumlist enumerator
194 %type <ttype> typename absdcl absdcl1 type_quals
195 %type <ttype> xexpr parms parm identifiers
197 %type <ttype> parmlist parmlist_1 parmlist_2
198 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
199 %type <ttype> identifiers_or_typenames
201 %type <itype> setspecs
203 %type <filename> save_filename
204 %type <lineno> save_lineno
206 ifobjc
207 /* the Objective-C nonterminals */
209 %type <ttype> ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator
210 %type <ttype> methoddecl unaryselector keywordselector selector
211 %type <ttype> keyworddecl receiver objcmessageexpr messageargs
212 %type <ttype> keywordexpr keywordarglist keywordarg
213 %type <ttype> myparms myparm optparmlist reservedwords objcselectorexpr
214 %type <ttype> selectorarg keywordnamelist keywordname objcencodeexpr
215 %type <ttype> objc_string protocolrefs identifier_list objcprotocolexpr
216 %type <ttype> CLASSNAME OBJC_STRING OBJECTNAME
217 end ifobjc
220 /* Number of statements (loosely speaking) seen so far.  */
221 static int stmt_count;
223 /* Input file and line number of the end of the body of last simple_if;
224    used by the stmt-rule immediately after simple_if returns.  */
225 static char *if_stmt_file;
226 static int if_stmt_line;
228 /* List of types and structure classes of the current declaration.  */
229 static tree current_declspecs;
231 /* Stack of saved values of current_declspecs.  */
232 static tree declspec_stack;
234 /* 1 if we explained undeclared var errors.  */
235 static int undeclared_variable_notice;
237 ifobjc
238 /* Objective-C specific information */
240 tree objc_interface_context;
241 tree objc_implementation_context;
242 tree objc_method_context;
243 tree objc_ivar_chain;
244 tree objc_ivar_context;
245 enum tree_code objc_inherit_code;
246 int objc_receiver_context;
247 int objc_public_flag;
249 end ifobjc
251 /* Tell yyparse how to print a token's value, if yydebug is set.  */
253 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
254 extern void yyprint ();
258 program: /* empty */
259                 { if (pedantic)
260                     pedwarn ("ANSI C forbids an empty source file");
261                   finish_file ();
262                 }
263         | extdefs
264                 {
265                   /* In case there were missing closebraces,
266                      get us back to the global binding level.  */
267                   while (! global_bindings_p ())
268                     poplevel (0, 0, 0);
269                   finish_file ();
270                 }
271         ;
273 /* the reason for the strange actions in this rule
274  is so that notype_initdecls when reached via datadef
275  can find a valid list of type and sc specs in $0. */
277 extdefs:
278         {$<ttype>$ = NULL_TREE; } extdef
279         | extdefs {$<ttype>$ = NULL_TREE; } extdef
280         ;
282 extdef:
283         fndef
284         | datadef
285 ifobjc
286         | objcdef
287 end ifobjc
288         | ASM_KEYWORD '(' expr ')' ';'
289                 { STRIP_NOPS ($3);
290                   if ((TREE_CODE ($3) == ADDR_EXPR
291                        && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
292                       || TREE_CODE ($3) == STRING_CST)
293                     assemble_asm ($3);
294                   else
295                     error ("argument of `asm' is not a constant string"); }
296         ;
298 datadef:
299           setspecs notype_initdecls ';'
300                 { if (pedantic)
301                     error ("ANSI C forbids data definition with no type or storage class");
302                   else if (!flag_traditional)
303                     warning ("data definition has no type or storage class"); }
304         | declmods setspecs notype_initdecls ';'
305           {}
306         | typed_declspecs setspecs initdecls ';'
307           {}
308         | declmods ';'
309           { pedwarn ("empty declaration"); }
310         | typed_declspecs ';'
311           { shadow_tag ($1); }
312         | error ';'
313         | error '}'
314         | ';'
315                 { if (pedantic)
316                     pedwarn ("ANSI C does not allow extra `;' outside of a function"); }
317         ;
319 fndef:
320           typed_declspecs setspecs declarator
321                 { if (! start_function ($1, $3, 0))
322                     YYERROR1;
323                   reinit_parse_for_function (); }
324           xdecls
325                 { store_parm_decls (); }
326           compstmt_or_error
327                 { finish_function (0); }
328         | typed_declspecs setspecs declarator error
329                 { }
330         | declmods setspecs notype_declarator
331                 { if (! start_function ($1, $3, 0))
332                     YYERROR1;
333                   reinit_parse_for_function (); }
334           xdecls
335                 { store_parm_decls (); }
336           compstmt_or_error
337                 { finish_function (0); }
338         | declmods setspecs notype_declarator error
339                 { }
340         | setspecs notype_declarator
341                 { if (! start_function (NULL_TREE, $2, 0))
342                     YYERROR1;
343                   reinit_parse_for_function (); }
344           xdecls
345                 { store_parm_decls (); }
346           compstmt_or_error
347                 { finish_function (0); }
348         | setspecs notype_declarator error
349                 { }
350         ;
352 identifier:
353         IDENTIFIER
354         | TYPENAME
355 ifobjc
356         | OBJECTNAME
357         | CLASSNAME
358 end ifobjc
359         ;
361 unop:     '&'
362                 { $$ = ADDR_EXPR; }
363         | '-'
364                 { $$ = NEGATE_EXPR; }
365         | '+'
366                 { $$ = CONVERT_EXPR; }
367         | PLUSPLUS
368                 { $$ = PREINCREMENT_EXPR; }
369         | MINUSMINUS
370                 { $$ = PREDECREMENT_EXPR; }
371         | '~'
372                 { $$ = BIT_NOT_EXPR; }
373         | '!'
374                 { $$ = TRUTH_NOT_EXPR; }
375         ;
377 expr:   nonnull_exprlist
378                 { $$ = build_compound_expr ($1); }
379         ;
381 exprlist:
382           /* empty */
383                 { $$ = NULL_TREE; }
384         | nonnull_exprlist
385         ;
387 nonnull_exprlist:
388         expr_no_commas
389                 { $$ = build_tree_list (NULL_TREE, $1); }
390         | nonnull_exprlist ',' expr_no_commas
391                 { chainon ($1, build_tree_list (NULL_TREE, $3)); }
392         ;
394 unary_expr:
395         primary
396         | '*' cast_expr   %prec UNARY
397                 { $$ = build_indirect_ref ($2, "unary *"); }
398         /* __extension__ turns off -pedantic for following primary.  */
399         | EXTENSION
400                 { $<itype>1 = pedantic;
401                   pedantic = 0; }
402           cast_expr       %prec UNARY
403                 { $$ = $3;
404                   pedantic = $<itype>1; }
405         | unop cast_expr  %prec UNARY
406                 { $$ = build_unary_op ($1, $2, 0);
407                   overflow_warning ($$); }
408         /* Refer to the address of a label as a pointer.  */
409         | ANDAND identifier
410                 { tree label = lookup_label ($2);
411                   if (pedantic)
412                     pedwarn ("ANSI C forbids `&&'");
413                   if (label == 0)
414                     $$ = null_pointer_node;
415                   else
416                     {
417                       TREE_USED (label) = 1;
418                       $$ = build1 (ADDR_EXPR, ptr_type_node, label);
419                       TREE_CONSTANT ($$) = 1;
420                     }
421                 }
422 /* This seems to be impossible on some machines, so let's turn it off.
423    You can use __builtin_next_arg to find the anonymous stack args.
424         | '&' ELLIPSIS
425                 { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
426                   $$ = error_mark_node;
427                   if (TREE_VALUE (tree_last (types)) == void_type_node)
428                     error ("`&...' used in function with fixed number of arguments");
429                   else
430                     {
431                       if (pedantic)
432                         pedwarn ("ANSI C forbids `&...'");
433                       $$ = tree_last (DECL_ARGUMENTS (current_function_decl));
434                       $$ = build_unary_op (ADDR_EXPR, $$, 0);
435                     } }
437         | SIZEOF unary_expr  %prec UNARY
438                 { if (TREE_CODE ($2) == COMPONENT_REF
439                       && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
440                     error ("`sizeof' applied to a bit-field");
441                   $$ = c_sizeof (TREE_TYPE ($2)); }
442         | SIZEOF '(' typename ')'  %prec HYPERUNARY
443                 { $$ = c_sizeof (groktypename ($3)); }
444         | ALIGNOF unary_expr  %prec UNARY
445                 { $$ = c_alignof_expr ($2); }
446         | ALIGNOF '(' typename ')'  %prec HYPERUNARY
447                 { $$ = c_alignof (groktypename ($3)); }
448         | REALPART cast_expr %prec UNARY
449                 { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
450         | IMAGPART cast_expr %prec UNARY
451                 { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
452         ;
454 cast_expr:
455         unary_expr
456         | '(' typename ')' cast_expr  %prec UNARY
457                 { tree type = groktypename ($2);
458                   $$ = build_c_cast (type, $4); }
459         | '(' typename ')' '{' 
460                 { start_init (NULL_TREE, NULL, 0);
461                   $2 = groktypename ($2);
462                   really_start_incremental_init ($2); }
463           initlist_maybe_comma '}'  %prec UNARY
464                 { char *name;
465                   tree result = pop_init_level (0);
466                   tree type = $2;
467                   finish_init ();
469                   if (pedantic)
470                     pedwarn ("ANSI C forbids constructor expressions");
471                   if (TYPE_NAME (type) != 0)
472                     {
473                       if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
474                         name = IDENTIFIER_POINTER (TYPE_NAME (type));
475                       else
476                         name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
477                     }
478                   else
479                     name = "";
480                   $$ = result;
481                   if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
482                     {
483                       int failure = complete_array_type (type, $$, 1);
484                       if (failure)
485                         abort ();
486                     }
487                 }
488         ;
490 expr_no_commas:
491           cast_expr
492         | expr_no_commas '+' expr_no_commas
493                 { $$ = parser_build_binary_op ($2, $1, $3); }
494         | expr_no_commas '-' expr_no_commas
495                 { $$ = parser_build_binary_op ($2, $1, $3); }
496         | expr_no_commas '*' expr_no_commas
497                 { $$ = parser_build_binary_op ($2, $1, $3); }
498         | expr_no_commas '/' expr_no_commas
499                 { $$ = parser_build_binary_op ($2, $1, $3); }
500         | expr_no_commas '%' expr_no_commas
501                 { $$ = parser_build_binary_op ($2, $1, $3); }
502         | expr_no_commas LSHIFT expr_no_commas
503                 { $$ = parser_build_binary_op ($2, $1, $3); }
504         | expr_no_commas RSHIFT expr_no_commas
505                 { $$ = parser_build_binary_op ($2, $1, $3); }
506         | expr_no_commas ARITHCOMPARE expr_no_commas
507                 { $$ = parser_build_binary_op ($2, $1, $3); }
508         | expr_no_commas EQCOMPARE expr_no_commas
509                 { $$ = parser_build_binary_op ($2, $1, $3); }
510         | expr_no_commas '&' expr_no_commas
511                 { $$ = parser_build_binary_op ($2, $1, $3); }
512         | expr_no_commas '|' expr_no_commas
513                 { $$ = parser_build_binary_op ($2, $1, $3); }
514         | expr_no_commas '^' expr_no_commas
515                 { $$ = parser_build_binary_op ($2, $1, $3); }
516         | expr_no_commas ANDAND expr_no_commas
517                 { $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $3); }
518         | expr_no_commas OROR expr_no_commas
519                 { $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $3); }
520         | expr_no_commas '?' xexpr ':' expr_no_commas
521                 { $$ = build_conditional_expr ($1, $3, $5); }
522         | expr_no_commas '=' expr_no_commas
523                 { $$ = build_modify_expr ($1, NOP_EXPR, $3);
524                   C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
525         | expr_no_commas ASSIGN expr_no_commas
526                 { $$ = build_modify_expr ($1, $2, $3);
527                   /* This inhibits warnings in truthvalue_conversion.  */
528                   C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
529         ;
531 primary:
532         IDENTIFIER
533                 {
534                   $$ = lastiddecl;
535                   if (!$$ || $$ == error_mark_node)
536                     {
537                       if (yychar == YYEMPTY)
538                         yychar = YYLEX;
539                       if (yychar == '(')
540                         {
541 ifobjc
542                           tree decl;
544                           if (objc_receiver_context
545                               && ! (objc_receiver_context
546                                     && strcmp (IDENTIFIER_POINTER ($1), "super")))
547                             /* we have a message to super */
548                             $$ = get_super_receiver ();
549                           else if (objc_method_context
550                                    && (decl = is_ivar (objc_ivar_chain, $1)))
551                             {
552                               if (is_private (decl))
553                                 $$ = error_mark_node;
554                               else
555                                 $$ = build_ivar_reference ($1);
556                             }
557                           else
558 end ifobjc
559                             {
560                               /* Ordinary implicit function declaration.  */
561                               $$ = implicitly_declare ($1);
562                               assemble_external ($$);
563                               TREE_USED ($$) = 1;
564                             }
565                         }
566                       else if (current_function_decl == 0)
567                         {
568                           error ("`%s' undeclared here (not in a function)",
569                                  IDENTIFIER_POINTER ($1));
570                           $$ = error_mark_node;
571                         }
572                       else
573                         {
574 ifobjc
575                           tree decl;
577                           if (objc_receiver_context
578                               && ! strcmp (IDENTIFIER_POINTER ($1), "super"))
579                             /* we have a message to super */
580                             $$ = get_super_receiver ();
581                           else if (objc_method_context
582                                    && (decl = is_ivar (objc_ivar_chain, $1)))
583                             {
584                               if (is_private (decl))
585                                 $$ = error_mark_node;
586                               else
587                                 $$ = build_ivar_reference ($1);
588                             }
589                           else
590 end ifobjc
591                             {
592                               if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node
593                                   || IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl)
594                                 {
595                                   error ("`%s' undeclared (first use this function)",
596                                          IDENTIFIER_POINTER ($1));
598                                   if (! undeclared_variable_notice)
599                                     {
600                                       error ("(Each undeclared identifier is reported only once");
601                                       error ("for each function it appears in.)");
602                                       undeclared_variable_notice = 1;
603                                     }
604                                 }
605                               $$ = error_mark_node;
606                               /* Prevent repeated error messages.  */
607                               IDENTIFIER_GLOBAL_VALUE ($1) = error_mark_node;
608                               IDENTIFIER_ERROR_LOCUS ($1) = current_function_decl;
609                             }
610                         }
611                     }
612                   else if (TREE_TYPE ($$) == error_mark_node)
613                     $$ = error_mark_node;
614                   else if (C_DECL_ANTICIPATED ($$))
615                     {
616                       /* The first time we see a build-in function used,
617                          if it has not been declared.  */
618                       C_DECL_ANTICIPATED ($$) = 0;
619                       if (yychar == YYEMPTY)
620                         yychar = YYLEX;
621                       if (yychar == '(')
622                         {
623                           /* Omit the implicit declaration we
624                              would ordinarily do, so we don't lose
625                              the actual built in type.
626                              But print a diagnostic for the mismatch.  */
627 ifobjc
628                           if (objc_method_context
629                               && is_ivar (objc_ivar_chain, $1))
630                             error ("Instance variable `%s' implicitly declared as function",
631                                    IDENTIFIER_POINTER (DECL_NAME ($$)));
632                           else
633 end ifobjc
634                             if (TREE_CODE ($$) != FUNCTION_DECL)
635                               error ("`%s' implicitly declared as function",
636                                      IDENTIFIER_POINTER (DECL_NAME ($$)));
637                           else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$)))
638                                     != TYPE_MODE (integer_type_node))
639                                    && (TREE_TYPE (TREE_TYPE ($$))
640                                        != void_type_node))
641                             pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
642                                      IDENTIFIER_POINTER (DECL_NAME ($$)));
643                           /* If it really returns void, change that to int.  */
644                           if (TREE_TYPE (TREE_TYPE ($$)) == void_type_node)
645                             TREE_TYPE ($$)
646                               = build_function_type (integer_type_node,
647                                                      TYPE_ARG_TYPES (TREE_TYPE ($$)));
648                         }
649                       else
650                         pedwarn ("built-in function `%s' used without declaration",
651                                  IDENTIFIER_POINTER (DECL_NAME ($$)));
653                       /* Do what we would ordinarily do when a fn is used.  */
654                       assemble_external ($$);
655                       TREE_USED ($$) = 1;
656                     }
657                   else
658                     {
659                       assemble_external ($$);
660                       TREE_USED ($$) = 1;
661 ifobjc
662                       /* we have a definition - still check if iVariable */
664                       if (!objc_receiver_context
665                           || (objc_receiver_context
666                               && strcmp (IDENTIFIER_POINTER ($1), "super")))
667                         {
668                           tree decl;
670                           if (objc_method_context
671                               && (decl = is_ivar (objc_ivar_chain, $1)))
672                             {
673                               if (IDENTIFIER_LOCAL_VALUE ($1))
674                                 warning ("local declaration of `%s' hides instance variable",
675                                          IDENTIFIER_POINTER ($1));
676                               else
677                                 {
678                                   if (is_private (decl))
679                                     $$ = error_mark_node;
680                                   else
681                                     $$ = build_ivar_reference ($1);
682                                 }
683                             }
684                         }
685                       else /* we have a message to super */
686                         $$ = get_super_receiver ();
687 end ifobjc
688                     }
690                   if (TREE_CODE ($$) == CONST_DECL)
691                     {
692                       $$ = DECL_INITIAL ($$);
693                       /* This is to prevent an enum whose value is 0
694                          from being considered a null pointer constant.  */
695                       $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$);
696                       TREE_CONSTANT ($$) = 1;
697                     }
698                 }
699         | CONSTANT
700         | string
701                 { $$ = combine_strings ($1); }
702         | '(' expr ')'
703                 { char class = TREE_CODE_CLASS (TREE_CODE ($2));
704                   if (class == 'e' || class == '1'
705                       || class == '2' || class == '<')
706                     C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
707                   $$ = $2; }
708         | '(' error ')'
709                 { $$ = error_mark_node; }
710         | '('
711                 { if (current_function_decl == 0)
712                     {
713                       error ("braced-group within expression allowed only inside a function");
714                       YYERROR;
715                     }
716                   /* We must force a BLOCK for this level
717                      so that, if it is not expanded later,
718                      there is a way to turn off the entire subtree of blocks
719                      that are contained in it.  */
720                   keep_next_level ();
721                   push_iterator_stack ();
722                   push_label_level ();
723                   $<ttype>$ = expand_start_stmt_expr (); }
724           compstmt ')'
725                 { tree rtl_exp;
726                   if (pedantic)
727                     pedwarn ("ANSI C forbids braced-groups within expressions");
728                   pop_iterator_stack ();
729                   pop_label_level ();
730                   rtl_exp = expand_end_stmt_expr ($<ttype>2);
731                   /* The statements have side effects, so the group does.  */
732                   TREE_SIDE_EFFECTS (rtl_exp) = 1;
734                   if (TREE_CODE ($3) == BLOCK)
735                     {
736                       /* Make a BIND_EXPR for the BLOCK already made.  */
737                       $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
738                                   NULL_TREE, rtl_exp, $3);
739                       /* Remove the block from the tree at this point.
740                          It gets put back at the proper place
741                          when the BIND_EXPR is expanded.  */
742                       delete_block ($3);
743                     }
744                   else
745                     $$ = $3;
746                 }
747         | primary '(' exprlist ')'   %prec '.'
748                 { $$ = build_function_call ($1, $3); }
749         | primary '[' expr ']'   %prec '.'
750                 { $$ = build_array_ref ($1, $3); }
751         | primary '.' identifier
752                 {
753 ifobjc
754                   if (doing_objc_thang)
755                     {
756                       if (is_public ($1, $3))
757                         $$ = build_component_ref ($1, $3);
758                       else
759                         $$ = error_mark_node;
760                     }
761                   else
762 end ifobjc
763                     $$ = build_component_ref ($1, $3);
764                 }
765         | primary POINTSAT identifier
766                 {
767                   tree expr = build_indirect_ref ($1, "->");
769 ifobjc
770                   if (doing_objc_thang)
771                     {
772                       if (is_public (expr, $3))
773                         $$ = build_component_ref (expr, $3);
774                       else
775                         $$ = error_mark_node;
776                     }
777                   else
778 end ifobjc
779                     $$ = build_component_ref (expr, $3);
780                 }
781         | primary PLUSPLUS
782                 { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
783         | primary MINUSMINUS
784                 { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
785 ifobjc
786         | objcmessageexpr
787                 { $$ = build_message_expr ($1); }
788         | objcselectorexpr
789                 { $$ = build_selector_expr ($1); }
790         | objcprotocolexpr
791                 { $$ = build_protocol_expr ($1); }
792         | objcencodeexpr
793                 { $$ = build_encode_expr ($1); }
794         | objc_string
795                 { $$ = build_objc_string_object ($1); }
796 end ifobjc
797         ;
799 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it.  */
800 string:
801           STRING
802         | string STRING
803                 { $$ = chainon ($1, $2); }
804         ;
806 ifobjc
807 /* Produces an OBJC_STRING_CST with prehaps more OBJC_STRING_CSTs chained
808    onto it.  */
809 objc_string:
810           OBJC_STRING
811         | objc_string OBJC_STRING
812                 { $$ = chainon ($1, $2); }
813         ;
814 end ifobjc
816 xdecls:
817         /* empty */
818         | datadecls
819         | datadecls ELLIPSIS
820                 /* ... is used here to indicate a varargs function.  */
821                 { c_mark_varargs ();
822                   if (pedantic)
823                     pedwarn ("ANSI C does not permit use of `varargs.h'"); }
824         ;
826 /* The following are analogous to lineno_decl, decls and decl
827    except that they do not allow nested functions.
828    They are used for old-style parm decls.  */
829 lineno_datadecl:
830           save_filename save_lineno datadecl
831                 { }
832         ;
834 datadecls:
835         lineno_datadecl
836         | errstmt
837         | datadecls lineno_datadecl
838         | lineno_datadecl errstmt
839         ;
841 datadecl:
842         typed_declspecs setspecs initdecls ';'
843                 { current_declspecs = TREE_VALUE (declspec_stack);
844                   declspec_stack = TREE_CHAIN (declspec_stack);
845                   resume_momentary ($2); }
846         | declmods setspecs notype_initdecls ';'
847                 { current_declspecs = TREE_VALUE (declspec_stack);
848                   declspec_stack = TREE_CHAIN (declspec_stack);
849                   resume_momentary ($2); }
850         | typed_declspecs ';'
851                 { shadow_tag_warned ($1, 1);
852                   pedwarn ("empty declaration"); }
853         | declmods ';'
854                 { pedwarn ("empty declaration"); }
855         ;
857 /* This combination which saves a lineno before a decl
858    is the normal thing to use, rather than decl itself.
859    This is to avoid shift/reduce conflicts in contexts
860    where statement labels are allowed.  */
861 lineno_decl:
862           save_filename save_lineno decl
863                 { }
864         ;
866 decls:
867         lineno_decl
868         | errstmt
869         | decls lineno_decl
870         | lineno_decl errstmt
871         ;
873 /* records the type and storage class specs to use for processing
874    the declarators that follow.
875    Maintains a stack of outer-level values of current_declspecs,
876    for the sake of parm declarations nested in function declarators.  */
877 setspecs: /* empty */
878                 { $$ = suspend_momentary ();
879                   pending_xref_error ();
880                   declspec_stack = tree_cons (NULL_TREE, current_declspecs,
881                                               declspec_stack);
882                   current_declspecs = $<ttype>0; }
883         ;
885 decl:
886         typed_declspecs setspecs initdecls ';'
887                 { current_declspecs = TREE_VALUE (declspec_stack);
888                   declspec_stack = TREE_CHAIN (declspec_stack);
889                   resume_momentary ($2); }
890         | declmods setspecs notype_initdecls ';'
891                 { current_declspecs = TREE_VALUE (declspec_stack);
892                   declspec_stack = TREE_CHAIN (declspec_stack);
893                   resume_momentary ($2); }
894         | typed_declspecs setspecs nested_function
895                 { current_declspecs = TREE_VALUE (declspec_stack);
896                   declspec_stack = TREE_CHAIN (declspec_stack);
897                   resume_momentary ($2); }
898         | declmods setspecs notype_nested_function
899                 { current_declspecs = TREE_VALUE (declspec_stack);
900                   declspec_stack = TREE_CHAIN (declspec_stack);
901                   resume_momentary ($2); }
902         | typed_declspecs ';'
903                 { shadow_tag ($1); }
904         | declmods ';'
905                 { pedwarn ("empty declaration"); }
906         ;
908 /* Declspecs which contain at least one type specifier or typedef name.
909    (Just `const' or `volatile' is not enough.)
910    A typedef'd name following these is taken as a name to be declared.  */
912 typed_declspecs:
913           typespec reserved_declspecs
914                 { $$ = tree_cons (NULL_TREE, $1, $2); }
915         | declmods typespec reserved_declspecs
916                 { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
917         ;
919 reserved_declspecs:  /* empty */
920                 { $$ = NULL_TREE; }
921         | reserved_declspecs typespecqual_reserved
922                 { $$ = tree_cons (NULL_TREE, $2, $1); }
923         | reserved_declspecs SCSPEC
924                 { if (extra_warnings)
925                     warning ("`%s' is not at beginning of declaration",
926                              IDENTIFIER_POINTER ($2));
927                   $$ = tree_cons (NULL_TREE, $2, $1); }
928         ;
930 /* List of just storage classes and type modifiers.
931    A declaration can start with just this, but then it cannot be used
932    to redeclare a typedef-name.  */
934 declmods:
935           TYPE_QUAL
936                 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
937                   TREE_STATIC ($$) = 1; }
938         | SCSPEC
939                 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
940         | declmods TYPE_QUAL
941                 { $$ = tree_cons (NULL_TREE, $2, $1);
942                   TREE_STATIC ($$) = 1; }
943         | declmods SCSPEC
944                 { if (extra_warnings && TREE_STATIC ($1))
945                     warning ("`%s' is not at beginning of declaration",
946                              IDENTIFIER_POINTER ($2));
947                   $$ = tree_cons (NULL_TREE, $2, $1);
948                   TREE_STATIC ($$) = TREE_STATIC ($1); }
949         ;
952 /* Used instead of declspecs where storage classes are not allowed
953    (that is, for typenames and structure components).
954    Don't accept a typedef-name if anything but a modifier precedes it.  */
956 typed_typespecs:
957           typespec reserved_typespecquals
958                 { $$ = tree_cons (NULL_TREE, $1, $2); }
959         | nonempty_type_quals typespec reserved_typespecquals
960                 { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
961         ;
963 reserved_typespecquals:  /* empty */
964                 { $$ = NULL_TREE; }
965         | reserved_typespecquals typespecqual_reserved
966                 { $$ = tree_cons (NULL_TREE, $2, $1); }
967         ;
969 /* A typespec (but not a type qualifier).
970    Once we have seen one of these in a declaration,
971    if a typedef name appears then it is being redeclared.  */
973 typespec: TYPESPEC
974         | structsp
975         | TYPENAME
976                 { /* For a typedef name, record the meaning, not the name.
977                      In case of `foo foo, bar;'.  */
978                   $$ = lookup_name ($1); }
979 ifobjc
980         | CLASSNAME protocolrefs
981                 { $$ = get_static_reference ($1, $2); }
982         | OBJECTNAME protocolrefs
983                 { $$ = get_object_reference ($2); }
984 end ifobjc
985         | TYPEOF '(' expr ')'
986                 { $$ = TREE_TYPE ($3); }
987         | TYPEOF '(' typename ')'
988                 { $$ = groktypename ($3); }
989         ;
991 /* A typespec that is a reserved word, or a type qualifier.  */
993 typespecqual_reserved: TYPESPEC
994         | TYPE_QUAL
995         | structsp
996         ;
998 initdecls:
999         initdcl
1000         | initdecls ',' initdcl
1001         ;
1003 notype_initdecls:
1004         notype_initdcl
1005         | notype_initdecls ',' initdcl
1006         ;
1008 maybeasm:
1009           /* empty */
1010                 { $$ = NULL_TREE; }
1011         | ASM_KEYWORD '(' string ')'
1012                 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
1013                   $$ = $3;
1014                 }
1015         ;
1017 initdcl:
1018           declarator maybeasm maybe_attribute '='
1019                 { $<ttype>$ = start_decl ($1, current_declspecs, 1);
1020                   decl_attributes ($<ttype>$, $3);
1021                   start_init ($<ttype>$, $2, global_bindings_p ()); }
1022           init
1023 /* Note how the declaration of the variable is in effect while its init is parsed! */
1024                 { finish_init ();
1025                   decl_attributes ($<ttype>5, $3);
1026                   finish_decl ($<ttype>5, $6, $2); }
1027         | declarator maybeasm maybe_attribute
1028                 { tree d = start_decl ($1, current_declspecs, 0);
1029                   decl_attributes (d, $3);
1030                   finish_decl (d, NULL_TREE, $2); }
1031         ;
1033 notype_initdcl:
1034           notype_declarator maybeasm maybe_attribute '='
1035                 { $<ttype>$ = start_decl ($1, current_declspecs, 1);
1036                   decl_attributes ($<ttype>$, $3);
1037                   start_init ($<ttype>$, $2, global_bindings_p ()); }
1038           init
1039 /* Note how the declaration of the variable is in effect while its init is parsed! */
1040                 { finish_init ();
1041                   decl_attributes ($<ttype>5, $3);
1042                   finish_decl ($<ttype>5, $6, $2); }
1043         | notype_declarator maybeasm maybe_attribute
1044                 { tree d = start_decl ($1, current_declspecs, 0);
1045                   decl_attributes (d, $3);
1046                   finish_decl (d, NULL_TREE, $2); }
1047         ;
1048 /* the * rules are dummies to accept the Apollo extended syntax
1049    so that the header files compile. */
1050 maybe_attribute:
1051       /* empty */
1052                 { $$ = NULL_TREE; }
1053         | attributes
1054                 { $$ = $1; }
1055         ;
1057 attributes:
1058       attribute
1059                 { $$ = $1; }
1060         | attributes attribute
1061                 { $$ = chainon ($1, $2); }
1062         ;
1064 attribute:
1065       ATTRIBUTE '(' '(' attribute_list ')' ')'
1066                 { $$ = $4; }
1067         ;
1069 attribute_list:
1070       attrib
1071                 { $$ = build_tree_list (NULL_TREE, $1); }
1072         | attribute_list ',' attrib
1073                 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
1074         ;
1076 attrib:
1077     /* empty */
1078                 { $$ = NULL_TREE; }
1079         | any_word
1080                 { $$ = $1; }
1081         | any_word '(' IDENTIFIER ')'
1082                 { $$ = tree_cons ($1, NULL_TREE,
1083                                   build_tree_list (NULL_TREE, $3)); }
1084         | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
1085                 { $$ = tree_cons ($1, NULL_TREE,
1086                                   tree_cons (NULL_TREE, $3, $5)); }
1087         | any_word '(' nonnull_exprlist ')'
1088                 { $$ = tree_cons ($1, NULL_TREE, $3); }
1089         ;
1091 /* This still leaves out most reserved keywords,
1092    shouldn't we include them?  */
1094 any_word:
1095           identifier
1096         | SCSPEC
1097         | TYPESPEC
1098         | TYPE_QUAL
1099         ;
1101 /* Initializers.  `init' is the entry point.  */
1103 init:
1104         expr_no_commas
1105         | '{'
1106                 { really_start_incremental_init (NULL_TREE);
1107                   /* Note that the call to clear_momentary
1108                      is in process_init_element.  */
1109                   push_momentary (); }
1110           initlist_maybe_comma '}'
1111                 { $$ = pop_init_level (0);
1112                   if ($$ == error_mark_node
1113                       && ! (yychar == STRING || yychar == CONSTANT))
1114                     pop_momentary ();
1115                   else
1116                     pop_momentary_nofree (); }
1118         | error
1119                 { $$ = error_mark_node; }
1120         ;
1122 /* `initlist_maybe_comma' is the guts of an initializer in braces.  */
1123 initlist_maybe_comma:
1124           /* empty */
1125                 { if (pedantic)
1126                     pedwarn ("ANSI C forbids empty initializer braces"); }
1127         | initlist1 maybecomma
1128         ;
1130 initlist1:
1131           initelt
1132         | initlist1 ',' initelt
1133         ;
1135 /* `initelt' is a single element of an initializer.
1136    It may use braces.  */
1137 initelt:
1138         expr_no_commas
1139                 { process_init_element ($1); }
1140         | '{' 
1141                 { push_init_level (0); }
1142           initlist_maybe_comma '}'
1143                 { process_init_element (pop_init_level (0)); }
1144         | error
1145         /* These are for labeled elements.  The syntax for an array element
1146            initializer conflicts with the syntax for an Objective-C message,
1147            so don't include these productions in the Objective-C grammer.  */
1149         | '[' expr_no_commas ELLIPSIS expr_no_commas ']' '='
1150                 { set_init_index ($2, $4); }
1151           initelt
1152         | '[' expr_no_commas ']' '='
1153                 { set_init_index ($2, NULL_TREE); }
1154           initelt
1155         | '[' expr_no_commas ']'
1156                 { set_init_index ($2, NULL_TREE); }
1157           initelt
1158 end ifc
1159         | identifier ':'
1160                 { set_init_label ($1); }
1161           initelt
1162         | '.' identifier '='
1163                 { set_init_label ($2); }
1164           initelt
1165         ;
1167 nested_function:
1168           declarator
1169                 { push_c_function_context ();
1170                   if (! start_function (current_declspecs, $1, 1))
1171                     {
1172                       pop_c_function_context ();
1173                       YYERROR1;
1174                     }
1175                   reinit_parse_for_function ();
1176                   store_parm_decls (); }
1177 /* This used to use compstmt_or_error.
1178    That caused a bug with input `f(g) int g {}',
1179    where the use of YYERROR1 above caused an error
1180    which then was handled by compstmt_or_error.
1181    There followed a repeated execution of that same rule,
1182    which called YYERROR1 again, and so on.  */
1183           compstmt
1184                 { finish_function (1);
1185                   pop_c_function_context (); }
1186         ;
1188 notype_nested_function:
1189           notype_declarator
1190                 { push_c_function_context ();
1191                   if (! start_function (current_declspecs, $1, 1))
1192                     {
1193                       pop_c_function_context ();
1194                       YYERROR1;
1195                     }
1196                   reinit_parse_for_function ();
1197                   store_parm_decls (); }
1198 /* This used to use compstmt_or_error.
1199    That caused a bug with input `f(g) int g {}',
1200    where the use of YYERROR1 above caused an error
1201    which then was handled by compstmt_or_error.
1202    There followed a repeated execution of that same rule,
1203    which called YYERROR1 again, and so on.  */
1204           compstmt
1205                 { finish_function (1);
1206                   pop_c_function_context (); }
1207         ;
1209 /* Any kind of declarator (thus, all declarators allowed
1210    after an explicit typespec).  */
1212 declarator:
1213           after_type_declarator
1214         | notype_declarator
1215         ;
1217 /* A declarator that is allowed only after an explicit typespec.  */
1219 after_type_declarator:
1220           '(' after_type_declarator ')'
1221                 { $$ = $2; }
1222         | after_type_declarator '(' parmlist_or_identifiers  %prec '.'
1223                 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1224 /*      | after_type_declarator '(' error ')'  %prec '.'
1225                 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1226                   poplevel (0, 0, 0); }  */
1227         | after_type_declarator '[' expr ']'  %prec '.'
1228                 { $$ = build_nt (ARRAY_REF, $1, $3); }
1229         | after_type_declarator '[' ']'  %prec '.'
1230                 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1231         | '*' type_quals after_type_declarator  %prec UNARY
1232                 { $$ = make_pointer_declarator ($2, $3); }
1233         | TYPENAME
1234 ifobjc
1235         | OBJECTNAME
1236 end ifobjc
1237         ;
1239 /* Kinds of declarator that can appear in a parameter list
1240    in addition to notype_declarator.  This is like after_type_declarator
1241    but does not allow a typedef name in parentheses as an identifier
1242    (because it would conflict with a function with that typedef as arg).  */
1244 parm_declarator:
1245           parm_declarator '(' parmlist_or_identifiers  %prec '.'
1246                 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1247 /*      | parm_declarator '(' error ')'  %prec '.'
1248                 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1249                   poplevel (0, 0, 0); }  */
1250         | parm_declarator '[' expr ']'  %prec '.'
1251                 { $$ = build_nt (ARRAY_REF, $1, $3); }
1252         | parm_declarator '[' ']'  %prec '.'
1253                 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1254         | '*' type_quals parm_declarator  %prec UNARY
1255                 { $$ = make_pointer_declarator ($2, $3); }
1256         | TYPENAME
1257         ;
1259 /* A declarator allowed whether or not there has been
1260    an explicit typespec.  These cannot redeclare a typedef-name.  */
1262 notype_declarator:
1263           notype_declarator '(' parmlist_or_identifiers  %prec '.'
1264                 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1265 /*      | notype_declarator '(' error ')'  %prec '.'
1266                 { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
1267                   poplevel (0, 0, 0); }  */
1268         | '(' notype_declarator ')'
1269                 { $$ = $2; }
1270         | '*' type_quals notype_declarator  %prec UNARY
1271                 { $$ = make_pointer_declarator ($2, $3); }
1272         | notype_declarator '[' expr ']'  %prec '.'
1273                 { $$ = build_nt (ARRAY_REF, $1, $3); }
1274         | notype_declarator '[' ']'  %prec '.'
1275                 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1276         | IDENTIFIER
1277         ;
1279 structsp:
1280           STRUCT identifier '{'
1281                 { $$ = start_struct (RECORD_TYPE, $2);
1282                   /* Start scope of tag before parsing components.  */
1283                 }
1284           component_decl_list '}'
1285                 { $$ = finish_struct ($<ttype>4, $5);
1286                   /* Really define the structure.  */
1287                 }
1288         | STRUCT '{' component_decl_list '}'
1289                 { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
1290                                       $3); }
1291         | STRUCT identifier
1292                 { $$ = xref_tag (RECORD_TYPE, $2); }
1293         | UNION identifier '{'
1294                 { $$ = start_struct (UNION_TYPE, $2); }
1295           component_decl_list '}'
1296                 { $$ = finish_struct ($<ttype>4, $5); }
1297         | UNION '{' component_decl_list '}'
1298                 { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
1299                                       $3); }
1300         | UNION identifier
1301                 { $$ = xref_tag (UNION_TYPE, $2); }
1302         | ENUM identifier '{'
1303                 { $<itype>3 = suspend_momentary ();
1304                   $$ = start_enum ($2); }
1305           enumlist maybecomma_warn '}'
1306                 { $$ = finish_enum ($<ttype>4, nreverse ($5));
1307                   resume_momentary ($<itype>3); }
1308         | ENUM '{'
1309                 { $<itype>2 = suspend_momentary ();
1310                   $$ = start_enum (NULL_TREE); }
1311           enumlist maybecomma_warn '}'
1312                 { $$ = finish_enum ($<ttype>3, nreverse ($4));
1313                   resume_momentary ($<itype>2); }
1314         | ENUM identifier
1315                 { $$ = xref_tag (ENUMERAL_TYPE, $2); }
1316         ;
1318 maybecomma:
1319           /* empty */
1320         | ','
1321         ;
1323 maybecomma_warn:
1324           /* empty */
1325         | ','
1326                 { if (pedantic) pedwarn ("comma at end of enumerator list"); }
1327         ;
1329 component_decl_list:
1330           component_decl_list2
1331                 { $$ = $1; }
1332         | component_decl_list2 component_decl
1333                 { $$ = chainon ($1, $2);
1334                   pedwarn ("no semicolon at end of struct or union"); }
1335         ;
1337 component_decl_list2:   /* empty */
1338                 { $$ = NULL_TREE; }
1339         | component_decl_list2 component_decl ';'
1340                 { $$ = chainon ($1, $2); }
1341         | component_decl_list2 ';'
1342                 { if (pedantic)
1343                     pedwarn ("extra semicolon in struct or union specified"); }
1344 ifobjc
1345         /* foo(sizeof(struct{ @defs(ClassName)})); */
1346         | DEFS '(' CLASSNAME ')'
1347                 {
1348                   tree interface = lookup_interface ($3);
1350                   if (interface)
1351                     $$ = get_class_ivars (interface);
1352                   else
1353                     {
1354                       error ("Cannot find interface declaration for `%s'",
1355                              IDENTIFIER_POINTER ($3));
1356                       $$ = NULL_TREE;
1357                     }
1358                 }
1359 end ifobjc
1360         ;
1362 /* There is a shift-reduce conflict here, because `components' may
1363    start with a `typename'.  It happens that shifting (the default resolution)
1364    does the right thing, because it treats the `typename' as part of
1365    a `typed_typespecs'.
1367    It is possible that this same technique would allow the distinction
1368    between `notype_initdecls' and `initdecls' to be eliminated.
1369    But I am being cautious and not trying it.  */
1371 component_decl:
1372           typed_typespecs setspecs components
1373                 { $$ = $3;
1374                   current_declspecs = TREE_VALUE (declspec_stack);
1375                   declspec_stack = TREE_CHAIN (declspec_stack);
1376                   resume_momentary ($2); }
1377         | typed_typespecs
1378                 { if (pedantic)
1379                     pedwarn ("ANSI C forbids member declarations with no members");
1380                   shadow_tag($1);
1381                   $$ = NULL_TREE; }
1382         | nonempty_type_quals setspecs components
1383                 { $$ = $3;
1384                   current_declspecs = TREE_VALUE (declspec_stack);
1385                   declspec_stack = TREE_CHAIN (declspec_stack);
1386                   resume_momentary ($2); }
1387         | nonempty_type_quals
1388                 { if (pedantic)
1389                     pedwarn ("ANSI C forbids member declarations with no members");
1390                   shadow_tag($1);
1391                   $$ = NULL_TREE; }
1392         | error
1393                 { $$ = NULL_TREE; }
1394         ;
1396 components:
1397           component_declarator
1398         | components ',' component_declarator
1399                 { $$ = chainon ($1, $3); }
1400         ;
1402 component_declarator:
1403           save_filename save_lineno declarator maybe_attribute
1404                 { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
1405                   decl_attributes ($$, $4); }
1406         | save_filename save_lineno
1407           declarator ':' expr_no_commas maybe_attribute
1408                 { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
1409                   decl_attributes ($$, $6); }
1410         | save_filename save_lineno ':' expr_no_commas maybe_attribute
1411                 { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
1412                   decl_attributes ($$, $5); }
1413         ;
1415 /* We chain the enumerators in reverse order.
1416    They are put in forward order where enumlist is used.
1417    (The order used to be significant, but no longer is so.
1418    However, we still maintain the order, just to be clean.)  */
1420 enumlist:
1421           enumerator
1422         | enumlist ',' enumerator
1423                 { $$ = chainon ($3, $1); }
1424         | error
1425                 { $$ = error_mark_node; }
1426         ;
1429 enumerator:
1430           identifier
1431                 { $$ = build_enumerator ($1, NULL_TREE); }
1432         | identifier '=' expr_no_commas
1433                 { $$ = build_enumerator ($1, $3); }
1434         ;
1436 typename:
1437         typed_typespecs absdcl
1438                 { $$ = build_tree_list ($1, $2); }
1439         | nonempty_type_quals absdcl
1440                 { $$ = build_tree_list ($1, $2); }
1441         ;
1443 absdcl:   /* an absolute declarator */
1444         /* empty */
1445                 { $$ = NULL_TREE; }
1446         | absdcl1
1447         ;
1449 nonempty_type_quals:
1450           TYPE_QUAL
1451                 { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
1452         | nonempty_type_quals TYPE_QUAL
1453                 { $$ = tree_cons (NULL_TREE, $2, $1); }
1454         ;
1456 type_quals:
1457           /* empty */
1458                 { $$ = NULL_TREE; }
1459         | type_quals TYPE_QUAL
1460                 { $$ = tree_cons (NULL_TREE, $2, $1); }
1461         ;
1463 absdcl1:  /* a nonempty absolute declarator */
1464           '(' absdcl1 ')'
1465                 { $$ = $2; }
1466           /* `(typedef)1' is `int'.  */
1467         | '*' type_quals absdcl1  %prec UNARY
1468                 { $$ = make_pointer_declarator ($2, $3); }
1469         | '*' type_quals  %prec UNARY
1470                 { $$ = make_pointer_declarator ($2, NULL_TREE); }
1471         | absdcl1 '(' parmlist  %prec '.'
1472                 { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
1473         | absdcl1 '[' expr ']'  %prec '.'
1474                 { $$ = build_nt (ARRAY_REF, $1, $3); }
1475         | absdcl1 '[' ']'  %prec '.'
1476                 { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
1477         | '(' parmlist  %prec '.'
1478                 { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
1479         | '[' expr ']'  %prec '.'
1480                 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
1481         | '[' ']'  %prec '.'
1482                 { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
1483         ;
1485 /* at least one statement, the first of which parses without error.  */
1486 /* stmts is used only after decls, so an invalid first statement
1487    is actually regarded as an invalid decl and part of the decls.  */
1489 stmts:
1490           lineno_stmt_or_label
1491         | stmts lineno_stmt_or_label
1492         | stmts errstmt
1493         ;
1495 xstmts:
1496         /* empty */
1497         | stmts
1498         ;
1500 errstmt:  error ';'
1501         ;
1503 pushlevel:  /* empty */
1504                 { emit_line_note (input_filename, lineno);
1505                   pushlevel (0);
1506                   clear_last_expr ();
1507                   push_momentary ();
1508                   expand_start_bindings (0);
1509 ifobjc
1510                   if (objc_method_context)
1511                     add_objc_decls ();
1512 end ifobjc
1513                 }
1514         ;
1516 /* Read zero or more forward-declarations for labels
1517    that nested functions can jump to.  */
1518 maybe_label_decls:
1519           /* empty */
1520         | label_decls
1521                 { if (pedantic)
1522                     pedwarn ("ANSI C forbids label declarations"); }
1523         ;
1525 label_decls:
1526           label_decl
1527         | label_decls label_decl
1528         ;
1530 label_decl:
1531           LABEL identifiers_or_typenames ';'
1532                 { tree link;
1533                   for (link = $2; link; link = TREE_CHAIN (link))
1534                     {
1535                       tree label = shadow_label (TREE_VALUE (link));
1536                       C_DECLARED_LABEL_FLAG (label) = 1;
1537                       declare_nonlocal_label (label);
1538                     }
1539                 }
1540         ;
1542 /* This is the body of a function definition.
1543    It causes syntax errors to ignore to the next openbrace.  */
1544 compstmt_or_error:
1545           compstmt
1546                 {}
1547         | error compstmt
1548         ;
1550 compstmt: '{' '}'
1551                 { $$ = convert (void_type_node, integer_zero_node); }
1552         | '{' pushlevel maybe_label_decls decls xstmts '}'
1553                 { emit_line_note (input_filename, lineno);
1554                   expand_end_bindings (getdecls (), 1, 0);
1555                   $$ = poplevel (1, 1, 0);
1556                   if (yychar == CONSTANT || yychar == STRING)
1557                     pop_momentary_nofree ();
1558                   else
1559                     pop_momentary (); }
1560         | '{' pushlevel maybe_label_decls error '}'
1561                 { emit_line_note (input_filename, lineno);
1562                   expand_end_bindings (getdecls (), kept_level_p (), 0);
1563                   $$ = poplevel (kept_level_p (), 0, 0);
1564                   if (yychar == CONSTANT || yychar == STRING)
1565                     pop_momentary_nofree ();
1566                   else
1567                     pop_momentary (); }
1568         | '{' pushlevel maybe_label_decls stmts '}'
1569                 { emit_line_note (input_filename, lineno);
1570                   expand_end_bindings (getdecls (), kept_level_p (), 0);
1571                   $$ = poplevel (kept_level_p (), 0, 0);
1572                   if (yychar == CONSTANT || yychar == STRING)
1573                     pop_momentary_nofree ();
1574                   else
1575                     pop_momentary (); }
1576         ;
1578 /* Value is number of statements counted as of the closeparen.  */
1579 simple_if:
1580           if_prefix lineno_labeled_stmt
1581 /* Make sure expand_end_cond is run once
1582    for each call to expand_start_cond.
1583    Otherwise a crash is likely.  */
1584         | if_prefix error
1585         ;
1587 if_prefix:
1588           IF '(' expr ')'
1589                 { emit_line_note ($<filename>-1, $<lineno>0);
1590                   expand_start_cond (truthvalue_conversion ($3), 0);
1591                   $<itype>$ = stmt_count;
1592                   if_stmt_file = $<filename>-1;
1593                   if_stmt_line = $<lineno>0;
1594                   position_after_white_space (); }
1595         ;
1597 /* This is a subroutine of stmt.
1598    It is used twice, once for valid DO statements
1599    and once for catching errors in parsing the end test.  */
1600 do_stmt_start:
1601           DO
1602                 { stmt_count++;
1603                   emit_line_note ($<filename>-1, $<lineno>0);
1604                   /* See comment in `while' alternative, above.  */
1605                   emit_nop ();
1606                   expand_start_loop_continue_elsewhere (1);
1607                   position_after_white_space (); }
1608           lineno_labeled_stmt WHILE
1609                 { expand_loop_continue_here (); }
1610         ;
1612 save_filename:
1613                 { $$ = input_filename; }
1614         ;
1616 save_lineno:
1617                 { $$ = lineno; }
1618         ;
1620 lineno_labeled_stmt:
1621           save_filename save_lineno stmt
1622                 { }
1623 /*      | save_filename save_lineno error
1624                 { }
1626         | save_filename save_lineno label lineno_labeled_stmt
1627                 { }
1628         ;
1630 lineno_stmt_or_label:
1631           save_filename save_lineno stmt_or_label
1632                 { }
1633         ;
1635 stmt_or_label:
1636           stmt
1637         | label
1638                 { int next;
1639                   position_after_white_space ();
1640                   next = getc (finput);
1641                   ungetc (next, finput);
1642                   if (pedantic && next == '}')
1643                     pedwarn ("ANSI C forbids label at end of compound statement");
1644                 }
1645         ;
1647 /* Parse a single real statement, not including any labels.  */
1648 stmt:
1649           compstmt
1650                 { stmt_count++; }
1651         | all_iter_stmt 
1652         | expr ';'
1653                 { stmt_count++;
1654                   emit_line_note ($<filename>-1, $<lineno>0);
1655 /* It appears that this should not be done--that a non-lvalue array
1656    shouldn't get an error if the value isn't used.
1657    Section 3.2.2.1 says that an array lvalue gets converted to a pointer
1658    if it appears as a top-level expression,
1659    but says nothing about non-lvalue arrays.  */
1660 #if 0
1661                   /* Call default_conversion to get an error
1662                      on referring to a register array if pedantic.  */
1663                   if (TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE
1664                       || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE)
1665                     $1 = default_conversion ($1);
1666 #endif
1667                   iterator_expand ($1);
1668                   clear_momentary (); }
1669         | simple_if ELSE
1670                 { expand_start_else ();
1671                   $<itype>1 = stmt_count;
1672                   position_after_white_space (); }
1673           lineno_labeled_stmt
1674                 { expand_end_cond ();
1675                   if (extra_warnings && stmt_count == $<itype>1)
1676                     warning ("empty body in an else-statement"); }
1677         | simple_if %prec IF
1678                 { expand_end_cond ();
1679                   /* This warning is here instead of in simple_if, because we
1680                      do not want a warning if an empty if is followed by an
1681                      else statement.  Increment stmt_count so we don't
1682                      give a second error if this is a nested `if'.  */
1683                   if (extra_warnings && stmt_count++ == $<itype>1)
1684                     warning_with_file_and_line (if_stmt_file, if_stmt_line,
1685                                                 "empty body in an if-statement"); }
1686 /* Make sure expand_end_cond is run once
1687    for each call to expand_start_cond.
1688    Otherwise a crash is likely.  */
1689         | simple_if ELSE error
1690                 { expand_end_cond (); }
1691         | WHILE
1692                 { stmt_count++;
1693                   emit_line_note ($<filename>-1, $<lineno>0);
1694                   /* The emit_nop used to come before emit_line_note,
1695                      but that made the nop seem like part of the preceding line.
1696                      And that was confusing when the preceding line was
1697                      inside of an if statement and was not really executed.
1698                      I think it ought to work to put the nop after the line number.
1699                      We will see.  --rms, July 15, 1991.  */
1700                   emit_nop (); }
1701           '(' expr ')'
1702                 { /* Don't start the loop till we have succeeded
1703                      in parsing the end test.  This is to make sure
1704                      that we end every loop we start.  */
1705                   expand_start_loop (1);
1706                   emit_line_note (input_filename, lineno);
1707                   expand_exit_loop_if_false (NULL_PTR,
1708                                              truthvalue_conversion ($4));
1709                   position_after_white_space (); }
1710           lineno_labeled_stmt
1711                 { expand_end_loop (); }
1712         | do_stmt_start
1713           '(' expr ')' ';'
1714                 { emit_line_note (input_filename, lineno);
1715                   expand_exit_loop_if_false (NULL_PTR,
1716                                              truthvalue_conversion ($3));
1717                   expand_end_loop ();
1718                   clear_momentary (); }
1719 /* This rule is needed to make sure we end every loop we start.  */
1720         | do_stmt_start error
1721                 { expand_end_loop ();
1722                   clear_momentary (); }
1723         | FOR
1724           '(' xexpr ';'
1725                 { stmt_count++;
1726                   emit_line_note ($<filename>-1, $<lineno>0);
1727                   /* See comment in `while' alternative, above.  */
1728                   emit_nop ();
1729                   if ($3) c_expand_expr_stmt ($3);
1730                   /* Next step is to call expand_start_loop_continue_elsewhere,
1731                      but wait till after we parse the entire for (...).
1732                      Otherwise, invalid input might cause us to call that
1733                      fn without calling expand_end_loop.  */
1734                 }
1735           xexpr ';'
1736                 /* Can't emit now; wait till after expand_start_loop...  */
1737                 { $<lineno>7 = lineno;
1738                   $<filename>$ = input_filename; }
1739           xexpr ')'
1740                 { 
1741                   /* Start the loop.  Doing this after parsing
1742                      all the expressions ensures we will end the loop.  */
1743                   expand_start_loop_continue_elsewhere (1);
1744                   /* Emit the end-test, with a line number.  */
1745                   emit_line_note ($<filename>8, $<lineno>7);
1746                   if ($6)
1747                     expand_exit_loop_if_false (NULL_PTR,
1748                                                truthvalue_conversion ($6));
1749                   /* Don't let the tree nodes for $9 be discarded by
1750                      clear_momentary during the parsing of the next stmt.  */
1751                   push_momentary ();
1752                   $<lineno>7 = lineno;
1753                   $<filename>8 = input_filename;
1754                   position_after_white_space (); }
1755           lineno_labeled_stmt
1756                 { /* Emit the increment expression, with a line number.  */
1757                   emit_line_note ($<filename>8, $<lineno>7);
1758                   expand_loop_continue_here ();
1759                   if ($9)
1760                     c_expand_expr_stmt ($9);
1761                   if (yychar == CONSTANT || yychar == STRING)
1762                     pop_momentary_nofree ();
1763                   else
1764                     pop_momentary ();
1765                   expand_end_loop (); }
1766         | SWITCH '(' expr ')'
1767                 { stmt_count++;
1768                   emit_line_note ($<filename>-1, $<lineno>0);
1769                   c_expand_start_case ($3);
1770                   /* Don't let the tree nodes for $3 be discarded by
1771                      clear_momentary during the parsing of the next stmt.  */
1772                   push_momentary ();
1773                   position_after_white_space (); }
1774           lineno_labeled_stmt
1775                 { expand_end_case ($3);
1776                   if (yychar == CONSTANT || yychar == STRING)
1777                     pop_momentary_nofree ();
1778                   else
1779                     pop_momentary (); }
1780         | BREAK ';'
1781                 { stmt_count++;
1782                   emit_line_note ($<filename>-1, $<lineno>0);
1783                   if ( ! expand_exit_something ())
1784                     error ("break statement not within loop or switch"); }
1785         | CONTINUE ';'
1786                 { stmt_count++;
1787                   emit_line_note ($<filename>-1, $<lineno>0);
1788                   if (! expand_continue_loop (NULL_PTR))
1789                     error ("continue statement not within a loop"); }
1790         | RETURN ';'
1791                 { stmt_count++;
1792                   emit_line_note ($<filename>-1, $<lineno>0);
1793                   c_expand_return (NULL_TREE); }
1794         | RETURN expr ';'
1795                 { stmt_count++;
1796                   emit_line_note ($<filename>-1, $<lineno>0);
1797                   c_expand_return ($2); }
1798         | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
1799                 { stmt_count++;
1800                   emit_line_note ($<filename>-1, $<lineno>0);
1801                   STRIP_NOPS ($4);
1802                   if ((TREE_CODE ($4) == ADDR_EXPR
1803                        && TREE_CODE (TREE_OPERAND ($4, 0)) == STRING_CST)
1804                       || TREE_CODE ($4) == STRING_CST)
1805                     expand_asm ($4);
1806                   else
1807                     error ("argument of `asm' is not a constant string"); }
1808         /* This is the case with just output operands.  */
1809         | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
1810                 { stmt_count++;
1811                   emit_line_note ($<filename>-1, $<lineno>0);
1812                   c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
1813                                          $2 == ridpointers[(int)RID_VOLATILE],
1814                                          input_filename, lineno); }
1815         /* This is the case with input operands as well.  */
1816         | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';'
1817                 { stmt_count++;
1818                   emit_line_note ($<filename>-1, $<lineno>0);
1819                   c_expand_asm_operands ($4, $6, $8, NULL_TREE,
1820                                          $2 == ridpointers[(int)RID_VOLATILE],
1821                                          input_filename, lineno); }
1822         /* This is the case with clobbered registers as well.  */
1823         | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
1824           asm_operands ':' asm_clobbers ')' ';'
1825                 { stmt_count++;
1826                   emit_line_note ($<filename>-1, $<lineno>0);
1827                   c_expand_asm_operands ($4, $6, $8, $10,
1828                                          $2 == ridpointers[(int)RID_VOLATILE],
1829                                          input_filename, lineno); }
1830         | GOTO identifier ';'
1831                 { tree decl;
1832                   stmt_count++;
1833                   emit_line_note ($<filename>-1, $<lineno>0);
1834                   decl = lookup_label ($2);
1835                   if (decl != 0)
1836                     {
1837                       TREE_USED (decl) = 1;
1838                       expand_goto (decl);
1839                     }
1840                 }
1841         | GOTO '*' expr ';'
1842                 { stmt_count++;
1843                   emit_line_note ($<filename>-1, $<lineno>0);
1844                   expand_computed_goto (convert (ptr_type_node, $3)); }
1845         | ';'
1846         ;
1848 all_iter_stmt:
1849           all_iter_stmt_simple
1850 /*      | all_iter_stmt_with_decl */
1851         ;
1853 all_iter_stmt_simple:
1854           FOR '(' primary ')' 
1855           {
1856             /* The value returned by this action is  */
1857             /*      1 if everything is OK */ 
1858             /*      0 in case of error or already bound iterator */
1860             $<itype>$ = 0;
1861             if (TREE_CODE ($3) != VAR_DECL)
1862               error ("invalid `for (ITERATOR)' syntax");
1863             else if (! ITERATOR_P ($3))
1864               error ("`%s' is not an iterator",
1865                      IDENTIFIER_POINTER (DECL_NAME ($3)));
1866             else if (ITERATOR_BOUND_P ($3))
1867               error ("`for (%s)' inside expansion of same iterator",
1868                      IDENTIFIER_POINTER (DECL_NAME ($3)));
1869             else
1870               {
1871                 $<itype>$ = 1;
1872                 iterator_for_loop_start ($3);
1873               }
1874           }
1875           lineno_labeled_stmt
1876           {
1877             if ($<itype>5)
1878               iterator_for_loop_end ($3);
1879           }
1881 /*  This really should allow any kind of declaration,
1882     for generality.  Fix it before turning it back on.
1884 all_iter_stmt_with_decl:
1885           FOR '(' ITERATOR pushlevel setspecs iterator_spec ')' 
1886           {
1887 */          /* The value returned by this action is  */
1888             /*      1 if everything is OK */ 
1889             /*      0 in case of error or already bound iterator */
1891             iterator_for_loop_start ($6);
1892           }
1893           lineno_labeled_stmt
1894           {
1895             iterator_for_loop_end ($6);
1896             emit_line_note (input_filename, lineno);
1897             expand_end_bindings (getdecls (), 1, 0);
1898             $<ttype>$ = poplevel (1, 1, 0);
1899             if (yychar == CONSTANT || yychar == STRING)
1900               pop_momentary_nofree ();
1901             else
1902               pop_momentary ();     
1903           }
1906 /* Any kind of label, including jump labels and case labels.
1907    ANSI C accepts labels only before statements, but we allow them
1908    also at the end of a compound statement.  */
1910 label:    CASE expr_no_commas ':'
1911                 { register tree value = check_case_value ($2);
1912                   register tree label
1913                     = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
1915                   stmt_count++;
1917                   if (value != error_mark_node)
1918                     {
1919                       tree duplicate;
1920                       int success = pushcase (value, convert_and_check,
1921                                               label, &duplicate);
1922                       if (success == 1)
1923                         error ("case label not within a switch statement");
1924                       else if (success == 2)
1925                         {
1926                           error ("duplicate case value");
1927                           error_with_decl (duplicate, "this is the first entry for that value");
1928                         }
1929                       else if (success == 3)
1930                         warning ("case value out of range");
1931                       else if (success == 5)
1932                         error ("case label within scope of cleanup or variable array");
1933                     }
1934                   position_after_white_space (); }
1935         | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
1936                 { register tree value1 = check_case_value ($2);
1937                   register tree value2 = check_case_value ($4);
1938                   register tree label
1939                     = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
1941                   stmt_count++;
1943                   if (value1 != error_mark_node && value2 != error_mark_node)
1944                     {
1945                       tree duplicate;
1946                       int success = pushcase_range (value1, value2,
1947                                                     convert_and_check, label,
1948                                                     &duplicate);
1949                       if (success == 1)
1950                         error ("case label not within a switch statement");
1951                       else if (success == 2)
1952                         {
1953                           error ("duplicate case value");
1954                           error_with_decl (duplicate, "this is the first entry for that value");
1955                         }
1956                       else if (success == 3)
1957                         warning ("case value out of range");
1958                       else if (success == 4)
1959                         warning ("empty case range");
1960                       else if (success == 5)
1961                         error ("case label within scope of cleanup or variable array");
1962                     }
1963                   position_after_white_space (); }
1964         | DEFAULT ':'
1965                 {
1966                   tree duplicate;
1967                   register tree label
1968                     = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
1969                   int success = pushcase (NULL_TREE, 0, label, &duplicate);
1970                   stmt_count++;
1971                   if (success == 1)
1972                     error ("default label not within a switch statement");
1973                   else if (success == 2)
1974                     {
1975                       error ("multiple default labels in one switch");
1976                       error_with_decl (duplicate, "this is the first default label");
1977                     }
1978                   position_after_white_space (); }
1979         | identifier ':'
1980                 { tree label = define_label (input_filename, lineno, $1);
1981                   stmt_count++;
1982                   emit_nop ();
1983                   if (label)
1984                     expand_label (label);
1985                   position_after_white_space (); }
1986         ;
1988 /* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
1990 maybe_type_qual:
1991         /* empty */
1992                 { emit_line_note (input_filename, lineno);
1993                   $$ = NULL_TREE; }
1994         | TYPE_QUAL
1995                 { emit_line_note (input_filename, lineno); }
1996         ;
1998 xexpr:
1999         /* empty */
2000                 { $$ = NULL_TREE; }
2001         | expr
2002         ;
2004 /* These are the operands other than the first string and colon
2005    in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
2006 asm_operands: /* empty */
2007                 { $$ = NULL_TREE; }
2008         | nonnull_asm_operands
2009         ;
2011 nonnull_asm_operands:
2012           asm_operand
2013         | nonnull_asm_operands ',' asm_operand
2014                 { $$ = chainon ($1, $3); }
2015         ;
2017 asm_operand:
2018           STRING '(' expr ')'
2019                 { $$ = build_tree_list ($1, $3); }
2020         ;
2022 asm_clobbers:
2023           string
2024                 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); }
2025         | asm_clobbers ',' string
2026                 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
2027         ;
2029 /* This is what appears inside the parens in a function declarator.
2030    Its value is a list of ..._TYPE nodes.  */
2031 parmlist:
2032                 { pushlevel (0);
2033                   clear_parm_order ();
2034                   declare_parm_level (0); }
2035           parmlist_1
2036                 { $$ = $2;
2037                   parmlist_tags_warning ();
2038                   poplevel (0, 0, 0); }
2039         ;
2041 parmlist_1:
2042           parmlist_2 ')'
2043         | parms ';'
2044                 { tree parm;
2045                   if (pedantic)
2046                     pedwarn ("ANSI C forbids forward parameter declarations");
2047                   /* Mark the forward decls as such.  */
2048                   for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
2049                     TREE_ASM_WRITTEN (parm) = 1;
2050                   clear_parm_order (); }
2051           parmlist_1
2052                 { $$ = $4; }
2053         | error ')'
2054                 { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
2055         ;
2057 /* This is what appears inside the parens in a function declarator.
2058    Is value is represented in the format that grokdeclarator expects.  */
2059 parmlist_2:  /* empty */
2060                 { $$ = get_parm_info (0); }
2061         | ELLIPSIS
2062                 { $$ = get_parm_info (0);
2063                   /* Gcc used to allow this as an extension.  However, it does
2064                      not work for all targets, and thus has been disabled.
2065                      Also, since func (...) and func () are indistinguishable,
2066                      it caused problems with the code in expand_builtin which
2067                      tries to verify that BUILT_IN_NEXT_ARG is being used
2068                      correctly.  */
2069                   error ("ANSI C requires a named argument before `...'");
2070                 }
2071         | parms
2072                 { $$ = get_parm_info (1); }
2073         | parms ',' ELLIPSIS
2074                 { $$ = get_parm_info (0); }
2075         ;
2077 parms:
2078         parm
2079                 { push_parm_decl ($1); }
2080         | parms ',' parm
2081                 { push_parm_decl ($3); }
2082         ;
2084 /* A single parameter declaration or parameter type name,
2085    as found in a parmlist.  */
2086 parm:
2087           typed_declspecs parm_declarator
2088                 { $$ = build_tree_list ($1, $2) ; }
2089         | typed_declspecs notype_declarator
2090                 { $$ = build_tree_list ($1, $2) ; }
2091         | typed_declspecs absdcl
2092                 { $$ = build_tree_list ($1, $2); }
2093         | declmods notype_declarator
2094                 { $$ = build_tree_list ($1, $2) ; }
2095         | declmods absdcl
2096                 { $$ = build_tree_list ($1, $2); }
2097         ;
2099 /* This is used in a function definition
2100    where either a parmlist or an identifier list is ok.
2101    Its value is a list of ..._TYPE nodes or a list of identifiers.  */
2102 parmlist_or_identifiers:
2103                 { pushlevel (0);
2104                   clear_parm_order ();
2105                   declare_parm_level (1); }
2106           parmlist_or_identifiers_1
2107                 { $$ = $2;
2108                   parmlist_tags_warning ();
2109                   poplevel (0, 0, 0); }
2110         ;
2112 parmlist_or_identifiers_1:
2113           parmlist_1
2114         | identifiers ')'
2115                 { tree t;
2116                   for (t = $1; t; t = TREE_CHAIN (t))
2117                     if (TREE_VALUE (t) == NULL_TREE)
2118                       error ("`...' in old-style identifier list");
2119                   $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }
2120         ;
2122 /* A nonempty list of identifiers.  */
2123 identifiers:
2124         IDENTIFIER
2125                 { $$ = build_tree_list (NULL_TREE, $1); }
2126         | identifiers ',' IDENTIFIER
2127                 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2128         ;
2130 /* A nonempty list of identifiers, including typenames.  */
2131 identifiers_or_typenames:
2132         identifier
2133                 { $$ = build_tree_list (NULL_TREE, $1); }
2134         | identifiers_or_typenames ',' identifier
2135                 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2136         ;
2138 ifobjc
2139 /* Objective-C productions.  */
2141 objcdef:
2142           classdef
2143         | classdecl
2144         | aliasdecl
2145         | protocoldef
2146         | methoddef
2147         | END
2148                 {
2149                   if (objc_implementation_context)
2150                     {
2151                       finish_class (objc_implementation_context);
2152                       objc_ivar_chain = NULL_TREE;
2153                       objc_implementation_context = NULL_TREE;
2154                     }
2155                   else
2156                     warning ("`@end' must appear in an implementation context");
2157                 }
2158         ;
2160 /* A nonempty list of identifiers.  */
2161 identifier_list:
2162         identifier
2163                 { $$ = build_tree_list (NULL_TREE, $1); }
2164         | identifier_list ',' identifier
2165                 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2166         ;
2168 classdecl:
2169           CLASS identifier_list ';'
2170                 {
2171                   objc_declare_class ($2);
2172                 }
2174 aliasdecl:
2175           ALIAS identifier identifier ';'
2176                 {
2177                   objc_declare_alias ($2, $3);
2178                 }
2180 classdef:
2181           INTERFACE identifier protocolrefs '{'
2182                 {
2183                   objc_interface_context = objc_ivar_context
2184                     = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2185                   objc_public_flag = 0;
2186                 }
2187           ivar_decl_list '}'
2188                 {
2189                   continue_class (objc_interface_context);
2190                 }
2191           methodprotolist
2192           END
2193                 {
2194                   finish_class (objc_interface_context);
2195                   objc_interface_context = NULL_TREE;
2196                 }
2198         | INTERFACE identifier protocolrefs
2199                 {
2200                   objc_interface_context
2201                     = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
2202                   continue_class (objc_interface_context);
2203                 }
2204           methodprotolist
2205           END
2206                 {
2207                   finish_class (objc_interface_context);
2208                   objc_interface_context = NULL_TREE;
2209                 }
2211         | INTERFACE identifier ':' identifier protocolrefs '{'
2212                 {
2213                   objc_interface_context = objc_ivar_context
2214                     = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2215                   objc_public_flag = 0;
2216                 }
2217           ivar_decl_list '}'
2218                 {
2219                   continue_class (objc_interface_context);
2220                 }
2221           methodprotolist
2222           END
2223                 {
2224                   finish_class (objc_interface_context);
2225                   objc_interface_context = NULL_TREE;
2226                 }
2228         | INTERFACE identifier ':' identifier protocolrefs
2229                 {
2230                   objc_interface_context
2231                     = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
2232                   continue_class (objc_interface_context);
2233                 }
2234           methodprotolist
2235           END
2236                 {
2237                   finish_class (objc_interface_context);
2238                   objc_interface_context = NULL_TREE;
2239                 }
2241         | IMPLEMENTATION identifier '{'
2242                 {
2243                   objc_implementation_context = objc_ivar_context
2244                     = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2245                   objc_public_flag = 0;
2246                 }
2247           ivar_decl_list '}'
2248                 {
2249                   objc_ivar_chain
2250                     = continue_class (objc_implementation_context);
2251                 }
2253         | IMPLEMENTATION identifier
2254                 {
2255                   objc_implementation_context
2256                     = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
2257                   objc_ivar_chain
2258                     = continue_class (objc_implementation_context);
2259                 }
2261         | IMPLEMENTATION identifier ':' identifier '{'
2262                 {
2263                   objc_implementation_context = objc_ivar_context
2264                     = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2265                   objc_public_flag = 0;
2266                 }
2267           ivar_decl_list '}'
2268                 {
2269                   objc_ivar_chain
2270                     = continue_class (objc_implementation_context);
2271                 }
2273         | IMPLEMENTATION identifier ':' identifier
2274                 {
2275                   objc_implementation_context
2276                     = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2277                   objc_ivar_chain
2278                     = continue_class (objc_implementation_context);
2279                 }
2281         | INTERFACE identifier '(' identifier ')' protocolrefs
2282                 {
2283                   objc_interface_context
2284                     = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6);
2285                   continue_class (objc_interface_context);
2286                 }
2287           methodprotolist
2288           END
2289                 {
2290                   finish_class (objc_interface_context);
2291                   objc_interface_context = NULL_TREE;
2292                 }
2294         | IMPLEMENTATION identifier '(' identifier ')'
2295                 {
2296                   objc_implementation_context
2297                     = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
2298                   objc_ivar_chain
2299                     = continue_class (objc_implementation_context);
2300                 }
2301         ;
2303 protocoldef:
2304           PROTOCOL identifier protocolrefs
2305                 {
2306                   remember_protocol_qualifiers ();
2307                   objc_interface_context
2308                     = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
2309                 }
2310           methodprotolist END
2311                 {
2312                   forget_protocol_qualifiers();
2313                   finish_protocol(objc_interface_context);
2314                   objc_interface_context = NULL_TREE;
2315                 }
2316         ;
2318 protocolrefs:
2319           /* empty */
2320                 {
2321                   $$ = NULL_TREE;
2322                 }
2323         | ARITHCOMPARE identifier_list ARITHCOMPARE
2324                 {
2325                   if ($1 == LT_EXPR && $3 == GT_EXPR)
2326                     $$ = $2;
2327                   else
2328                     YYERROR1;
2329                 }
2330         ;
2332 ivar_decl_list:
2333           ivar_decl_list visibility_spec ivar_decls
2334         | ivar_decls
2335         ;
2337 visibility_spec:
2338           PRIVATE { objc_public_flag = 2; }
2339         | PROTECTED { objc_public_flag = 0; }
2340         | PUBLIC { objc_public_flag = 1; }
2341         ;
2343 ivar_decls:
2344           /* empty */
2345                 {
2346                   $$ = NULL_TREE;
2347                 }
2348         | ivar_decls ivar_decl ';'
2349         | ivar_decls ';'
2350                 {
2351                   if (pedantic)
2352                     pedwarn ("extra semicolon in struct or union specified");
2353                 }
2354         ;
2357 /* There is a shift-reduce conflict here, because `components' may
2358    start with a `typename'.  It happens that shifting (the default resolution)
2359    does the right thing, because it treats the `typename' as part of
2360    a `typed_typespecs'.
2362    It is possible that this same technique would allow the distinction
2363    between `notype_initdecls' and `initdecls' to be eliminated.
2364    But I am being cautious and not trying it.  */
2366 ivar_decl:
2367         typed_typespecs setspecs ivars
2368                 {
2369                   $$ = $3;
2370                   resume_momentary ($2);
2371                 }
2372         | nonempty_type_quals setspecs ivars
2373                 {
2374                   $$ = $3;
2375                   resume_momentary ($2);
2376                 }
2377         | error
2378                 { $$ = NULL_TREE; }
2379         ;
2381 ivars:
2382           /* empty */
2383                 { $$ = NULL_TREE; }
2384         | ivar_declarator
2385         | ivars ',' ivar_declarator
2386         ;
2388 ivar_declarator:
2389           declarator
2390                 {
2391                   $$ = add_instance_variable (objc_ivar_context,
2392                                               objc_public_flag,
2393                                               $1, current_declspecs,
2394                                               NULL_TREE);
2395                 }
2396         | declarator ':' expr_no_commas
2397                 {
2398                   $$ = add_instance_variable (objc_ivar_context,
2399                                               objc_public_flag,
2400                                               $1, current_declspecs, $3);
2401                 }
2402         | ':' expr_no_commas
2403                 {
2404                   $$ = add_instance_variable (objc_ivar_context,
2405                                               objc_public_flag,
2406                                               NULL_TREE,
2407                                               current_declspecs, $2);
2408                 }
2409         ;
2411 methoddef:
2412           '+'
2413                 {
2414                   remember_protocol_qualifiers ();
2415                   if (objc_implementation_context)
2416                     objc_inherit_code = CLASS_METHOD_DECL;
2417                   else
2418                     fatal ("method definition not in class context");
2419                 }
2420           methoddecl
2421                 {
2422                   forget_protocol_qualifiers ();
2423                   add_class_method (objc_implementation_context, $3);
2424                   start_method_def ($3);
2425                   objc_method_context = $3;
2426                 }
2427           optarglist
2428                 {
2429                   continue_method_def ();
2430                 }
2431           compstmt_or_error
2432                 {
2433                   finish_method_def ();
2434                   objc_method_context = NULL_TREE;
2435                 }
2437         | '-'
2438                 {
2439                   remember_protocol_qualifiers ();
2440                   if (objc_implementation_context)
2441                     objc_inherit_code = INSTANCE_METHOD_DECL;
2442                   else
2443                     fatal ("method definition not in class context");
2444                 }
2445           methoddecl
2446                 {
2447                   forget_protocol_qualifiers ();
2448                   add_instance_method (objc_implementation_context, $3);
2449                   start_method_def ($3);
2450                   objc_method_context = $3;
2451                 }
2452           optarglist
2453                 {
2454                   continue_method_def ();
2455                 }
2456           compstmt_or_error
2457                 {
2458                   finish_method_def ();
2459                   objc_method_context = NULL_TREE;
2460                 }
2461         ;
2463 /* the reason for the strange actions in this rule
2464  is so that notype_initdecls when reached via datadef
2465  can find a valid list of type and sc specs in $0. */
2467 methodprotolist:
2468           /* empty  */
2469         | {$<ttype>$ = NULL_TREE; } methodprotolist2
2470         ;
2472 methodprotolist2:                /* eliminates a shift/reduce conflict */
2473            methodproto
2474         |  datadef
2475         | methodprotolist2 methodproto
2476         | methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef
2477         ;
2479 semi_or_error:
2480           ';'
2481         | error
2482         ;
2484 methodproto:
2485           '+'
2486                 {
2487                   objc_inherit_code = CLASS_METHOD_DECL;
2488                 }
2489           methoddecl
2490                 {
2491                   add_class_method (objc_interface_context, $3);
2492                 }
2493           semi_or_error
2495         | '-'
2496                 {
2497                   objc_inherit_code = INSTANCE_METHOD_DECL;
2498                 }
2499           methoddecl
2500                 {
2501                   add_instance_method (objc_interface_context, $3);
2502                 }
2503           semi_or_error
2504         ;
2506 methoddecl:
2507           '(' typename ')' unaryselector
2508                 {
2509                   $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);
2510                 }
2512         | unaryselector
2513                 {
2514                   $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);
2515                 }
2517         | '(' typename ')' keywordselector optparmlist
2518                 {
2519                   $$ = build_method_decl (objc_inherit_code, $2, $4, $5);
2520                 }
2522         | keywordselector optparmlist
2523                 {
2524                   $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);
2525                 }
2526         ;
2528 /* "optarglist" assumes that start_method_def has already been called...
2529    if it is not, the "xdecls" will not be placed in the proper scope */
2531 optarglist:
2532           /* empty */
2533         | ';' myxdecls
2534         ;
2536 /* to get around the following situation: "int foo (int a) int b; {}" that
2537    is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */
2539 myxdecls:
2540           /* empty */
2541         | mydecls
2542         ;
2544 mydecls:
2545         mydecl
2546         | errstmt
2547         | mydecls mydecl
2548         | mydecl errstmt
2549         ;
2551 mydecl:
2552         typed_declspecs setspecs myparms ';'
2553                 { resume_momentary ($2); }
2554         | typed_declspecs ';'
2555                 { shadow_tag ($1); }
2556         | declmods ';'
2557                 { pedwarn ("empty declaration"); }
2558         ;
2560 myparms:
2561         myparm
2562                 { push_parm_decl ($1); }
2563         | myparms ',' myparm
2564                 { push_parm_decl ($3); }
2565         ;
2567 /* A single parameter declaration or parameter type name,
2568    as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
2570 myparm:
2571           parm_declarator
2572                 { $$ = build_tree_list (current_declspecs, $1)  ; }
2573         | notype_declarator
2574                 { $$ = build_tree_list (current_declspecs, $1)  ; }
2575         | absdcl
2576                 { $$ = build_tree_list (current_declspecs, $1)  ; }
2577         ;
2579 optparmlist:
2580           /* empty */
2581                 {
2582                   $$ = NULL_TREE;
2583                 }
2584         | ',' ELLIPSIS
2585                 {
2586                   /* oh what a kludge! */
2587                   $$ = (tree)1;
2588                 }
2589         | ','
2590                 {
2591                   pushlevel (0);
2592                 }
2593           parmlist_2
2594                 {
2595                   /* returns a tree list node generated by get_parm_info */
2596                   $$ = $3;
2597                   poplevel (0, 0, 0);
2598                 }
2599         ;
2601 unaryselector:
2602           selector
2603         ;
2605 keywordselector:
2606           keyworddecl
2608         | keywordselector keyworddecl
2609                 {
2610                   $$ = chainon ($1, $2);
2611                 }
2612         ;
2614 selector:
2615           IDENTIFIER
2616         | TYPENAME
2617         | OBJECTNAME
2618         | reservedwords
2619         ;
2621 reservedwords:
2622           ENUM { $$ = get_identifier (token_buffer); }
2623         | STRUCT { $$ = get_identifier (token_buffer); }
2624         | UNION { $$ = get_identifier (token_buffer); }
2625         | IF { $$ = get_identifier (token_buffer); }
2626         | ELSE { $$ = get_identifier (token_buffer); }
2627         | WHILE { $$ = get_identifier (token_buffer); }
2628         | DO { $$ = get_identifier (token_buffer); }
2629         | FOR { $$ = get_identifier (token_buffer); }
2630         | SWITCH { $$ = get_identifier (token_buffer); }
2631         | CASE { $$ = get_identifier (token_buffer); }
2632         | DEFAULT { $$ = get_identifier (token_buffer); }
2633         | BREAK { $$ = get_identifier (token_buffer); }
2634         | CONTINUE { $$ = get_identifier (token_buffer); }
2635         | RETURN  { $$ = get_identifier (token_buffer); }
2636         | GOTO { $$ = get_identifier (token_buffer); }
2637         | ASM_KEYWORD { $$ = get_identifier (token_buffer); }
2638         | SIZEOF { $$ = get_identifier (token_buffer); }
2639         | TYPEOF { $$ = get_identifier (token_buffer); }
2640         | ALIGNOF { $$ = get_identifier (token_buffer); }
2641         | TYPESPEC | TYPE_QUAL
2642         ;
2644 keyworddecl:
2645           selector ':' '(' typename ')' identifier
2646                 {
2647                   $$ = build_keyword_decl ($1, $4, $6);
2648                 }
2650         | selector ':' identifier
2651                 {
2652                   $$ = build_keyword_decl ($1, NULL_TREE, $3);
2653                 }
2655         | ':' '(' typename ')' identifier
2656                 {
2657                   $$ = build_keyword_decl (NULL_TREE, $3, $5);
2658                 }
2660         | ':' identifier
2661                 {
2662                   $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
2663                 }
2664         ;
2666 messageargs:
2667           selector
2668         | keywordarglist
2669         ;
2671 keywordarglist:
2672           keywordarg
2673         | keywordarglist keywordarg
2674                 {
2675                   $$ = chainon ($1, $2);
2676                 }
2677         ;
2680 keywordexpr:
2681           nonnull_exprlist
2682                 {
2683                   if (TREE_CHAIN ($1) == NULL_TREE)
2684                     /* just return the expr., remove a level of indirection */
2685                     $$ = TREE_VALUE ($1);
2686                   else
2687                     /* we have a comma expr., we will collapse later */
2688                     $$ = $1;
2689                 }
2690         ;
2692 keywordarg:
2693           selector ':' keywordexpr
2694                 {
2695                   $$ = build_tree_list ($1, $3);
2696                 }
2697         | ':' keywordexpr
2698                 {
2699                   $$ = build_tree_list (NULL_TREE, $2);
2700                 }
2701         ;
2703 receiver:
2704           expr
2705         | CLASSNAME
2706                 {
2707                   $$ = get_class_reference ($1);
2708                 }
2709         ;
2711 objcmessageexpr:
2712           '['
2713                 { objc_receiver_context = 1; }
2714           receiver
2715                 { objc_receiver_context = 0; }
2716           messageargs ']'
2717                 {
2718                   $$ = build_tree_list ($3, $5);
2719                 }
2720         ;
2722 selectorarg:
2723           selector
2724         | keywordnamelist
2725         ;
2727 keywordnamelist:
2728           keywordname
2729         | keywordnamelist keywordname
2730                 {
2731                   $$ = chainon ($1, $2);
2732                 }
2733         ;
2735 keywordname:
2736           selector ':'
2737                 {
2738                   $$ = build_tree_list ($1, NULL_TREE);
2739                 }
2740         | ':'
2741                 {
2742                   $$ = build_tree_list (NULL_TREE, NULL_TREE);
2743                 }
2744         ;
2746 objcselectorexpr:
2747           SELECTOR '(' selectorarg ')'
2748                 {
2749                   $$ = $3;
2750                 }
2751         ;
2753 objcprotocolexpr:
2754           PROTOCOL '(' identifier ')'
2755                 {
2756                   $$ = $3;
2757                 }
2758         ;
2760 /* extension to support C-structures in the archiver */
2762 objcencodeexpr:
2763           ENCODE '(' typename ')'
2764                 {
2765                   $$ = groktypename ($3);
2766                 }
2767         ;
2769 end ifobjc