[2/2] PR c/65403 - Add tests for -Wno-error=<some-future-option>

Message ID 20190319024657.11618-3-alexhenrie24@gmail.com
State Superseded
Headers show
Series
  • Future warnings not treated as errors
Related show

Commit Message

Alex Henrie March 19, 2019, 2:46 a.m.
---
 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

-- 
2.21.0

Comments

Jeff Law June 19, 2019, 5:55 p.m. | #1
On 3/18/19 8:46 PM, Alex Henrie wrote:
> ---

>  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

This needs a ChangeLog entry.  It could be as simple as:

	* c-c++-common/pr65403-1.c: New test.
	* c-c++-common/pr65403-2.c: New test.

No inherent problems with the test, though I think we need to verify
they still do the right thing given the hints the compiler will try to
emit on unknown options now.  That's easy enough to do once we have
concluded on what the behvior should be now that the compiler emits
hints for unknown options.

Jeff

Patch

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..128d4f694a6
--- /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 } */