From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 6D06B3858435; Mon, 25 Oct 2021 15:08:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D06B3858435 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4678] [Ada] Simplify detection of a parent interface equality X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 6888031123ed16ccf01dd803207362b4500db624 X-Git-Newrev: 9e67eed1efd54d17e863159086048be673e9587e Message-Id: <20211025150846.6D06B3858435@sourceware.org> Date: Mon, 25 Oct 2021 15:08:46 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2021 15:08:46 -0000 https://gcc.gnu.org/g:9e67eed1efd54d17e863159086048be673e9587e commit r12-4678-g9e67eed1efd54d17e863159086048be673e9587e Author: Piotr Trojanek Date: Fri Oct 8 14:45:51 2021 +0200 [Ada] Simplify detection of a parent interface equality gcc/ada/ * exp_ch3.adb (Predefined_Primitive_Bodies): Simplify detection of existing equality operator. Diff: --- gcc/ada/exp_ch3.adb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e8d4326ab8d..00a6b6c630e 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -10972,16 +10972,13 @@ package body Exp_Ch3 is while Present (Prim) loop if Chars (Node (Prim)) = Name_Op_Eq and then not Is_Internal (Node (Prim)) - and then Present (First_Entity (Node (Prim))) -- The predefined equality primitive must have exactly two - -- formals whose type is this tagged type + -- formals whose type is this tagged type. - and then Present (Last_Entity (Node (Prim))) - and then Next_Entity (First_Entity (Node (Prim))) - = Last_Entity (Node (Prim)) - and then Etype (First_Entity (Node (Prim))) = Tag_Typ - and then Etype (Last_Entity (Node (Prim))) = Tag_Typ + and then Number_Formals (Node (Prim)) = 2 + and then Etype (First_Formal (Node (Prim))) = Tag_Typ + and then Etype (Last_Formal (Node (Prim))) = Tag_Typ then Eq_Needed := False; Eq_Name := No_Name;