diff mbox series

[Ada] Remove dead code for overlapping actuals in prefix notation

Message ID 20210618083826.GA128828@adacore.com
State New
Headers show
Series [Ada] Remove dead code for overlapping actuals in prefix notation | expand

Commit Message

Pierre-Marie de Rodat June 18, 2021, 8:38 a.m. UTC
Detection of overlapping actuals doesn't need to be special-cased for
prefix notation, because it is done after prefixed calls have been
rewritten into ordinary calls, both in normal compilation and semantic
checking mode (with switch -gnatc).

Behaviour is unaffected; the removed code was dead.

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

gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Remove dead branch
	for overlapping actuals in prefix notation.
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
@@ -3839,45 +3839,15 @@  package body Sem_Warn is
 
                        or else Error_To_Warning;
 
-                     --  If the call was written in prefix notation, and thus
-                     --  its prefix before rewriting was a selected component,
-                     --  count only visible actuals in call.
-
-                     if Is_Entity_Name (First_Actual (N))
-                       and then Nkind (Original_Node (N)) = Nkind (N)
-                       and then Nkind (Name (Original_Node (N))) =
-                                                     N_Selected_Component
-                       and then
-                         Is_Entity_Name (Prefix (Name (Original_Node (N))))
-                       and then
-                         Entity (Prefix (Name (Original_Node (N)))) =
-                           Entity (First_Actual (N))
-                     then
-                        if Act1 = First_Actual (N) then
-                           Error_Msg_FE
-                             ("<I<`IN OUT` prefix overlaps with "
-                              & "actual for&", Act1, Form2);
-
-                        else
-                           --  For greater clarity, give name of formal
-
-                           Error_Msg_Node_2 := Form2;
-                           Error_Msg_FE
-                             ("<I<writable actual for & overlaps with "
-                              & "actual for&", Act1, Form2);
-                        end if;
-
-                     else
-                        --  For greater clarity, give name of formal
+                     --  For greater clarity, give name of formal
 
-                        Error_Msg_Node_2 := Form2;
+                     Error_Msg_Node_2 := Form2;
 
-                        --  This is one of the messages
+                     --  This is one of the messages
 
-                        Error_Msg_FE
-                          ("<I<writable actual for & overlaps with "
-                           & "actual for&", Act1, Form1);
-                     end if;
+                     Error_Msg_FE
+                       ("<I<writable actual for & overlaps with actual for &",
+                        Act1, Form1);
                   end if;
                end if;
             end if;