aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-02-25 16:35:36 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-25 16:35:36 +0100
commit80c2c20282aae97e232df885461b828d5d6573b0 (patch)
tree80193eba32d9e6b7b50591ca71a891de016291d2 /gcc/ada/sem_util.adb
parent7b27e18398d1feefb4d30dbc127258b703676a17 (diff)
downloadgcc-80c2c20282aae97e232df885461b828d5d6573b0.zip
gcc-80c2c20282aae97e232df885461b828d5d6573b0.tar.gz
gcc-80c2c20282aae97e232df885461b828d5d6573b0.tar.bz2
[multiple changes]
2014-02-25 Robert Dewar <dewar@adacore.com> * errout.adb: Various changes for better msgs for anonmous access subprogram types. * erroutc.ads, erroutc.adb (Buffer_Ends_With): Version with character argument. (Buffer_Remove): Version with character argument. * sem_attr.adb (Resolve_Attribute, case Access): Better handling of mismatching conventions for access-to-subprogram case. * sem_prag.adb (Set_Convention_From_Pragma): Deal with anonymous access types in record. * sem_util.ads, sem_util.adb (Set_Convention): Handle anonymous access types, including in records. 2014-02-25 Doug Rupp <rupp@adacore.com> * sigtramp-ppcvxw.c, sigtramp.h, sigtramp-armvxw.c: Comment enhancements and corrections. 2014-02-25 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: New section "Conventions and Anonymous Access Types" From-SVN: r208143
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ad42534..791bc2e 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -15631,6 +15631,52 @@ package body Sem_Util is
then
Set_Can_Use_Internal_Rep (E, False);
end if;
+
+ -- If E is an object or component, and the type of E is an anonymous
+ -- access type with no convention set, then also set the convention of
+ -- the anonymous access type. We do not do this for anonymous protected
+ -- types, since protected types always have the default convention.
+
+ if Present (Etype (E))
+ and then (Is_Object (E)
+ or else Ekind (E) = E_Component
+
+ -- Allow E_Void (happens for pragma Convention appearing
+ -- in the middle of a record applying to a component)
+
+ or else Ekind (E) = E_Void)
+ then
+ declare
+ Typ : constant Entity_Id := Etype (E);
+
+ begin
+ if Ekind_In (Typ, E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
+ and then not Has_Convention_Pragma (Typ)
+ then
+ Basic_Set_Convention (Typ, Val);
+ Set_Has_Convention_Pragma (Typ);
+
+ -- And for the access subprogram type, deal similarly with the
+ -- designated E_Subprogram_Type if it is also internal (which
+ -- it always is?)
+
+ if Ekind (Typ) = E_Anonymous_Access_Subprogram_Type then
+ declare
+ Dtype : constant Entity_Id := Designated_Type (Typ);
+ begin
+ if Ekind (Dtype) = E_Subprogram_Type
+ and then Is_Itype (Dtype)
+ and then not Has_Convention_Pragma (Dtype)
+ then
+ Basic_Set_Convention (Dtype, Val);
+ Set_Has_Convention_Pragma (Dtype);
+ end if;
+ end;
+ end if;
+ end if;
+ end;
+ end if;
end Set_Convention;
------------------------