decl.c (struct named_label_list): Rename eh_region to in_try_scope, add in_catch_scope.

* decl.c (struct named_label_list): Rename eh_region to
        in_try_scope, add in_catch_scope.
        (struct binding_level): Rename eh_region to is_try_scope,
        add is_catch_scope.
        (note_level_for_try): Rename from note_level_for_eh.
        (note_level_for_catch): New.
        (poplevel): Copy both is_try_scope and is_catch_scope to
        the named_label_list struct.
        (check_previous_goto_1): Don't check for catch block via
        DECL_ARTIFICIAL; use in_try_scope instead.
        (check_goto): Likewise.
        * cp-tree.h (note_level_for_try, note_level_for_catch): Declare.
        * except.c (expand_start_catch_block): Call note_level_for_catch.
        * semantics.c (begin_compound_stmt): Update for note_level_for_try.

From-SVN: r40920
This commit is contained in:
Richard Henderson 2001-03-28 00:25:45 -08:00
parent 1e7c4465e9
commit 826840d96a
5 changed files with 60 additions and 24 deletions

View File

@ -1,3 +1,20 @@
2001-03-28 Richard Henderson <rth@redhat.com>
* decl.c (struct named_label_list): Rename eh_region to
in_try_scope, add in_catch_scope.
(struct binding_level): Rename eh_region to is_try_scope,
add is_catch_scope.
(note_level_for_try): Rename from note_level_for_eh.
(note_level_for_catch): New.
(poplevel): Copy both is_try_scope and is_catch_scope to
the named_label_list struct.
(check_previous_goto_1): Don't check for catch block via
DECL_ARTIFICIAL; use in_try_scope instead.
(check_goto): Likewise.
* cp-tree.h (note_level_for_try, note_level_for_catch): Declare.
* except.c (expand_start_catch_block): Call note_level_for_catch.
* semantics.c (begin_compound_stmt): Update for note_level_for_try.
2001-03-27 Richard Henderson <rth@redhat.com>
* except.c: Use USING_SJLJ_EXCEPTIONS instead of
@ -124,7 +141,7 @@
* except.c: Don't include it.
2001-03-22 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
based on an idea from Joe Buck <jbuck@synopsys.com>
based on an idea from Joe Buck <jbuck@synopsys.com>
* parse.y (bad_decl, template_arg_list_ignore, arg_list_ignore):
New nonterminals.
@ -1041,8 +1058,8 @@ Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-16 Daniel Berlin <dberlin@redhat.com>
* cvt.c (ocp_convert): Handle vector type conversion
* typeck2.c (digest_init): Handle vector type initializations
* cvt.c (ocp_convert): Handle vector type conversion
* typeck2.c (digest_init): Handle vector type initializations
2001-01-16 Phil Edwards <pme@sources.redhat.com>
@ -1249,7 +1266,7 @@ Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
* cp/decl2.c (cxx_post_options): Call cpp_post_options.
* cp/decl2.c (cxx_post_options): Call cpp_post_options.
2001-01-05 Nathan Sidwell <nathan@codesourcery.com>

View File

@ -3766,7 +3766,8 @@ extern void maybe_push_cleanup_level PARAMS ((tree));
extern void begin_scope PARAMS ((scope_kind));
extern void finish_scope PARAMS ((void));
extern void note_level_for_for PARAMS ((void));
extern void note_level_for_eh PARAMS ((void));
extern void note_level_for_try PARAMS ((void));
extern void note_level_for_catch PARAMS ((void));
extern void resume_level PARAMS ((struct binding_level *));
extern void delete_block PARAMS ((tree));
extern void insert_block PARAMS ((tree));

View File

@ -282,8 +282,9 @@ struct named_label_list
tree old_value;
tree label_decl;
tree bad_decls;
int eh_region;
struct named_label_list *next;
unsigned int in_try_scope : 1;
unsigned int in_catch_scope : 1;
};
#define named_labels cp_function_chain->x_named_labels
@ -456,12 +457,15 @@ struct binding_level
worry about ambiguous (ARM or ISO) scope rules. */
unsigned is_for_scope : 1;
/* True if this level corresponds to an EH region, as for a try block.
Currently this information is only available while building the
tree structure. */
unsigned eh_region : 1;
/* True if this level corresponds to a TRY block. Currently this
information is only available while building the tree structure. */
unsigned is_try_scope : 1;
/* Four bits left for this word. */
/* True if this level corresponds to a CATCH block. Currently this
information is only available while building the tree structure. */
unsigned is_catch_scope : 1;
/* Three bits left for this word. */
#if defined(DEBUG_CP_BINDING_LEVELS)
/* Binding depth at which this level began. */
@ -920,9 +924,17 @@ note_level_for_for ()
/* Record that the current binding level represents a try block. */
void
note_level_for_eh ()
note_level_for_try ()
{
current_binding_level->eh_region = 1;
current_binding_level->is_try_scope = 1;
}
/* Record that the current binding level represents a catch block. */
void
note_level_for_catch ()
{
current_binding_level->is_catch_scope = 1;
}
/* For a binding between a name and an entity at a block scope,
@ -1326,8 +1338,10 @@ poplevel (keep, reverse, functionbody)
if (labels->binding_level == current_binding_level)
{
tree decl;
if (current_binding_level->eh_region)
labels->eh_region = 1;
if (current_binding_level->is_try_scope)
labels->in_try_scope = 1;
if (current_binding_level->is_catch_scope)
labels->in_catch_scope = 1;
for (decl = labels->names_in_scope; decl;
decl = TREE_CHAIN (decl))
if (decl_jump_unsafe (decl))
@ -4946,10 +4960,7 @@ check_previous_goto_1 (decl, level, names, file, line)
identified = 1;
}
if (problem > 1 && DECL_ARTIFICIAL (new_decls))
/* Can't skip init of __exception_info. */
cp_error_at (" enters catch block", new_decls);
else if (problem > 1)
if (problem > 1)
cp_error_at (" crosses initialization of `%#D'",
new_decls);
else
@ -4959,7 +4970,7 @@ check_previous_goto_1 (decl, level, names, file, line)
if (b == level)
break;
if (b->eh_region && ! saw_eh)
if ((b->is_try_scope || b->is_catch_scope) && ! saw_eh)
{
if (! identified)
{
@ -4972,7 +4983,10 @@ check_previous_goto_1 (decl, level, names, file, line)
pedwarn_with_file_and_line (file, line, " from here");
identified = 1;
}
error (" enters try block");
if (b->is_try_scope)
error (" enters try block");
else
error (" enters catch block");
saw_eh = 1;
}
}
@ -5051,7 +5065,8 @@ check_goto (decl)
if (lab == 0)
return;
if ((lab->eh_region || lab->bad_decls) && !identified)
if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls)
&& !identified)
{
cp_pedwarn_at ("jump to label `%D'", decl);
pedwarn (" from here");
@ -5072,8 +5087,10 @@ check_goto (decl)
cp_pedwarn_at (" enters scope of non-POD `%#D'", b);
}
if (lab->eh_region)
if (lab->in_try_scope)
error (" enters try block");
else if (lab->in_catch_scope)
error (" enters catch block");
}
/* Define a label, specifying the location in the source file.

View File

@ -616,6 +616,7 @@ expand_start_catch_block (decl)
/* Create a binding level for the eh_info and the exception object
cleanup. */
compound_stmt_1 = begin_compound_stmt (/*has_no_scope=*/0);
note_level_for_catch ();
if (! decl || ! decl_is_java_type (TREE_TYPE (decl), 1))
{

View File

@ -832,7 +832,7 @@ begin_compound_stmt (has_no_scope)
{
do_pushlevel ();
if (is_try)
note_level_for_eh ();
note_level_for_try ();
}
else
/* Normally, we try hard to keep the BLOCK for a