From b2c3160ca56fe11425e80fffff754f206faf9e19 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 8 Sep 2017 11:15:24 +0200 Subject: [PATCH] [multiple changes] 2017-09-08 Bob Duff * sem_ch3.adb (Build_Derived_Private_Type): Inherit representation items from interfaces that the derived type implements, not just from the parent type. * sem_util.ads, sem_util.adb (Abstract_Interface_List): Change this to return an empty list when there are no interfaces. * einfo.ads, sem_ch13.adb: Minor comment fixes. * sem_attr.adb: Minor comment fix. 2017-09-08 Doug Rupp * sigtramp-vxworks.c [i386]: Adjust the kernel context for x86-vx7. 2017-09-08 Hristian Kirtchev * exp_ch4.adb (Expand_N_Allocator): Generate a call to Allocate_Any_Controlled when the allocation does not require any initialization. From-SVN: r251870 --- gcc/ada/ChangeLog | 21 +++++++++++++++++++++ gcc/ada/einfo.ads | 4 ++-- gcc/ada/exp_ch4.adb | 4 +++- gcc/ada/sem_attr.adb | 3 ++- gcc/ada/sem_ch13.adb | 2 +- gcc/ada/sem_ch3.adb | 11 ++++++++++- gcc/ada/sem_util.adb | 7 ++++++- gcc/ada/sem_util.ads | 5 +++-- gcc/ada/sigtramp-vxworks.c | 13 ++++++++++--- 9 files changed, 58 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e4501eae9ed..2631caf70ee 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2017-09-08 Bob Duff + + * sem_ch3.adb (Build_Derived_Private_Type): Inherit + representation items from interfaces that the derived type + implements, not just from the parent type. + * sem_util.ads, sem_util.adb (Abstract_Interface_List): Change + this to return an empty list when there are no interfaces. + * einfo.ads, sem_ch13.adb: Minor comment fixes. + * sem_attr.adb: Minor comment fix. + +2017-09-08 Doug Rupp + + * sigtramp-vxworks.c [i386]: Adjust the kernel context for + x86-vx7. + +2017-09-08 Hristian Kirtchev + + * exp_ch4.adb (Expand_N_Allocator): Generate a + call to Allocate_Any_Controlled when the allocation does not + require any initialization. + 2017-09-08 Hristian Kirtchev * sem_util.adb (Copy_Node_With_Replacement): diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index e83c1c430d4..227055649c1 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -2730,8 +2730,8 @@ package Einfo is -- Is_Interface (Flag186) -- Defined in record types and subtypes. Set to indicate that the current --- entity corresponds with an abstract interface. Because abstract --- interfaces are conceptually a special kind of abstract tagged types +-- entity corresponds to an abstract interface. Because abstract +-- interfaces are conceptually a special kind of abstract tagged type -- we represent them by means of tagged record types and subtypes -- marked with this attribute. This allows us to reuse most of the -- compiler support for abstract tagged types to implement interfaces diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index ce8783742f5..e2e58c97a96 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -4632,7 +4632,9 @@ package body Exp_Ch4 is -- No initialization required else - null; + Build_Allocate_Deallocate_Proc + (N => N, + Is_Allocate => True); end if; -- Case of initialization procedure present, must be called diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 09ca1fd0f7f..641ac87eb9b 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -8199,7 +8199,8 @@ package body Sem_Attr is case Id is - -- Attributes related to Ada 2012 iterators (placeholder ???) + -- Attributes related to Ada 2012 iterators; nothing to evaluate for + -- these. when Attribute_Constant_Indexing | Attribute_Default_Iterator diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 9b97f8f59ac..dea044af528 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -3974,7 +3974,7 @@ package body Sem_Ch13 is procedure Check_Iterator_Functions; -- Check that there is a single function in Default_Iterator attribute - -- has the proper type structure. + -- that has the proper type structure. function Check_Primitive_Function (Subp : Entity_Id) return Boolean; -- Common legality check for the previous two diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 41bf2a8671c..158aa674597 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -9576,9 +9576,18 @@ package body Sem_Ch3 is Set_Has_Predicates (Derived_Type); end if; - -- The derived type inherits the representation clauses of the parent + -- The derived type inherits representation clauses from the parent + -- type, and from any interfaces. Inherit_Rep_Item_Chain (Derived_Type, Parent_Type); + declare + Iface : Node_Id := First (Abstract_Interface_List (Derived_Type)); + begin + while Present (Iface) loop + Inherit_Rep_Item_Chain (Derived_Type, Entity (Iface)); + Next (Iface); + end loop; + end; -- If the parent type has delayed rep aspects, then mark the derived -- type as possibly inheriting a delayed rep aspect. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index f57b7c58208..9deee3bc98f 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -198,12 +198,17 @@ package body Sem_Util is return Abstract_Interface_List (Etype (Typ)); - else pragma Assert ((Ekind (Typ)) = E_Record_Type); + elsif Ekind (Typ) = E_Record_Type then if Nkind (Parent (Typ)) = N_Formal_Type_Declaration then Nod := Formal_Type_Definition (Parent (Typ)); else Nod := Type_Definition (Parent (Typ)); end if; + + -- It's not the kind of type that can implement interfaces + + else + return Empty_List; end if; return Interface_List (Nod); diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 58a362b1584..a7b3487ac26 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -37,8 +37,9 @@ with Urealp; use Urealp; package Sem_Util is function Abstract_Interface_List (Typ : Entity_Id) return List_Id; - -- Given a type that implements interfaces look for its associated - -- definition node and return its list of interfaces. + -- The list of interfaces implemented by Typ. Empty if there are none, + -- including the cases where there can't be any because e.g. the type is + -- not tagged. procedure Add_Access_Type_To_Process (E : Entity_Id; A : Entity_Id); -- Add A to the list of access types to process when expanding the diff --git a/gcc/ada/sigtramp-vxworks.c b/gcc/ada/sigtramp-vxworks.c index e9dd9aa1ce8..211be97e244 100644 --- a/gcc/ada/sigtramp-vxworks.c +++ b/gcc/ada/sigtramp-vxworks.c @@ -6,7 +6,7 @@ * * * Asm Implementation File * * * - * Copyright (C) 2011-2015, Free Software Foundation, Inc. * + * Copyright (C) 2011-2017, 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- * @@ -39,6 +39,9 @@ #include #include #ifndef __RTP__ +#if defined(__i386__) +#include +#endif #include #else #include @@ -127,11 +130,13 @@ void __gnat_sigtramp (int signo, void *si, void *sc, containing a complete REG_SET just before the field 'sc_pregs', this adds a 208 bytes offset to get the value of 'sc_pregs'. * on x86-vx7: the same offset is used on vx7: 3 32-bit values are present - at the enf of the reg set, but the padding is then of 0xc4 characters. + at the end of the reg set, but the padding is then of 0xc4 characters. * on x86_64-vx7: two 64-bit values are added at the beginning of the REG_SET. This adds a 16 bytes offset to get the value of 'sc_pregs', and another 16 bytes offset within the pregs structure to retrieve the registers list. + + * See header file regsSimlinux.h. */ /* Retrieve the registers to restore : */ @@ -141,7 +146,9 @@ void __gnat_sigtramp (int signo, void *si, void *sc, /* move sctx 208 bytes further, so that the vxsim's sc_pregs field coincide with the expected x86 one */ struct sigcontext * sctx = - (struct sigcontext *) (sc + (__gnat_is_vxsim ? 208 : 0)); + (struct sigcontext *) (sc + (__gnat_is_vxsim ? + (_WRS_VXWORKS_MAJOR == 7 ? 204 : 208) + : 0)); #elif defined(__x86_64__) /* move sctx 16 bytes further, so that the vxsim's sc_pregs field coincide with the expected x86_64 one */ -- 2.30.2