aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in33
1 files changed, 20 insertions, 13 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 176041bf0c8..0b4bde33263 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -28,9 +28,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* To whomever it may concern: I have heard that such a thing was once
written by AT&T, but I have never seen it. */
-ifobjc
-%expect 31 /* shift/reduce conflicts, and 1 reduce/reduce conflict. */
-end ifobjc
ifc
%expect 10 /* shift/reduce conflicts, and no reduce/reduce conflicts. */
end ifc
@@ -395,7 +392,7 @@ fndef:
save_filename save_lineno compstmt_or_error
{ DECL_SOURCE_FILE (current_function_decl) = $7;
DECL_SOURCE_LINE (current_function_decl) = $8;
- finish_function (0);
+ finish_function (0, 1);
POP_DECLSPEC_STACK; }
| declspecs_ts setspecs declarator error
{ POP_DECLSPEC_STACK; }
@@ -409,7 +406,7 @@ fndef:
save_filename save_lineno compstmt_or_error
{ DECL_SOURCE_FILE (current_function_decl) = $7;
DECL_SOURCE_LINE (current_function_decl) = $8;
- finish_function (0);
+ finish_function (0, 1);
POP_DECLSPEC_STACK; }
| declspecs_nots setspecs notype_declarator error
{ POP_DECLSPEC_STACK; }
@@ -423,7 +420,7 @@ fndef:
save_filename save_lineno compstmt_or_error
{ DECL_SOURCE_FILE (current_function_decl) = $6;
DECL_SOURCE_LINE (current_function_decl) = $7;
- finish_function (0);
+ finish_function (0, 1);
POP_DECLSPEC_STACK; }
| setspecs notype_declarator error
{ POP_DECLSPEC_STACK; }
@@ -534,6 +531,10 @@ alignof:
ALIGNOF { skip_evaluation++; }
;
+typeof:
+ TYPEOF { skip_evaluation++; }
+ ;
+
cast_expr:
unary_expr
| '(' typename ')' cast_expr %prec UNARY
@@ -1376,10 +1377,10 @@ ifobjc
| non_empty_protocolrefs
{ $$ = get_object_reference ($1); }
end ifobjc
- | TYPEOF '(' expr ')'
- { $$ = TREE_TYPE ($3); }
- | TYPEOF '(' typename ')'
- { $$ = groktypename ($3); }
+ | typeof '(' expr ')'
+ { skip_evaluation--; $$ = TREE_TYPE ($3); }
+ | typeof '(' typename ')'
+ { skip_evaluation--; $$ = groktypename ($3); }
;
/* typespec_nonreserved_attr does not exist. */
@@ -1523,6 +1524,7 @@ initelt:
if (pedantic)
pedwarn ("obsolete use of designated initializer with `:'"); }
initval
+ {}
| initval
;
@@ -1582,7 +1584,7 @@ nested_function:
{ tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $5;
DECL_SOURCE_LINE (decl) = $6;
- finish_function (1);
+ finish_function (1, 1);
pop_function_context ();
add_decl_stmt (decl); }
;
@@ -1612,7 +1614,7 @@ notype_nested_function:
{ tree decl = current_function_decl;
DECL_SOURCE_FILE (decl) = $5;
DECL_SOURCE_LINE (decl) = $6;
- finish_function (1);
+ finish_function (1, 1);
pop_function_context ();
add_decl_stmt (decl); }
;
@@ -2067,6 +2069,7 @@ end ifobjc
poplevel: /* empty */
{ $$ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); }
+ ;
/* Start and end blocks created for the new scopes of C99. */
c99_block_start: /* empty */
@@ -2137,7 +2140,8 @@ compstmt_or_error:
;
compstmt_start: '{' { compstmt_count++;
- $$ = c_begin_compound_stmt (); }
+ $$ = c_begin_compound_stmt (); }
+ ;
compstmt_nostart: '}'
{ $$ = convert (void_type_node, integer_zero_node); }
@@ -2169,6 +2173,7 @@ compstmt_primary_start:
compstmt_count++;
$$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree));
}
+ ;
compstmt: compstmt_start compstmt_nostart
{ RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
@@ -2693,12 +2698,14 @@ classdecl:
{
objc_declare_class ($2);
}
+ ;
aliasdecl:
ALIAS identifier identifier ';'
{
objc_declare_alias ($2, $3);
}
+ ;
classdef:
INTERFACE identifier protocolrefs '{'