summaryrefslogtreecommitdiff
path: root/gcc/cp/parse.y
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-01-24 03:27:30 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-01-24 03:27:30 +0000
commit7437519c9e25ae3666dd2d11dbb010516ee65d6c (patch)
tree494a4e57911fee8c577218fbf4f5afaff7e5c29e /gcc/cp/parse.y
parent709619d9162fade06265038534bb20276d770708 (diff)
downloadgcc-7437519c9e25ae3666dd2d11dbb010516ee65d6c.tar.gz
Make-lang.in (parse.c): Adjust expected number of shift-reduce conflicts.
* Make-lang.in (parse.c): Adjust expected number of shift-reduce conflicts. (decl.o): Depend on diagnostic.h. * decl.c: Include diagnostic.h. (grokdeclarator): Check for null pointer. (finish_function): Don't abort when current_binding_level->parm_flag != 1, if errors have occurred; throw away the statement tree and extra binding levels, and continue. * lex.c (note_list_got_semicolon): Check for null pointer. * method.c (hack_identifier): Just return error_mark_node if value is error_mark_node. * parse.y (primary: TYPEID(type_id)): No need to use TYPE_MAIN_VARIANT here. (handler_seq): Accept an empty list of catch clauses and generate a fake handler block to avoid later crashes. (ansi_raise_identifier): Accept the error token too. * semantics.c (begin_class_definition, finish_class_definition): Check for error_mark_node. From-SVN: r49163
Diffstat (limited to 'gcc/cp/parse.y')
-rw-r--r--gcc/cp/parse.y13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index f6dba7ec4ce..83a1cd020aa 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -1650,7 +1650,7 @@ primary:
| TYPEID '(' type_id ')'
{ tree type = groktypename ($3.t);
check_for_new_type ("typeid", $3);
- $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
+ $$ = get_typeid (type); }
| global_scope IDENTIFIER
{ $$ = do_scoped_id ($2, 1); }
| global_scope template_id
@@ -3505,6 +3505,15 @@ try_block:
handler_seq:
handler
| handler_seq handler
+ | /* empty */
+ { /* Generate a fake handler block to avoid later aborts. */
+ tree fake_handler = begin_handler ();
+ finish_handler_parms (NULL_TREE, fake_handler);
+ finish_handler (fake_handler);
+ $<ttype>$ = fake_handler;
+
+ error ("must have at least one catch per try block");
+ }
;
handler:
@@ -3809,6 +3818,8 @@ ansi_raise_identifier:
check_for_new_type ("exception specifier", $1);
$$ = groktypename ($1.t);
}
+ | error
+ { $$ = error_mark_node; }
;
ansi_raise_identifiers: