Commit 812f574f by Arnaud Charlet

[multiple changes]

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
parent 020e3d02
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> 2009-04-08 Thomas Quinot <quinot@adacore.com>
* sem_ch8.adb: Minor reformatting. * sem_ch8.adb: Minor reformatting.
...@@ -656,6 +656,13 @@ package body Prj.Nmsc is ...@@ -656,6 +656,13 @@ package body Prj.Nmsc is
Source_Paths_Htable.Set (In_Tree.Source_Paths_HT, Path, Id); Source_Paths_Htable.Set (In_Tree.Source_Paths_HT, Path, Id);
end if; 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 -- Add the source to the global list
Src_Data.Next_In_Sources := In_Tree.First_Source; Src_Data.Next_In_Sources := In_Tree.First_Source;
...@@ -806,8 +813,9 @@ package body Prj.Nmsc is ...@@ -806,8 +813,9 @@ package body Prj.Nmsc is
Source := Data.First_Source; Source := Data.First_Source;
Source_Loop : while Source /= No_Source loop Source_Loop : while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
exit Source_Loop when Src_Data.Language = Language; exit Source_Loop when Src_Data.Language = Language;
...@@ -2513,7 +2521,7 @@ package body Prj.Nmsc is ...@@ -2513,7 +2521,7 @@ package body Prj.Nmsc is
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
Src_Data.In_Interfaces := False; Src_Data.In_Interfaces := False;
Source := Src_Data.Next_In_Project; Source := Src_Data.Next_In_Project;
...@@ -2542,7 +2550,8 @@ package body Prj.Nmsc is ...@@ -2542,7 +2550,8 @@ package body Prj.Nmsc is
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
if Src_Data.File = Name then if Src_Data.File = Name then
if not Src_Data.Locally_Removed then if not Src_Data.Locally_Removed then
...@@ -2604,7 +2613,8 @@ package body Prj.Nmsc is ...@@ -2604,7 +2613,8 @@ package body Prj.Nmsc is
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
if not Src_Data.Declared_In_Interfaces then if not Src_Data.Declared_In_Interfaces then
Src_Data.In_Interfaces := False; Src_Data.In_Interfaces := False;
...@@ -2634,8 +2644,10 @@ package body Prj.Nmsc is ...@@ -2634,8 +2644,10 @@ package body Prj.Nmsc is
-- Check that a list of unit names contains only valid names -- Check that a list of unit names contains only valid names
procedure Get_Exceptions (Kind : Source_Kind); procedure Get_Exceptions (Kind : Source_Kind);
-- Comment required ???
procedure Get_Unit_Exceptions (Kind : Source_Kind); procedure Get_Unit_Exceptions (Kind : Source_Kind);
-- Comment required ???
---------------------- ----------------------
-- Check_Unit_Names -- -- Check_Unit_Names --
...@@ -3553,12 +3565,10 @@ package body Prj.Nmsc is ...@@ -3553,12 +3565,10 @@ package body Prj.Nmsc is
Src_Id := Proj_Data.First_Source; Src_Id := Proj_Data.First_Source;
while Src_Id /= No_Source loop while Src_Id /= No_Source loop
declare declare
Src : Source_Data renames Src : Source_Data renames In_Tree.Sources.Table (Src_Id);
In_Tree.Sources.Table (Src_Id);
begin begin
exit when Src.Lang_Kind /= File_Based exit when Src.Lang_Kind /= File_Based
or else Src.Kind /= Spec; or else Src.Kind /= Spec;
Src_Id := Src.Next_In_Project; Src_Id := Src.Next_In_Project;
end; end;
end loop; end loop;
...@@ -7394,16 +7404,16 @@ package body Prj.Nmsc is ...@@ -7394,16 +7404,16 @@ package body Prj.Nmsc is
-- For other language, the source is simply removed. -- For other language, the source is simply removed.
declare declare
Source : Source_Id; Source : Source_Id;
begin begin
Source := Data.First_Source; Source := Data.First_Source;
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin
begin
if Src_Data.Naming_Exception if Src_Data.Naming_Exception
and then Src_Data.Path = No_Path_Information and then Src_Data.Path = No_Path_Information
then then
...@@ -8145,15 +8155,15 @@ package body Prj.Nmsc is ...@@ -8145,15 +8155,15 @@ package body Prj.Nmsc is
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
if Unit /= No_Name if Unit /= No_Name
and then Src_Data.Unit = Unit and then Src_Data.Unit = Unit
and then and then
((Src_Data.Kind = Spec and then Kind = Impl) ((Src_Data.Kind = Spec and then Kind = Impl)
or else or else
(Src_Data.Kind = Impl and then Kind = Spec)) (Src_Data.Kind = Impl and then Kind = Spec))
then then
Other_Part := Source; Other_Part := Source;
...@@ -8481,12 +8491,10 @@ package body Prj.Nmsc is ...@@ -8481,12 +8491,10 @@ package body Prj.Nmsc is
Source := Data.First_Source; Source := Data.First_Source;
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames In_Tree.Sources.Table (Source);
In_Tree.Sources.Table (Source);
begin begin
-- A file that is excluded cannot also be an exception file -- An excluded file cannot also be an exception file name
-- name
if Excluded_Sources_Htable.Get (Src_Data.File) /= if Excluded_Sources_Htable.Get (Src_Data.File) /=
No_File_Found No_File_Found
...@@ -8514,13 +8522,12 @@ package body Prj.Nmsc is ...@@ -8514,13 +8522,12 @@ package body Prj.Nmsc is
Source_Names.Set (K => Src_Data.File, E => Name_Loc); Source_Names.Set (K => Src_Data.File, E => Name_Loc);
-- If this is an Ada exception, record it in table -- If this is an Ada exception, record in table Unit_Exceptions
-- Unit_Exceptions
if Src_Data.Unit /= No_Name then if Src_Data.Unit /= No_Name then
declare declare
Unit_Except : Unit_Exception := Unit_Except : Unit_Exception :=
Unit_Exceptions.Get (Src_Data.Unit); Unit_Exceptions.Get (Src_Data.Unit);
begin begin
Unit_Except.Name := Src_Data.Unit; Unit_Except.Name := Src_Data.Unit;
...@@ -8548,11 +8555,10 @@ package body Prj.Nmsc is ...@@ -8548,11 +8555,10 @@ package body Prj.Nmsc is
while FF /= No_File_Found loop while FF /= No_File_Found loop
OK := False; OK := False;
Source := In_Tree.First_Source; Source := In_Tree.First_Source;
while Source /= No_Source loop while Source /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Source); In_Tree.Sources.Table (Source);
begin begin
if Src_Data.File = FF.File then if Src_Data.File = FF.File then
...@@ -8625,12 +8631,12 @@ package body Prj.Nmsc is ...@@ -8625,12 +8631,12 @@ package body Prj.Nmsc is
while Src_Id /= No_Source loop while Src_Id /= No_Source loop
declare declare
Src_Data : Source_Data renames Src_Data : Source_Data renames
In_Tree.Sources.Table (Src_Id); In_Tree.Sources.Table (Src_Id);
begin begin
if Src_Data.Compiled and then Src_Data.Object_Exists if Src_Data.Compiled and then Src_Data.Object_Exists
and then Project_Extends and then Project_Extends
(Project, Src_Data.Project, In_Tree) (Project, Src_Data.Project, In_Tree)
then then
if Src_Data.Unit = No_Name then if Src_Data.Unit = No_Name then
if Src_Data.Kind = Impl then if Src_Data.Kind = Impl then
...@@ -8656,10 +8662,9 @@ package body Prj.Nmsc is ...@@ -8656,10 +8662,9 @@ package body Prj.Nmsc is
declare declare
Src_Ind : constant Source_File_Index := Src_Ind : constant Source_File_Index :=
Sinput.P.Load_Project_File Sinput.P.Load_Project_File
(Get_Name_String (Get_Name_String
(Src_Data.Path.Name)); (Src_Data.Path.Name));
begin begin
if Sinput.P.Source_File_Is_Subunit if Sinput.P.Source_File_Is_Subunit
(Src_Ind) (Src_Ind)
......
...@@ -857,6 +857,7 @@ package body Prj is ...@@ -857,6 +857,7 @@ package body Prj is
Units_Htable.Reset (Tree.Units_HT); Units_Htable.Reset (Tree.Units_HT);
Files_Htable.Reset (Tree.Files_HT); Files_Htable.Reset (Tree.Files_HT);
Source_Paths_Htable.Reset (Tree.Source_Paths_HT); Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
Unit_Sources_Htable.Reset (Tree.Unit_Sources_HT);
-- Private part table -- Private part table
......
...@@ -696,7 +696,7 @@ package Prj is ...@@ -696,7 +696,7 @@ package Prj is
Object_Exists : Boolean := True; Object_Exists : Boolean := True;
-- True if an object file exists -- 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 -- False if the object file is not use to link executables or included
-- in libraries. -- in libraries.
...@@ -804,6 +804,14 @@ package Prj is ...@@ -804,6 +804,14 @@ package Prj is
Equal => "="); Equal => "=");
-- Mapping of source paths to source ids -- 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); type Verbosity is (Default, Medium, High);
-- Verbosity when parsing GNAT Project Files -- Verbosity when parsing GNAT Project Files
-- Default is default (very quiet, if no errors). -- Default is default (very quiet, if no errors).
...@@ -1464,6 +1472,7 @@ package Prj is ...@@ -1464,6 +1472,7 @@ package Prj is
Units_HT : Units_Htable.Instance; Units_HT : Units_Htable.Instance;
Files_HT : Files_Htable.Instance; Files_HT : Files_Htable.Instance;
Source_Paths_HT : Source_Paths_Htable.Instance; Source_Paths_HT : Source_Paths_Htable.Instance;
Unit_Sources_HT : Unit_Sources_Htable.Instance;
-- Private part -- Private part
......
...@@ -11253,7 +11253,7 @@ package body Sem_Prag is ...@@ -11253,7 +11253,7 @@ package body Sem_Prag is
GNAT_Pragma; GNAT_Pragma;
Check_Arg_Count (1); Check_Arg_Count (1);
Check_Optional_Identifier (Arg1, Name_Entity); Check_Optional_Identifier (Arg1, Name_Entity);
Check_Arg_Is_Local_Name (Arg1); Check_Arg_Is_Library_Level_Local_Name (Arg1);
Id := Expression (Arg1); Id := Expression (Arg1);
Analyze (Id); Analyze (Id);
...@@ -11273,6 +11273,7 @@ package body Sem_Prag is ...@@ -11273,6 +11273,7 @@ package body Sem_Prag is
end if; end if;
Set_Has_Pragma_Thread_Local_Storage (E); Set_Has_Pragma_Thread_Local_Storage (E);
Set_Has_Gigi_Rep_Item (E);
end Thread_Local_Storage; end Thread_Local_Storage;
---------------- ----------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment