This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [arm] Make constructors return this
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Earnshaw <rearnsha at arm dot com>
- Date: Fri, 02 Jul 2004 14:01:15 -0700
- Subject: Re: [arm] Make constructors return this
- Organization: CodeSourcery, LLC
- References: <200407012328.25836.paul@codesourcery.com>
Paul Brook wrote:
The patch below makes full and subobject constructors and destructors return
the object constructed or destroyed, as required by the ARM EABI. It doesn't
yet attempt to use this information.
I've also made the deleting destructor return the address of the deleted
object, simply because I couldn't figure out how to prevent it. This is
technically a violation of the ABI, but I think it's harmless.
It could lead to inferior code, in that the compiler now has to put the
"this" pointer in a register, but it should be otherwise OK. The only
way I can think of to fix it would be to have the cloning machinery
adjust the deleting destructor's return type and then mutate the return
statement to not return a value. That's probably doable, but I don't
think it should block your patch.
Tested with cross to arm-none-elf, and bootstrapped i686-linux.
Ok?
+/* In a contructor or destructor, the point at which all derived class
"constructor"
+ destroying has been done, just before any base class destroying will
+ be done. */
and now it should say "construcing or destroying", presumably?
+ /* We can't use the proper return type here because we run into
+ problems with abiguous bases and covariant returns. */
+ if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype))
Why not do this in the TYPE_FOR_JAVA case as well?
Otherwise, this looks OK, thanks!
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com