[Ada] Improve building of untagged equality
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 8 Mar 2022 16:37:29 +0000 (17:37 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:03 +0000 (08:42 +0000)
When checking components of a record type for their own user-defined
equality function it is enough to find just one such a component.

Cleanup related to handling of user-defined equality in GNATprove.

gcc/ada/

* exp_ch3.adb (Build_Untagged_Equality): Exit early when the
outcome of a loop is already known.

gcc/ada/exp_ch3.adb

index 018f88b..dfbbc62 100644 (file)
@@ -4541,6 +4541,7 @@ package body Exp_Ch3 is
            and then Present (User_Defined_Eq (Etype (Comp)))
          then
             Build_Eq := True;
+            exit;
          end if;
 
          Next_Component (Comp);