* [Ada] Remove duplicated detection of user-defined equality
@ 2022-05-16 8:43 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-16 8:43 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Cleanup related to handling of user-defined equality in GNATprove.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch3.adb (User_Defined_Eq): Replace duplicated code with a
call to Get_User_Defined_Eq.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1163 bytes --]
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
--- 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-16 8:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 8:43 [Ada] Remove duplicated detection of user-defined equality Pierre-Marie de Rodat
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).