This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH resend 2/2] PR c/65403 - Add tests for -Wno-error=<some-future-option>
- From: Alex Henrie <alexhenrie24 at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, manu at gcc dot gnu dot org, mliska at suse dot cz, joseph at codesourcery dot com, msebor at gmail dot com, law at redhat dot com
- Cc: Alex Henrie <alexhenrie24 at gmail dot com>
- Date: Thu, 22 Aug 2019 22:17:40 -0600
- Subject: [PATCH resend 2/2] PR c/65403 - Add tests for -Wno-error=<some-future-option>
- References: <20190823041740.7186-1-alexhenrie24@gmail.com>
* c-c++-common/pr65403-1.c: New test.
* c-c++-common/pr65403-2.c: New test.
---
gcc/testsuite/c-c++-common/pr65403-1.c | 10 ++++++++++
gcc/testsuite/c-c++-common/pr65403-2.c | 15 +++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 gcc/testsuite/c-c++-common/pr65403-1.c
create mode 100644 gcc/testsuite/c-c++-common/pr65403-2.c
diff --git a/gcc/testsuite/c-c++-common/pr65403-1.c b/gcc/testsuite/c-c++-common/pr65403-1.c
new file mode 100644
index 00000000000..fbe004a1f78
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr65403-1.c
@@ -0,0 +1,10 @@
+/* PR c/65403 */
+/* Test an unrecognized -Wno-error option in the absence of any other
+ diagnostics. The -Wno-error option should be ignored. */
+
+/* { dg-options "-Werror -Wno-error=some-future-warning" } */
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr65403-2.c b/gcc/testsuite/c-c++-common/pr65403-2.c
new file mode 100644
index 00000000000..8b5faa7270e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr65403-2.c
@@ -0,0 +1,15 @@
+/* PR c/65403 */
+/* Test a warning, treated as an error, that some future -Wno-error option
+ might downgrade back to a warning. The -Wno-error option should produce a
+ warning in this case. */
+
+/* { dg-options "-Wunused-variable -Werror -Wno-error=some-future-warning" } */
+
+int main(int argc, char **argv)
+{
+ int foo; /* { dg-error "unused variable 'foo'" } */
+ return 0;
+}
+
+/* { dg-error "no option '-Wsome-future-warning'" "" { target *-*-* } 0 } */
+/* { dg-message "all warnings being treated as errors" "" { target *-*-* } 0 } */
--
2.23.0