aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-01-22 09:42:09 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-01-22 09:42:09 -0500
commitb58564754b8f157067e661a00c83c8fd9c75dc54 (patch)
tree3d7cb8c1f3c21239a3a8a7046c8a953c2a4a34a0
parent6bc34b14ef3f254de4bf8570d1282d1cfd89c134 (diff)
downloadgcc-b58564754b8f157067e661a00c83c8fd9c75dc54.zip
gcc-b58564754b8f157067e661a00c83c8fd9c75dc54.tar.gz
gcc-b58564754b8f157067e661a00c83c8fd9c75dc54.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c16
-rw-r--r--gcc/cp/init.c8
-rw-r--r--gcc/cp/parse.y11
4 files changed, 23 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 18f5038..7c88cac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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.
2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2a4eaea..fe3e24d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4207,9 +4207,6 @@ pushdecl (x)
them there. */
struct binding_level *b = current_binding_level->level_chain;
- /* Skip the ctor/dtor cleanup level. */
- b = b->level_chain;
-
/* ARM $8.3 */
if (b->parm_flag == 1)
{
@@ -14054,6 +14051,14 @@ begin_function_body ()
{
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);
COMPOUND_STMT_BODY_BLOCK (stmt) = 1;
@@ -14064,11 +14069,6 @@ begin_function_body ()
else if (DECL_DESTRUCTOR_P (current_function_decl))
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;
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3aaedaf..f159f44 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -668,11 +668,6 @@ emit_base_init (mem_init_list, base_init_list)
int i;
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);
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)
perform_member_init (member, init, from_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
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index 420e428..f6dba7e 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -758,9 +758,16 @@ eat_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:
- .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);
}
;