public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [Ada] Remove double initialization of interpretation tables
Date: Wed, 28 Apr 2021 05:41:39 -0400	[thread overview]
Message-ID: <20210428094139.GA139713@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2517 bytes --]

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



                 reply	other threads:[~2021-04-28  9:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210428094139.GA139713@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).