Commit 45d04cbb by Geert Bosch

sem_ch12.adb (Instantiate_Package_Body): if instance is a compilation unit...

	* sem_ch12.adb (Instantiate_Package_Body): if instance is a compilation
	 unit, always replace instance node with new body, for ASIS use.

	* prj-nmsc.adb (Language_Independent_Check): Issue a warning if
	libraries are not supported and both attributes Library_Name and
	Library_Dir are specified.

	* prj-proc.adb (Expression): Set location of Result to location of
	first term.

	* Makefile.in: Add mlib.o, mlib-fil.o, mlib-tgt and mlib-utl to GNATLS.
	(prj-nmsc is now importing MLib.Tgt)

	* prj-proc.adb: Put the change indicated above that was forgotten.

From-SVN: r47690
parent 89632846
...@@ -489,6 +489,10 @@ GNATLS_OBJS = \ ...@@ -489,6 +489,10 @@ GNATLS_OBJS = \
hostparm.o \ hostparm.o \
krunch.o \ krunch.o \
lib.o \ lib.o \
mlib.o \
mlib-fil.o \
mlib-tgt.o \
mlib-utl.o \
namet.o \ namet.o \
nlists.o \ nlists.o \
opt.o \ opt.o \
......
...@@ -34,6 +34,7 @@ with Errout; use Errout; ...@@ -34,6 +34,7 @@ with Errout; use Errout;
with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with MLib.Tgt;
with Namet; use Namet; with Namet; use Namet;
with Osint; use Osint; with Osint; use Osint;
with Output; use Output; with Output; use Output;
...@@ -1948,6 +1949,12 @@ package body Prj.Nmsc is ...@@ -1948,6 +1949,12 @@ package body Prj.Nmsc is
Data.Library_Name /= No_Name; Data.Library_Name /= No_Name;
if Data.Library then if Data.Library then
if not MLib.Tgt.Libraries_Are_Supported then
Error_Msg ("?libraries are not supported on this platform",
Lib_Name.Location);
else
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line ("This is a library project file"); Write_Line ("This is a library project file");
end if; end if;
...@@ -2005,6 +2012,7 @@ package body Prj.Nmsc is ...@@ -2005,6 +2012,7 @@ package body Prj.Nmsc is
end; end;
end if; end if;
end if; end if;
end if;
end; end;
if Current_Verbosity = High then if Current_Verbosity = High then
......
...@@ -246,7 +246,7 @@ package body Prj.Proc is ...@@ -246,7 +246,7 @@ package body Prj.Proc is
-- Reference to the last string elements in Result, when Kind is List. -- Reference to the last string elements in Result, when Kind is List.
begin begin
Result.Location := Location_Of (From_Project_Node); Result.Location := Location_Of (First_Term);
-- Process each term of the expression, starting with First_Term -- Process each term of the expression, starting with First_Term
...@@ -639,7 +639,6 @@ package body Prj.Proc is ...@@ -639,7 +639,6 @@ package body Prj.Proc is
end case; end case;
The_Term := Next_Term (The_Term); The_Term := Next_Term (The_Term);
end loop; end loop;
return Result; return Result;
......
...@@ -2548,17 +2548,21 @@ package body Sem_Ch12 is ...@@ -2548,17 +2548,21 @@ package body Sem_Ch12 is
Set_Instance_Spec (N, Act_Decl); Set_Instance_Spec (N, Act_Decl);
-- Case of not a compilation unit -- If not a compilation unit, insert the package declaration
-- after the instantiation node.
if Nkind (Parent (N)) /= N_Compilation_Unit then if Nkind (Parent (N)) /= N_Compilation_Unit then
Mark_Rewrite_Insertion (Act_Decl); Mark_Rewrite_Insertion (Act_Decl);
Insert_Before (N, Act_Decl); Insert_Before (N, Act_Decl);
Analyze (Act_Decl); Analyze (Act_Decl);
-- Case of compilation unit that is generic instantiation -- For an instantiation that is a compilation unit, place
-- declaration on current node so context is complete
-- Place declaration on current node so context is complete -- for analysis (including nested instantiations). It this
-- for analysis (including nested instantiations). -- is the main unit, the declaration eventually replaces the
-- instantiation node. If the instance body is later created, it
-- replaces the instance node, and the declation is attached to
-- it (see Build_Instance_Compilation_Unit_Nodes).
else else
if Cunit_Entity (Current_Sem_Unit) = Defining_Entity (N) then if Cunit_Entity (Current_Sem_Unit) = Defining_Entity (N) then
...@@ -3319,6 +3323,13 @@ package body Sem_Ch12 is ...@@ -3319,6 +3323,13 @@ package body Sem_Ch12 is
Set_Library_Unit (Decl_Cunit, Body_Cunit); Set_Library_Unit (Decl_Cunit, Body_Cunit);
Set_Library_Unit (Body_Cunit, Decl_Cunit); Set_Library_Unit (Body_Cunit, Decl_Cunit);
-- If the instance is not the main unit, its context, categorization,
-- and elaboration entity are not relevant to the compilation.
if Parent (N) /= Cunit (Main_Unit) then
return;
end if;
-- The context clause items on the instantiation, which are now -- The context clause items on the instantiation, which are now
-- attached to the body compilation unit (since the body overwrote -- attached to the body compilation unit (since the body overwrote
-- the original instantiation node), semantically belong on the spec, -- the original instantiation node), semantically belong on the spec,
...@@ -6578,11 +6589,15 @@ package body Sem_Ch12 is ...@@ -6578,11 +6589,15 @@ package body Sem_Ch12 is
if Nkind (Parent (Inst_Node)) = N_Compilation_Unit then if Nkind (Parent (Inst_Node)) = N_Compilation_Unit then
if Parent (Inst_Node) = Cunit (Main_Unit) then -- Replace instance node with body of instance, and create
-- new node for corresponding instance declaration.
Build_Instance_Compilation_Unit_Nodes Build_Instance_Compilation_Unit_Nodes
(Inst_Node, Act_Body, Act_Decl); (Inst_Node, Act_Body, Act_Decl);
Analyze (Inst_Node); Analyze (Inst_Node);
if Parent (Inst_Node) = Cunit (Main_Unit) then
-- If the instance is a child unit itself, then set the -- If the instance is a child unit itself, then set the
-- scope of the expanded body to be the parent of the -- scope of the expanded body to be the parent of the
-- instantiation (ensuring that the fully qualified name -- instantiation (ensuring that the fully qualified name
...@@ -6594,10 +6609,6 @@ package body Sem_Ch12 is ...@@ -6594,10 +6609,6 @@ package body Sem_Ch12 is
Set_Scope Set_Scope
(Defining_Entity (Inst_Node), Scope (Act_Decl_Id)); (Defining_Entity (Inst_Node), Scope (Act_Decl_Id));
end if; end if;
else
Set_Parent (Act_Body, Parent (Inst_Node));
Analyze (Act_Body);
end if; end if;
-- Case where instantiation is not a library unit -- Case where instantiation is not a library unit
......
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