[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 8 Apr 2009 13:29:19 +0000 (15:29 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 8 Apr 2009 13:29:19 +0000 (15:29 +0200)
2009-04-08  Tristan Gingold  <gingold@adacore.com>

* sem_prag.adb: Restrict pragma Thread_Local_Storage to library level
variables.
Set Has_Gigi_Rep_Item flag to TLS variables (to ease gigi work).

2009-04-08  Vincent Celier  <celier@adacore.com>

* prj-nmsc.adb:
(Add_Source): Add the mapping of the unit name to source file name in
the Unit_Sources_HT hash table, if the unit name is not null.

* prj.adb (Reset): Reset hash table Tree.Unit_Sources_HT

* prj.ads (Unit_Sources_Htable): New hash table instantiation
(Project_Tree_Data): New component Unit_Sources_HT

From-SVN: r145728

gcc/ada/ChangeLog
gcc/ada/prj-nmsc.adb
gcc/ada/prj.adb
gcc/ada/prj.ads
gcc/ada/sem_prag.adb

index 3d661230c6bea32b841ae0036293a4dff430ca7a..940337e2e5e67f53b920899fea03917fe9d11291 100644 (file)
@@ -1,3 +1,20 @@
+2009-04-08  Tristan Gingold  <gingold@adacore.com>
+
+       * sem_prag.adb: Restrict pragma Thread_Local_Storage to library level
+       variables.
+       Set Has_Gigi_Rep_Item flag to TLS variables (to ease gigi work).
+
+2009-04-08  Vincent Celier  <celier@adacore.com>
+
+       * prj-nmsc.adb:
+       (Add_Source): Add the mapping of the unit name to source file name in
+       the Unit_Sources_HT hash table, if the unit name is not null.
+
+       * prj.adb (Reset): Reset hash table Tree.Unit_Sources_HT
+
+       * prj.ads (Unit_Sources_Htable): New hash table instantiation
+       (Project_Tree_Data): New component Unit_Sources_HT
+
 2009-04-08  Thomas Quinot  <quinot@adacore.com>
 
        * sem_ch8.adb: Minor reformatting.
index c00a69ae7c9cd142185e41c2c1acdb602b35fd92..3c2d5d8a20e5c5151508cb6b170b851cf038334d 100644 (file)
@@ -656,6 +656,13 @@ package body Prj.Nmsc is
          Source_Paths_Htable.Set (In_Tree.Source_Paths_HT, Path, Id);
       end if;
 
+      --  Add the source id to the Unit_Sources_HT hash table, if the unit name
+      --  is not null.
+
+      if Unit /= No_Name then
+         Unit_Sources_Htable.Set (In_Tree.Unit_Sources_HT, Unit, Id);
+      end if;
+
       --  Add the source to the global list
 
       Src_Data.Next_In_Sources := In_Tree.First_Source;
@@ -806,8 +813,9 @@ package body Prj.Nmsc is
                   Source := Data.First_Source;
                   Source_Loop : while Source /= No_Source loop
                      declare
-                        Src_Data      : Source_Data renames
-                          In_Tree.Sources.Table (Source);
+                        Src_Data : Source_Data renames
+                                     In_Tree.Sources.Table (Source);
+
                      begin
                         exit Source_Loop when Src_Data.Language = Language;
 
@@ -2513,7 +2521,7 @@ package body Prj.Nmsc is
             while Source /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Source);
+                               In_Tree.Sources.Table (Source);
                begin
                   Src_Data.In_Interfaces := False;
                   Source := Src_Data.Next_In_Project;
@@ -2542,7 +2550,8 @@ package body Prj.Nmsc is
                while Source /= No_Source loop
                   declare
                      Src_Data : Source_Data renames
-                       In_Tree.Sources.Table (Source);
+                                  In_Tree.Sources.Table (Source);
+
                   begin
                      if Src_Data.File = Name then
                         if not Src_Data.Locally_Removed then
@@ -2604,7 +2613,8 @@ package body Prj.Nmsc is
             while Source /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Source);
+                               In_Tree.Sources.Table (Source);
+
                begin
                   if not Src_Data.Declared_In_Interfaces then
                      Src_Data.In_Interfaces := False;
@@ -2634,8 +2644,10 @@ package body Prj.Nmsc is
       --  Check that a list of unit names contains only valid names
 
       procedure Get_Exceptions (Kind : Source_Kind);
+      --  Comment required ???
 
       procedure Get_Unit_Exceptions (Kind : Source_Kind);
+      --  Comment required ???
 
       ----------------------
       -- Check_Unit_Names --
@@ -3553,12 +3565,10 @@ package body Prj.Nmsc is
                Src_Id := Proj_Data.First_Source;
                while Src_Id /= No_Source loop
                   declare
-                     Src       : Source_Data renames
-                       In_Tree.Sources.Table (Src_Id);
+                     Src : Source_Data renames In_Tree.Sources.Table (Src_Id);
                   begin
                      exit when Src.Lang_Kind /= File_Based
                        or else Src.Kind /= Spec;
-
                      Src_Id := Src.Next_In_Project;
                   end;
                end loop;
@@ -7394,16 +7404,16 @@ package body Prj.Nmsc is
          --  For other language, the source is simply removed.
 
          declare
-            Source   : Source_Id;
+            Source : Source_Id;
 
          begin
             Source := Data.First_Source;
             while Source /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Source);
-               begin
+                               In_Tree.Sources.Table (Source);
 
+               begin
                   if Src_Data.Naming_Exception
                     and then Src_Data.Path = No_Path_Information
                   then
@@ -8145,15 +8155,15 @@ package body Prj.Nmsc is
             while Source /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Source);
+                               In_Tree.Sources.Table (Source);
 
                begin
                   if Unit /= No_Name
                     and then Src_Data.Unit = Unit
                     and then
                       ((Src_Data.Kind = Spec and then Kind = Impl)
-                       or else
-                         (Src_Data.Kind = Impl and then Kind = Spec))
+                         or else
+                       (Src_Data.Kind = Impl and then Kind = Spec))
                   then
                      Other_Part := Source;
 
@@ -8481,12 +8491,10 @@ package body Prj.Nmsc is
          Source := Data.First_Source;
          while Source /= No_Source loop
             declare
-               Src_Data : Source_Data renames
-                 In_Tree.Sources.Table (Source);
+               Src_Data : Source_Data renames In_Tree.Sources.Table (Source);
 
             begin
-               --  A file that is excluded cannot also be an exception file
-               --  name
+               --  An excluded file cannot also be an exception file name
 
                if Excluded_Sources_Htable.Get (Src_Data.File) /=
                  No_File_Found
@@ -8514,13 +8522,12 @@ package body Prj.Nmsc is
 
                Source_Names.Set (K => Src_Data.File, E => Name_Loc);
 
-               --  If this is an Ada exception, record it in table
-               --  Unit_Exceptions
+               --  If this is an Ada exception, record in table Unit_Exceptions
 
                if Src_Data.Unit /= No_Name then
                   declare
                      Unit_Except : Unit_Exception :=
-                       Unit_Exceptions.Get (Src_Data.Unit);
+                                     Unit_Exceptions.Get (Src_Data.Unit);
 
                   begin
                      Unit_Except.Name := Src_Data.Unit;
@@ -8548,11 +8555,10 @@ package body Prj.Nmsc is
          while FF /= No_File_Found loop
             OK     := False;
             Source := In_Tree.First_Source;
-
             while Source /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Source);
+                               In_Tree.Sources.Table (Source);
 
                begin
                   if Src_Data.File = FF.File then
@@ -8625,12 +8631,12 @@ package body Prj.Nmsc is
             while Src_Id /= No_Source loop
                declare
                   Src_Data : Source_Data renames
-                    In_Tree.Sources.Table (Src_Id);
+                               In_Tree.Sources.Table (Src_Id);
 
                begin
                   if Src_Data.Compiled and then Src_Data.Object_Exists
                     and then Project_Extends
-                      (Project, Src_Data.Project, In_Tree)
+                               (Project, Src_Data.Project, In_Tree)
                   then
                      if Src_Data.Unit = No_Name then
                         if Src_Data.Kind = Impl then
@@ -8656,10 +8662,9 @@ package body Prj.Nmsc is
 
                                  declare
                                     Src_Ind : constant Source_File_Index :=
-                                      Sinput.P.Load_Project_File
-                                        (Get_Name_String
-                                             (Src_Data.Path.Name));
-
+                                                Sinput.P.Load_Project_File
+                                                 (Get_Name_String
+                                                   (Src_Data.Path.Name));
                                  begin
                                     if Sinput.P.Source_File_Is_Subunit
                                       (Src_Ind)
index 505e2dad3d14b3425987a528200681e47dbedc1a..ca804d9b0a86a066c6326ffe1c2b2e4fdb719a25 100644 (file)
@@ -857,6 +857,7 @@ package body Prj is
       Units_Htable.Reset            (Tree.Units_HT);
       Files_Htable.Reset            (Tree.Files_HT);
       Source_Paths_Htable.Reset     (Tree.Source_Paths_HT);
+      Unit_Sources_Htable.Reset     (Tree.Unit_Sources_HT);
 
       --  Private part table
 
index 18bbd197aa0364cfdf3b89e587e0734dd4683657..c8ce1773d9965dd59a58191372c12544f6c81377 100644 (file)
@@ -696,7 +696,7 @@ package Prj is
       Object_Exists       : Boolean               := True;
       --  True if an object file exists
 
-      Object_Linked          : Boolean               := True;
+      Object_Linked          : Boolean            := True;
       --  False if the object file is not use to link executables or included
       --  in libraries.
 
@@ -804,6 +804,14 @@ package Prj is
       Equal      => "=");
    --  Mapping of source paths to source ids
 
+   package Unit_Sources_Htable is new Simple_HTable
+     (Header_Num => Header_Num,
+      Element    => Source_Id,
+      No_Element => No_Source,
+      Key        => Name_Id,
+      Hash       => Hash,
+      Equal      => "=");
+
    type Verbosity is (Default, Medium, High);
    --  Verbosity when parsing GNAT Project Files
    --    Default is default (very quiet, if no errors).
@@ -1464,6 +1472,7 @@ package Prj is
          Units_HT          : Units_Htable.Instance;
          Files_HT          : Files_Htable.Instance;
          Source_Paths_HT   : Source_Paths_Htable.Instance;
+         Unit_Sources_HT   : Unit_Sources_Htable.Instance;
 
          --  Private part
 
index cee2069a0304c1e17a50a4c3f317e3d267b66879..fef7407fa2802caab453ba7e062749a5ef8d334e 100644 (file)
@@ -11253,7 +11253,7 @@ package body Sem_Prag is
             GNAT_Pragma;
             Check_Arg_Count (1);
             Check_Optional_Identifier (Arg1, Name_Entity);
-            Check_Arg_Is_Local_Name (Arg1);
+            Check_Arg_Is_Library_Level_Local_Name (Arg1);
 
             Id := Expression (Arg1);
             Analyze (Id);
@@ -11273,6 +11273,7 @@ package body Sem_Prag is
             end if;
 
             Set_Has_Pragma_Thread_Local_Storage (E);
+            Set_Has_Gigi_Rep_Item (E);
          end Thread_Local_Storage;
 
          ----------------