Commit c6840e83 by Arnaud Charlet

[multiple changes]

2017-04-25  Bob Duff  <duff@adacore.com>

	* sem_ch8.adb (Use_One_Type): If a use_type_clause
	is redundant, set its Used_Operations to empty. This is only
	necessary for use clauses that appear in the parent of a generic
	child unit, because those use clauses get reanalyzed when we
	instantiate the generic, and we don't want the Used_Operations
	carried over from the original context (where it was probably
	not redundant).

2017-04-25  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb: Minor reformatting.

From-SVN: r247169
parent f2a54683
2017-04-25 Bob Duff <duff@adacore.com> 2017-04-25 Bob Duff <duff@adacore.com>
* sem_ch8.adb (Use_One_Type): If a use_type_clause
is redundant, set its Used_Operations to empty. This is only
necessary for use clauses that appear in the parent of a generic
child unit, because those use clauses get reanalyzed when we
instantiate the generic, and we don't want the Used_Operations
carried over from the original context (where it was probably
not redundant).
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch6.adb: Minor reformatting.
2017-04-25 Bob Duff <duff@adacore.com>
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Use Source_Index (Current_Sem_Unit) to find the correct casing. Use Source_Index (Current_Sem_Unit) to find the correct casing.
* exp_prag.adb (Expand_Pragma_Check): Use Source_Index * exp_prag.adb (Expand_Pragma_Check): Use Source_Index
......
...@@ -6635,10 +6635,10 @@ package body Exp_Ch6 is ...@@ -6635,10 +6635,10 @@ package body Exp_Ch6 is
Attribute_Name => Name_Tag); Attribute_Name => Name_Tag);
end if; end if;
if not CodePeer_Mode then -- CodePeer does not do anything useful with
-- CodePeer doesn't do anything useful with -- Ada.Tags.Type_Specific_Data components.
-- Ada.Tags.Type_Specific_Data components
if not CodePeer_Mode then
Insert_Action (Exp, Insert_Action (Exp,
Make_Raise_Program_Error (Loc, Make_Raise_Program_Error (Loc,
Condition => Condition =>
...@@ -6647,7 +6647,7 @@ package body Exp_Ch6 is ...@@ -6647,7 +6647,7 @@ package body Exp_Ch6 is
Right_Opnd => Right_Opnd =>
Make_Integer_Literal (Loc, Make_Integer_Literal (Loc,
Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))), Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))),
Reason => PE_Accessibility_Check_Failed)); Reason => PE_Accessibility_Check_Failed));
end if; end if;
end; end;
......
...@@ -9200,11 +9200,22 @@ package body Sem_Ch8 is ...@@ -9200,11 +9200,22 @@ package body Sem_Ch8 is
("incomplete type from limited view " ("incomplete type from limited view "
& "cannot appear in use clause", Id); & "cannot appear in use clause", Id);
-- If the use clause is redundant, Used_Operations will usually be
-- empty, but we need to set it to empty here in one case: If we are
-- instantiating a generic library unit, then we install the ancestors
-- of that unit in the scope stack, which involves reprocessing use
-- clauses in those ancestors. Such a use clause will typically have a
-- nonempty Used_Operations unless it was redundant in the generic unit,
-- even if it is redundant at the place of the instantiation.
elsif Redundant_Use (Id) then
Set_Used_Operations (Parent (Id), New_Elmt_List);
-- If the subtype mark designates a subtype in a different package, -- If the subtype mark designates a subtype in a different package,
-- we have to check that the parent type is visible, otherwise the -- we have to check that the parent type is visible, otherwise the
-- use type clause is a noop. Not clear how to do that??? -- use type clause is a noop. Not clear how to do that???
elsif not Redundant_Use (Id) then else
Set_In_Use (T); Set_In_Use (T);
-- If T is tagged, primitive operators on class-wide operands -- If T is tagged, primitive operators on class-wide operands
......
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