diff mbox

PATCH to check_global_declaration for bootstrap/66448

Message ID 5576FDBD.3020607@redhat.com
State New
Headers show

Commit Message

Jason Merrill June 9, 2015, 2:52 p.m. UTC
On targets without alias support (Darwin) bootstrap was failing with a 
warning about one of the constructor clones being unused.  We shouldn't 
warn about that, since clones are artificial; we should only warn if the 
abstract constructor is unused.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit 16232674086f330d05f7279681978eb683990ed5
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 9 10:12:47 2015 -0400

    	PR bootstrap/66448
    	* toplev.c (check_global_declaration): Don't warn about a clone.

diff --git a/gcc/testsuite/g++.dg/warn/Wunused-function1.C b/gcc/testsuite/g++.dg/warn/Wunused-function1.C
new file mode 100644
index 0000000..86b319a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-function1.C
@@ -0,0 +1,12 @@ 
+// PR bootstrap/66448
+// { dg-options "-Wunused-function" }
+
+struct A { A(); };
+namespace {
+  struct B: virtual A { B(); };
+  B::B() { }
+  B b;
+
+  struct C: virtual A { C(); };
+  C::C() { }			// { dg-warning "defined but not used" }
+}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 306d008..b1ccc18 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -529,6 +529,7 @@  check_global_declaration (tree decl)
       && ! (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))
       && ! DECL_EXTERNAL (decl)
       && ! DECL_ARTIFICIAL (decl)
+      && ! DECL_ABSTRACT_ORIGIN (decl)
       && ! TREE_PUBLIC (decl)
       /* A volatile variable might be used in some non-obvious way.  */
       && ! TREE_THIS_VOLATILE (decl)