aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-07-30 13:27:20 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-07-30 13:27:20 -0400
commita41844e513aa643b1bc41815f7f4ae48aba90464 (patch)
tree650ed490795a4de522819f365890e79a8ced42af /gcc/cp
parentd5d0ed2d89a56273efe30331c3e94651134615e7 (diff)
downloadgcc-a41844e513aa643b1bc41815f7f4ae48aba90464.zip
gcc-a41844e513aa643b1bc41815f7f4ae48aba90464.tar.gz
gcc-a41844e513aa643b1bc41815f7f4ae48aba90464.tar.bz2
re PR ipa/61659 (Extra undefined symbol because of devirtualization)
PR c++/61659 PR c++/61687 Revert: gcc/c-family/ * c.opt (-fuse-all-virtuals): New. gcc/cp/ * decl2.c (mark_all_virtuals): New variable. (maybe_emit_vtables): Check it instead of flag_devirtualize. (cp_write_global_declarations): Set it and give helpful diagnostic if it introduces errors. * class.c (finish_struct_1): Check it. From-SVN: r213308
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/decl2.c37
3 files changed, 10 insertions, 38 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3d8bf6d..25d9b8a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,14 @@
2014-07-30 Jason Merrill <jason@redhat.com>
+ PR c++/61659
+ PR c++/61687
+ Revert:
+ * decl2.c (mark_all_virtuals): New variable.
+ (maybe_emit_vtables): Check it instead of flag_devirtualize.
+ (cp_write_global_declarations): Set it and give helpful diagnostic
+ if it introduces errors.
+ * class.c (finish_struct_1): Check it.
+
PR lto/53808
PR c++/61659
* pt.c (push_template_decl_real): Set DECL_COMDAT on templates.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 0f611e1..235c68a 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6408,7 +6408,7 @@ finish_struct_1 (tree t)
in every translation unit where the class definition appears. If
we're devirtualizing, we can look into the vtable even if we
aren't emitting it. */
- if (CLASSTYPE_KEY_METHOD (t) == NULL_TREE || flag_use_all_virtuals)
+ if (CLASSTYPE_KEY_METHOD (t) == NULL_TREE)
keyed_classes = tree_cons (NULL_TREE, t, keyed_classes);
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 884be0a..eafdce5 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -106,11 +106,6 @@ static GTY(()) vec<tree, va_gc> *no_linkage_decls;
/* Nonzero if we're done parsing and into end-of-file activities. */
int at_eof;
-
-/* Nonzero if we've instantiated everything used directly, and now want to
- mark all virtual functions as used so that they are available for
- devirtualization. */
-static int mark_all_virtuals;
/* Return a member function type (a METHOD_TYPE), given FNTYPE (a
@@ -2020,15 +2015,6 @@ maybe_emit_vtables (tree ctype)
if (DECL_COMDAT (primary_vtbl)
&& CLASSTYPE_DEBUG_REQUESTED (ctype))
note_debug_info_needed (ctype);
- if (mark_all_virtuals && !DECL_ODR_USED (primary_vtbl))
- {
- /* Make sure virtual functions get instantiated/synthesized so that
- they can be inlined after devirtualization even if the vtable is
- never emitted. */
- mark_used (primary_vtbl);
- mark_vtable_entries (primary_vtbl);
- return true;
- }
return false;
}
@@ -4345,8 +4331,6 @@ cp_write_global_declarations (void)
instantiated, etc., etc. */
emit_support_tinfos ();
- int errs = errorcount + sorrycount;
- bool explained_devirt = false;
do
{
@@ -4579,27 +4563,6 @@ cp_write_global_declarations (void)
pending_statics->length ()))
reconsider = true;
- if (flag_use_all_virtuals)
- {
- if (!reconsider && !mark_all_virtuals)
- {
- mark_all_virtuals = true;
- reconsider = true;
- errs = errorcount + sorrycount;
- }
- else if (mark_all_virtuals
- && !explained_devirt
- && (errorcount + sorrycount > errs))
- {
- inform (global_dc->last_location, "this error is seen due to "
- "instantiation of all virtual functions, which the C++ "
- "standard says are always considered used; this is done "
- "to support devirtualization optimizations, but can be "
- "disabled with -fno-use-all-virtuals");
- explained_devirt = true;
- }
- }
-
retries++;
}
while (reconsider);