[PATCH/RFC] enable -Wstrict-prototypes (PR 82922)

Message ID fd0e8802-a5ae-d474-ab3b-da4691ba104d@gmail.com
State New
Headers show
Series
  • [PATCH/RFC] enable -Wstrict-prototypes (PR 82922)
Related show

Commit Message

Martin Sebor Jan. 11, 2018, 6:41 p.m.
Declaring a function without a prototype has been deprecated
for nearly two decades (since C99) and may be removed from
the C language in C2X.  To prompt programs to transition to
the more modern and safer style, PR 82922 requests to enable
Wstrict-prototypes in -Wextra.

With the recent changes to add prototypes to a handful of
functions in Go and libgo, GCC bootstraps with the option
on x86_64 but there are a number of testsuite failures.
The attached patch either avoids or, in a small number of
instances, prunes out the warnings to let the tests pass
on x86_64.

It's possible that enabling the option could cause bootstrap
to break on other targets but since (if) only libraries are
compiled as C code anymore and not GCC back-end code, it seems
unlikely.  Handling such cases is also trivial, so unless I'm
missing something, enabling the option should be low risk for
GCC.

It seems more plausible that are tests for other targets that
would fail with the option, but if the the small number of
x86_64-specific tests in the patch is any indication (AFAICS
just 1) they could be dealt with as they are uncovered during
testing with only a minimum of disruption.

Assuming there is consensus to enable -Wstrict-prototypes, does
enabling the option and dealing with individual failures case-
by-case sound like a reasonable approach, or are are there
other/better ways to proceed without a lot of overhead that
I'm not thinking of?

I'm in the process of testing powerpc64le but I don't have
the ability or the cycles to do other targets.

Martin

Comments

Jakub Jelinek Jan. 11, 2018, 7:10 p.m. | #1
On Thu, Jan 11, 2018 at 11:41:19AM -0700, Martin Sebor wrote:
> Declaring a function without a prototype has been deprecated
> for nearly two decades (since C99) and may be removed from
> the C language in C2X.  To prompt programs to transition to
> the more modern and safer style, PR 82922 requests to enable
> Wstrict-prototypes in -Wextra.

Does it really warn for

int
main ()
{
...
}

?  main isn't called from C code, there is no reason why it should
use prototypes.  In the testsuite we have over 5000 C tests that do
something like that.

Furthermore, this should have been suggested in stage1, not 3 days before
end of stage3 IMNSHO.

	Jakub
Jeff Law Jan. 11, 2018, 7:18 p.m. | #2
On 01/11/2018 12:10 PM, Jakub Jelinek wrote:
> On Thu, Jan 11, 2018 at 11:41:19AM -0700, Martin Sebor wrote:
>> Declaring a function without a prototype has been deprecated
>> for nearly two decades (since C99) and may be removed from
>> the C language in C2X.  To prompt programs to transition to
>> the more modern and safer style, PR 82922 requests to enable
>> Wstrict-prototypes in -Wextra.
> 
> Does it really warn for
> 
> int
> main ()
> {
> ...
> }
> 
> ?  main isn't called from C code, there is no reason why it should
> use prototypes.  In the testsuite we have over 5000 C tests that do
> something like that.
> 
> Furthermore, this should have been suggested in stage1, not 3 days before
> end of stage3 IMNSHO.
Given the scope of the behavior change, let's push this out to the next
stage1.

Jeff
Joseph Myers Jan. 11, 2018, 8:17 p.m. | #3
Code intended to work as both C and C++ may well use () for no arguments.  
Maybe what's enabled by -Wextra should be a subset of the warning that 
allows function definitions with ()?  Especially since if C does remove 
unprototyped functions at some point (and as I recall, people were happy 
with the idea for C11, but no paper was put forward with concrete wording 
changes, so nothing happened), there's the question of what () should then 
mean, and the obvious answer would be that C versions without unprototyped 
functions should define () as meaning the same as (void), like C++.
Martin Sebor Jan. 11, 2018, 8:21 p.m. | #4
On 01/11/2018 12:10 PM, Jakub Jelinek wrote:
> On Thu, Jan 11, 2018 at 11:41:19AM -0700, Martin Sebor wrote:
>> Declaring a function without a prototype has been deprecated
>> for nearly two decades (since C99) and may be removed from
>> the C language in C2X.  To prompt programs to transition to
>> the more modern and safer style, PR 82922 requests to enable
>> Wstrict-prototypes in -Wextra.
>
> Does it really warn for
>
> int
> main ()
> {
> ...
> }
>
> ?  main isn't called from C code, there is no reason why it should
> use prototypes.  In the testsuite we have over 5000 C tests that do
> something like that.

It does.  Maybe most of those tests aren't compiled with -Wall.
But I didn't spend too much time analyzing the tests that failed
due to these warnings.  I just added prototypes to every function
in such tests that was missing it.  Where it looked like it might
compromise the test I pruned the warning.

> Furthermore, this should have been suggested in stage1, not 3 days before
> end of stage3 IMNSHO.

Unfortunately, I didn't get to it sooner.  However, and also
IMNSHO, since the usage has been deprecated since 1999 and
given the risks associated with calling such functions,
the option could and should have been added to -Wextra at least
a decade ago.  So forgive me for being a few weeks late with my
proposal to try rectify that.

Martin
Martin Sebor Jan. 11, 2018, 8:42 p.m. | #5
On 01/11/2018 01:17 PM, Joseph Myers wrote:
> Code intended to work as both C and C++ may well use () for no arguments.
> Maybe what's enabled by -Wextra should be a subset of the warning that
> allows function definitions with ()?  Especially since if C does remove
> unprototyped functions at some point (and as I recall, people were happy
> with the idea for C11, but no paper was put forward with concrete wording
> changes, so nothing happened), there's the question of what () should then
> mean, and the obvious answer would be that C versions without unprototyped
> functions should define () as meaning the same as (void), like C++.

WG14 hasn't yet discussed which deprecated features will be removed
in C2X and what the deprecation might look like, but the convener
mentioned at the last meeting wanting start going through the list
and making decisions about each.  No proposal to do that for C2X
is necessary.

The change you suggest seems reasonable to me for new code but it
would break legacy code.  I can't speak to how WG14 would respond
to it but to consider it the committee would need a proposal.

We have already discussed some of this on this list in the context
of the -Wcast-function-type warning.  I said I'd put together a paper
on the topic and so it should probably mention your suggestion as
well.  If you have other ideas or if you think collaborating on
a paper would be useful I'd be happy to.

Whatever happens in C2x, I'm confident that GCC will continue to
support the feature for compatibility, and so it wouldn't be
a waste of time to refine the warning and be made more useful.
For instance, complaining about the definition of main() (as
opposed to a forward declaration) does seem overly pedantic and
could be suppressed.  Thinking about the C/C++ intersection and
maybe partitioning the warning into subsets might be worthwhile
too.

Martin

Patch

diff --git a/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c b/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c
index d188d6f..923fb92 100644
--- a/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c
+++ b/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c
@@ -10,7 +10,7 @@  void *memset (void *, int, size_t);
 char buf[1024];
 
 void
-foo ()
+foo (void)
 {
   memset (buf, sizeof buf, 0);	/* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
   memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
diff --git a/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c b/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c
index 8647138..c77107f 100644
--- a/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c
+++ b/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c
@@ -11,7 +11,7 @@  void *memset (void *, int, size_t);
 char buf[1024];
 
 void
-foo ()
+foo (void)
 {
   memset (buf, sizeof buf, u'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
   memset (buf, sizeof buf, U'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
diff --git a/gcc/testsuite/c-c++-common/attr-used-2.c b/gcc/testsuite/c-c++-common/attr-used-2.c
index f78b94b..ba532d5 100644
--- a/gcc/testsuite/c-c++-common/attr-used-2.c
+++ b/gcc/testsuite/c-c++-common/attr-used-2.c
@@ -3,7 +3,7 @@ 
 
 static int xyzzy __attribute__((__used__)) = 1; 
 
-void foo()
+void foo(void)
 {
   int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */
 }
diff --git a/gcc/testsuite/c-c++-common/dfp/func-mixed.c b/gcc/testsuite/c-c++-common/dfp/func-mixed.c
index 6f7e2eb..4543144 100644
--- a/gcc/testsuite/c-c++-common/dfp/func-mixed.c
+++ b/gcc/testsuite/c-c++-common/dfp/func-mixed.c
@@ -144,7 +144,7 @@  arg5_128 (int arg0, unsigned int arg1, float arg2,
 
 
 int
-main ()
+main (void)
 {
   /* _Decimal32 variants.  */
   if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) FAILURE
diff --git a/gcc/testsuite/c-c++-common/gomp/pr58472.c b/gcc/testsuite/c-c++-common/gomp/pr58472.c
index 355ca40..4ef6b08 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr58472.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr58472.c
@@ -5,7 +5,7 @@ 
 float a[1024], b[1024];
 
 float
-foo ()
+foo (void)
 {
   float s = 0.f;
   unsigned int i;
diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c
index 8edfbce..673ce57 100644
--- a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c
@@ -21,7 +21,7 @@  struct S s;
 int *volatile r;
 
 int
-main ()
+main (void)
 {
   struct S t;
   p = &a[32];
diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c
index a1110a2..3883668 100644
--- a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c
+++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c
@@ -35,7 +35,7 @@  struct S *volatile q;
 int *volatile r;
 
 int
-main ()
+main (void)
 {
   u = ~(__UINTPTR_TYPE__) 0;
   p = (char *) u;
diff --git a/gcc/testsuite/gcc.dg/20020104-1.c b/gcc/testsuite/gcc.dg/20020104-1.c
index be36a74..dc9284d 100644
--- a/gcc/testsuite/gcc.dg/20020104-1.c
+++ b/gcc/testsuite/gcc.dg/20020104-1.c
@@ -5,7 +5,7 @@ 
 
 void bar (char *p, char *q);
 
-int main()
+int main (void)
 {
   char foo [32], *p;
 
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-4.c b/gcc/testsuite/gcc.dg/Warray-bounds-4.c
index 71526f2..c5da844 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-4.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-4.c
@@ -10,7 +10,7 @@  static void g(DWORD * p, int n)
         for (i = 0; i < n && !p[n - 1]; i++);  /* { dg-bogus "subscript is above array bounds" } */
 }
 
-void f() {
+void f(void) {
         DWORD arr[8];
 
         g(arr, 4);
diff --git a/gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c b/gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
index 45e5e42..b03a6c2 100644
--- a/gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
+++ b/gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
@@ -4,4 +4,4 @@ 
 
 int foo(bar) { return bar;} /* { dg-bogus "type of 'bar' defaults to 'int'" } */
 
-
+/* { dg-prune-output "\\\[-Wstrict-prototypes]" } */
diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c b/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
index 82a61d9..67575b6 100644
--- a/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
@@ -2,7 +2,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2 -Wall" } */
 int
-foo ()
+foo (void)
 {
   int i, bits;
   for (i = 1, bits = 1; i > 0; i += i) /* { dg-warning "assuming signed overflow does not occur" "correct warning" { xfail *-*-* } } */
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c
index 3eb91ee..90f75fe 100644
--- a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c
@@ -7,22 +7,22 @@  int test1(char *ptr)
   return ptr == "foo";  /* { dg-warning "comparison with string" } */
 }
 
-int test2()
+int test2 (void)
 {
   return "foo" != (const char*)0;
 }
 
-int test3()
+int test3 (void)
 {
   return "foo" == (const char*)0;
 }
 
-int test4()
+int test4 (void)
 {
   return (const char*)0 != "foo";
 }
 
-int test5()
+int test5 (void)
 {
   return (const char*)0 == "foo";
 }
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
index f2a711a..238e9f7 100644
--- a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
@@ -7,22 +7,22 @@  int test1(char *ptr)
   return ptr == "foo";
 }
 
-int test2()
+int test2 (void)
 {
   return "foo" != (const char*)0;
 }
 
-int test3()
+int test3 (void)
 {
   return "foo" == (const char*)0;
 }
 
-int test4()
+int test4 (void)
 {
   return (const char*)0 != "foo";
 }
 
-int test5()
+int test5 (void)
 {
   return (const char*)0 == "foo";
 }
diff --git a/gcc/testsuite/gcc.dg/builtin-choose-expr.c b/gcc/testsuite/gcc.dg/builtin-choose-expr.c
index ceac605..9c48b85 100644
--- a/gcc/testsuite/gcc.dg/builtin-choose-expr.c
+++ b/gcc/testsuite/gcc.dg/builtin-choose-expr.c
@@ -34,15 +34,15 @@ 
         } while (0)
 
 
-extern void abort ();
-extern void exit ();
+extern void abort (void);
+extern void exit (void);
 
-void bad ()
+void bad (void)
 {
   abort ();
 }
 
-void good ()
+void good (void)
 {
   exit (0);
 }
diff --git a/gcc/testsuite/gcc.dg/builtins-30.c b/gcc/testsuite/gcc.dg/builtins-30.c
index 37e5dba..72721bf 100644
--- a/gcc/testsuite/gcc.dg/builtins-30.c
+++ b/gcc/testsuite/gcc.dg/builtins-30.c
@@ -25,3 +25,5 @@  long double cosl (foo, bar)  /* { dg-warning "shadows a built-in|number of argum
 {
   return strtod ("nan", 0);
 }
+
+/* { dg-prune-output "\\\[-Wstrict-prototypes]" } */
diff --git a/gcc/testsuite/gcc.dg/cleanup-1.c b/gcc/testsuite/gcc.dg/cleanup-1.c
index 48b8264..6231028 100644
--- a/gcc/testsuite/gcc.dg/cleanup-1.c
+++ b/gcc/testsuite/gcc.dg/cleanup-1.c
@@ -6,7 +6,7 @@ 
 #define C(x)	__attribute__((cleanup(x)))
 
 static int f1(void *x U) { return 0; }
-static void f2() { }
+static void f2() { } /* { dg-warning "\\\[-Wstrict-prototypes]" } */
 static void f3(void) { } /* { dg-message "note: declared here" } */
 static void f4(void *x U) { }
 static void f5(int *x U) { }
diff --git a/gcc/testsuite/gcc.dg/cpp/very-long-comment.c b/gcc/testsuite/gcc.dg/cpp/very-long-comment.c
index 88d8eb9..ac8bf57 100644
--- a/gcc/testsuite/gcc.dg/cpp/very-long-comment.c
+++ b/gcc/testsuite/gcc.dg/cpp/very-long-comment.c
@@ -7,7 +7,7 @@  This is a really long comment. This is a really long comment. This is a really l
 /* { dg-do compile } */
 #warning test warning /* { dg-warning "test warning" } */
 #include <stdio.h>
-int main()
+int main (void)
 {
   printf("This is line %d\n", __LINE__);
   return 0;
diff --git a/gcc/testsuite/gcc.dg/dfp/composite-type.c b/gcc/testsuite/gcc.dg/dfp/composite-type.c
index 6d461c7..f7e6a6d 100644
--- a/gcc/testsuite/gcc.dg/dfp/composite-type.c
+++ b/gcc/testsuite/gcc.dg/dfp/composite-type.c
@@ -45,7 +45,7 @@  DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types when assigning to
 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
 
 
-int main()
+int main (void)
 {
   DECIMAL_COMPOSITE_TEST(32);  /* { dg-warning "incompatible pointer type" } */
   DECIMAL_COMPOSITE_TEST(64);  /* { dg-warning "incompatible pointer type" } */
@@ -53,3 +53,5 @@  int main()
 
   return 0;
 }
+
+/* { dg-prune-output "\\\[-Wstrict-prototypes]" } */
diff --git a/gcc/testsuite/gcc.dg/dfp/struct-union.c b/gcc/testsuite/gcc.dg/dfp/struct-union.c
index 956fdcf..cc14bea 100644
--- a/gcc/testsuite/gcc.dg/dfp/struct-union.c
+++ b/gcc/testsuite/gcc.dg/dfp/struct-union.c
@@ -31,7 +31,7 @@  union u h (union u u)
   return u;
 }
 
-void f()
+void f (void)
 {
   cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
   cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
diff --git a/gcc/testsuite/gcc.dg/format/pr78680.c b/gcc/testsuite/gcc.dg/format/pr78680.c
index 0c599f3..3e9cb2b 100644
--- a/gcc/testsuite/gcc.dg/format/pr78680.c
+++ b/gcc/testsuite/gcc.dg/format/pr78680.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -Wall -Wextra -fdiagnostics-show-caret" } */
 
-void fn1() {
+void fn1 (void) {
   __builtin_printf("\
      %ld.\n\
         2\n"); };
diff --git a/gcc/testsuite/gcc.dg/gomp/pr30421.c b/gcc/testsuite/gcc.dg/gomp/pr30421.c
index 901ba3c..8d3711e 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr30421.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr30421.c
@@ -3,7 +3,7 @@ 
 /* { dg-options "-O2 -fopenmp -Wall" } */
 
 int
-foo ()
+foo (void)
 {
   int a = 0, i;
 
@@ -15,7 +15,7 @@  foo ()
 }
 
 int
-bar ()
+bar (void)
 {
   int a = 0, i;
 
@@ -27,7 +27,7 @@  bar ()
 }
 
 int
-baz ()
+baz (void)
 {
   int a = 0, i;
 
diff --git a/gcc/testsuite/gcc.dg/gomp/pr34694.c b/gcc/testsuite/gcc.dg/gomp/pr34694.c
index 35cbf33..a494b85 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr34694.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr34694.c
@@ -5,7 +5,7 @@ 
 int i;
 
 void
-foo ()
+foo (void)
 {
 #pragma omp parallel
   {
diff --git a/gcc/testsuite/gcc.dg/ifelse-1.c b/gcc/testsuite/gcc.dg/ifelse-1.c
index 2dd2208..e8a7bfc 100644
--- a/gcc/testsuite/gcc.dg/ifelse-1.c
+++ b/gcc/testsuite/gcc.dg/ifelse-1.c
@@ -4,12 +4,11 @@ 
 */
 
 
-extern int bar ();
-extern int com ();
-extern int baz ();
+extern int bar (void);
+extern int com (void);
+extern int baz (void);
 void
-foo (a,b)
-     int a, b;
+foo (int a, b)
 {
   if (a)
     if (b)
diff --git a/gcc/testsuite/gcc.dg/m-un-1.c b/gcc/testsuite/gcc.dg/m-un-1.c
index ad84d44..ebcfc32 100644
--- a/gcc/testsuite/gcc.dg/m-un-1.c
+++ b/gcc/testsuite/gcc.dg/m-un-1.c
@@ -21,7 +21,7 @@  while loops, but that is presumably much much harder to test for.
 /* { dg-options "-O -Wall" } */
 
 int
-sub ()
+sub (void)
 {
   int i = 0;
   int j = 0;
diff --git a/gcc/testsuite/gcc.dg/misc-column.c b/gcc/testsuite/gcc.dg/misc-column.c
index e68300b..7465215 100644
--- a/gcc/testsuite/gcc.dg/misc-column.c
+++ b/gcc/testsuite/gcc.dg/misc-column.c
@@ -9,7 +9,7 @@  struct {
 	char b;
 } *q;
 
-extern void bar();
+extern void bar(void);
 
 void foo (void)
 {
diff --git a/gcc/testsuite/gcc.dg/pr12603.c b/gcc/testsuite/gcc.dg/pr12603.c
index f7caef2..5671806 100644
--- a/gcc/testsuite/gcc.dg/pr12603.c
+++ b/gcc/testsuite/gcc.dg/pr12603.c
@@ -2,7 +2,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O3 -Wall -Wextra -Wreturn-type" } */
 int
-this_function_never_returns ()
+this_function_never_returns (void)
 {
   for (;;);
 }
diff --git a/gcc/testsuite/gcc.dg/pr18241-1.c b/gcc/testsuite/gcc.dg/pr18241-1.c
index a37e77d..d8417b2 100644
--- a/gcc/testsuite/gcc.dg/pr18241-1.c
+++ b/gcc/testsuite/gcc.dg/pr18241-1.c
@@ -89,7 +89,7 @@  out:
 	return ret;
 }
 
-int main ()
+int main (void)
 {
 	struct radix_tree_root r;
 	struct radix_tree_node node;
diff --git a/gcc/testsuite/gcc.dg/pr18241-2.c b/gcc/testsuite/gcc.dg/pr18241-2.c
index a3ff1de..7a81ca7 100644
--- a/gcc/testsuite/gcc.dg/pr18241-2.c
+++ b/gcc/testsuite/gcc.dg/pr18241-2.c
@@ -51,7 +51,7 @@  void radix_tree_tag_clear(struct radix_tree_root *root, unsigned long index)
 struct radix_tree_root r;
 struct radix_tree_node node;
 
-int main ()
+int main (void)
 {
   	r.height = 1;
 	r.rnode = &node;
diff --git a/gcc/testsuite/gcc.dg/pr35736.c b/gcc/testsuite/gcc.dg/pr35736.c
index f411bb8..2bf8166 100644
--- a/gcc/testsuite/gcc.dg/pr35736.c
+++ b/gcc/testsuite/gcc.dg/pr35736.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O -Wall" } */
 
-void foo()
+void foo (void)
 {
   while (1)
     for (;;({ continue; }))
diff --git a/gcc/testsuite/gcc.dg/pr49120.c b/gcc/testsuite/gcc.dg/pr49120.c
index 50993e6..203999a 100644
--- a/gcc/testsuite/gcc.dg/pr49120.c
+++ b/gcc/testsuite/gcc.dg/pr49120.c
@@ -4,7 +4,7 @@ 
 /* { dg-require-effective-target alloca } */
 
 int
-main ()
+main (void)
 {
   int a = 1;
   int c = ({ char b[a + 1]; b[0] = 0; b[0]; });
diff --git a/gcc/testsuite/gcc.dg/pr63748.c b/gcc/testsuite/gcc.dg/pr63748.c
index cc353a7..2c24379 100644
--- a/gcc/testsuite/gcc.dg/pr63748.c
+++ b/gcc/testsuite/gcc.dg/pr63748.c
@@ -4,7 +4,7 @@ 
 
 #include <setjmp.h>
 
-jmp_buf *alloc_jmp_buf ();
+jmp_buf *alloc_jmp_buf (void);
 int foo (void *);
 
 int
diff --git a/gcc/testsuite/gcc.dg/pr70281.c b/gcc/testsuite/gcc.dg/pr70281.c
index 9447fb1..d3bebff 100644
--- a/gcc/testsuite/gcc.dg/pr70281.c
+++ b/gcc/testsuite/gcc.dg/pr70281.c
@@ -1,5 +1,5 @@ 
 /* { dg-options "-Wall -fdiagnostics-show-caret" } */
-int bch_stats_show ()
+int bch_stats_show (void)
 {
   return __builtin_types_compatible_p (unsigned, int) ? "" : "";  /* { dg-warning "cast" } */
 /* { dg-begin-multiline-output "" }
diff --git a/gcc/testsuite/gcc.dg/pr79223.c b/gcc/testsuite/gcc.dg/pr79223.c
index ef0dd1b..018d8c5 100644
--- a/gcc/testsuite/gcc.dg/pr79223.c
+++ b/gcc/testsuite/gcc.dg/pr79223.c
@@ -13,7 +13,7 @@  char s[4];
 
 size_t range (void)
 {
-  extern size_t size ();
+  extern size_t size (void);
   size_t n = size ();
   if (n <= sizeof d)
     return sizeof d + 1;
diff --git a/gcc/testsuite/gcc.dg/simd-1.c b/gcc/testsuite/gcc.dg/simd-1.c
index e92662e..af5a597 100644
--- a/gcc/testsuite/gcc.dg/simd-1.c
+++ b/gcc/testsuite/gcc.dg/simd-1.c
@@ -19,7 +19,7 @@  int foo1;
 short foo2 __attribute__((vector_size (8)));
 
 void
-hanneke ()
+hanneke (void)
 {
   /* Assignment.  */
   a = b;
diff --git a/gcc/testsuite/gcc.dg/simd-1b.c b/gcc/testsuite/gcc.dg/simd-1b.c
index 44c39c2..b878a7a 100644
--- a/gcc/testsuite/gcc.dg/simd-1b.c
+++ b/gcc/testsuite/gcc.dg/simd-1b.c
@@ -11,7 +11,7 @@  v4si a, b;
 v2si c, d;
 
 void
-hanneke ()
+hanneke (void)
 {
   /* Operators on compatible SIMD types.  */
   a %= b;
diff --git a/gcc/testsuite/gcc.dg/simd-2.c b/gcc/testsuite/gcc.dg/simd-2.c
index 13e1cab..42cba7c 100644
--- a/gcc/testsuite/gcc.dg/simd-2.c
+++ b/gcc/testsuite/gcc.dg/simd-2.c
@@ -17,7 +17,7 @@  float foo1;
 v2sf foo2;
 
 void
-hanneke ()
+hanneke (void)
 {
   /* Assignment.  */
   a = b;
diff --git a/gcc/testsuite/gcc.dg/tm/unused.c b/gcc/testsuite/gcc.dg/tm/unused.c
index 7c8aa3e..e108f93 100644
--- a/gcc/testsuite/gcc.dg/tm/unused.c
+++ b/gcc/testsuite/gcc.dg/tm/unused.c
@@ -2,12 +2,12 @@ 
 /* { dg-options "-fgnu-tm -Wall" } */
 
 __attribute__((transaction_safe))
-static int unused_func ()	/* { dg-warning "defined but not used" } */
+static int unused_func (void)	/* { dg-warning "defined but not used" } */
 {
   return 12345;
 }
 
-int main()
+int main (void)
 {
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
index 961fa48..54ebe23 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
@@ -11,7 +11,7 @@  void sink (void*);
 
 /* Exercise all special C and POSIX characters.  */
 
-void test_characters ()
+void test_characters (void)
 {
   T ("%%");           /* { dg-warning ".%%. directive writing 1 byte" } */
 
@@ -128,7 +128,7 @@  void test_width_and_precision_out_of_range (char *d)
 /* Verify that an excessively long directive is truncated and the truncation
    is indicated by three trailing dots in the text of the warning.  */
 
-void test_overlong_plain_string ()
+void test_overlong_plain_string (void)
 {
   static const char longfmtstr[] =
     "0123456789012345678901234567890123456789012345678901234567890123456789%%";
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
index eb27de6..6db9c5c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
@@ -91,7 +91,7 @@  char* ptr = buffer;
 #  define TEST_FAILURE(line, ignore1, ignore2, ignore3)			\
   do {									\
     extern void CAT (failure_on_line_, line)(void);			\
-    CAT (failure_on_line_, line)();					\
+    CAT (failure_on_line_, line)(void);					\
   } while (0)
 #else
 /* The test is run by DejaGnu with optimization enabled.  When it's run
@@ -174,7 +174,7 @@  test_c (char c)
 unsigned __attribute__ ((noclone, noinline))
 unsigned_value (void)
 {
-  extern int rand ();
+  extern int rand (void);
   return rand ();
 }
 
@@ -183,7 +183,7 @@  unsigned_value (void)
 int __attribute__ ((noclone, noinline))
 int_value (void)
 {
-  extern int rand ();
+  extern int rand (void);
   return rand ();
 }
 
@@ -233,7 +233,7 @@  test_d_i (int i, long li)
   EQL ( 1, -1, "%i", uchar_range (0, 9));
 
   /* The range information available to passes other than the Value
-     Range Propoagation pass itself is so bad that the following two
+     Range Propagation pass itself is so bad that the following two
      tests fail (the range seen in the test below is [0, 99] rather
      than [10, 99].
   EQL ( 2,  3, "%i", uchar_range (10, 99));
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79327.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79327.c
index 7db875d..71458fe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr79327.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79327.c
@@ -8,7 +8,7 @@  char buf[64];
 #define FMT "%+03d%02d"
 const char *volatile fmt = FMT;
 
-int main ()
+int main (void)
 {
   int c = a;
   int d = b;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79800.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79800.c
index 030e276..aa5b19d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr79800.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79800.c
@@ -23,7 +23,7 @@  void f (int p)
 
 volatile int i = -1;
 
-int main ()
+int main (void)
 {
   f (i);
 
diff --git a/gcc/testsuite/gcc.dg/uninit-10-O0.c b/gcc/testsuite/gcc.dg/uninit-10-O0.c
index f761ac9..69ef364 100644
--- a/gcc/testsuite/gcc.dg/uninit-10-O0.c
+++ b/gcc/testsuite/gcc.dg/uninit-10-O0.c
@@ -41,8 +41,7 @@  extern int have_error;
 extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
 
 void
-validate_insn_alternatives (d)
-     struct data *d;
+validate_insn_alternatives (struct data *d)
 {
   int n = 0, start;
 
diff --git a/gcc/testsuite/gcc.dg/uninit-10.c b/gcc/testsuite/gcc.dg/uninit-10.c
index 0d62020..16931b8 100644
--- a/gcc/testsuite/gcc.dg/uninit-10.c
+++ b/gcc/testsuite/gcc.dg/uninit-10.c
@@ -41,8 +41,7 @@  extern int have_error;
 extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
 
 void
-validate_insn_alternatives (d)
-     struct data *d;
+validate_insn_alternatives (struct data *d)
 {
   int n = 0, start;
 
diff --git a/gcc/testsuite/gcc.dg/uninit-A-O0.c b/gcc/testsuite/gcc.dg/uninit-A-O0.c
index 6937691..6c80868 100644
--- a/gcc/testsuite/gcc.dg/uninit-A-O0.c
+++ b/gcc/testsuite/gcc.dg/uninit-A-O0.c
@@ -45,8 +45,7 @@  tree resolve_and_layout (tree, tree);
 tree lookup_field_wrapper (tree, tree);
 
 void
-qualify_ambiguous_name (id)
-     tree id;
+qualify_ambiguous_name (tree id)
 {
   tree qual, qual_wfl, decl;
   tree name;	 /* { dg-bogus "name" "uninitialized variable warning" } */
diff --git a/gcc/testsuite/gcc.dg/uninit-A.c b/gcc/testsuite/gcc.dg/uninit-A.c
index 28f7fe9..a11918c 100644
--- a/gcc/testsuite/gcc.dg/uninit-A.c
+++ b/gcc/testsuite/gcc.dg/uninit-A.c
@@ -45,8 +45,7 @@  tree resolve_and_layout (tree, tree);
 tree lookup_field_wrapper (tree, tree);
 
 void
-qualify_ambiguous_name (id)
-     tree id;
+qualify_ambiguous_name (tree id)
 {
   tree qual, qual_wfl, decl;
   tree name;	 /* { dg-bogus "name" "uninitialized variable warning" } */
diff --git a/gcc/testsuite/gcc.dg/unused-1.c b/gcc/testsuite/gcc.dg/unused-1.c
index 8db7c2c..790254d 100644
--- a/gcc/testsuite/gcc.dg/unused-1.c
+++ b/gcc/testsuite/gcc.dg/unused-1.c
@@ -9,3 +9,5 @@  f(c)
 {
   return 0;
 }
+
+/* { dg-prune-output "\\\[-Wstrict-prototypes]" } */
diff --git a/gcc/testsuite/gcc.dg/unused-6-WallWextra.c b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c
index d2d80be..2d66bc5 100644
--- a/gcc/testsuite/gcc.dg/unused-6-WallWextra.c
+++ b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c
@@ -5,7 +5,7 @@  static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning
 {
   return 0;
 }
-int tt()
+int tt(void)
 {
   return t(0);
 }
diff --git a/gcc/testsuite/gcc.dg/unused-6-no.c b/gcc/testsuite/gcc.dg/unused-6-no.c
index 0923cfb..acb8b31 100644
--- a/gcc/testsuite/gcc.dg/unused-6-no.c
+++ b/gcc/testsuite/gcc.dg/unused-6-no.c
@@ -5,7 +5,7 @@  static int t(int i) /* { dg-bogus "unused parameter" "unused parameter warning"
 {
   return 0;
 }
-int tt()
+int tt(void)
 {
   return t(0);
 }
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
index 5fdd1e2..c0e63cf 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
+++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c
@@ -133,7 +133,7 @@  struct test_data
 } test_data;
 
 static int shrink_wrap_global;
-static void __attribute((sysv_abi)) do_tests ();
+static void __attribute((sysv_abi)) do_tests (void);
 static void init_test (void *fn, const char *name,
 		       enum alignment_option alignment,
 		       enum shrink_wrap_option shrink_wrap, long ret_expected);
@@ -257,7 +257,7 @@  static const char *shrink_wrap_str[SHRINK_WRAP_COUNT] =
   "", "shrink-wrap fast path", "shrink-wrap slow path"
 };
 
-static const char *test_descr ()
+static const char *test_descr (void)
 {
   static char buffer[0x400];
 
@@ -378,7 +378,7 @@  static __attribute__((ms_abi, noinline)) long do_sibcall (long arg) {
   return arg + FLAG_SIBCALL;
 }
 
-void usage ()
+void usage (void)
 {
   fprintf (stderr, "Usage: %s [-s <seed>] [-f]\n", argv0);
   exit (-1);