diff mbox series

[Ada] Improve building of untagged equality

Message ID 20220516084301.GA3843444@adacore.com
State New
Headers show
Series [Ada] Improve building of untagged equality | expand

Commit Message

Pierre-Marie de Rodat May 16, 2022, 8:43 a.m. UTC
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.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

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

Patch

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
@@ -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);