[COMMITTED] ada: Tune style in detection of writable function actuals

Message ID 20230613073742.238961-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Tune style in detection of writable function actuals |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès June 13, 2023, 7:37 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Cleanup; semantics is unaffected.

gcc/ada/

	* sem_util.adb (Check_Function_Writable_Actuals): Tune style; use
	subtype name to detect membership test nodes.

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

---
 gcc/ada/sem_util.adb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index a75ebf5d7b1..237bbd3987c 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -2899,6 +2899,10 @@  package body Sem_Util is
                function Get_Record_Part (N : Node_Id) return Node_Id;
                --  Return the record part of this record type definition
 
+               ---------------------
+               -- Get_Record_Part --
+               ---------------------
+
                function Get_Record_Part (N : Node_Id) return Node_Id is
                   Type_Def : constant Node_Id := Type_Definition (N);
                begin
@@ -3293,9 +3297,7 @@  package body Sem_Util is
                               & "in unspecified order",
                               Node (Elmt_2));
 
-                        when N_In
-                           | N_Not_In
-                        =>
+                        when N_Membership_Test =>
                            Error_Msg_N
                              ("value may be affected by call in other "
                               & "alternative because they are evaluated "
@@ -3307,7 +3309,7 @@  package body Sem_Util is
                              ("value of actual may be affected by call in "
                               & "other actual because they are evaluated "
                               & "in unspecified order",
-                           Node (Elmt_2));
+                              Node (Elmt_2));
                      end case;
                   end if;