From eaed2a2c96e0a214819f7ecc1430a6b4f97465e7 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 24 Mar 2015 13:26:10 +0100 Subject: [PATCH] [multiple changes] 2015-03-24 Gary Dismukes * sem_ch3.adb: Minor typo fix (missing paren). 2015-03-24 Robert Dewar * sinfo.ads: Update comment. 2015-03-24 Robert Dewar * exp_attr.adb: Add entry for typ'Deref. * sem_attr.adb (Deref): New GNAT attribute. * sem_attr.ads: Add entry for new GNAT attribute Deref. * snames.ads-tmpl: Add entries for new attribute Deref. From-SVN: r221630 --- gcc/ada/ChangeLog | 15 +++++++++++++++ gcc/ada/exp_attr.adb | 1 + gcc/ada/sem_attr.adb | 11 +++++++++++ gcc/ada/sem_attr.ads | 19 +++++++++++++++---- gcc/ada/sem_ch3.adb | 2 +- gcc/ada/sinfo.ads | 4 +++- gcc/ada/snames.ads-tmpl | 2 ++ 7 files changed, 48 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e0613e527eb..ca430dc9da3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2015-03-24 Gary Dismukes + + * sem_ch3.adb: Minor typo fix (missing paren). + +2015-03-24 Robert Dewar + + * sinfo.ads: Update comment. + +2015-03-24 Robert Dewar + + * exp_attr.adb: Add entry for typ'Deref. + * sem_attr.adb (Deref): New GNAT attribute. + * sem_attr.ads: Add entry for new GNAT attribute Deref. + * snames.ads-tmpl: Add entries for new attribute Deref. + 2015-03-24 Ed Schonberg * sem_ch13.adb (Rep_Item_Too_Early): allow pragma Convention diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index a4f6f5a8082..d80364634b0 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -7103,6 +7103,7 @@ package body Exp_Attr is when Attribute_Bit_Order | Attribute_Code_Address | Attribute_Definite | + Attribute_Deref | Attribute_Null_Parameter | Attribute_Passed_By_Reference | Attribute_Pool_Address | diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 01b0cd8e885..68901b1adf5 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3540,6 +3540,16 @@ package body Sem_Attr is Check_Floating_Point_Type_0; Set_Etype (N, Standard_Boolean); + ----------- + -- Deref -- + ----------- + + when Attribute_Deref => + Check_Type; + Check_E1; + Resolve (E1, RTE (RE_Address)); + Set_Etype (N, P_Type); + --------------------- -- Descriptor_Size -- --------------------- @@ -9642,6 +9652,7 @@ package body Sem_Attr is Attribute_Count | Attribute_Default_Bit_Order | Attribute_Default_Scalar_Storage_Order | + Attribute_Deref | Attribute_Elaborated | Attribute_Elab_Body | Attribute_Elab_Spec | diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads index c2652211b21..c1e592844fa 100644 --- a/gcc/ada/sem_attr.ads +++ b/gcc/ada/sem_attr.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -42,9 +42,9 @@ package Sem_Attr is -- Implementation Dependent Attributes -- ----------------------------------------- - -- This section describes the implementation dependent attributes - -- provided in GNAT, as well as constructing an array of flags - -- indicating which attributes these are. + -- This section describes the implementation dependent attributes provided + -- in GNAT, as well as constructing an array of flags indicating which + -- attributes these are. Attribute_Impl_Def : Attribute_Class_Array := Attribute_Class_Array'( @@ -152,6 +152,17 @@ package Sem_Attr is -- Default_Scalar_Storage_Order, or equal to Default_Bit_Order if -- unspecified) as a System.Bit_Order value. This is a static attribute. + ----------- + -- Deref -- + ----------- + + Attribute_Deref => True, + -- typ'Deref (expr) is valid only if expr is of type System'Address. + -- The result is an object of type typ that is obtained by treating the + -- address as an access-to-typ value that points to the result. It is + -- basically equivalent to (atyp!expr).all where atyp is an access type + -- for the type. + --------------- -- Elab_Body -- --------------- diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 8a1e1320783..64761f8a61b 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3161,7 +3161,7 @@ package body Sem_Ch3 is and then No (Corresponding_Generic_Association (Parent (Obj_Id))) -- Don't give this for internally generated entities (such as the - -- FIRST and LAST temporaries generated for bounds. + -- FIRST and LAST temporaries generated for bounds). and then Comes_From_Source (Obj_Id) then diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 5f057f236a8..c2a8bf6fbc3 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -827,7 +827,9 @@ package Sinfo is -- setting tag values, etc. N_Object_Declaration nodes also have this -- flag defined. Here it is used to indicate that an initialization -- expression is valid, even where it would normally not be allowed - -- (e.g. where the type involved is limited). + -- (e.g. where the type involved is limited). It is also used to stop + -- a Force_Evaluation call for an unchecked conversion, but this usage + -- is unclear and not documented ??? -- Associated_Node (Node4-Sem) -- Present in nodes that can denote an entity: identifiers, character diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 3781cfccc04..cd9d7f118b6 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -845,6 +845,7 @@ package Snames is Name_Definite : constant Name_Id := N + $; Name_Delta : constant Name_Id := N + $; Name_Denorm : constant Name_Id := N + $; + Name_Deref : constant Name_Id := N + $; -- GNAT Name_Descriptor_Size : constant Name_Id := N + $; Name_Digits : constant Name_Id := N + $; Name_Elaborated : constant Name_Id := N + $; -- GNAT @@ -1476,6 +1477,7 @@ package Snames is Attribute_Definite, Attribute_Delta, Attribute_Denorm, + Attribute_Deref, Attribute_Descriptor_Size, Attribute_Digits, Attribute_Elaborated, -- 2.30.2