aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-04-17 21:24:55 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-04-17 21:24:55 +0200
commit747742f6f3c80d04109b55ad1e90a77eac3ffd88 (patch)
tree66a2fdb68971de23cabbaef8248e075cc43931db
parentaadd9a6e26915538eb1417c36c43739b09acfe48 (diff)
downloadgcc-747742f6f3c80d04109b55ad1e90a77eac3ffd88.zip
gcc-747742f6f3c80d04109b55ad1e90a77eac3ffd88.tar.gz
gcc-747742f6f3c80d04109b55ad1e90a77eac3ffd88.tar.bz2
re PR c++/89325 (False warnings about "optimization attribute" on operators when -fno-ipa-cp-clone)
PR c++/89325 * g++.dg/ext/attrib58.C: New test. * g++.dg/ext/attrib59.C: New test. * g++.dg/ext/attrib60.C: New test. From-SVN: r270422
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib58.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib59.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib60.C9
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 963245e..11580f2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2019-04-17 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89325
+ * g++.dg/ext/attrib58.C: New test.
+ * g++.dg/ext/attrib59.C: New test.
+ * g++.dg/ext/attrib60.C: New test.
+
PR target/90125
* gcc.target/i386/avx512f-vfmsubXXXss-2.c (avx512f_test): Adjust
constants to ensure precise result even when not using fma.
diff --git a/gcc/testsuite/g++.dg/ext/attrib58.C b/gcc/testsuite/g++.dg/ext/attrib58.C
new file mode 100644
index 0000000..01c0035
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib58.C
@@ -0,0 +1,8 @@
+// PR c++/89325
+// { dg-do compile }
+// { dg-options "-Wattributes" }
+
+struct A { friend int &operator<< (int &i, const A &) { return i; } }; // { dg-bogus "previous definition" }
+#pragma GCC optimize ("-fno-ipa-cp-clone")
+struct B {};
+int &operator<<(int &, const B &); // { dg-bogus "optimization attribute on '\[^\n\r]*' follows definition but the attribute doesn.t match" }
diff --git a/gcc/testsuite/g++.dg/ext/attrib59.C b/gcc/testsuite/g++.dg/ext/attrib59.C
new file mode 100644
index 0000000..b883d26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib59.C
@@ -0,0 +1,11 @@
+// PR c++/89325
+// { dg-do compile }
+// { dg-options "-Wattributes" }
+
+int foo (int) { return 0; } // { dg-bogus "previous definition" }
+int bar (int) { return 0; } // { dg-bogus "previous definition" }
+int baz (int) { return 0; } // { dg-message "previous definition" }
+__attribute__((optimize (0))) int bar (long); // { dg-bogus "optimization attribute on '\[^\n\r]*' follows definition but the attribute doesn.t match" }
+#pragma GCC optimize ("-fno-ipa-cp-clone")
+int foo (long); // { dg-bogus "optimization attribute on '\[^\n\r]*' follows definition but the attribute doesn.t match" }
+int baz (int); // { dg-warning "optimization attribute on '\[^\n\r]*' follows definition but the attribute doesn.t match" }
diff --git a/gcc/testsuite/g++.dg/ext/attrib60.C b/gcc/testsuite/g++.dg/ext/attrib60.C
new file mode 100644
index 0000000..26958cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib60.C
@@ -0,0 +1,9 @@
+// PR c++/89325
+// { dg-do compile }
+// { dg-options "-Wattributes" }
+
+__attribute__((noinline)) void foo (int) {} // { dg-bogus "previous definition" }
+inline void foo (long); // { dg-bogus "inline declaration of '\[^\n\r]*' follows declaration with attribute 'noinline'" }
+inline void foo (long) {}
+__attribute__((noinline)) void bar (int) {} // { dg-message "previous definition" }
+inline void bar (int); // { dg-warning "inline declaration of '\[^\n\r]*' follows declaration with attribute 'noinline'" }