diff options
author | Jason Merrill <jason@redhat.com> | 2002-12-17 01:24:02 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2002-12-17 01:24:02 -0500 |
commit | 9f175208940aa2112b07e440e7601a662a3a1a52 (patch) | |
tree | dcfd0036884e5fabefd7fb68dda94834b0cfe2e1 /gcc | |
parent | c79d892f6408c9308bab00b37f718e077f960daa (diff) | |
download | gcc-9f175208940aa2112b07e440e7601a662a3a1a52.zip gcc-9f175208940aa2112b07e440e7601a662a3a1a52.tar.gz gcc-9f175208940aa2112b07e440e7601a662a3a1a52.tar.bz2 |
c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT doesn't match the begin SCOPE_STMT in partialness.
* c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT
doesn't match the begin SCOPE_STMT in partialness.
cp/
* semantics.c (do_pushlevel): Call pushlevel after adding the
SCOPE_STMT.
(do_poplevel): Call poplevel before adding the SCOPE_STMT.
* parse.y (function_body): Go back to using compstmt.
* decl.c (pushdecl): Skip another level to get to the parms level.
* call.c (build_new_method_call): Use is_dummy_object to determine
whether or not to evaluate the object parameter to a static member
function.
From-SVN: r60196
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-semantics.c | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/parse.y | 11 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 17 |
7 files changed, 36 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9becce..dc1de48 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-12-16 Jason Merrill <jason@redhat.com> + + * c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT + doesn't match the begin SCOPE_STMT in partialness. + 2002-12-16 Geoffrey Keating <geoffk@apple.com> * genmultilib: Create temporary files in unique subdirectory. diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 0b8f587..77d7384 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -146,6 +146,8 @@ add_scope_stmt (begin_p, partial_p) } else { + if (partial_p != SCOPE_PARTIAL_P (TREE_PURPOSE (top))) + abort (); TREE_VALUE (top) = ss; *stack_ptr = TREE_CHAIN (top); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ceafa26..a1b5038 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2002-12-16 Jason Merrill <jason@redhat.com> + + * semantics.c (do_pushlevel): Call pushlevel after adding the + SCOPE_STMT. + (do_poplevel): Call poplevel before adding the SCOPE_STMT. + * parse.y (function_body): Go back to using compstmt. + * decl.c (pushdecl): Skip another level to get to the parms level. + + * call.c (build_new_method_call): Use is_dummy_object to determine + whether or not to evaluate the object parameter to a static member + function. + 2002-12-14 Jason Merrill <jason@redhat.com> * semantics.c (simplify_aggr_init_exprs_r): Also prepend the diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f766092..cafbb14 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4908,7 +4908,7 @@ build_new_method_call (tree instance, tree fns, tree args, call = build_over_call (cand, args, flags); /* In an expression of the form `a->f()' where `f' turns out to be a static member function, `a' is none-the-less evaluated. */ - if (instance && TREE_SIDE_EFFECTS (instance)) + if (!is_dummy_object (instance_ptr) && TREE_SIDE_EFFECTS (instance)) call = build (COMPOUND_EXPR, TREE_TYPE (call), instance, call); } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e3f5b5a..2d6b4a4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4161,6 +4161,9 @@ pushdecl (x) them there. */ struct cp_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) { diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 2f0fd93..4f62841 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -798,15 +798,10 @@ eat_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. */ + mem-initializer-list, so we open one there, too. */ function_body: - 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); + begin_function_body_ ctor_initializer_opt compstmt + { finish_function_body ($1); } ; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 1ceb1f3..763916a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -125,14 +125,17 @@ do_poplevel () { tree scope_stmts = NULL_TREE; - if (!processing_template_decl) - scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); - block = poplevel (kept_level_p (), 1, 0); - if (block && !processing_template_decl) + if (!processing_template_decl) { - SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block; - SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block; + /* This needs to come after the poplevel so that partial scopes + are properly nested. */ + scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); + if (block) + { + SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block; + SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block; + } } } @@ -146,9 +149,9 @@ do_pushlevel () { if (stmts_are_full_exprs_p ()) { - pushlevel (0); if (!processing_template_decl) add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); + pushlevel (0); } } |