From patchwork Thu Dec 2 16:28:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 48395 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A0973857C42 for ; Thu, 2 Dec 2021 16:30:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A0973857C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638462618; bh=gnP3CZrRjusQBLMHS3ucbdJja+ABAlV0PidZii35etY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=oB5jDVgi1fCJfF0Pw7Uf+YLPYwNw3qUYZi+FDFT9dISS70pD5P9Wb4iKkMXx7X45L pL+OEoSwhrAsEtev4OYTLunb2d6MntZvLS/cujGrwFjksQQQR/fMf5F8qxhtj9d+7E wJpiV5QleyvR8EHpQ7ZyQqwqAUMmZbZAUJhCTGIY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id D3636385780E for ; Thu, 2 Dec 2021 16:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3636385780E Received: by mail-wr1-x435.google.com with SMTP id q3so37947032wru.5 for ; Thu, 02 Dec 2021 08:28:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=gnP3CZrRjusQBLMHS3ucbdJja+ABAlV0PidZii35etY=; b=IBa+bL4jEwQLHNJ1gdhW7lUnHj7ZZXXO1Wes/MRt7E8v7MhspB9n84h8nUo3Ujdewr MqidM1QxvGYHWqlnj7Z7Qbc+Y4HEkVp4ucz2XreJil0r6h4E+JWFlFEv0NecW+yO9kV1 XW0QSORkZVLBjyCVdFZLlhdBeoZXA4NIcJHSJz5WoCQ6K+YIa1ZzcvCFPTlf+od++14P IZ1bJiMbKeBg9PjknilkcMFMDoC+vV1bVgSWOBbjK/mF6IqLvWvZLD+NjnPZkVfafK0J a9hjeXKm8Wc6Ef6QMYU7hSFA2CTBJNuBR9bUFp7In5Xt/A4Er1B8jAAY2RF9gLObECY1 R5PA== X-Gm-Message-State: AOAM53264zfgEL9yRlPbpaODXny6JXXzSbrwu/vX6LSB0xwlNj/gaAu+ EwEX4s+fsTjOVYLb7rH0m252vUxlR4qUHA== X-Google-Smtp-Source: ABdhPJywOJ7stvjyu0ExQ9tV+Sgs2SlNl4AlS/4lwBJKy+2785ulxemIkoHykrni8B35pGWq58NSZQ== X-Received: by 2002:adf:ce0e:: with SMTP id p14mr15099510wrn.423.1638462517867; Thu, 02 Dec 2021 08:28:37 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id w4sm209055wrs.88.2021.12.02.08.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 08:28:37 -0800 (PST) Date: Thu, 2 Dec 2021 16:28:36 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] More intuitive names in sanity-checking of derived types Message-ID: <20211202162836.GA2156223@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Routine Check_Derived_Type used generic names for local variables, e.g. Elmt, List, Subp. This patch renames them to be more intuitive, in particular, using Derived_ and Parent_ prefixes for variables related to derived and parent types, respectively. Cleanup related to expansion of dispatching equality for GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Check_Derived_Type): Rename local variables; fix style in comment. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -16369,12 +16369,12 @@ package body Sem_Ch3 is ------------------------ function Check_Derived_Type return Boolean is - E : Entity_Id; - Elmt : Elmt_Id; - List : Elist_Id; - New_Subp : Entity_Id; - Op_Elmt : Elmt_Id; - Subp : Entity_Id; + E : Entity_Id; + Derived_Elmt : Elmt_Id; + Derived_Op : Entity_Id; + Derived_Ops : Elist_Id; + Parent_Elmt : Elmt_Id; + Parent_Op : Entity_Id; begin -- Traverse list of entities in the current scope searching for @@ -16389,7 +16389,7 @@ package body Sem_Ch3 is -- Disable this test if Derived_Type completes an incomplete -- type because in such case more primitives can be added -- later to the list of primitives of Derived_Type by routine - -- Process_Incomplete_Dependents + -- Process_Incomplete_Dependents. return True; end if; @@ -16397,13 +16397,13 @@ package body Sem_Ch3 is Next_Entity (E); end loop; - List := Collect_Primitive_Operations (Derived_Type); - Elmt := First_Elmt (List); + Derived_Ops := Collect_Primitive_Operations (Derived_Type); - Op_Elmt := First_Elmt (Op_List); - while Present (Op_Elmt) loop - Subp := Node (Op_Elmt); - New_Subp := Node (Elmt); + Derived_Elmt := First_Elmt (Derived_Ops); + Parent_Elmt := First_Elmt (Op_List); + while Present (Parent_Elmt) loop + Parent_Op := Node (Parent_Elmt); + Derived_Op := Node (Derived_Elmt); -- At this early stage Derived_Type has no entities with attribute -- Interface_Alias. In addition, such primitives are always @@ -16411,31 +16411,31 @@ package body Sem_Ch3 is -- Therefore, if found we can safely stop processing pending -- entities. - exit when Present (Interface_Alias (Subp)); + exit when Present (Interface_Alias (Parent_Op)); -- Handle hidden entities - if not Is_Predefined_Dispatching_Operation (Subp) - and then Is_Hidden (Subp) + if not Is_Predefined_Dispatching_Operation (Parent_Op) + and then Is_Hidden (Parent_Op) then - if Present (New_Subp) - and then Primitive_Names_Match (Subp, New_Subp) + if Present (Derived_Op) + and then Primitive_Names_Match (Parent_Op, Derived_Op) then - Next_Elmt (Elmt); + Next_Elmt (Derived_Elmt); end if; else - if not Present (New_Subp) - or else Ekind (Subp) /= Ekind (New_Subp) - or else not Primitive_Names_Match (Subp, New_Subp) + if No (Derived_Op) + or else Ekind (Parent_Op) /= Ekind (Derived_Op) + or else not Primitive_Names_Match (Parent_Op, Derived_Op) then return False; end if; - Next_Elmt (Elmt); + Next_Elmt (Derived_Elmt); end if; - Next_Elmt (Op_Elmt); + Next_Elmt (Parent_Elmt); end loop; return True;