]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify redundant checks for non-empty lists
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 27 May 2021 15:16:34 +0000 (17:16 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 8 Jul 2021 13:34:20 +0000 (13:34 +0000)
gcc/ada/

* sem_ch12.adb, sem_ch6.adb, sem_ch9.adb, sprint.adb: Simplify
checks for non-empty lists.

gcc/ada/sem_ch12.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch9.adb
gcc/ada/sprint.adb

index bf51ce9e7e12ee3a52fadc5270dab25af42ebdaa..85c854f19f387887b2b28e3ea8d1f19d6bbd2352 100644 (file)
@@ -9724,7 +9724,6 @@ package body Sem_Ch12 is
 
          if Nkind (Par_N) = N_Package_Specification
            and then Decls = Visible_Declarations (Par_N)
-           and then Present (Private_Declarations (Par_N))
            and then not Is_Empty_List (Private_Declarations (Par_N))
          then
             Decls := Private_Declarations (Par_N);
index 75e5a99c1324e87933d3bf12ecc5e41a46577b06..fbb2b55926a3663ee8fa7caaf0a2bf7b0ea102a1 100644 (file)
@@ -549,7 +549,6 @@ package body Sem_Ch6 is
             else
                if Nkind (Par) = N_Package_Specification
                  and then Decls = Visible_Declarations (Par)
-                 and then Present (Private_Declarations (Par))
                  and then not Is_Empty_List (Private_Declarations (Par))
                then
                   Decls := Private_Declarations (Par);
index 65f48a71b08cae14cd8c92c617e8c8237acb2a7b..ab25dd0143a929197c8cf57007f7b7487855ef67 100644 (file)
@@ -1955,9 +1955,7 @@ package body Sem_Ch9 is
       Tasking_Used := True;
       Analyze_Declarations (Visible_Declarations (N));
 
-      if Present (Private_Declarations (N))
-        and then not Is_Empty_List (Private_Declarations (N))
-      then
+      if not Is_Empty_List (Private_Declarations (N)) then
          Last_Id := Last_Entity (Prot_Typ);
          Analyze_Declarations (Private_Declarations (N));
 
index 446792911ddd3ae24596f5293c23b29c56564f13..c1f1edecd80da652b3c17ca863e8be2fcee65383 100644 (file)
@@ -1065,16 +1065,12 @@ package body Sprint is
                if Present (Expressions (Node)) then
                   Sprint_Comma_List (Expressions (Node));
 
-                  if Present (Component_Associations (Node))
-                    and then not Is_Empty_List (Component_Associations (Node))
-                  then
+                  if not Is_Empty_List (Component_Associations (Node)) then
                      Write_Str (", ");
                   end if;
                end if;
 
-               if Present (Component_Associations (Node))
-                 and then not Is_Empty_List (Component_Associations (Node))
-               then
+               if not Is_Empty_List (Component_Associations (Node)) then
                   Indent_Begin;
 
                   declare