public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Remove unused switch statement wrapper Date: Thu, 11 Aug 2022 19:19:41 +0000 (GMT) [thread overview] Message-ID: <20220811191941.F30323856DC8@sourceware.org> (raw) https://gcc.gnu.org/g:113b830ca0f80cf02d2db993fb3850b1f8c3293e commit 113b830ca0f80cf02d2db993fb3850b1f8c3293e Author: Philip Herron <philip.herron@embecosm.com> Date: Thu Aug 11 12:54:42 2022 +0100 Remove unused switch statement wrapper Diff: --- gcc/rust/rust-backend.h | 12 --------- gcc/rust/rust-gcc.cc | 65 ------------------------------------------------- 2 files changed, 77 deletions(-) diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index f7c0b083370..126283c1a54 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 27196e88593..f6c053465fb 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
reply other threads:[~2022-08-11 19:19 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220811191941.F30323856DC8@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).