diff options
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r-- | gcc/c-parse.in | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 86880ac6153..94df4bbc3b0 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1321,16 +1321,23 @@ initdcl: declarator maybeasm maybe_attribute '=' { $<ttype>$ = start_decl ($1, current_declspecs, true, chainon ($3, all_prefix_attributes)); + if (!$<ttype>$) + $<ttype>$ = error_mark_node; start_init ($<ttype>$, $2, global_bindings_p ()); } init /* Note how the declaration of the variable is in effect while its init is parsed! */ { finish_init (); - maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); - finish_decl ($<ttype>5, $6.value, $2); } + if ($<ttype>5 != error_mark_node) + { + maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); + finish_decl ($<ttype>5, $6.value, $2); + } + } | declarator maybeasm maybe_attribute { tree d = start_decl ($1, current_declspecs, false, chainon ($3, all_prefix_attributes)); - finish_decl (d, NULL_TREE, $2); + if (d) + finish_decl (d, NULL_TREE, $2); } ; @@ -1338,16 +1345,23 @@ notype_initdcl: notype_declarator maybeasm maybe_attribute '=' { $<ttype>$ = start_decl ($1, current_declspecs, true, chainon ($3, all_prefix_attributes)); + if (!$<ttype>$) + $<ttype>$ = error_mark_node; start_init ($<ttype>$, $2, global_bindings_p ()); } init /* Note how the declaration of the variable is in effect while its init is parsed! */ { finish_init (); - maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); - finish_decl ($<ttype>5, $6.value, $2); } + if ($<ttype>5 != error_mark_node) + { + maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); + finish_decl ($<ttype>5, $6.value, $2); + } + } | notype_declarator maybeasm maybe_attribute { tree d = start_decl ($1, current_declspecs, false, chainon ($3, all_prefix_attributes)); - finish_decl (d, NULL_TREE, $2); } + if (d) + finish_decl (d, NULL_TREE, $2); } ; /* the * rules are dummies to accept the Apollo extended syntax so that the header files compile. */ |