The formal and actual parameters in a subprogram call must match each other.
This is now checked with assertion (so that we can detect possible mistakes),
while the production builds have less work to do. Semantics unchanged.

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

2018-05-25  Piotr Trojanek  <troja...@adacore.com>

gcc/ada/

        * sem_util.adb (Iterate_Call_Parameters): Rewrite with extra
        assertions; replace function versions of Next_Formal/Next_Actual with
        their procedural versions (which are more concise).
--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -17882,11 +17882,14 @@ package body Sem_Util is
       Actual : Node_Id   := First_Actual (Call);
 
    begin
-      while Present (Formal) and then Present (Actual) loop
+      while Present (Formal) loop
+         pragma Assert (Present (Formal));
          Handle_Parameter (Formal, Actual);
-         Formal := Next_Formal (Formal);
-         Actual := Next_Actual (Actual);
+         Next_Formal (Formal);
+         Next_Actual (Actual);
       end loop;
+
+      pragma Assert (No (Actual));
    end Iterate_Call_Parameters;
 
    ---------------------------

Reply via email to