aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-23 08:59:47 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-23 08:59:47 +0200
commit74853971933adc9c021b596d1e574f6851a7165c (patch)
tree7ca867f80e6d89c254fab730b81c4a7fd03ef4e5 /gcc/ada/sem_disp.adb
parente771c08509c5bc959cd8a59aaa15965cfc04a48c (diff)
downloadgcc-74853971933adc9c021b596d1e574f6851a7165c.zip
gcc-74853971933adc9c021b596d1e574f6851a7165c.tar.gz
gcc-74853971933adc9c021b596d1e574f6851a7165c.tar.bz2
[multiple changes]
2010-06-23 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Mark_Coextensions): If the expression in the allocator for a coextension in an object declaration is a concatenation, treat coextension as dynamic. 2010-06-23 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Add_Internal_Interface_Entities): Ensure that the internal entities are added to the scope of the tagged type. (Derive_Subprograms): Do not stop derivation when we find the first internal entity that has attribute Interface_Alias. After the change done to Override_Dispatching_Operations it is no longer true that these primirives are always located at the end of the list of primitives. * einfo.ads (Primitive_Operations): Add documentation. * exp_disp.adb (Write_DT): Improve output adding to the name of the primitive a prefix indicating its corresponding tagged type. * sem_disp.adb (Override_Dispatching_Operations): If the overridden entity covers the primitive of an interface that is not an ancestor of this tagged type then the new primitive is added at the end of the list of primitives. Required to fulfill the C++ ABI. From-SVN: r161253
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 77fcb4f..a21337b 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -784,7 +784,7 @@ package body Sem_Disp is
and then not Comes_From_Source (Subp)
and then not Has_Dispatching_Parent
then
- -- Complete decoration if internally built subprograms that override
+ -- Complete decoration of internally built subprograms that override
-- a dispatching primitive. These entities correspond with the
-- following cases:
@@ -1709,7 +1709,28 @@ package body Sem_Disp is
return;
end if;
- Replace_Elmt (Elmt, New_Op);
+ -- The location of entities that come from source in the list of
+ -- primitives of the tagged type must follow their order of occurrence
+ -- in the sources to fulfill the C++ ABI. If the overriden entity is a
+ -- primitive of an interface that is not an ancestor of this tagged
+ -- type (that is, it is an entity added to the list of primitives by
+ -- Derive_Interface_Progenitors), then we must append the new entity
+ -- at the end of the list of primitives.
+
+ if Present (Alias (Prev_Op))
+ and then Is_Interface (Find_Dispatching_Type (Alias (Prev_Op)))
+ and then not Is_Ancestor (Find_Dispatching_Type (Alias (Prev_Op)),
+ Tagged_Type)
+ then
+ Remove_Elmt (Primitive_Operations (Tagged_Type), Elmt);
+ Append_Elmt (New_Op, Primitive_Operations (Tagged_Type));
+
+ -- The new primitive replaces the overriden entity. Required to ensure
+ -- that overriding primitive is assigned the same dispatch table slot.
+
+ else
+ Replace_Elmt (Elmt, New_Op);
+ end if;
if Ada_Version >= Ada_05
and then Has_Interfaces (Tagged_Type)