OSDN Git Service

* attribs.c (strip_attrs): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / c-parse.in
index 2269bef..f8acb23 100644 (file)
@@ -127,6 +127,10 @@ do {                                                                       \
    yylval contains an IDENTIFIER_NODE which indicates which one.  */
 %token TYPE_QUAL
 
+/* Objective-C protocol qualifiers.  These acquire their magic powers
+   only in certain contexts.  */
+%token OBJC_TYPE_QUAL
+
 /* Character or numeric constants.
    yylval is the node for the constant.  */
 %token CONSTANT
@@ -271,6 +275,9 @@ static GTY(()) tree all_prefix_attributes;
    all_prefix_attributes.  */
 static GTY(()) tree declspec_stack;
 
+/* INDIRECT_REF with a TREE_TYPE of the type being queried for offsetof.  */
+static tree offsetof_base;
+
 /* PUSH_DECLSPEC_STACK is called from setspecs; POP_DECLSPEC_STACK
    should be called from the productions making use of setspecs.  */
 #define PUSH_DECLSPEC_STACK                                             \
@@ -677,8 +684,15 @@ primary:
                { $$.value = build_va_arg ($3.value, groktypename ($5));
                  $$.original_code = ERROR_MARK; }
 
-       | OFFSETOF '(' typename ',' offsetof_member_designator ')'
-               { $$.value = build_offsetof (groktypename ($3), $5);
+       | OFFSETOF '(' typename ','
+               { tree type = groktypename ($3);
+                 if (type == error_mark_node)
+                   offsetof_base = error_mark_node;
+                 else
+                   offsetof_base = build1 (INDIRECT_REF, type, NULL);
+               }
+         offsetof_member_designator ')'
+               { $$.value = fold_offsetof ($6);
                  $$.original_code = ERROR_MARK; }
        | OFFSETOF '(' error ')'
                { $$.value = error_mark_node; $$.original_code = ERROR_MARK; }
@@ -704,8 +718,8 @@ primary:
                  e2 = TYPE_MAIN_VARIANT (groktypename ($5));
 
                  $$.value = comptypes (e1, e2)
-                   ? build_int_cst (NULL_TREE, 1, 0)
-                   : build_int_cst (NULL_TREE, 0, 0);
+                   ? build_int_cst (NULL_TREE, 1)
+                   : build_int_cst (NULL_TREE, 0);
                  $$.original_code = ERROR_MARK;
                }
        | TYPES_COMPATIBLE_P '(' error ')'
@@ -749,17 +763,15 @@ primary:
 
 /* This is the second argument to __builtin_offsetof.  We must have one
    identifier, and beyond that we want to accept sub structure and sub
-   array references.  We return tree list where each element has
-   PURPOSE set for component refs or VALUE set for array refs.  We'll
-   turn this into something real inside build_offsetof.  */
+   array references.  */
 
 offsetof_member_designator:
          identifier
-               { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
+               { $$ = build_component_ref (offsetof_base, $1); }
        | offsetof_member_designator '.' identifier
-               { $$ = tree_cons ($3, NULL_TREE, $1); }
+               { $$ = build_component_ref ($1, $3); }
        | offsetof_member_designator '[' expr ']'
-               { $$ = tree_cons (NULL_TREE, $3.value, $1); }
+               { $$ = build_array_ref ($1, $3.value); }
        ;
 
 old_style_parm_decls:
@@ -2590,16 +2602,10 @@ parmlist_or_identifiers_1:
          parmlist_1
        | identifiers ')'
                { tree t;
-                 for (t = $1; t; t = TREE_CHAIN (t))
-                   if (TREE_VALUE (t) == NULL_TREE)
-                     error ("`...' in old-style identifier list");
                  $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
 
                  /* Make sure we have a parmlist after attributes.  */
-                 if ($<ttype>-1 != 0
-                     && (TREE_CODE ($$) != TREE_LIST
-                         || TREE_PURPOSE ($$) == 0
-                         || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
+                 if ($<ttype>-1 != 0)
                    YYERROR1;
                }
        ;