public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Make the identification of case expressions more robust
@ 2023-06-27 12:08 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-06-27 12:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

From: Eric Botcazou <ebotcazou@adacore.com>

gcc/ada/

	* gcc-interface/trans.cc (Case_Statement_to_gnu): Rename boolean
	constant and use From_Conditional_Expression flag for its value.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/gcc-interface/trans.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index ddc7b6dde1e..b74bb0683bf 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -2700,11 +2700,9 @@ Case_Statement_to_gnu (Node_Id gnat_node)
 	 never been problematic, but not for case expressions in Ada 2012.  */
       if (choices_added_p)
 	{
-	  const bool is_case_expression
-	    = (Nkind (Parent (gnat_node)) == N_Expression_With_Actions);
-	  tree group
-	    = build_stmt_group (Statements (gnat_when), !is_case_expression);
-	  bool group_may_fallthru = block_may_fallthru (group);
+	  const bool case_expr_p = From_Conditional_Expression (gnat_node);
+	  tree group = build_stmt_group (Statements (gnat_when), !case_expr_p);
+	  const bool group_may_fallthru = block_may_fallthru (group);
 	  add_stmt (group);
 	  if (group_may_fallthru)
 	    {
-- 
2.40.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-27 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 12:08 [COMMITTED] ada: Make the identification of case expressions more robust Marc Poulhiès

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).