Commit 60050a2d by Javier Miranda Committed by Arnaud Charlet

par-load.adb: Load the context items in two rounds.

2005-07-04  Javier Miranda  <miranda@adacore.com>

	* par-load.adb: Load the context items in two rounds.

From-SVN: r101584
parent c6bbcfff
......@@ -87,6 +87,9 @@ procedure Load is
Unum : Unit_Number_Type;
-- Unit number of loaded unit
Limited_With_Found : Boolean := False;
-- Set True if a limited WITH is found, used to ???
function Same_File_Name_Except_For_Case
(Expected_File_Name : File_Name_Type;
Actual_File_Name : File_Name_Type) return Boolean;
......@@ -350,11 +353,34 @@ begin
Reset_Validity_Check_Options;
end if;
-- Loop through context items
-- Load the context items in two rounds: the first round handles normal
-- withed units and the second round handles Ada 2005 limited-withed units.
-- This is required to allow the low-level circuitry that detects circular
-- dependencies of units the correct notification of the following error:
-- limited with D;
-- with D; with C;
-- package C is ... package D is ...
for Round in 1 .. 2 loop
Context_Node := First (Context_Items (Curunit));
while Present (Context_Node) loop
if Nkind (Context_Node) = N_With_Clause then
-- During the first round we check if there is some limited-with
-- context clause; otherwise the second round will be skipped
if Nkind (Context_Node) = N_With_Clause
and then Round = 1
and then Limited_Present (Context_Node)
then
Limited_With_Found := True;
end if;
if Nkind (Context_Node) = N_With_Clause
and then ((Round = 1 and then not Limited_Present (Context_Node))
or else
(Round = 2 and then Limited_Present (Context_Node)))
then
With_Node := Context_Node;
Spec_Name := Get_Unit_Name (With_Node);
......@@ -429,6 +455,9 @@ begin
Next (Context_Node);
end loop;
exit when not Limited_With_Found;
end loop;
-- Restore style/validity check mode for main unit
Set_Style_Check_Options (Save_Style_Checks);
......
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