From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [COMMITTED] ada: Make the identification of case expressions more robust
Date: Tue, 27 Jun 2023 14:08:11 +0200 [thread overview]
Message-ID: <20230627120811.3420419-1-poulhies@adacore.com> (raw)
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
reply other threads:[~2023-06-27 12:08 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=20230627120811.3420419-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@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: link
Be 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).