diff mbox series

[Ada] Remove unnecessary check for missing parameter specifications

Message ID 20220105113335.GA2714243@adacore.com
State New
Headers show
Series [Ada] Remove unnecessary check for missing parameter specifications | expand

Commit Message

Pierre-Marie de Rodat Jan. 5, 2022, 11:33 a.m. UTC
List iteration with First/Present/Next is safe even for No_List. This
safety is intentional and we rely on it in many places.

Code cleanup; semantics is unaffected.

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

gcc/ada/

	* exp_disp.adb (Gen_Parameters_Profile): Remove redundant guard.
diff mbox series

Patch

diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -8065,19 +8065,17 @@  package body Exp_Disp is
                Out_Present         => True,
                Parameter_Type      => New_Occurrence_Of (Typ, Loc)));
 
-         if Present (Parameter_Specifications (Parent (E))) then
-            P := First (Parameter_Specifications (Parent (E)));
-            while Present (P) loop
-               Append_To (Parms,
-                 Make_Parameter_Specification (Loc,
-                   Defining_Identifier =>
-                     Make_Defining_Identifier (Loc,
-                       Chars => Chars (Defining_Identifier (P))),
-                   Parameter_Type      => New_Copy_Tree (Parameter_Type (P)),
-                   Expression          => New_Copy_Tree (Expression (P))));
-               Next (P);
-            end loop;
-         end if;
+         P := First (Parameter_Specifications (Parent (E)));
+         while Present (P) loop
+            Append_To (Parms,
+              Make_Parameter_Specification (Loc,
+                Defining_Identifier =>
+                  Make_Defining_Identifier (Loc,
+                    Chars => Chars (Defining_Identifier (P))),
+                Parameter_Type      => New_Copy_Tree (Parameter_Type (P)),
+                Expression          => New_Copy_Tree (Expression (P))));
+            Next (P);
+         end loop;
 
          return Parms;
       end Gen_Parameters_Profile;