summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_disp.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-04 15:07:59 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-04 15:07:59 +0000
commitf235fedee9919b7396c17f2a16f6b8d0f79ee87f (patch)
treed86193b63a1853cbc95c49932831c817706056d6 /gcc/ada/exp_disp.ads
parentdd0cb1e84bfcf364f43051804d39545c8d0c3787 (diff)
downloadgcc-f235fedee9919b7396c17f2a16f6b8d0f79ee87f.tar.gz
2010-10-04 Vincent Celier <celier@adacore.com>
* a-direct.adb (Copy_File): Interpret the Form parameter and call System.OS_Lib.Copy_File to do the work accordingly. Raise Use_Error if the Form parameter contains an incorrect value for field preserve= or mode=. * a-direct.ads (Create_Directory, Create_Path): Indicate that the Form parameter is ignored. (Copy_File): Indicate the interpretation of the Form parameter. 2010-10-04 Vincent Celier <celier@adacore.com> * make.adb (Gnatmake): When there are no foreign languages declared and a main in attribute Main of the main project does not exist or is a source of another project, fail immediately before attempting compilation. 2010-10-04 Javier Miranda <miranda@adacore.com> * exp_disp.ads (Convert_Tag_To_Interface): New function which must be used to convert a node referencing a tag to a class-wide interface type. * exp_disp.adb (Convert_Tag_To_Interface): New function. (Expand_Interface_Conversion): Replace invocation of Unchecked_Conversion by new function Convert_Tag_To_Interface. (Write_DT): Add support for null primitives. * exp_ch3.adb (Expand_N_Object_Declaration): For tagged type objects, cleanup code that handles interface conversions and avoid unchecked conversion of referenced tag components. * exp_ch5.adb (Expand_N_Assignment_Statement): Code cleanup. Avoid unrequired conversions when generating a dispatching call to _assign. * sprint.adb (Write_Itype): Fix wrong output of not null access itypes. 2010-10-04 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Expand_N_Op_Not): Handle properly both operands when the parent is a binary boolean operation and the operand is an unpacked array. (Build_Boolean_Array_Proc_Call): If the operands are both negations, the operands of the rewritten node are the operands of the negations, not the negations themselves. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_disp.ads')
-rw-r--r--gcc/ada/exp_disp.ads27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ada/exp_disp.ads b/gcc/ada/exp_disp.ads
index 5c3796ba410..823693ba492 100644
--- a/gcc/ada/exp_disp.ads
+++ b/gcc/ada/exp_disp.ads
@@ -186,6 +186,33 @@ package Exp_Disp is
-- bodies they are added to the end of the list of declarations of the
-- package body.
+ function Convert_Tag_To_Interface
+ (Typ : Entity_Id; Expr : Node_Id) return Node_Id;
+ pragma Inline (Convert_Tag_To_Interface);
+ -- This function is used in class-wide interface conversions; the expanded
+ -- code generated to convert a tagged object to a class-wide interface type
+ -- involves referencing the tag component containing the secondary dispatch
+ -- table associated with the interface. Given the expression Expr that
+ -- references a tag component, we cannot generate an unchecked conversion
+ -- to leave the expression decorated with the class-wide interface type Typ
+ -- because an unchecked conversion cannot be seen as a no-op. An unchecked
+ -- conversion is conceptually a function call and therefore the RM allows
+ -- the backend to obtain a copy of the value of the actual object and store
+ -- it in some other place (like a register); in such case the interface
+ -- conversion is not equivalent to a displacement of the pointer to the
+ -- interface and any further displacement fails. Although the functionality
+ -- of this function is simple and could be done directly, the purpose of
+ -- this routine is to leave well documented in the sources these
+ -- occurrences.
+
+ -- If Expr is an N_Selected_Component that references a tag generate:
+ -- type ityp is non null access Typ;
+ -- ityp!(Expr'Address).all
+
+ -- if Expr is an N_Function_Call to Ada.Tags.Displace then generate:
+ -- type ityp is non null access Typ;
+ -- ityp!(Expr).all
+
function CPP_Num_Prims (Typ : Entity_Id) return Nat;
-- Return the number of primitives of the C++ part of the dispatch table.
-- For types that are not derivations of CPP types return 0.