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
This commit is contained in:
Jason Merrill 2002-12-17 01:24:02 -05:00 committed by Jason Merrill
parent c79d892f64
commit 9f17520894
7 changed files with 36 additions and 16 deletions

View file

@ -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.

View file

@ -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);
}

View file

@ -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

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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);
}
;

View file

@ -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);
}
}