aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-11 12:54:42 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-11 12:54:42 +0100
commit113b830ca0f80cf02d2db993fb3850b1f8c3293e (patch)
tree286cd2a0784258291c80554612596d6c81a4815c
parenteca2ac2c23e0c8b438fd696d4f85e35c9210d8dd (diff)
downloadgcc-113b830ca0f80cf02d2db993fb3850b1f8c3293e.zip
gcc-113b830ca0f80cf02d2db993fb3850b1f8c3293e.tar.gz
gcc-113b830ca0f80cf02d2db993fb3850b1f8c3293e.tar.bz2
Remove unused switch statement wrapper
-rw-r--r--gcc/rust/rust-backend.h12
-rw-r--r--gcc/rust/rust-gcc.cc65
2 files changed, 0 insertions, 77 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index f7c0b08..126283c 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -306,18 +306,6 @@ public:
// exit expressions
virtual tree exit_expression (tree condition, Location) = 0;
- // Create a switch statement where the case values are constants.
- // CASES and STATEMENTS must have the same number of entries. If
- // VALUE matches any of the list in CASES[i], which will all be
- // integers, then STATEMENTS[i] is executed. STATEMENTS[i] will
- // either end with a goto statement or will fall through into
- // STATEMENTS[i + 1]. CASES[i] is empty for the default clause,
- // which need not be last. FUNCTION is the current function.
- virtual tree switch_statement (tree function, tree value,
- const std::vector<std::vector<tree> > &cases,
- const std::vector<tree> &statements, Location)
- = 0;
-
// Create a single statement from two statements.
virtual tree compound_statement (tree, tree) = 0;
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 27196e8..f6c0534 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -264,10 +264,6 @@ public:
tree if_statement (tree, tree condition, tree then_block, tree else_block,
Location);
- tree switch_statement (tree function, tree value,
- const std::vector<std::vector<tree>> &cases,
- const std::vector<tree> &statements, Location);
-
tree compound_statement (tree, tree);
tree statement_list (const std::vector<tree> &);
@@ -2054,67 +2050,6 @@ Gcc_backend::exit_expression (tree cond_tree, Location locus)
cond_tree);
}
-// Switch.
-
-tree
-Gcc_backend::switch_statement (tree decl, tree value,
- const std::vector<std::vector<tree>> &cases,
- const std::vector<tree> &statements,
- Location switch_location)
-{
- gcc_assert (cases.size () == statements.size ());
-
- if (DECL_STRUCT_FUNCTION (decl) == NULL)
- push_struct_function (decl);
- else
- push_cfun (DECL_STRUCT_FUNCTION (decl));
-
- tree stmt_list = NULL_TREE;
- std::vector<std::vector<tree>>::const_iterator pc = cases.begin ();
- for (std::vector<tree>::const_iterator ps = statements.begin ();
- ps != statements.end (); ++ps, ++pc)
- {
- if (pc->empty ())
- {
- location_t loc
- = (*ps != NULL ? EXPR_LOCATION (*ps) : UNKNOWN_LOCATION);
- tree label = create_artificial_label (loc);
- tree c = build_case_label (NULL_TREE, NULL_TREE, label);
- append_to_statement_list (c, &stmt_list);
- }
- else
- {
- for (std::vector<tree>::const_iterator pcv = pc->begin ();
- pcv != pc->end (); ++pcv)
- {
- tree t = (*pcv);
- if (t == error_mark_node)
- return error_mark_node;
- location_t loc = EXPR_LOCATION (t);
- tree label = create_artificial_label (loc);
- tree c = build_case_label ((*pcv), NULL_TREE, label);
- append_to_statement_list (c, &stmt_list);
- }
- }
-
- if (*ps != NULL)
- {
- tree t = (*ps);
- if (t == error_mark_node)
- return error_mark_node;
- append_to_statement_list (t, &stmt_list);
- }
- }
- pop_cfun ();
-
- tree tv = value;
- if (tv == error_mark_node)
- return error_mark_node;
- tree t = build2_loc (switch_location.gcc_location (), SWITCH_EXPR, NULL_TREE,
- tv, stmt_list);
- return t;
-}
-
// Pair of statements.
tree