From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 19B433A7704B for ; Wed, 28 Apr 2021 09:41:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19B433A7704B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B8B7E5613B; Wed, 28 Apr 2021 05:41:39 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xvx7fsZHqnB6; Wed, 28 Apr 2021 05:41:39 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 940775613E; Wed, 28 Apr 2021 05:41:39 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 934CB12D; Wed, 28 Apr 2021 05:41:39 -0400 (EDT) Date: Wed, 28 Apr 2021 05:41:39 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Remove double initialization of interpretation tables Message-ID: <20210428094139.GA139713@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Wed, 28 Apr 2021 09:41:44 -0000 --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Global variable Sem_Type.Headers, which is used in type resolution, was initialized twice: by elaboration and by Init_Interp_Tables (called by Gnat1drv). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * fmap.ads (Reset_Tables): Remove outdated references to GNSA/ASIS. * sem_eval.ads (Initialize): Likewise. * sem_type.adb (Headers): Remove initialization at elaboration. * sem_type.ads (Init_Interp_Tables): Remove outdated reference to gnatf. * stringt.ads (Initialize): Fix style in comment. --ZGiS0Q5IWpPtfppv Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/fmap.ads b/gcc/ada/fmap.ads --- a/gcc/ada/fmap.ads +++ b/gcc/ada/fmap.ads @@ -68,10 +68,7 @@ package Fmap is -- mapping file whose file name is File_Name. procedure Reset_Tables; - -- Initialize all the internal data structures. This procedure is used - -- when several compilations are performed by the same process (by GNSA - -- for ASIS, for example) to remove any existing mappings from a previous - -- compilation. + -- Initialize all the internal data structures procedure Add_Forbidden_File_Name (Name : File_Name_Type); -- Indicate that a source file name is forbidden. This is used when there diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads --- a/gcc/ada/sem_eval.ads +++ b/gcc/ada/sem_eval.ads @@ -556,8 +556,7 @@ package Sem_Eval is -- messages must always point to the same location as the parent message. procedure Initialize; - -- Initializes the internal data structures. Must be called before each - -- separate main program unit (e.g. in a GNSA/ASIS context). + -- Initializes the internal data structures private -- The Eval routines are all marked inline, since they are called once diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -97,7 +97,7 @@ package body Sem_Type is Header_Size : constant Int := 2 ** 12; No_Entry : constant Int := -1; - Headers : array (0 .. Header_Size) of Int := (others => No_Entry); + Headers : array (0 .. Header_Size) of Int; package Interp_Map is new Table.Table ( Table_Component_Type => Interp_Ref, diff --git a/gcc/ada/sem_type.ads b/gcc/ada/sem_type.ads --- a/gcc/ada/sem_type.ads +++ b/gcc/ada/sem_type.ads @@ -94,7 +94,7 @@ package Sem_Type is ----------------- procedure Init_Interp_Tables; - -- Invoked by gnatf when processing multiple files + -- Initialize data structures for overload resolution procedure Collect_Interps (N : Node_Id); -- Invoked when the name N has more than one visible interpretation. This diff --git a/gcc/ada/stringt.ads b/gcc/ada/stringt.ads --- a/gcc/ada/stringt.ads +++ b/gcc/ada/stringt.ads @@ -56,7 +56,7 @@ package Stringt is -------------------------------------- procedure Initialize; - -- Initializes the strings table for a new compilation. + -- Initializes the strings table for a new compilation procedure Lock; -- Lock internal tables before calling back end --ZGiS0Q5IWpPtfppv--