On 11/02/16 18:51, Jason Merrill wrote: > On 11/02/2016 02:11 AM, Bernd Edlinger wrote: >> On 11/01/16 19:15, Bernd Edlinger wrote: >>> On 11/01/16 18:11, Jason Merrill wrote: >>>> On Tue, Nov 1, 2016 at 11:45 AM, Bernd Edlinger >>>> <bernd.edlin...@hotmail.de> wrote: >>>>> On 11/01/16 16:20, Jason Merrill wrote: >>>>>> On 10/17/2016 03:18 PM, Bernd Edlinger wrote: >>>>>> I'm not even sure we need a new warning. Can we combine this warning >>>>>> with the block that currently follows? >>>>> >>>>> After 20 years of not having a warning on that, >>>>> an implicitly enabled warning would at least break lots of bogus >>>>> test cases. >>>> >>>> Would it, though? Which test cases still break with the current patch? >>> >>> Less than before, but there are still at least a few of them. >>> >>> I can make a list and send it tomorrow. >> >> FAIL: g++.dg/cpp1y/lambda-generic-udt.C -std=gnu++14 (test for excess >> errors) >> FAIL: g++.dg/cpp1y/lambda-generic-xudt.C -std=gnu++14 (test for excess >> errors) >> FAIL: g++.dg/init/new15.C -std=c++11 (test for excess errors) >> FAIL: g++.dg/init/new15.C -std=c++14 (test for excess errors) >> FAIL: g++.dg/init/new15.C -std=c++98 (test for excess errors) >> FAIL: g++.dg/ipa/inline-1.C -std=gnu++11 (test for excess errors) >> FAIL: g++.dg/ipa/inline-1.C -std=gnu++14 (test for excess errors) >> FAIL: g++.dg/ipa/inline-1.C -std=gnu++98 (test for excess errors) >> FAIL: g++.dg/ipa/inline-2.C -std=gnu++11 (test for excess errors) >> FAIL: g++.dg/ipa/inline-2.C -std=gnu++14 (test for excess errors) >> FAIL: g++.dg/ipa/inline-2.C -std=gnu++98 (test for excess errors) >> FAIL: g++.dg/tc1/dr20.C -std=c++11 (test for excess errors) >> FAIL: g++.dg/tc1/dr20.C -std=c++14 (test for excess errors) >> FAIL: g++.dg/tc1/dr20.C -std=c++98 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-1.C -std=gnu++11 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-1.C -std=gnu++14 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-1.C -std=gnu++98 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-2.C -std=gnu++11 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-2.C -std=gnu++14 (test for excess errors) >> FAIL: g++.dg/tree-ssa/inline-2.C -std=gnu++98 (test for excess errors) >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O0 -flto >> -flto-partition=1to1 -fno-use-linker-plugin >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O0 -flto >> -flto-partition=none -fuse-linker-plugin >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O0 -flto >> -fuse-linker-plugin -fno-fat-lto-objects >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O2 -flto >> -flto-partition=1to1 -fno-use-linker-plugin >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O2 -flto >> -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects >> FAIL: g++.dg/lto/20080908-1 cp_lto_20080908-1_0.o assemble, -O2 -flto >> -fuse-linker-plugin >> FAIL: g++.dg/lto/pr68811 cp_lto_pr68811_0.o assemble, -O2 >> FAIL: g++.old-deja/g++.law/except1.C -std=gnu++11 (test for excess >> errors) >> FAIL: g++.old-deja/g++.law/except1.C -std=gnu++14 (test for excess >> errors) >> FAIL: g++.old-deja/g++.law/except1.C -std=gnu++98 (test for excess >> errors) >> FAIL: g++.old-deja/g++.mike/p700.C -std=gnu++11 (test for excess errors) >> FAIL: g++.old-deja/g++.mike/p700.C -std=gnu++14 (test for excess errors) >> FAIL: g++.old-deja/g++.mike/p700.C -std=gnu++98 (test for excess errors) >> FAIL: g++.old-deja/g++.other/builtins10.C -std=c++11 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/builtins10.C -std=c++14 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/realloc.C -std=c++11 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/realloc.C -std=c++14 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/realloc.C -std=c++98 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/vbase5.C -std=c++11 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/vbase5.C -std=c++14 (test for excess >> errors) >> FAIL: g++.old-deja/g++.other/vbase5.C -std=c++98 (test for excess >> errors) >> >> >> The lto test case does emit the warning when assembling, but >> it still produces an executable and even executes it. >> >> Also g++.dg/cpp1y/lambda-generic-udt.C, g++.dg/tc1/dr20.C >> and g++.old-deja/g++.other/vbase5.C are execution tests. >> >> So I was wrong to assume these were all compile-only tests. >> >> I think that list should be fixable, if we decide to enable >> the warning by default. > > Yes, either by fixing the prototypes or disabling the warning. >
Yes, I am inclined to enable the warning by default now. Most of the test cases are fixable in a fairly obvious way, see attachment. But I am unsure about g++.old-deja/g++.other/builtins10.C: // { dg-do assemble } // Test that built-in functions don't warn when prototyped without arguments. // Origin: PR c++/9367 // Copyright (C) 2003 Free Software Foundation. extern "C" int snprintf(); PR c++/9367 was a *bogus* warning. Either delete the test case, or change the expectation to the new warning? But the libitm warnings are a real bug, the prototypes of the _ITM_ builtin functions and in the libitm.h simply do not match, that was just not visible before because the test suite does apparently not use -Wall. Bernd.
Index: gcc/testsuite/g++.dg/cpp1y/lambda-generic-udt.C =================================================================== --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-udt.C (revision 241752) +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-udt.C (working copy) @@ -14,7 +14,7 @@ bool shadow = false; }; -extern "C" void printf(...); +extern "C" int printf(const char*, ...); #define assert(e) if (e); else \ printf ("%s:%d: !(%s)\n", __FILE__, __LINE__, #e), __builtin_abort (); Index: gcc/testsuite/g++.dg/init/new15.C =================================================================== --- gcc/testsuite/g++.dg/init/new15.C (revision 241752) +++ gcc/testsuite/g++.dg/init/new15.C (working copy) @@ -1,6 +1,6 @@ // PR c++/9782 -extern "C" void printf(const char*, ...); +extern "C" int printf(const char*, ...); template <int> struct A { Index: gcc/testsuite/g++.dg/ipa/inline-1.C =================================================================== --- gcc/testsuite/g++.dg/ipa/inline-1.C (revision 241752) +++ gcc/testsuite/g++.dg/ipa/inline-1.C (working copy) @@ -3,7 +3,7 @@ /* { dg-add-options bind_pic_locally } */ namespace std { - extern "C" void puts(const char *s); + extern "C" int puts(const char *s); } template <class T, class E> void Index: gcc/testsuite/g++.dg/ipa/inline-2.C =================================================================== --- gcc/testsuite/g++.dg/ipa/inline-2.C (revision 241752) +++ gcc/testsuite/g++.dg/ipa/inline-2.C (working copy) @@ -3,7 +3,7 @@ /* { dg-add-options bind_pic_locally } */ namespace std { - extern "C" void puts(const char *s); + extern "C" int puts(const char *s); } template <class T, class E> void Index: gcc/testsuite/g++.dg/lto/20080908-1_0.C =================================================================== --- gcc/testsuite/g++.dg/lto/20080908-1_0.C (revision 241752) +++ gcc/testsuite/g++.dg/lto/20080908-1_0.C (working copy) @@ -1,5 +1,5 @@ /* { dg-lto-do run } */ -extern "C" { extern void *memcpy (void *, const void *, unsigned); } +extern "C" { extern void *memcpy (void *, const void *, __SIZE_TYPE__); } inline int bci (const float &source) Index: gcc/testsuite/g++.dg/lto/pr68811_0.C =================================================================== --- gcc/testsuite/g++.dg/lto/pr68811_0.C (revision 241752) +++ gcc/testsuite/g++.dg/lto/pr68811_0.C (working copy) @@ -1,5 +1,5 @@ // { dg-lto-do link } -/* { dg-lto-options "-O2 -w" } */ +/* { dg-lto-options "-O2\\ -w" } */ // { dg-extra-ld-options "-r -nostdlib" } extern "C" char *strcpy(char *, const char *); char InitXPCOMGlue_lastSlash; Index: gcc/testsuite/g++.dg/tc1/dr20.C =================================================================== --- gcc/testsuite/g++.dg/tc1/dr20.C (revision 241752) +++ gcc/testsuite/g++.dg/tc1/dr20.C (working copy) @@ -2,7 +2,7 @@ // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // DR20: Some clarifications needed for 12.8 para 15 -extern "C" void printf(const char*, ...); +extern "C" int printf(const char*, ...); extern "C" void abort(void); int count = 0; Index: gcc/testsuite/g++.dg/tree-ssa/inline-1.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/inline-1.C (revision 241752) +++ gcc/testsuite/g++.dg/tree-ssa/inline-1.C (working copy) @@ -3,7 +3,7 @@ /* { dg-add-options bind_pic_locally } */ namespace std { - extern "C" void puts(const char *s); + extern "C" int puts(const char *s); } template <class T, class E> void Index: gcc/testsuite/g++.dg/tree-ssa/inline-2.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/inline-2.C (revision 241752) +++ gcc/testsuite/g++.dg/tree-ssa/inline-2.C (working copy) @@ -3,7 +3,7 @@ /* { dg-add-options bind_pic_locally } */ namespace std { - extern "C" void puts(const char *s); + extern "C" int puts(const char *s); } template <class T, class E> void Index: gcc/testsuite/g++.old-deja/g++.law/except1.C =================================================================== --- gcc/testsuite/g++.old-deja/g++.law/except1.C (revision 241752) +++ gcc/testsuite/g++.old-deja/g++.law/except1.C (working copy) @@ -7,7 +7,7 @@ // Subject: Bugs // Date: Wed, 22 Jul 92 08:29:30 EDT -extern "C" void puts(const char *); +extern "C" int puts(const char *); class foo { public: Index: gcc/testsuite/g++.old-deja/g++.mike/p700.C =================================================================== --- gcc/testsuite/g++.old-deja/g++.mike/p700.C (revision 241752) +++ gcc/testsuite/g++.old-deja/g++.mike/p700.C (working copy) @@ -1,5 +1,5 @@ // { dg-do assemble } -// { dg-options "-Wno-deprecated -Wno-register" } +// { dg-options "-w" } // { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 } // prms-id: 700 Index: gcc/testsuite/g++.old-deja/g++.other/realloc.C =================================================================== --- gcc/testsuite/g++.old-deja/g++.other/realloc.C (revision 241752) +++ gcc/testsuite/g++.old-deja/g++.other/realloc.C (working copy) @@ -1,4 +1,5 @@ // { dg-do assemble } +// { dg-options "-w" } extern "C" void realloc(); Index: gcc/testsuite/g++.old-deja/g++.other/vbase5.C =================================================================== --- gcc/testsuite/g++.old-deja/g++.other/vbase5.C (revision 241752) +++ gcc/testsuite/g++.old-deja/g++.other/vbase5.C (working copy) @@ -6,7 +6,7 @@ // vbases. Normally that's just a pessimization, unfortunately during // constructoring it leads to uninitialized reads. -extern "C" int printf (...); +extern "C" int printf (const char*,...); int fail = 0; Index: gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm =================================================================== --- gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm (revision 241752) +++ gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm (working copy) @@ -1,7 +1,7 @@ /* { dg-lto-do run } */ /* { dg-skip-if "Needs OBJC2 ABI" { "*-*-darwin*" && lp64 } { "*" } { "" } } */ extern "C" { -extern int printf (char *,...) ; +extern int printf (const char *,...) ; extern void abort (void) ; }