public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1285] ada: Remove redundant guard against empty lists
@ 2023-05-26  7:37 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-26  7:37 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fa4b7069a0dfd28b58c718cf8b2060df47a39641

commit r14-1285-gfa4b7069a0dfd28b58c718cf8b2060df47a39641
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Mar 29 09:36:39 2023 +0200

    ada: Remove redundant guard against empty lists
    
    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.

Diff:
---
 gcc/ada/sem_prag.adb | 4 +---
 gcc/ada/sem_util.adb | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 96ea17209f3..5363d2bee80 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -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;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index e11eded398d..9d12ee71d93 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:37 [gcc r14-1285] ada: Remove redundant guard against empty lists Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).