]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Make the identification of case expressions more robust
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 17 Jun 2023 21:19:19 +0000 (23:19 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 27 Jun 2023 12:05:51 +0000 (14:05 +0200)
gcc/ada/

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

gcc/ada/gcc-interface/trans.cc

index ddc7b6dde1e90f201aa66350ea209e4d5f3cf6bc..b74bb0683bf570545826cd519cb660985eab1c94 100644 (file)
@@ -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)
            {