From patchwork Thu Jan 11 18:41:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 859235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-470865-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NPfRhu6L"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zHZTr4XwZz9sP9 for ; Fri, 12 Jan 2018 05:41:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=sN4Kvndurolr7fm/v2XmIAsN6mvdn9Kj35r7HtuMR286rSicxZ lMoxLLbn5eL/Ff7CJYQ9wC0Lm+IbCXTN55Rgyifn1PR5zX3s0XwSrHjOlG0Rn6Hf mkNo6/WOIaRC1WEFWqpyymcJHh2BMxxxQIaDTt68c4He9h8mwI++zt6q0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=oIxjTlT2LHT7U01Ku4gkT92WPPM=; b=NPfRhu6LltLfWn3tVrcS 2i6qPkfywaUJW4NUXwK5BSoufuAvNqUtQN+VOYztfY0iOdEEway38dxEEdcqt9WR hk8UILmDlGb6wBKF6GgckAXQGy5oEYE3Z+B2gWdZXpThFdT/JfBj1731MRMMOxVk qrcCYcqMKHFaL0rfflSjYDo= Received: (qmail 119422 invoked by alias); 11 Jan 2018 18:41:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119385 invoked by uid 89); 11 Jan 2018 18:41:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=pr79223.c, pr79223c, UD:pr79223.c, decades X-HELO: mail-oi0-f67.google.com Received: from mail-oi0-f67.google.com (HELO mail-oi0-f67.google.com) (209.85.218.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Jan 2018 18:41:23 +0000 Received: by mail-oi0-f67.google.com with SMTP id u83so2278244oie.7 for ; Thu, 11 Jan 2018 10:41:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=6Jt2OwIYyD3tvtHbprQzuc60uk1UE9rsvC1ujeQKFBY=; b=iUvh69KFDJYSB4Bp5a+4IxEKqyl+IhPbpRIo3W6ZDgVzLAnquFLFXGeLPUMNogo3/r lQIycDr0zwvE2yvuQH3iOpurjKsHNGsJ7ScTlW6NDpuVPJg5MXY2moi8JvmJ1vcbBsF1 EZtyfWBVFdxy0ogGRRtLyZa4nyNb7p2fvY7BIBC4MU5uO2ccst6rsb7kIy4fC0RhrB3l 1/hRj7vic3dYfcc4y0BbRk4z5YQjW8JDwxqiF4Q74XUZh5W2VpJE9AECY9YV/HYbg2MW 6+lHEZGetrf3y5UCNz2YUWX9UxQmGrGRW+XsNnABpuuNbghg54gad7nLX89jZEmxF7RV muaQ== X-Gm-Message-State: AKwxytcvKU19+lTAWVOUpIt6/gje8/2cptNjCpaWE92h+JOFsD8dMHpZ uXQTvq6Er0iN/UPj/1/a9mqT/A== X-Google-Smtp-Source: ACJfBovugNjETrwkEX3yBzYOapRS6JY0oW4/hkMUnnt7kiSKm75Mf8Xgn91jpded45fuMn9MGcJTCA== X-Received: by 10.202.205.145 with SMTP id d139mr5187833oig.84.1515696081302; Thu, 11 Jan 2018 10:41:21 -0800 (PST) Received: from localhost.localdomain ([97.118.124.0]) by smtp.gmail.com with ESMTPSA id f193sm3270757oih.28.2018.01.11.10.41.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 10:41:20 -0800 (PST) To: Gcc Patch List From: Martin Sebor Subject: [PATCH/RFC] enable -Wstrict-prototypes (PR 82922) Message-ID: Date: Thu, 11 Jan 2018 11:41:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes 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 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 -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 -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 ] [-f]\n", argv0); exit (-1);