aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2007-12-13 11:45:14 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2007-12-13 11:45:14 +0100
commit4b7908862fde84f12ad07d740ba26674726f999d (patch)
tree25f200164d543c2ededaa659887d25abe85ce286
parentd776fae437fced6fa609eada28c91e75010d95ef (diff)
downloadgcc-4b7908862fde84f12ad07d740ba26674726f999d.zip
gcc-4b7908862fde84f12ad07d740ba26674726f999d.tar.gz
gcc-4b7908862fde84f12ad07d740ba26674726f999d.tar.bz2
itypes.ads, itypes.adb (Create_Itype): For access-to-subprogram types...
2007-12-06 Bob Duff <duff@adacore.com> * itypes.ads, itypes.adb (Create_Itype): For access-to-subprogram types, set Can_Use_Internal_Rep appropriately, based on Always_Compatible_Rep_On_Target. From-SVN: r130878
-rw-r--r--gcc/ada/itypes.adb15
-rw-r--r--gcc/ada/itypes.ads54
2 files changed, 39 insertions, 30 deletions
diff --git a/gcc/ada/itypes.adb b/gcc/ada/itypes.adb
index bd63254..125e6e2 100644
--- a/gcc/ada/itypes.adb
+++ b/gcc/ada/itypes.adb
@@ -23,11 +23,12 @@
-- --
------------------------------------------------------------------------------
-with Atree; use Atree;
-with Opt; use Opt;
-with Sem; use Sem;
-with Sinfo; use Sinfo;
-with Stand; use Stand;
+with Atree; use Atree;
+with Opt; use Opt;
+with Sem; use Sem;
+with Sinfo; use Sinfo;
+with Stand; use Stand;
+with Targparm; use Targparm;
package body Itypes is
@@ -67,6 +68,10 @@ package body Itypes is
Set_Is_Frozen (Typ);
end if;
+ if Ekind in Access_Subprogram_Type_Kind then
+ Set_Can_Use_Internal_Rep (Typ, not Always_Compatible_Rep_On_Target);
+ end if;
+
return Typ;
end Create_Itype;
diff --git a/gcc/ada/itypes.ads b/gcc/ada/itypes.ads
index 809ca7e..d677bf9 100644
--- a/gcc/ada/itypes.ads
+++ b/gcc/ada/itypes.ads
@@ -35,9 +35,9 @@ package Itypes is
-- Implicit Types --
--------------------
- -- Implicit types are types and subtypes created by the semantic phase
- -- or the expander to reflect the underlying semantics. These could be
- -- generated by building trees for corresponding declarations and then
+ -- Implicit types (Itypes) are types and subtypes created by the semantic
+ -- phase or the expander to reflect the underlying semantics. These could
+ -- be generated by building trees for corresponding declarations and then
-- analyzing these trees, but there are three reasons for not doing this:
-- 1. The declarations would require more tree nodes
@@ -55,9 +55,9 @@ package Itypes is
-- The type declaration declaring an Itype must be analyzed with checks
-- off because this declaration has not been inserted in the tree (if it
- -- has been then it is not an itype), and hence checks that would be
+ -- has been then it is not an Itype), and hence checks that would be
-- generated during the analysis cannot be inserted in the tree. At any
- -- rate, itype analysis should always be done with checks off, otherwise
+ -- rate, Itype analysis should always be done with checks off, otherwise
-- duplicate checks will most likely be emitted.
-- Unlike types declared explicitly, implicit types are defined on first
@@ -73,16 +73,17 @@ package Itypes is
-- call to New_Copy_Tree is to create a complete duplicate of a tree,
-- as though it had appeared separately in the source), the Itype in
-- question is duplicated as part of the New_Copy_Tree processing.
+
-- As a consequence of this copying mechanism, the association between
- -- itypes and associated nodes must be one-to-one: several itypes must
+ -- Itypes and associated nodes must be one-to-one: several Itypes must
-- not share an associated node. For example, the semantic decoration
- -- of an array aggregate generates several itypes: for each index subtype
+ -- of an array aggregate generates several Itypes: for each index subtype
-- and for the array subtype. The associated node of each index subtype
-- is the corresponding range expression.
- -----------------
- -- Subprograms --
- -----------------
+ ------------------
+ -- Create_Itype --
+ ------------------
function Create_Itype
(Ekind : Entity_Kind;
@@ -91,28 +92,31 @@ package Itypes is
Suffix : Character := ' ';
Suffix_Index : Nat := 0;
Scope_Id : Entity_Id := Current_Scope) return Entity_Id;
- -- Used to create a new Itype.
+ -- Used to create a new Itype
--
- -- Related_Nod is the node for which this Itype was created. It is
- -- set as the Associated_Node_For_Itype of the new itype. The Sloc of
- -- the new Itype is that of this node.
+ -- Related_Nod is the node for which this Itype was created. It is
+ -- set as the Associated_Node_For_Itype of the new Itype. The Sloc of
+ -- the new Itype is that of this node.
--
- -- Related_Id is present only if the implicit type name may be referenced
- -- as a public symbol, and thus needs a unique external name. The name
- -- is created by a call to:
+ -- Related_Id is present only if the implicit type name may be referenced
+ -- as a public symbol, and thus needs a unique external name. The name
+ -- is created by a call to:
--
- -- New_External_Name (Chars (Related_Id), Suffix, Suffix_Index, 'T')
+ -- New_External_Name (Chars (Related_Id), Suffix, Suffix_Index, 'T')
--
- -- If the implicit type does not need an external name, then the
- -- Related_Id parameter is omitted (and hence Empty). In this case
- -- Suffix and Suffix_Index are ignored and the implicit type name is
- -- created by a call to New_Internal_Name ('T').
+ -- If the implicit type does not need an external name, then the
+ -- Related_Id parameter is omitted (and hence Empty). In this case
+ -- Suffix and Suffix_Index are ignored and the implicit type name is
+ -- created by a call to New_Internal_Name ('T').
--
- -- Note that in all cases, the name starts with "T". This is used
- -- to identify implicit types in the error message handling circuits.
+ -- Note that in all cases, the name starts with "T". This is used
+ -- to identify implicit types in the error message handling circuits.
--
-- The Scope_Id parameter specifies the scope of the created type, and
-- is normally the Current_Scope as shown, but can be set otherwise.
+ --
+ -- If Ekind is in Access_Subprogram_Type_Kind, Can_Use_Internal_Rep is set
+ -- True, unless Always_Compatible_Rep_On_Target is True.
---------------------------------
-- Create_Null_Excluding_Itype --
@@ -126,7 +130,7 @@ package Itypes is
-- returns an internal access-subtype declaration of T that has the null
-- exclusion attribute set to True.
--
- -- Usage of null-excluding itypes
+ -- Usage of null-excluding Itypes
-- ------------------------------
--
-- type T1 is access ...