]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove redundant guard against empty lists
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 29 Mar 2023 07:36:39 +0000 (09:36 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:18 +0000 (09:29 +0200)
There is no need to guard against routine Contains being called on
No_Elist, because it will return False. Code cleanup related to handling
of primitive operations in GNATprove; semantics is unaffected.

gcc/ada/

* sem_prag.adb (Record_Possible_Body_Reference): Remove call to Present.
* sem_util.adb (Find_Untagged_Type_Of): Likewise.

gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb

index 96ea17209f34845db446b221f1e1cea27f5039a2..5363d2bee80b6590badcb445d6b32a7af460e245 100644 (file)
@@ -32644,9 +32644,7 @@ package body Sem_Prag is
          if Nkind (Context) = N_Package_Body then
             Spec_Id := Corresponding_Spec (Context);
 
-            if Present (Abstract_States (Spec_Id))
-              and then Contains (Abstract_States (Spec_Id), State_Id)
-            then
+            if Contains (Abstract_States (Spec_Id), State_Id) then
                if No (Body_References (State_Id)) then
                   Set_Body_References (State_Id, New_Elmt_List);
                end if;
index e11eded398d5a73edb662b77149e87a42b60d7c2..9d12ee71d939dcc0eb94a1ce0cdf5cbba6f66640 100644 (file)
@@ -6524,7 +6524,6 @@ package body Sem_Util is
       begin
          while Present (E) and then E /= Prim loop
             if not Is_Tagged_Type (E)
-              and then Present (Direct_Primitive_Operations (E))
               and then Contains (Direct_Primitive_Operations (E), Prim)
             then
                return E;