This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [arm] Make constructors return this


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]