gcc.dg/Wmissing-parameter-type*: Test the intended warning

Message ID 877cmsaanz.fsf@oldenburg.str.redhat.com
State Accepted
Headers
Series gcc.dg/Wmissing-parameter-type*: Test the intended warning |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Florian Weimer Nov. 8, 2023, 8:53 a.m. UTC
  gcc/testsuite/ChangeLog:

	* gcc.dg/Wmissing-parameter-type.c: Build with -std=gnu89
        to trigger the -Wmissing-parameter-type warning
	and not the default -Wimplicit warning.  Also match
	against -Wmissing-parameter-type.
	* gcc.dg/Wmissing-parameter-type.c: Likewise.

---
 gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c | 4 ++--
 gcc/testsuite/gcc.dg/Wmissing-parameter-type.c        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)


base-commit: e9107464bb24f77038ad042ba858abed4ca060c0
  

Patch

diff --git a/gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c b/gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
index 37e1a571bda..2cd28a2ecd1 100644
--- a/gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
+++ b/gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
@@ -1,7 +1,7 @@ 
 /* Test -Wmissing-parameter-type is enabled by -Wextra */
 /* { dg-do compile } */
-/* { dg-options "-Wextra" } */
+/* { dg-options "-std=gnu89 -Wextra" } */
 
-int foo(bar) { return bar;} /* { dg-warning "type of 'bar' defaults to 'int'" } */
+int foo(bar) { return bar;} /* { dg-warning "type of 'bar' defaults to 'int' \\\[-Wmissing-parameter-type\\\]" } */
 
 
diff --git a/gcc/testsuite/gcc.dg/Wmissing-parameter-type.c b/gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
index 8ec94e2caf7..b25e8d21602 100644
--- a/gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
+++ b/gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-Wmissing-parameter-type" } */
+/* { dg-options "-std=gnu89 -Wmissing-parameter-type" } */
 
-int foo(bar) { return bar; } /* { dg-warning "type of 'bar' defaults to 'int'" } */
+int foo(bar) { return bar; } /* { dg-warning "type of 'bar' defaults to 'int' \\\[-Wmissing-parameter-type\\\]" } */