public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH to check_global_declaration for bootstrap/66448
@ 2015-06-09 16:06 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2015-06-09 16:06 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

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.

[-- Attachment #2: 66448-clone.patch --]
[-- Type: text/x-patch, Size: 1183 bytes --]

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-09 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 16:06 PATCH to check_global_declaration for bootstrap/66448 Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).