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.in30
1 files changed, 20 insertions, 10 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 176041bf0c8..2fc4359bf10 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -395,7 +395,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 +409,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 +423,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 +534,10 @@ alignof:
ALIGNOF { skip_evaluation++; }
;
+typeof:
+ TYPEOF { skip_evaluation++; }
+ ;
+
cast_expr:
unary_expr
| '(' typename ')' cast_expr %prec UNARY
@@ -1376,10 +1380,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 +1527,7 @@ initelt:
if (pedantic)
pedwarn ("obsolete use of designated initializer with `:'"); }
initval
+ {}
| initval
;
@@ -1582,7 +1587,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 +1617,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 +2072,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 +2143,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 +2176,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 +2701,14 @@ classdecl:
{
objc_declare_class ($2);
}
+ ;
aliasdecl:
ALIAS identifier identifier ';'
{
objc_declare_alias ($2, $3);
}
+ ;
classdef:
INTERFACE identifier protocolrefs '{'