cp-tree.h (begin_compound_stmt): No scope arg is a bool.

* cp-tree.h (begin_compound_stmt): No scope arg is a bool.
	(finish_compound_stmt): Remove no scope arg.
	* decl.c (register_dtor_fn): Adjust begin_compound_stmt and
	end_compound_stmt calls.
	(expand_static_init, begin_destructor_body, begin_function_body,
	finish_function_body): Likewise.
	* decl2.c (start_objects, finish_objects,
	start_static_storage_duration_function,
	finish_static_storage_duration_function): Likewise.
	* init.c (begin_init_stmts, finish_init_stmts,
	construct_virtual_base, build_vec_init): Likewise.
	* method.c (do_build_assign_ref, synthesize_method): Likewise.
	* parser.c (cp_parser_compound_statement,
	cp_parser_implicitly_scoped_statement,
	cp_parser_already_scoped_statement): Likewise.
	* pt.c (tsubst_expr): Likewise.
	* semantics.c (begin_compound_stmt): No scope arg is a bool.
	(finish_compound_stmt): Remove no scope arg.

	* error.c (dump_expr) <COMPOUND_EXPR case>: A compound expr is
	always dyadic.

From-SVN: r69882
This commit is contained in:
Nathan Sidwell 2003-07-28 11:06:31 +00:00 committed by Nathan Sidwell
parent 8376cf3db9
commit 7a3397c739
10 changed files with 68 additions and 57 deletions

View File

@ -1,3 +1,27 @@
2003-07-28 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (begin_compound_stmt): No scope arg is a bool.
(finish_compound_stmt): Remove no scope arg.
* decl.c (register_dtor_fn): Adjust begin_compound_stmt and
end_compound_stmt calls.
(expand_static_init, begin_destructor_body, begin_function_body,
finish_function_body): Likewise.
* decl2.c (start_objects, finish_objects,
start_static_storage_duration_function,
finish_static_storage_duration_function): Likewise.
* init.c (begin_init_stmts, finish_init_stmts,
construct_virtual_base, build_vec_init): Likewise.
* method.c (do_build_assign_ref, synthesize_method): Likewise.
* parser.c (cp_parser_compound_statement,
cp_parser_implicitly_scoped_statement,
cp_parser_already_scoped_statement): Likewise.
* pt.c (tsubst_expr): Likewise.
* semantics.c (begin_compound_stmt): No scope arg is a bool.
(finish_compound_stmt): Remove no scope arg.
* error.c (dump_expr) <COMPOUND_EXPR case>: A compound expr is
always dyadic.
2003-07-27 Mark Mitchell <mark@codesourcery.com> 2003-07-27 Mark Mitchell <mark@codesourcery.com>
* call.c (standard_conversion): Tweak handling of * call.c (standard_conversion): Tweak handling of

View File

@ -4126,8 +4126,8 @@ extern void finish_handler_parms (tree, tree);
extern void begin_catch_block (tree); extern void begin_catch_block (tree);
extern void finish_handler (tree); extern void finish_handler (tree);
extern void finish_cleanup (tree, tree); extern void finish_cleanup (tree, tree);
extern tree begin_compound_stmt (int); extern tree begin_compound_stmt (bool);
extern tree finish_compound_stmt (int, tree); extern tree finish_compound_stmt (tree);
extern tree finish_asm_stmt (tree, tree, tree, tree, tree); extern tree finish_asm_stmt (tree, tree, tree, tree, tree);
extern tree finish_label_stmt (tree); extern tree finish_label_stmt (tree);
extern void finish_label_decl (tree); extern void finish_label_decl (tree);

View File

@ -8475,9 +8475,9 @@ register_dtor_fn (tree decl)
pop_deferring_access_checks (); pop_deferring_access_checks ();
/* Create the body of the anonymous function. */ /* Create the body of the anonymous function. */
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
finish_expr_stmt (fcall); finish_expr_stmt (fcall);
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_compound_stmt (compound_stmt);
end_cleanup_fn (); end_cleanup_fn ();
/* Call atexit with the cleanup function. */ /* Call atexit with the cleanup function. */
@ -8562,7 +8562,7 @@ expand_static_init (tree decl, tree init)
/* Begin the conditional initialization. */ /* Begin the conditional initialization. */
if_stmt = begin_if_stmt (); if_stmt = begin_if_stmt ();
finish_if_stmt_cond (get_guard_cond (guard), if_stmt); finish_if_stmt_cond (get_guard_cond (guard), if_stmt);
then_clause = begin_compound_stmt (/*has_no_scope=*/0); then_clause = begin_compound_stmt (/*has_no_scope=*/false);
/* Do the initialization itself. */ /* Do the initialization itself. */
assignment = init ? init : NULL_TREE; assignment = init ? init : NULL_TREE;
@ -8586,7 +8586,7 @@ expand_static_init (tree decl, tree init)
variable. */ variable. */
register_dtor_fn (decl); register_dtor_fn (decl);
finish_compound_stmt (/*has_no_scope=*/0, then_clause); finish_compound_stmt (then_clause);
finish_then_clause (if_stmt); finish_then_clause (if_stmt);
finish_if_stmt (); finish_if_stmt ();
} }
@ -13840,14 +13840,14 @@ begin_destructor_body (void)
initialize the vtables.) */ initialize the vtables.) */
finish_if_stmt_cond (boolean_true_node, if_stmt); finish_if_stmt_cond (boolean_true_node, if_stmt);
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
/* Make all virtual function table pointers in non-virtual base /* Make all virtual function table pointers in non-virtual base
classes point to CURRENT_CLASS_TYPE's virtual function classes point to CURRENT_CLASS_TYPE's virtual function
tables. */ tables. */
initialize_vtbl_ptrs (current_class_ptr); initialize_vtbl_ptrs (current_class_ptr);
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_compound_stmt (compound_stmt);
finish_then_clause (if_stmt); finish_then_clause (if_stmt);
finish_if_stmt (); finish_if_stmt ();
@ -13914,7 +13914,7 @@ begin_function_body (void)
operation of dwarfout.c. */ operation of dwarfout.c. */
keep_next_level (1); keep_next_level (1);
stmt = begin_compound_stmt (0); stmt = begin_compound_stmt (/*has_no_scope=*/false);
COMPOUND_STMT_BODY_BLOCK (stmt) = 1; COMPOUND_STMT_BODY_BLOCK (stmt) = 1;
if (processing_template_decl) if (processing_template_decl)
@ -13940,7 +13940,7 @@ void
finish_function_body (tree compstmt) finish_function_body (tree compstmt)
{ {
/* Close the block. */ /* Close the block. */
finish_compound_stmt (0, compstmt); finish_compound_stmt (compstmt);
if (processing_template_decl) if (processing_template_decl)
/* Do nothing now. */; /* Do nothing now. */;

View File

@ -2025,7 +2025,7 @@ start_objects (int method_type, int initp)
DECL_GLOBAL_DTOR_P (current_function_decl) = 1; DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1; DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1;
body = begin_compound_stmt (/*has_no_scope=*/0); body = begin_compound_stmt (/*has_no_scope=*/false);
/* We cannot allow these functions to be elided, even if they do not /* We cannot allow these functions to be elided, even if they do not
have external linkage. And, there's no point in deferring have external linkage. And, there's no point in deferring
@ -2046,7 +2046,7 @@ finish_objects (int method_type, int initp, tree body)
tree fn; tree fn;
/* Finish up. */ /* Finish up. */
finish_compound_stmt (/*has_no_scope=*/0, body); finish_compound_stmt (body);
fn = finish_function (0); fn = finish_function (0);
expand_or_defer_fn (fn); expand_or_defer_fn (fn);
@ -2182,7 +2182,7 @@ start_static_storage_duration_function (unsigned count)
SF_PRE_PARSED); SF_PRE_PARSED);
/* Set up the scope of the outermost block in the function. */ /* Set up the scope of the outermost block in the function. */
body = begin_compound_stmt (/*has_no_scope=*/0); body = begin_compound_stmt (/*has_no_scope=*/false);
/* This function must not be deferred because we are depending on /* This function must not be deferred because we are depending on
its compilation to tell us what is TREE_SYMBOL_REFERENCED. */ its compilation to tell us what is TREE_SYMBOL_REFERENCED. */
@ -2200,7 +2200,7 @@ static void
finish_static_storage_duration_function (tree body) finish_static_storage_duration_function (tree body)
{ {
/* Close out the function. */ /* Close out the function. */
finish_compound_stmt (/*has_no_scope=*/0, body); finish_compound_stmt (body);
expand_or_defer_fn (finish_function (0)); expand_or_defer_fn (finish_function (0));
} }

View File

@ -1491,20 +1491,9 @@ dump_expr (tree t, int flags)
case COMPOUND_EXPR: case COMPOUND_EXPR:
pp_left_paren (cxx_pp); pp_left_paren (cxx_pp);
/* Within templates, a COMPOUND_EXPR has only one operand, dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
containing a TREE_LIST of the two operands. */ pp_separate_with_comma (cxx_pp);
if (TREE_CODE (TREE_OPERAND (t, 0)) == TREE_LIST) dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
{
if (TREE_OPERAND (t, 1))
abort();
dump_expr_list (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
}
else
{
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_separate_with_comma (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
pp_right_paren (cxx_pp); pp_right_paren (cxx_pp);
break; break;

View File

@ -72,7 +72,7 @@ begin_init_stmts (tree *stmt_expr_p, tree *compound_stmt_p)
bool is_global = !building_stmt_tree (); bool is_global = !building_stmt_tree ();
*stmt_expr_p = begin_stmt_expr (); *stmt_expr_p = begin_stmt_expr ();
*compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/1); *compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/true);
return is_global; return is_global;
} }
@ -83,7 +83,7 @@ begin_init_stmts (tree *stmt_expr_p, tree *compound_stmt_p)
static tree static tree
finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt) finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt)
{ {
finish_compound_stmt (/*has_no_scope=*/1, compound_stmt); finish_compound_stmt (compound_stmt);
stmt_expr = finish_stmt_expr (stmt_expr); stmt_expr = finish_stmt_expr (stmt_expr);
STMT_EXPR_NO_SCOPE (stmt_expr) = true; STMT_EXPR_NO_SCOPE (stmt_expr) = true;
@ -842,7 +842,7 @@ construct_virtual_base (tree vbase, tree arguments)
flag = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl)); flag = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl));
inner_if_stmt = begin_if_stmt (); inner_if_stmt = begin_if_stmt ();
finish_if_stmt_cond (flag, inner_if_stmt); finish_if_stmt_cond (flag, inner_if_stmt);
compound_stmt = begin_compound_stmt (/*has_no_scope=*/1); compound_stmt = begin_compound_stmt (/*has_no_scope=*/true);
/* Compute the location of the virtual base. If we're /* Compute the location of the virtual base. If we're
constructing virtual bases, then we must be the most derived constructing virtual bases, then we must be the most derived
@ -852,7 +852,7 @@ construct_virtual_base (tree vbase, tree arguments)
expand_aggr_init_1 (vbase, current_class_ref, exp, arguments, expand_aggr_init_1 (vbase, current_class_ref, exp, arguments,
LOOKUP_COMPLAIN); LOOKUP_COMPLAIN);
finish_compound_stmt (/*has_no_scope=*/1, compound_stmt); finish_compound_stmt (compound_stmt);
finish_then_clause (inner_if_stmt); finish_then_clause (inner_if_stmt);
finish_if_stmt (); finish_if_stmt ();
@ -2485,7 +2485,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array)
&& from_array != 2) && from_array != 2)
{ {
try_block = begin_try_block (); try_block = begin_try_block ();
try_body = begin_compound_stmt (/*has_no_scope=*/1); try_body = begin_compound_stmt (/*has_no_scope=*/true);
} }
if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR) if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR)
@ -2564,7 +2564,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array)
for_stmt); for_stmt);
/* Otherwise, loop through the elements. */ /* Otherwise, loop through the elements. */
for_body = begin_compound_stmt (/*has_no_scope=*/1); for_body = begin_compound_stmt (/*has_no_scope=*/true);
if (from_array) if (from_array)
{ {
@ -2605,7 +2605,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array)
if (base2) if (base2)
finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base2, 0)); finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base2, 0));
finish_compound_stmt (/*has_no_scope=*/1, for_body); finish_compound_stmt (for_body);
finish_for_stmt (for_stmt); finish_for_stmt (for_stmt);
} }
@ -2625,7 +2625,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array)
type = strip_array_types (type); type = strip_array_types (type);
} }
finish_compound_stmt (/*has_no_scope=*/1, try_body); finish_compound_stmt (try_body);
finish_cleanup_try_block (try_block); finish_cleanup_try_block (try_block);
e = build_vec_delete_1 (rval, m, e = build_vec_delete_1 (rval, m,
type, type,

View File

@ -587,7 +587,7 @@ do_build_assign_ref (tree fndecl)
tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl)); tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
tree compound_stmt; tree compound_stmt;
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
parm = convert_from_reference (parm); parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type) if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
@ -680,7 +680,7 @@ do_build_assign_ref (tree fndecl)
} }
} }
finish_return_stmt (current_class_ref); finish_return_stmt (current_class_ref);
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_compound_stmt (compound_stmt);
} }
void void
@ -744,8 +744,8 @@ synthesize_method (tree fndecl)
if (need_body) if (need_body)
{ {
tree compound_stmt; tree compound_stmt;
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_compound_stmt (compound_stmt);
} }
finish_function_body (stmt); finish_function_body (stmt);

View File

@ -5280,11 +5280,11 @@ cp_parser_compound_statement (cp_parser *parser)
if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'")) if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
return error_mark_node; return error_mark_node;
/* Begin the compound-statement. */ /* Begin the compound-statement. */
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
/* Parse an (optional) statement-seq. */ /* Parse an (optional) statement-seq. */
cp_parser_statement_seq_opt (parser); cp_parser_statement_seq_opt (parser);
/* Finish the compound-statement. */ /* Finish the compound-statement. */
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_compound_stmt (compound_stmt);
/* Consume the `}'. */ /* Consume the `}'. */
cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
@ -5762,11 +5762,11 @@ cp_parser_implicitly_scoped_statement (cp_parser* parser)
if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
{ {
/* Create a compound-statement. */ /* Create a compound-statement. */
statement = begin_compound_stmt (/*has_no_scope=*/0); statement = begin_compound_stmt (/*has_no_scope=*/false);
/* Parse the dependent-statement. */ /* Parse the dependent-statement. */
cp_parser_statement (parser); cp_parser_statement (parser);
/* Finish the dummy compound-statement. */ /* Finish the dummy compound-statement. */
finish_compound_stmt (/*has_no_scope=*/0, statement); finish_compound_stmt (statement);
} }
/* Otherwise, we simply parse the statement directly. */ /* Otherwise, we simply parse the statement directly. */
else else
@ -5790,11 +5790,11 @@ cp_parser_already_scoped_statement (cp_parser* parser)
tree statement; tree statement;
/* Create a compound-statement. */ /* Create a compound-statement. */
statement = begin_compound_stmt (/*has_no_scope=*/1); statement = begin_compound_stmt (/*has_no_scope=*/true);
/* Parse the dependent-statement. */ /* Parse the dependent-statement. */
cp_parser_statement (parser); cp_parser_statement (parser);
/* Finish the dummy compound-statement. */ /* Finish the dummy compound-statement. */
finish_compound_stmt (/*has_no_scope=*/1, statement); finish_compound_stmt (statement);
} }
/* Otherwise, we simply parse the statement directly. */ /* Otherwise, we simply parse the statement directly. */
else else

View File

@ -7732,7 +7732,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (COMPOUND_STMT_BODY_BLOCK (t)) if (COMPOUND_STMT_BODY_BLOCK (t))
finish_function_body (stmt); finish_function_body (stmt);
else else
finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t), stmt); finish_compound_stmt (stmt);
} }
break; break;

View File

@ -985,12 +985,12 @@ finish_handler (tree handler)
RECHAIN_STMTS (handler, HANDLER_BODY (handler)); RECHAIN_STMTS (handler, HANDLER_BODY (handler));
} }
/* Begin a compound-statement. If HAS_NO_SCOPE is nonzero, the /* Begin a compound-statement. If HAS_NO_SCOPE is true, the
compound-statement does not define a scope. Returns a new compound-statement does not define a scope. Returns a new
COMPOUND_STMT if appropriate. */ COMPOUND_STMT. */
tree tree
begin_compound_stmt (int has_no_scope) begin_compound_stmt (bool has_no_scope)
{ {
tree r; tree r;
int is_try = 0; int is_try = 0;
@ -1018,20 +1018,18 @@ begin_compound_stmt (int has_no_scope)
return r; return r;
} }
/* Finish a compound-statement, which may be given by COMPOUND_STMT. /* Finish a compound-statement, which is given by COMPOUND_STMT. */
If HAS_NO_SCOPE is nonzero, the compound statement does not define
a scope. */
tree tree
finish_compound_stmt (int has_no_scope, tree compound_stmt) finish_compound_stmt (tree compound_stmt)
{ {
tree r; tree r;
tree t; tree t;
if (!has_no_scope) if (COMPOUND_STMT_NO_SCOPE (compound_stmt))
r = do_poplevel ();
else
r = NULL_TREE; r = NULL_TREE;
else
r = do_poplevel ();
RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt)); RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt));