aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-01-04 09:50:33 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-01-04 09:50:33 +0000
commit2d3c7e4f2d3c39f0ff5f0bcf0c5d97e0d7a893dc (patch)
tree8f2d336054a316aa0401e0ec52b1adf9c9982266 /gcc/ada/gcc-interface/trans.c
parent0394741f9b89489efdd72c95fae7d2867065a72b (diff)
downloadgcc-2d3c7e4f2d3c39f0ff5f0bcf0c5d97e0d7a893dc.zip
gcc-2d3c7e4f2d3c39f0ff5f0bcf0c5d97e0d7a893dc.tar.gz
gcc-2d3c7e4f2d3c39f0ff5f0bcf0c5d97e0d7a893dc.tar.bz2
trans.c (Case_Statement_to_gnu): Put the SLOC of the end-of-case on the end label and its associated gotos, if any.
* gcc-interface/trans.c (Case_Statement_to_gnu): Put the SLOC of the end-of-case on the end label and its associated gotos, if any. From-SVN: r168458
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index ecd9489..30dbf7a 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1954,6 +1954,7 @@ Case_Statement_to_gnu (Node_Id gnat_node)
{
tree gnu_result, gnu_expr, gnu_label;
Node_Id gnat_when;
+ location_t end_locus;
bool may_fallthru = false;
gnu_expr = gnat_to_gnu (Expression (gnat_node));
@@ -1977,7 +1978,10 @@ Case_Statement_to_gnu (Node_Id gnat_node)
/* We build a SWITCH_EXPR that contains the code with interspersed
CASE_LABEL_EXPRs for each label. */
- gnu_label = create_artificial_label (input_location);
+ if (!Sloc_to_locus (Sloc (gnat_node) + UI_To_Int (End_Span (gnat_node)),
+ &end_locus))
+ end_locus = input_location;
+ gnu_label = create_artificial_label (end_locus);
start_stmt_group ();
for (gnat_when = First_Non_Pragma (Alternatives (gnat_node));
@@ -2062,7 +2066,9 @@ Case_Statement_to_gnu (Node_Id gnat_node)
add_stmt (group);
if (group_may_fallthru)
{
- add_stmt (build1 (GOTO_EXPR, void_type_node, gnu_label));
+ tree stmt = build1 (GOTO_EXPR, void_type_node, gnu_label);
+ SET_EXPR_LOCATION (stmt, end_locus);
+ add_stmt (stmt);
may_fallthru = true;
}
}