+2005-01-25 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * class.c (abort_fndecl_addr): New variable.
+ (build_vtbl_initializer): If we have a pure virtual function
+ share the abort function's address.
+ Include gt-cp-class.h at the end.
+ * config-lang.in (gtfiles): Add cp/class.c.
+
2005-01-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* cxx-pretty-print.c (pp_cxx_statement): Add prototype. Make static.
return inits;
}
+static GTY(()) tree abort_fndecl_addr;
+
/* Construct the initializer for BINFO's virtual function table. BINFO
is part of the hierarchy dominated by T. If we're building a
construction vtable, the ORIG_BINFO is the binfo we should use to
/* You can't call an abstract virtual function; it's abstract.
So, we replace these functions with __pure_virtual. */
if (DECL_PURE_VIRTUAL_P (fn_original))
- fn = abort_fndecl;
- else if (!integer_zerop (delta) || vcall_index)
{
- fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
- if (!DECL_NAME (fn))
- finish_thunk (fn);
+ fn = abort_fndecl;
+ if (abort_fndecl_addr == NULL)
+ abort_fndecl_addr = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
+ init = abort_fndecl_addr;
+ }
+ else
+ {
+ if (!integer_zerop (delta) || vcall_index)
+ {
+ fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
+ if (!DECL_NAME (fn))
+ finish_thunk (fn);
+ }
+ /* Take the address of the function, considering it to be of an
+ appropriate generic type. */
+ init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
}
- /* Take the address of the function, considering it to be of an
- appropriate generic type. */
- init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
}
/* And add it to the chain of initializers. */
return build_address (fndecl);
}
+#include "gt-cp-class.h"
target_libs="target-libstdc++-v3 target-gperf"
-gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c"
+gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c \$(srcdir)/cp/class.c"