This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.2
With this patch, the empty class passing hackery can go away, hurrah.
Yay.
BTW, why do we use stubs for langhook defaults? I would think leaving the
hook entry NULL would be more efficient for languages that are happy with
the default, as a comparison to zero is much cheaper than an indirect
jump...
Well, what I would do is simply move the current expr_size_unit into the
new hook. Then, have the C++ hook call the generic hook if it doesn't
want to override it.
+ tree
+ cp_expr_size (exp)
+ tree exp;
+ {
+ if (CLASS_TYPE_P (TREE_TYPE (exp)))
+ return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
+ else
+ /* Use the default code. */
+ return NULL_TREE;
+ }
Isn't that the size without virtual base classes? What if the expression
is for a complete object with virtual bases?
A good answer is that in that case the C++ front end will never present
the back end with an expression like that requiring copying. In that
case, there should be an assert and a comment indicating that in
cp_expr_size so that we can tell if we screw up.
Overall, I think I'd rather we wait for 3.2.1 for this patch -- but then
I think it's a good idea.
Thanks!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com