Commit 9c69c3af by Eric Botcazou Committed by Eric Botcazou

trans.c (Case_Statement_to_gnu): Bool-ify variable.

	* gcc-interface/trans.c (Case_Statement_to_gnu): Bool-ify variable.
	(gnat_to_gnu) <N_Null_Statement>: When not optimizing, generate a
	goto to the next statement.

From-SVN: r158200
parent c460cd49
2010-04-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Case_Statement_to_gnu): Bool-ify variable.
(gnat_to_gnu) <N_Null_Statement>: When not optimizing, generate a
goto to the next statement.
2010-04-09 Eric Botcazou <ebotcazou@adacore.com> 2010-04-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (maybe_variable): Delete. * gcc-interface/gigi.h (maybe_variable): Delete.
......
...@@ -1876,8 +1876,8 @@ Case_Statement_to_gnu (Node_Id gnat_node) ...@@ -1876,8 +1876,8 @@ Case_Statement_to_gnu (Node_Id gnat_node)
Present (gnat_when); Present (gnat_when);
gnat_when = Next_Non_Pragma (gnat_when)) gnat_when = Next_Non_Pragma (gnat_when))
{ {
bool choices_added_p = false;
Node_Id gnat_choice; Node_Id gnat_choice;
int choices_added = 0;
/* First compile all the different case choices for the current WHEN /* First compile all the different case choices for the current WHEN
alternative. */ alternative. */
...@@ -1940,14 +1940,14 @@ Case_Statement_to_gnu (Node_Id gnat_node) ...@@ -1940,14 +1940,14 @@ Case_Statement_to_gnu (Node_Id gnat_node)
gnu_low, gnu_high, gnu_low, gnu_high,
create_artificial_label (input_location)), create_artificial_label (input_location)),
gnat_choice); gnat_choice);
choices_added++; choices_added_p = true;
} }
} }
/* Push a binding level here in case variables are declared as we want /* Push a binding level here in case variables are declared as we want
them to be local to this set of statements instead of to the block them to be local to this set of statements instead of to the block
containing the Case statement. */ containing the Case statement. */
if (choices_added > 0) if (choices_added_p)
{ {
add_stmt (build_stmt_group (Statements (gnat_when), true)); add_stmt (build_stmt_group (Statements (gnat_when), true));
add_stmt (build1 (GOTO_EXPR, void_type_node, add_stmt (build1 (GOTO_EXPR, void_type_node,
...@@ -4465,7 +4465,22 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4465,7 +4465,22 @@ gnat_to_gnu (Node_Id gnat_node)
break; break;
case N_Null_Statement: case N_Null_Statement:
gnu_result = alloc_stmt_list (); /* When not optimizing, turn null statements from source into gotos to
the next statement that the middle-end knows how to preserve. */
if (!optimize && Comes_From_Source (gnat_node))
{
tree stmt, label = create_label_decl (NULL_TREE);
start_stmt_group ();
stmt = build1 (GOTO_EXPR, void_type_node, label);
set_expr_location_from_node (stmt, gnat_node);
add_stmt (stmt);
stmt = build1 (LABEL_EXPR, void_type_node, label);
set_expr_location_from_node (stmt, gnat_node);
add_stmt (stmt);
gnu_result = end_stmt_group ();
}
else
gnu_result = alloc_stmt_list ();
break; break;
case N_Assignment_Statement: case N_Assignment_Statement:
......
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