Commit b5856475 by Jason Merrill Committed by Jason Merrill

parse.y (function_body): Suppress the block for the outermost curly braces.

        * parse.y (function_body): Suppress the block for the outermost
        curly braces.
        * decl.c (pushdecl): Don't try to skip it.
        (begin_function_body): Keep the block we create, not the next one.
        * init.c (emit_base_init): Don't mess with keep_next_level.

From-SVN: r49076
parent 6bc34b14
2002-01-22 Jason Merrill <jason@redhat.com> 2002-01-22 Jason Merrill <jason@redhat.com>
* parse.y (function_body): Suppress the block for the outermost
curly braces.
* decl.c (pushdecl): Don't try to skip it.
(begin_function_body): Keep the block we create, not the next one.
* init.c (emit_base_init): Don't mess with keep_next_level.
* class.c (build_base_path): Tweak formatting. * class.c (build_base_path): Tweak formatting.
2002-01-19 Nathan Sidwell <nathan@codesourcery.com> 2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
......
...@@ -4207,9 +4207,6 @@ pushdecl (x) ...@@ -4207,9 +4207,6 @@ pushdecl (x)
them there. */ them there. */
struct binding_level *b = current_binding_level->level_chain; struct binding_level *b = current_binding_level->level_chain;
/* Skip the ctor/dtor cleanup level. */
b = b->level_chain;
/* ARM $8.3 */ /* ARM $8.3 */
if (b->parm_flag == 1) if (b->parm_flag == 1)
{ {
...@@ -14054,6 +14051,14 @@ begin_function_body () ...@@ -14054,6 +14051,14 @@ begin_function_body ()
{ {
tree stmt; tree stmt;
if (processing_template_decl)
/* Do nothing now. */;
else
/* Always keep the BLOCK node associated with the outermost pair of
curly braces of a function. These are needed for correct
operation of dwarfout.c. */
keep_next_level (1);
stmt = begin_compound_stmt (0); stmt = begin_compound_stmt (0);
COMPOUND_STMT_BODY_BLOCK (stmt) = 1; COMPOUND_STMT_BODY_BLOCK (stmt) = 1;
...@@ -14064,11 +14069,6 @@ begin_function_body () ...@@ -14064,11 +14069,6 @@ begin_function_body ()
else if (DECL_DESTRUCTOR_P (current_function_decl)) else if (DECL_DESTRUCTOR_P (current_function_decl))
begin_destructor_body (); begin_destructor_body ();
/* Always keep the BLOCK node associated with the outermost pair of
curly braces of a function. These are needed for correct
operation of dwarfout.c. */
keep_next_level (1);
return stmt; return stmt;
} }
......
...@@ -668,11 +668,6 @@ emit_base_init (mem_init_list, base_init_list) ...@@ -668,11 +668,6 @@ emit_base_init (mem_init_list, base_init_list)
int i; int i;
int n_baseclasses = BINFO_N_BASETYPES (t_binfo); int n_baseclasses = BINFO_N_BASETYPES (t_binfo);
/* We did a keep_next_level (1) in begin_function_body. We don't want
that to apply to any blocks generated for member initializers, so
clear it out. */
keep_next_level (0);
mem_init_list = sort_member_init (t, mem_init_list); mem_init_list = sort_member_init (t, mem_init_list);
sort_base_init (t, base_init_list, &rbase_init_list, &vbase_init_list); sort_base_init (t, base_init_list, &rbase_init_list, &vbase_init_list);
...@@ -753,9 +748,6 @@ emit_base_init (mem_init_list, base_init_list) ...@@ -753,9 +748,6 @@ emit_base_init (mem_init_list, base_init_list)
perform_member_init (member, init, from_init_list); perform_member_init (member, init, from_init_list);
mem_init_list = TREE_CHAIN (mem_init_list); mem_init_list = TREE_CHAIN (mem_init_list);
} }
/* And restore it. */
keep_next_level (1);
} }
/* Returns the address of the vtable (i.e., the value that should be /* Returns the address of the vtable (i.e., the value that should be
......
...@@ -758,9 +758,16 @@ eat_saved_input: ...@@ -758,9 +758,16 @@ eat_saved_input:
| END_OF_SAVED_INPUT | END_OF_SAVED_INPUT
; ;
/* The outermost block of a function really begins before the
mem-initializer-list, so we open one there and suppress the one that
actually corresponds to the curly braces. */
function_body: function_body:
.begin_function_body ctor_initializer_opt compstmt .begin_function_body ctor_initializer_opt save_lineno '{'
{ $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
compstmtend
{ {
STMT_LINENO ($<ttype>5) = $3;
finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
finish_function_body ($1); finish_function_body ($1);
} }
; ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment