diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-08-09 08:53:52 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-08-09 04:53:52 -0400 |
commit | 227cf17127926cf07f801555ec6f905df82eddd2 (patch) | |
tree | 37a0725d27a153ddd6bcbfbfdc622c1b91cdd6ee /gcc | |
parent | e7b9b18e4ac2c20a2458270889d1b5385d158808 (diff) | |
download | gcc-227cf17127926cf07f801555ec6f905df82eddd2.zip gcc-227cf17127926cf07f801555ec6f905df82eddd2.tar.gz gcc-227cf17127926cf07f801555ec6f905df82eddd2.tar.bz2 |
decl.c (struct binding_level): Add eh_region field.
* decl.c (struct binding_level): Add eh_region field.
(push_binding_level): Set it.
(define_label): Complain about jumping into an EH block.
From-SVN: r28622
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 27 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 |
3 files changed, 30 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 41037ae..963b9c6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,10 +1,12 @@ 1999-08-08 Jason Merrill <jason@yorick.cygnus.com> + * decl.c (struct binding_level): Add eh_region field. + (push_binding_level): Set it. + (define_label): Complain about jumping into an EH block. + * ptree.c (print_lang_type): Print the real type of a PMF. Print what exceptions a fn type throws. - * typeck.c (common_type): Use same_type_p. - 1999-08-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * class.c (count_fields, add_fields_to_vec): Add static prototype. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 27f915c..93f66b2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -639,7 +639,10 @@ struct binding_level worry about ambiguous (ARM or ANSI) scope rules. */ unsigned is_for_scope : 1; - /* Two bits left for this word. */ + /* True if this level corresponds to an EH region, as for a try block. */ + unsigned eh_region : 1; + + /* One bit left for this word. */ #if defined(DEBUG_CP_BINDING_LEVELS) /* Binding depth at which this level began. */ @@ -703,6 +706,12 @@ push_binding_level (newlevel, tag_transparent, keep) current_binding_level = newlevel; newlevel->tag_transparent = tag_transparent; newlevel->more_cleanups_ok = 1; + + /* We are called before expand_start_bindings, but after + expand_eh_region_start for a try block; so we check this now, + before the EH block is covered up. */ + newlevel->eh_region = is_eh_region (); + newlevel->keep = keep; #if defined(DEBUG_CP_BINDING_LEVELS) newlevel->binding_depth = binding_depth; @@ -4868,6 +4877,7 @@ define_label (filename, line, name) { struct named_label_list *uses, *prev; int identified = 0; + int saw_eh = 0; /* Mark label as having been defined. */ DECL_INITIAL (decl) = error_mark_node; @@ -4922,7 +4932,7 @@ define_label (filename, line, name) uses->lineno_o_goto, " from here"); } identified = 1; - } + } if (problem) cp_error_at (" crosses initialization of `%#D'", @@ -4935,6 +4945,19 @@ define_label (filename, line, name) } if (b == uses->binding_level) break; + if (b->eh_region && ! saw_eh) + { + if (! identified) + { + cp_error ("jump to label `%D'", decl); + error_with_file_and_line + (uses->filename_o_goto, + uses->lineno_o_goto, " from here"); + identified = 1; + } + error (" enters exception handling block"); + saw_eh = 1; + } b = b->level_chain; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8724548..991234c 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -699,7 +699,7 @@ common_type (t1, t2) tt1 = TYPE_MAIN_VARIANT (tt1); tt2 = TYPE_MAIN_VARIANT (tt2); - if (same_type_p (tt1, tt2)) + if (tt1 == tt2) target = tt1; else if (b1) { |