summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:42:20 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:42:20 +0000
commite7e688ddb985f3538b2b821dfc2a7387faff071f (patch)
tree781d59ae00b077715bca0d62ce1d0e3e26fa5570 /gcc/ada/sem_disp.adb
parentda336b70c58a7eae86b0edd97c183503c25a9dd0 (diff)
downloadgcc-e7e688ddb985f3538b2b821dfc2a7387faff071f.tar.gz
2007-09-26 Javier Miranda <miranda@adacore.com>
Eric Botcazou <ebotcazou@adacore.com> * a-tags.adb: (Get_HT_Link/Set_HT_Link): Updated to handle the additional level of indirection added to the HT_Link component of the TSD. This is required to statically allocate the TSD. * a-tags.ads: Minor reordering of the declarations in the private part. Required to add a level of indirection to the contents of the TSD component HT_Link. This is required to statically allocate the TSD. * decl.c (gnat_to_gnu_entity) <object>: Do not exclude objects with Is_Statically_Allocated set from constant objects. Do not make exported constants created by the compiler volatile. (gnat_to_gnu_param): Do not treat an IN parameter whose address is taken as read-only. * trans.c (Identifier_to_gnu): For constants, unshare initializers before returning them. * exp_disp.ads, exp_disp.adb (Building_Static_DT): Spec moved to the public part of the package. (Make_DT): Move HT_Link component out of the TSD record. For this purpose Make_DT now declares a separate object that stores the HT_Link value, and initializes the TSD component with the address of this new object. The addition of this level of indirection is required to statically allocate the TSD because the TSD cannot have variable components. (Expand_Interface_Conversion): Improve the expanded code. (Expand_Interface_Thunk): Set Is_Thunk in the thunk entity. * sem_disp.adb (Check_Dispatching_Operation): In case of a body declaring a primitive operation ---allowed by RM 3.9.2 (13.e/2)---, if we are building static dispatch tables then we must not generate extra code to register the primitive because the dispatch table will be built at the end of the library package; otherwise we notify that we cannot build the static dispatch table. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb25
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 9862f7a64b9..5924039e6f9 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -740,9 +740,27 @@ package body Sem_Disp is
Set_DT_Position (Subp, DT_Position (Old_Subp));
if not Restriction_Active (No_Dispatching_Calls) then
- Register_Primitive (Sloc (Subp_Body),
- Prim => Subp,
- Ins_Nod => Subp_Body);
+ if Building_Static_DT (Tagged_Type) then
+
+ -- If the static dispatch table has not been
+ -- built then there is nothing else to do now;
+ -- otherwise we notify that we cannot build the
+ -- static dispatch table.
+
+ if Has_Dispatch_Table (Tagged_Type) then
+ Error_Msg_N
+ ("overriding of& is too late for building" &
+ " static dispatch tables!", Subp);
+ Error_Msg_N
+ ("\spec should appear immediately after" &
+ " the type!", Subp);
+ end if;
+
+ else
+ Register_Primitive (Sloc (Subp_Body),
+ Prim => Subp,
+ Ins_Nod => Subp_Body);
+ end if;
end if;
end if;
end if;
@@ -789,6 +807,7 @@ package body Sem_Disp is
if Present (Old_Subp) then
Check_Subtype_Conformant (Subp, Old_Subp);
+
if (Chars (Subp) = Name_Initialize
or else Chars (Subp) = Name_Adjust
or else Chars (Subp) = Name_Finalize)