diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-07-09 15:19:56 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-07-09 15:19:56 +0200 |
commit | d48f3dca79fe7cd124c90d33dcc88b2147e23856 (patch) | |
tree | 1d5c645601721230be583f9182a5db021543e450 /gcc/ada/exp_ch8.adb | |
parent | 22a83cea153e34e826ed42afd56334be89a9ad8e (diff) | |
download | gcc-d48f3dca79fe7cd124c90d33dcc88b2147e23856.zip gcc-d48f3dca79fe7cd124c90d33dcc88b2147e23856.tar.gz gcc-d48f3dca79fe7cd124c90d33dcc88b2147e23856.tar.bz2 |
[multiple changes]
2012-07-09 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb: Extend previous change to elementary types.
2012-07-09 Javier Miranda <miranda@adacore.com>
* exp_ch8.adb (Expand_N_Subprogram_Renaming_Declaration): Reverse
previous patch since unconditionally handling as renaming_as_body
renamings of predefined dispatching equality and unequality operator
cause visibility problems with private overridings of the equality
operator (see ACATS C854001).
2012-07-09 Vincent Pucci <pucci@adacore.com>
* exp_attr.adb (Signal_Bad_Attribute): Raise Program_Error in
case of internal attribute names (already rejected by the parser).
* par-ch13.adb (P_Representation_Clause): Complain if an internal
attribute name that comes from source occurs.
* par-ch4.adb (P_Name): Complain if an internal attribute name
occurs in the context of an attribute reference.
* par-util.adb (Signal_Bad_Attribute): Don't complain about
mispelling attribute with internal attributes.
* sem_attr.adb (Analyze_Attribute): Raise Program_Error in case
of internal attribute names (already rejected by the parser).
* snames.adb-tmpl (Is_Internal_Attribute_Name): New routine.
* snames.ads-tmpl: Attributes CPU, Dispatching_Domain and
Interrupt_Priority are marked as INT attributes since they
don't denote real attribute and are only used internally in
the compiler.
(Is_Internal_Attribute_Name): New routine.
From-SVN: r189378
Diffstat (limited to 'gcc/ada/exp_ch8.adb')
-rw-r--r-- | gcc/ada/exp_ch8.adb | 68 |
1 files changed, 3 insertions, 65 deletions
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb index 3647ceb..b0e525e 100644 --- a/gcc/ada/exp_ch8.adb +++ b/gcc/ada/exp_ch8.adb @@ -300,8 +300,7 @@ package body Exp_Ch8 is -- Handle cases where we build a body for a renamed equality if Is_Entity_Name (Nam) - and then (Chars (Entity (Nam)) = Name_Op_Ne - or else Chars (Entity (Nam)) = Name_Op_Eq) + and then Chars (Entity (Nam)) = Name_Op_Eq and then Scope (Entity (Nam)) = Standard_Standard then declare @@ -315,7 +314,6 @@ package body Exp_Ch8 is -- untagged record type (AI05-0123). if Ada_Version >= Ada_2012 - and then Chars (Entity (Nam)) = Name_Op_Eq and then Is_Record_Type (Typ) and then not Is_Tagged_Type (Typ) and then not Is_Frozen (Typ) @@ -337,71 +335,11 @@ package body Exp_Ch8 is Expand_Record_Equality (Id, Typ => Typ, - Lhs => - Make_Identifier (Loc, Chars (First_Formal (Id))), - Rhs => - Make_Identifier - (Loc, Chars (Next_Formal (First_Formal (Id)))), + Lhs => Make_Identifier (Loc, Chars (Left)), + Rhs => Make_Identifier (Loc, Chars (Right)), Bodies => Declarations (Decl)))))); Append (Decl, List_Containing (N)); - - -- Handle renamings of predefined dispatching equality operators. - -- When we analyze a renaming of the equality operator of a tagged - -- type, the predefined dispatching primitives are not available - -- (since they are added by the expander when the tagged type is - -- frozen) and hence they are left decorated as renamings of the - -- standard non-dispatching operators. Here we generate a body - -- for such renamings which invokes the predefined dispatching - -- equality operator. - - -- Example: - - -- type T is tagged null record; - -- function Eq (X, Y : T1) return Boolean renames "="; - -- function Neq (X, Y : T1) return Boolean renames "/="; - - elsif Is_Record_Type (Typ) - and then Is_Tagged_Type (Typ) - and then Is_Dispatching_Operation (Id) - and then not Is_Dispatching_Operation (Entity (Nam)) - then - pragma Assert (not Is_Frozen (Typ)); - - Decl := Build_Body_For_Renaming; - - -- Clean decoration of intrinsic subprogram - - Set_Is_Intrinsic_Subprogram (Id, False); - Set_Convention (Id, Convention_Ada); - - if Chars (Entity (Nam)) = Name_Op_Ne then - Set_Handled_Statement_Sequence (Decl, - Make_Handled_Sequence_Of_Statements (Loc, - Statements => New_List ( - Make_Simple_Return_Statement (Loc, - Expression => - Make_Op_Not (Loc, - Make_Op_Eq (Loc, - Left_Opnd => - New_Reference_To (Left, Loc), - Right_Opnd => - New_Reference_To (Right, Loc))))))); - - else pragma Assert (Chars (Entity (Nam)) = Name_Op_Eq); - Set_Handled_Statement_Sequence (Decl, - Make_Handled_Sequence_Of_Statements (Loc, - Statements => New_List ( - Make_Simple_Return_Statement (Loc, - Expression => - Make_Op_Eq (Loc, - Left_Opnd => - New_Reference_To (Left, Loc), - Right_Opnd => - New_Reference_To (Right, Loc)))))); - end if; - - Append (Decl, List_Containing (N)); end if; end; end if; |