diff mbox series

[Ada] Check all pairs of actuals for overlapping

Message ID 20210617143310.GA9827@adacore.com
State New
Headers show
Series [Ada] Check all pairs of actuals for overlapping | expand

Commit Message

Pierre-Marie de Rodat June 17, 2021, 2:33 p.m. UTC
When detecting overlapping actuals GNAT was giving up on the first pair
of parameters that refer to the same object (even when there was no
overlapping because both parameters had mode IN). Now we examine all
pairs.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Fix style;
	refactor repeated calls to Nkind; remove early RETURN.
diff mbox series

Patch

diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3693,10 +3693,10 @@  package body Sem_Warn is
 
       --  Local variables
 
-      Act1      : Node_Id;
-      Act2      : Node_Id;
-      Form1     : Entity_Id;
-      Form2     : Entity_Id;
+      Act1  : Node_Id;
+      Act2  : Node_Id;
+      Form1 : Entity_Id;
+      Form2 : Entity_Id;
 
    --  Start of processing for Warn_On_Overlapping_Actuals
 
@@ -3708,9 +3708,7 @@  package body Sem_Warn is
 
       --  Exclude calls rewritten as enumeration literals
 
-      if Nkind (N) not in N_Subprogram_Call
-        and then Nkind (N) /= N_Entry_Call_Statement
-      then
+      if Nkind (N) not in N_Subprogram_Call | N_Entry_Call_Statement then
          return;
       end if;
 
@@ -3879,8 +3877,6 @@  package body Sem_Warn is
                      end if;
                   end if;
                end if;
-
-               return;
             end if;
 
             Next_Formal (Form2);