Commit f691d19f by Arnaud Charlet

[multiple changes]

2012-07-16  Vasiliy Fofanov  <fofanov@adacore.com>

	* ug_words, vms_data.ads: Document VMS qualifiers for -gnatn1/2
	switches.

2012-07-16  Bob Duff  <duff@adacore.com>

	* sinfo.ads: Minor comment fix.

2012-07-16  Bob Duff  <duff@adacore.com>

	* sem_elab.adb (Within_Elaborate_All): Walk the with clauses to
	find pragmas Elaborate_All that may be found in the transitive
	closure of the dependences.

From-SVN: r189517
parent b3408631
2012-07-16 Vasiliy Fofanov <fofanov@adacore.com>
* ug_words, vms_data.ads: Document VMS qualifiers for -gnatn1/2
switches.
2012-07-16 Bob Duff <duff@adacore.com>
* sinfo.ads: Minor comment fix.
2012-07-16 Bob Duff <duff@adacore.com>
* sem_elab.adb (Within_Elaborate_All): Walk the with clauses to
find pragmas Elaborate_All that may be found in the transitive
closure of the dependences.
2012-07-16 Robert Dewar <dewar@adacore.com> 2012-07-16 Robert Dewar <dewar@adacore.com>
* exp_pakd.adb, freeze.adb, sem_util.adb, vms_data.ads: Minor * exp_pakd.adb, freeze.adb, sem_util.adb, vms_data.ads: Minor
......
...@@ -325,11 +325,13 @@ package body Sem_Elab is ...@@ -325,11 +325,13 @@ package body Sem_Elab is
-- Given two scopes E1 and E2, returns True if E1 is equal to E2, or is one -- Given two scopes E1 and E2, returns True if E1 is equal to E2, or is one
-- of its contained scopes, False otherwise. -- of its contained scopes, False otherwise.
function Within_Elaborate_All (E : Entity_Id) return Boolean; function Within_Elaborate_All
-- Before emitting a warning on a scope E for a missing elaborate_all, (Unit : Unit_Number_Type;
-- check whether E may be in the context of a directly visible unit U to E : Entity_Id) return Boolean;
-- which the pragma applies. This prevents spurious warnings when the -- Return True if we are within the scope of an Elaborate_All for E, or if
-- called entity is renamed within U. -- we are within the scope of an Elaborate_All for some other unit U, and U
-- with's E. This prevents spurious warnings when the called entity is
-- renamed within U, or in case of generic instances.
-------------------------------------- --------------------------------------
-- Activate_Elaborate_All_Desirable -- -- Activate_Elaborate_All_Desirable --
...@@ -831,7 +833,7 @@ package body Sem_Elab is ...@@ -831,7 +833,7 @@ package body Sem_Elab is
end loop; end loop;
end if; end if;
if Within_Elaborate_All (E_Scope) then if Within_Elaborate_All (Current_Sem_Unit, E_Scope) then
return; return;
end if; end if;
...@@ -1229,9 +1231,8 @@ package body Sem_Elab is ...@@ -1229,9 +1231,8 @@ package body Sem_Elab is
P := Parent (N); P := Parent (N);
while Present (P) loop while Present (P) loop
if Nkind (P) = N_Parameter_Specification if Nkind_In (P, N_Parameter_Specification,
or else N_Component_Declaration)
Nkind (P) = N_Component_Declaration
then then
return; return;
...@@ -3282,14 +3283,46 @@ package body Sem_Elab is ...@@ -3282,14 +3283,46 @@ package body Sem_Elab is
-- Within_Elaborate_All -- -- Within_Elaborate_All --
-------------------------- --------------------------
function Within_Elaborate_All (E : Entity_Id) return Boolean is function Within_Elaborate_All
(Unit : Unit_Number_Type;
E : Entity_Id) return Boolean
is
type Unit_Number_Set is array (Main_Unit .. Last_Unit) of Boolean;
pragma Pack (Unit_Number_Set);
Seen : Unit_Number_Set := (others => False);
-- Seen (X) is True after we have seen unit X in the walk. This is used
-- to prevent processing the same unit more than once.
Result : Boolean := False;
procedure Helper (Unit : Unit_Number_Type);
-- This helper procedure does all the work for Within_Elaborate_All. It
-- walks the dependency graph, and sets Result to True if it finds an
-- appropriate Elaborate_All.
------------
-- Helper --
------------
procedure Helper (Unit : Unit_Number_Type) is
CU : constant Node_Id := Cunit (Unit);
Item : Node_Id; Item : Node_Id;
Item2 : Node_Id; Item2 : Node_Id;
Elab_Id : Entity_Id; Elab_Id : Entity_Id;
Par : Node_Id; Par : Node_Id;
begin begin
Item := First (Context_Items (Cunit (Current_Sem_Unit))); if Seen (Unit) then
return;
else
Seen (Unit) := True;
end if;
-- First, check for Elaborate_Alls on this unit
Item := First (Context_Items (CU));
while Present (Item) loop while Present (Item) loop
if Nkind (Item) = N_Pragma if Nkind (Item) = N_Pragma
and then Pragma_Name (Item) = Name_Elaborate_All and then Pragma_Name (Item) = Name_Elaborate_All
...@@ -3297,21 +3330,28 @@ package body Sem_Elab is ...@@ -3297,21 +3330,28 @@ package body Sem_Elab is
-- Return if some previous error on the pragma itself -- Return if some previous error on the pragma itself
if Error_Posted (Item) then if Error_Posted (Item) then
return False; return;
end if; end if;
Elab_Id := Elab_Id :=
Entity Entity
(Expression (First (Pragma_Argument_Associations (Item)))); (Expression (First (Pragma_Argument_Associations (Item))));
if E = Elab_Id then
Result := True;
return;
end if;
Par := Parent (Unit_Declaration_Node (Elab_Id)); Par := Parent (Unit_Declaration_Node (Elab_Id));
Item2 := First (Context_Items (Par)); Item2 := First (Context_Items (Par));
while Present (Item2) loop while Present (Item2) loop
if Nkind (Item2) = N_With_Clause if Nkind (Item2) = N_With_Clause
and then Entity (Name (Item2)) = E and then Entity (Name (Item2)) = E
and then not Limited_Present (Item2)
then then
return True; Result := True;
return;
end if; end if;
Next (Item2); Next (Item2);
...@@ -3321,7 +3361,43 @@ package body Sem_Elab is ...@@ -3321,7 +3361,43 @@ package body Sem_Elab is
Next (Item); Next (Item);
end loop; end loop;
return False; -- Second, recurse on with's. We could do this as part of the above
-- loop, but it's probably more efficient to have two loops, because
-- the relevant Elaborate_All is likely to be on the initial unit. In
-- other words, we're walking the with's breadth-first. This part is
-- only necessary in the dynamic elaboration model.
if Dynamic_Elaboration_Checks then
Item := First (Context_Items (CU));
while Present (Item) loop
if Nkind (Item) = N_With_Clause
and then not Limited_Present (Item)
then
-- Note: the following call to Get_Cunit_Unit_Number does a
-- linear search, which could be slow, but it's OK because
-- we're about to give a warning anyway. Also, there might
-- be hundreds of units, but not millions. If it turns out
-- to be a problem, we could store the Get_Cunit_Unit_Number
-- in each N_Compilation_Unit node, but that would involve
-- rearranging N_Compilation_Unit_Aux to make room.
Helper (Get_Cunit_Unit_Number (Library_Unit (Item)));
if Result then
return;
end if;
end if;
Next (Item);
end loop;
end if;
end Helper;
-- Start of processing for Within_Elaborate_All
begin
Helper (Unit);
return Result;
end Within_Elaborate_All; end Within_Elaborate_All;
end Sem_Elab; end Sem_Elab;
...@@ -5796,9 +5796,11 @@ package Sinfo is ...@@ -5796,9 +5796,11 @@ package Sinfo is
-- Unreferenced_In_Spec (Flag7-Sem) -- Unreferenced_In_Spec (Flag7-Sem)
-- No_Entities_Ref_In_Spec (Flag8-Sem) -- No_Entities_Ref_In_Spec (Flag8-Sem)
-- Note: Limited_Present and Limited_View_Installed give support to -- Note: Limited_Present and Limited_View_Installed are used to support
-- Ada 2005 (AI-50217). -- the implementation of Ada 2005 (AI-50217).
-- Similarly, Private_Present gives support to AI-50262.
-- Similarly, Private_Present is used to support the implementation of
-- Ada 2005 (AI-50262).
---------------------- ----------------------
-- With_Type clause -- -- With_Type clause --
...@@ -5806,8 +5808,9 @@ package Sinfo is ...@@ -5806,8 +5808,9 @@ package Sinfo is
-- This is a GNAT extension, used to implement mutually recursive -- This is a GNAT extension, used to implement mutually recursive
-- types declared in different packages. -- types declared in different packages.
-- Note: this is now obsolete. The functionality of this construct -- Note: this is now obsolete. The functionality of this construct
-- is now implemented by the Ada 2005 Limited_with_Clause. -- is now implemented by the Ada 2005 limited_with_clause.
--------------------- ---------------------
-- 10.2 Body stub -- -- 10.2 Body stub --
......
...@@ -84,6 +84,8 @@ gcc -c ^ GNAT COMPILE ...@@ -84,6 +84,8 @@ gcc -c ^ GNAT COMPILE
-gnatm ^ /ERROR_LIMIT -gnatm ^ /ERROR_LIMIT
-gnatm2 ^ /ERROR_LIMIT=2 -gnatm2 ^ /ERROR_LIMIT=2
-gnatn ^ /INLINE=PRAGMA -gnatn ^ /INLINE=PRAGMA
-gnatn1 ^ /INLINE=PRAGMA_LEVEL_1
-gnatn2 ^ /INLINE=PRAGMA_LEVEL_2
-gnatN ^ /INLINE=FULL -gnatN ^ /INLINE=FULL
-gnato ^ /CHECKS=OVERFLOW -gnato ^ /CHECKS=OVERFLOW
-gnatp ^ /CHECKS=SUPPRESS_ALL -gnatp ^ /CHECKS=SUPPRESS_ALL
......
...@@ -1826,8 +1826,13 @@ package VMS_Data is ...@@ -1826,8 +1826,13 @@ package VMS_Data is
-- (/OPTIMIZE=SOME) or higher (/OPTIMIZE=UNROLL_LOOPS) -- (/OPTIMIZE=SOME) or higher (/OPTIMIZE=UNROLL_LOOPS)
-- levels of optimization. -- levels of optimization.
-- --
-- PRAGMA_LEVEL_1/2 not documented ??? -- PRAGMA_LEVEL_1
-- Direct control of the level of "Inline" pragmas
-- optimization with moderate inlining across modules.
-- --
-- PRAGMA_LEVEL_2
-- Direct control of the level of "Inline" pragmas
-- optimization with full inlining across modules.
-- --
-- FULL Front end inlining. The front end inlining activated -- FULL Front end inlining. The front end inlining activated
-- by this switch is generally more extensive, and quite -- by this switch is generally more extensive, and quite
......
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