This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR c/43125: [4.5 Regression] Revision 156907 failed gcc.dg/attr-used.c
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Feb 2010 07:54:54 -0800
- Subject: PATCH: PR c/43125: [4.5 Regression] Revision 156907 failed gcc.dg/attr-used.c
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
We don't have C++ tests for used attribute. This patch moves C tests to
c-c++-common. OK to install?
Thanks.
H.J.
---
2010-02-21 H.J. Lu <hongjiu.lu@intel.com>
PR c/43125
* gcc.dg/attr-used-2.c: Moved to ...
* c-c++-common/attr-used-2.c: Here.
* gcc.dg/attr-used.c: Moved to ...
* c-c++-common/attr-used.c: Here.
--- /dev/null 2010-02-17 08:35:46.237211646 -0800
+++ gcc/testsuite/c-c++-common/attr-used-2.c 2009-10-14 11:53:06.000000000 -0700
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+static int xyzzy __attribute__((__used__)) = 1;
+
+void foo()
+{
+ int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */
+}
+
+/* { dg-final { scan-assembler "xyzzy" } } */
--- /dev/null 2010-02-17 08:35:46.237211646 -0800
+++ gcc/testsuite/c-c++-common/attr-used.c 2009-10-14 11:53:06.000000000 -0700
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+static void function_declaration_before(void) __attribute__((__used__));
+
+static void function_declaration_before(void) {}
+
+static void function_declaration_after(void) {}
+
+static void function_declaration_after(void) __attribute__((__used__));
+
+/* { dg-final { scan-assembler "function_declaration_before" } } */
+/* { dg-final { scan-assembler "function_declaration_after" } } */