From 06f6c43f5c0d8df09010ec690b237bc62e3b6d02 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 20 Apr 2016 12:29:26 +0200 Subject: [multiple changes] 2016-04-20 Hristian Kirtchev * sem_ch12.adb (Copy_Generic_Node): Handle the special qualification installed for universal literals that act as operands in binary or unary operators. (Qualify_Operand): Mark the qualification to signal the instantiation mechanism how to handle global reference propagation. * sinfo.adb (Is_Qualified_Universal_Literal): New routine. (Set_Is_Qualified_Universal_Literal): New routine. * sinfo.ads New attribute Is_Qualified_Universal_Literal along with occurrences in nodes. (Is_Qualified_Universal_Literal): New routine along with pragma Inline. (Set_Is_Qualified_Universal_Literal): New routine along with pragma Inline. 2016-04-20 Ed Schonberg * sem.adb (Do_Analyze): Save and restore Style_Max_Line_Length so that the corresponding checks are preserved across compilations that include System.Constants in their context. 2016-04-20 Gary Dismukes * sem_type.adb: Minor typo fix and reformatting. * a-conhel.ads: Update comment. 2016-04-20 Bob Duff * a-cihama.adb, a-cihase.adb, a-coinve.adb (Copy): Rewrite the code so it doesn't trigger an "uninit var" warning. From-SVN: r235256 --- gcc/ada/sem_ch12.adb | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'gcc/ada/sem_ch12.adb') diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index bd7a6a4..e6d5af5 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7293,6 +7293,20 @@ package body Sem_Ch12 is Set_Entity (New_N, Entity (Assoc)); Check_Private_View (N); + -- The node is a reference to a global type and acts as the + -- subtype mark of a qualified expression created in order + -- to aid resolution of accidental overloading in instances. + -- Since N is a reference to a type, the Associated_Node of + -- N denotes an entity rather than another identifier. See + -- Qualify_Universal_Operands for details. + + elsif Nkind (N) = N_Identifier + and then Nkind (Parent (N)) = N_Qualified_Expression + and then Subtype_Mark (Parent (N)) = N + and then Is_Qualified_Universal_Literal (Parent (N)) + then + Set_Entity (New_N, Assoc); + -- The name in the call may be a selected component if the -- call has not been analyzed yet, as may be the case for -- pre/post conditions in a generic unit. @@ -13982,6 +13996,7 @@ package body Sem_Ch12 is Loc : constant Source_Ptr := Sloc (Opnd); Typ : constant Entity_Id := Etype (Actual); Mark : Node_Id; + Qual : Node_Id; begin -- Qualify the operand when it is of a universal type. Note that @@ -14007,10 +14022,19 @@ package body Sem_Ch12 is Mark := Qualify_Type (Loc, Typ); end if; - Rewrite (Opnd, + Qual := Make_Qualified_Expression (Loc, Subtype_Mark => Mark, - Expression => Relocate_Node (Opnd))); + Expression => Relocate_Node (Opnd)); + + -- Mark the qualification to distinguish it from other source + -- constructs and signal the instantiation mechanism that this + -- node requires special processing. See Copy_Generic_Node for + -- details. + + Set_Is_Qualified_Universal_Literal (Qual); + + Rewrite (Opnd, Qual); end if; end Qualify_Operand; -- cgit v1.1