2014-02-20 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Feb 2014 13:44:20 +0000 (13:44 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Feb 2014 13:44:20 +0000 (13:44 +0000)
* sem_elab.adb: Minor code reorganization (use Nkind_In).
* stringt.adb: Remove temporary pragma Warnings (Off).
* stringt.ads: Add pragma Elaborate_Body to ensure initialization
of Null_String_Id.

2014-02-20  Matthew Heaney  <heaney@adacore.com>

* a-chtgbk.adb (Replace): Use correct offset when calculating bucket
index.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207944 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/a-chtgbk.adb
gcc/ada/sem_elab.adb
gcc/ada/stringt.adb
gcc/ada/stringt.ads

index 9882be7..9d12879 100644 (file)
@@ -1,3 +1,15 @@
+2014-02-20  Robert Dewar  <dewar@adacore.com>
+
+       * sem_elab.adb: Minor code reorganization (use Nkind_In).
+       * stringt.adb: Remove temporary pragma Warnings (Off).
+       * stringt.ads: Add pragma Elaborate_Body to ensure initialization
+       of Null_String_Id.
+
+2014-02-20  Matthew Heaney  <heaney@adacore.com>
+
+       * a-chtgbk.adb (Replace): Use correct offset when calculating bucket
+       index.
+
 2014-02-20  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch5.adb (Analyze_Iterator_Specification): Initialize
index 13082c9..5f6bfa0 100644 (file)
@@ -275,6 +275,13 @@ package body Ada.Containers.Hash_Tables.Generic_Bounded_Keys is
       --  Per AI05-0022, the container implementation is required to detect
       --  element tampering by a generic actual subprogram.
 
+      --  The following block appears to be vestigial -- this should be done
+      --  using Checked_Index instead. Also, we might have to move the actual
+      --  tampering checks to the top of the subprogram, in order to prevent
+      --  infinite recursion when calling Hash. (This is similar to how Insert
+      --  and Delete are implemented.) This implies that we will have to defer
+      --  the computation of New_Index until after the tampering check. ???
+
       declare
          B : Natural renames HT.Busy;
          L : Natural renames HT.Lock;
@@ -282,7 +289,7 @@ package body Ada.Containers.Hash_Tables.Generic_Bounded_Keys is
          B := B + 1;
          L := L + 1;
 
-         Old_Indx := Hash (NN (Node)) mod HT.Buckets'Length;
+         Old_Indx := HT.Buckets'First + Hash (NN (Node)) mod HT.Buckets'Length;
 
          B := B - 1;
          L := L - 1;
index 5ab711d..9b8a3b2 100644 (file)
@@ -1553,11 +1553,9 @@ package body Sem_Elab is
       --  then there is nothing to do (we do not know what is being assigned),
       --  but otherwise this is an assignment to the prefix.
 
-      if Nkind (N) = N_Indexed_Component
-           or else
-         Nkind (N) = N_Selected_Component
-           or else
-         Nkind (N) = N_Slice
+      if Nkind_In (N, N_Indexed_Component,
+                      N_Selected_Component,
+                      N_Slice)
       then
          if not Is_Access_Type (Etype (Prefix (N))) then
             Check_Elab_Assign (Prefix (N));
index 62a4dd5..6afba04 100644 (file)
@@ -474,8 +474,6 @@ package body Stringt is
 
 --  Setup the null string
 
-pragma Warnings (Off); -- kill strange warning from code below ???
-
 begin
    Start_String;
    Null_String_Id := End_String;
index 864690d..92b74e2 100644 (file)
@@ -33,6 +33,8 @@ with System; use System;
 with Types;  use Types;
 
 package Stringt is
+   pragma Elaborate_Body;
+   --  This is to make sure Null_String_Id is properly initialized
 
 --  This package contains routines for handling the strings table which is
 --  used to store string constants encountered in the source, and also those