public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-480] [Ada] Remove duplicated detection of user-defined equality
Date: Mon, 16 May 2022 08:43:21 +0000 (GMT)	[thread overview]
Message-ID: <20220516084321.B8FDA3857823@sourceware.org> (raw)

https://gcc.gnu.org/g:9a39b25f6f52f6eab159a096551e2576fa0890cd

commit r13-480-g9a39b25f6f52f6eab159a096551e2576fa0890cd
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Mar 8 17:46:26 2022 +0100

    [Ada] Remove duplicated detection of user-defined equality
    
    Cleanup related to handling of user-defined equality in GNATprove.
    
    gcc/ada/
    
            * exp_ch3.adb (User_Defined_Eq): Replace duplicated code with a
            call to Get_User_Defined_Eq.

Diff:
---
 gcc/ada/exp_ch3.adb | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index dfbbc62b4d6..ef53591928b 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -4500,32 +4500,14 @@ package body Exp_Ch3 is
       ---------------------
 
       function User_Defined_Eq (T : Entity_Id) return Entity_Id is
-         Prim : Elmt_Id;
-         Op   : Entity_Id;
+         Op : constant Entity_Id := TSS (T, TSS_Composite_Equality);
 
       begin
-         Op := TSS (T, TSS_Composite_Equality);
-
          if Present (Op) then
             return Op;
+         else
+            return Get_User_Defined_Eq (T);
          end if;
-
-         Prim := First_Elmt (Collect_Primitive_Operations (T));
-         while Present (Prim) loop
-            Op := Node (Prim);
-
-            if Chars (Op) = Name_Op_Eq
-              and then Etype (Op) = Standard_Boolean
-              and then Etype (First_Formal (Op)) = T
-              and then Etype (Next_Formal (First_Formal (Op))) = T
-            then
-               return Op;
-            end if;
-
-            Next_Elmt (Prim);
-         end loop;
-
-         return Empty;
       end User_Defined_Eq;
 
    --  Start of processing for Build_Untagged_Equality


                 reply	other threads:[~2022-05-16  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516084321.B8FDA3857823@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).