From: Martin Liska Date: Mon, 6 Nov 2017 13:41:35 +0000 (+0100) Subject: Fix -Wreturn-type fallout. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=454f8b2b0c6f9645b3df6be98efe2ca520f2ce82;p=gcc.git Fix -Wreturn-type fallout. 2017-11-06 Martin Liska * c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value for functions with non-void return type, or change type to void, or add -Wno-return-type for test. (foo2): Likewise. * c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise. (foo1): Likewise. * c-c++-common/cilk-plus/CK/errors.c: Likewise. * c-c++-common/cilk-plus/CK/pr60197.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise. (test_exe): Likewise. * c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise. * g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise. * g++.dg/eh/sighandle.C (dosegv): Likewise. * g++.dg/ext/vector14.C (foo): Likewise. (main): Likewise. * g++.dg/graphite/pr41305.C: Likewise. * g++.dg/graphite/pr42930.C: Likewise. * g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise. (makeDir): Likewise. * g++.dg/other/i386-8.C (foo): Likewise. * g++.dg/pr45788.C: Likewise. * g++.dg/pr64688.C (at_c): Likewise. * g++.dg/pr65032.C (G::DecodeVorbis): Likewise. * g++.dg/pr71633.C (c3::fn2): Likewise. * g++.dg/stackprotectexplicit2.C (A): Likewise. * g++.old-deja/g++.law/weak.C (main): Likewise. 2017-11-06 Martin Liska * testsuite/libgomp.c++/loop-2.C: Return a value for functions with non-void return type, or change type to void, or add -Wno-return-type for test. * testsuite/libgomp.c++/loop-4.C: Likewise. * testsuite/libgomp.c++/parallel-1.C: Likewise. * testsuite/libgomp.c++/shared-1.C: Likewise. * testsuite/libgomp.c++/single-1.C: Likewise. * testsuite/libgomp.c++/single-2.C: Likewise. 2017-11-06 Martin Liska * testsuite/27_io/basic_fstream/cons/char/path.cc (main): Return a value for functions with non-void return type, or change type to void, or add -Wno-return-type for test. * testsuite/27_io/basic_ifstream/cons/char/path.cc (main): Likewise. * testsuite/27_io/basic_ofstream/open/char/path.cc (main): Likewise. From-SVN: r254451 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c3a2fa2abb..1d5ba34ff9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,34 @@ +2017-11-06 Martin Liska + + * c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value + for functions with non-void return type, or change type to void, + or add -Wno-return-type for test. + (foo2): Likewise. + * c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise. + (foo1): Likewise. + * c-c++-common/cilk-plus/CK/errors.c: Likewise. + * c-c++-common/cilk-plus/CK/pr60197.c: Likewise. + * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. + * c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise. + (test_exe): Likewise. + * c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise. + * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise. + * g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise. + * g++.dg/eh/sighandle.C (dosegv): Likewise. + * g++.dg/ext/vector14.C (foo): Likewise. + (main): Likewise. + * g++.dg/graphite/pr41305.C: Likewise. + * g++.dg/graphite/pr42930.C: Likewise. + * g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise. + (makeDir): Likewise. + * g++.dg/other/i386-8.C (foo): Likewise. + * g++.dg/pr45788.C: Likewise. + * g++.dg/pr64688.C (at_c): Likewise. + * g++.dg/pr65032.C (G::DecodeVorbis): Likewise. + * g++.dg/pr71633.C (c3::fn2): Likewise. + * g++.dg/stackprotectexplicit2.C (A): Likewise. + * g++.old-deja/g++.law/weak.C (main): Likewise. + 2017-11-06 Eric Botcazou * gnat.dg/gcov: New directory. diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c index 83325a77501..89a3d57ebdd 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c @@ -2,13 +2,13 @@ /* { dg-do compile } */ /* { dg-options "-fcilkplus" } */ -int foo1 () +void foo1 () { int a; a = __sec_reduce_add (1); /* { dg-error "Invalid builtin arguments" } */ } -int foo2 () +void foo2 () { int a; a = __sec_reduce_add (); /* { dg-error "Invalid builtin arguments" } */ diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c index a956d0e18ab..b47de1e7ebc 100755 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c @@ -4,8 +4,7 @@ int A[10]; -int foo () { - +void foo () { /* C compiler uses the term "undeclared" whereas C++ compiler uses "not declared". Thus, grepping for declared seem to be the easiest. */ char c = (char)N; /* { dg-error "declared" } */ @@ -15,12 +14,8 @@ int foo () { A[l:s:c]; } -int foo1 (int N) { - +void foo1 (int N) { char c = (char)N; short s = (short)N; A[l:s:c]; /* { dg-error "declared" } */ } - - - diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c index b1e336e3328..d637924e9e1 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -Wno-return-type" } */ int func_2(void); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c index 2b47d1efb7d..301a6f2e9d1 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c @@ -1,6 +1,6 @@ /* PR c/60197 */ /* { dg-do compile } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -Wno-return-type" } */ extern int foo (void); extern int bar (int); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c index 14b7eef1276..602971e02c9 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -Wno-return-type" } */ int main (void) { diff --git a/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c b/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c index c56adc4d662..658cc092995 100644 --- a/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c +++ b/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c @@ -29,13 +29,15 @@ int result; void test_pic (struct bfd_link_info *info) { if (bfd_link_pic (info)) - result++; + result++; } int test_exe (struct bfd_link_info *info) { if (bfd_link_executable (info)) result++; + + return 0; } /* { dg-final { scan-assembler-times "testn?b" 2 } } */ diff --git a/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c b/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c index a14bceb4566..c95cc56dfa9 100644 --- a/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c +++ b/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c @@ -36,6 +36,8 @@ int test_exe (struct bfd_link_info *info) { if (bfd_link_executable (info)) result++; + + return 0; } /* { dg-final { scan-assembler-times "testn?b" 2 } } */ diff --git a/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc b/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc index db81912cbe5..111a2a29686 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc +++ b/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc @@ -15,6 +15,8 @@ T my_func (T *x, T y) *x = y; else *x = *x; + + return T(); } template T my_func (T *x, T y); diff --git a/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc b/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc index b442bf9cc24..a9a8a51ce7e 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc +++ b/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc @@ -16,7 +16,7 @@ struct A2 { }; A2 fa2 () { - A2 (); + return A2 (); } struct B1 { diff --git a/gcc/testsuite/g++.dg/eh/sighandle.C b/gcc/testsuite/g++.dg/eh/sighandle.C index 5c4995e7677..c2200024687 100644 --- a/gcc/testsuite/g++.dg/eh/sighandle.C +++ b/gcc/testsuite/g++.dg/eh/sighandle.C @@ -12,6 +12,7 @@ void sighandler (int signo, siginfo_t * si, void * uc) char * dosegv () { * ((volatile int *)0) = 12; + return 0; } int main () diff --git a/gcc/testsuite/g++.dg/ext/vector14.C b/gcc/testsuite/g++.dg/ext/vector14.C index 8e792108fb8..eecff39de47 100644 --- a/gcc/testsuite/g++.dg/ext/vector14.C +++ b/gcc/testsuite/g++.dg/ext/vector14.C @@ -8,7 +8,11 @@ #define vector __attribute__((vector_size(16))) -template vector signed int foo (vector float value) {} +template vector signed int foo (vector float value) +{ + vector signed int a; + return a; +} template void foo (float) {} @@ -19,4 +23,6 @@ main () float f; foo<1> (v); foo<1> (f); + + return 0; } diff --git a/gcc/testsuite/g++.dg/graphite/pr41305.C b/gcc/testsuite/g++.dg/graphite/pr41305.C index 6a30b0e9e39..756b1267288 100644 --- a/gcc/testsuite/g++.dg/graphite/pr41305.C +++ b/gcc/testsuite/g++.dg/graphite/pr41305.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-O3 -floop-interchange -Wno-conversion-null" } +// { dg-options "-O3 -floop-interchange -Wno-conversion-null -Wno-return-type" } void __throw_bad_alloc (); diff --git a/gcc/testsuite/g++.dg/graphite/pr42930.C b/gcc/testsuite/g++.dg/graphite/pr42930.C index c1150ce9353..e569cea0177 100644 --- a/gcc/testsuite/g++.dg/graphite/pr42930.C +++ b/gcc/testsuite/g++.dg/graphite/pr42930.C @@ -1,4 +1,4 @@ -/* { dg-options "-O1 -floop-block" } */ +/* { dg-options "-O1 -floop-block -Wno-return-type" } */ typedef unsigned char byte; typedef unsigned int uint; diff --git a/gcc/testsuite/g++.dg/opt/pr46640.C b/gcc/testsuite/g++.dg/opt/pr46640.C index 1c25778e8da..b55afd4937e 100644 --- a/gcc/testsuite/g++.dg/opt/pr46640.C +++ b/gcc/testsuite/g++.dg/opt/pr46640.C @@ -7,6 +7,7 @@ struct QBasicAtomicInt bool deref () { asm volatile ("":"=m" (i), "=qm" (j)); + return true; } }; @@ -41,4 +42,6 @@ bool makeDir (unsigned len) return false; i = pos; } + + return true; } diff --git a/gcc/testsuite/g++.dg/other/i386-8.C b/gcc/testsuite/g++.dg/other/i386-8.C index cf833a524de..a9465ef12bc 100644 --- a/gcc/testsuite/g++.dg/other/i386-8.C +++ b/gcc/testsuite/g++.dg/other/i386-8.C @@ -19,4 +19,6 @@ foo (float *x, short *y) __m64 c = _mm_cvtps_pi16 (b); __builtin_memcpy (y, &c, sizeof (short) * 4); y[0] = bar (y[0]); + + return 0; } diff --git a/gcc/testsuite/g++.dg/pr45788.C b/gcc/testsuite/g++.dg/pr45788.C index 0f4db20c769..9148585a7f6 100644 --- a/gcc/testsuite/g++.dg/pr45788.C +++ b/gcc/testsuite/g++.dg/pr45788.C @@ -1,5 +1,5 @@ // { dg-do compile { target i?86-*-* x86_64-*-* } } -// { dg-options "-O3 -fwhole-program -msse2" } +// { dg-options "-O3 -fwhole-program -msse2 -Wno-return-type" } typedef long unsigned int __darwin_size_t; typedef __darwin_size_t size_t; diff --git a/gcc/testsuite/g++.dg/pr64688.C b/gcc/testsuite/g++.dg/pr64688.C index 3525e49b735..bf85f1abb45 100644 --- a/gcc/testsuite/g++.dg/pr64688.C +++ b/gcc/testsuite/g++.dg/pr64688.C @@ -24,7 +24,10 @@ template struct F; template struct G; template struct H; template struct H {}; -template unsigned char at_c(H) {} +template unsigned char at_c(H) +{ + return 0; +} template class I; template class J; template class K; diff --git a/gcc/testsuite/g++.dg/pr65032.C b/gcc/testsuite/g++.dg/pr65032.C index a62f50b49bf..d6b6768d25a 100644 --- a/gcc/testsuite/g++.dg/pr65032.C +++ b/gcc/testsuite/g++.dg/pr65032.C @@ -84,4 +84,6 @@ G::DecodeVorbis (int *p1) mDecodedAudioFrames -= b; fn2 (b); } + + return nsresult(); } diff --git a/gcc/testsuite/g++.dg/pr71633.C b/gcc/testsuite/g++.dg/pr71633.C index 48e9c9833ec..8852695b910 100644 --- a/gcc/testsuite/g++.dg/pr71633.C +++ b/gcc/testsuite/g++.dg/pr71633.C @@ -20,6 +20,7 @@ class c3 : c1, c2 int *c3::fn2 () const { + return 0; } int *c3::fn3 (int p) const diff --git a/gcc/testsuite/g++.dg/stackprotectexplicit2.C b/gcc/testsuite/g++.dg/stackprotectexplicit2.C index 9cf9ab909c9..35d9e886ccf 100644 --- a/gcc/testsuite/g++.dg/stackprotectexplicit2.C +++ b/gcc/testsuite/g++.dg/stackprotectexplicit2.C @@ -7,6 +7,7 @@ int A() { int A[23]; char b[22]; + return 0; } int __attribute__((stack_protect)) B() @@ -24,4 +25,4 @@ int __attribute__((stack_protect)) c() } -/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */ \ No newline at end of file +/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */ diff --git a/gcc/testsuite/g++.old-deja/g++.law/weak.C b/gcc/testsuite/g++.old-deja/g++.law/weak.C index 49132adbeb3..52444e77946 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/weak.C +++ b/gcc/testsuite/g++.old-deja/g++.law/weak.C @@ -11,10 +11,12 @@ std::istream x (0); +int main () { x.get(); std::putc(0, 0); std::fgets(0, 0, 0); x.get((char*) 0, 0); + return 0; } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f68604ca424..7c0e808d587 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,14 @@ +2017-11-06 Martin Liska + + * testsuite/libgomp.c++/loop-2.C: Return a value + for functions with non-void return type, or change type to void, + or add -Wno-return-type for test. + * testsuite/libgomp.c++/loop-4.C: Likewise. + * testsuite/libgomp.c++/parallel-1.C: Likewise. + * testsuite/libgomp.c++/shared-1.C: Likewise. + * testsuite/libgomp.c++/single-1.C: Likewise. + * testsuite/libgomp.c++/single-2.C: Likewise. + 2017-10-31 Tom de Vries * plugin/plugin-hsa.c (HSA_LOG): Remove semicolon after diff --git a/libgomp/testsuite/libgomp.c++/loop-2.C b/libgomp/testsuite/libgomp.c++/loop-2.C index ea3dc588afd..77144b8e7c6 100644 --- a/libgomp/testsuite/libgomp.c++/loop-2.C +++ b/libgomp/testsuite/libgomp.c++/loop-2.C @@ -15,6 +15,7 @@ void parloop (int *a) a[i] = i + 3; } +int main() { int i, a[N]; diff --git a/libgomp/testsuite/libgomp.c++/loop-4.C b/libgomp/testsuite/libgomp.c++/loop-4.C index 731f2345021..a940854c637 100644 --- a/libgomp/testsuite/libgomp.c++/loop-4.C +++ b/libgomp/testsuite/libgomp.c++/loop-4.C @@ -1,5 +1,6 @@ extern "C" void abort (void); +int main() { int i, a; diff --git a/libgomp/testsuite/libgomp.c++/parallel-1.C b/libgomp/testsuite/libgomp.c++/parallel-1.C index 3c931471328..ce338d0ddf9 100644 --- a/libgomp/testsuite/libgomp.c++/parallel-1.C +++ b/libgomp/testsuite/libgomp.c++/parallel-1.C @@ -8,6 +8,7 @@ foo (void) return 10; } +int main () { int A = 0; diff --git a/libgomp/testsuite/libgomp.c++/shared-1.C b/libgomp/testsuite/libgomp.c++/shared-1.C index 334a553ce23..2f61daa1213 100644 --- a/libgomp/testsuite/libgomp.c++/shared-1.C +++ b/libgomp/testsuite/libgomp.c++/shared-1.C @@ -53,6 +53,7 @@ parallel (int a, int b) abort (); } +int main() { parallel (1, 2); diff --git a/libgomp/testsuite/libgomp.c++/single-1.C b/libgomp/testsuite/libgomp.c++/single-1.C index e318a48ca5c..221236f24f2 100644 --- a/libgomp/testsuite/libgomp.c++/single-1.C +++ b/libgomp/testsuite/libgomp.c++/single-1.C @@ -1,5 +1,6 @@ extern "C" void abort (void); +int main() { int i = 0; diff --git a/libgomp/testsuite/libgomp.c++/single-2.C b/libgomp/testsuite/libgomp.c++/single-2.C index c2dd228568d..d24b1d85e66 100644 --- a/libgomp/testsuite/libgomp.c++/single-2.C +++ b/libgomp/testsuite/libgomp.c++/single-2.C @@ -7,6 +7,7 @@ struct X int c; }; +int main() { int i = 0; diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 70061e93779..a9a19a4871a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2017-11-06 Martin Liska + + * testsuite/27_io/basic_fstream/cons/char/path.cc (main): + Return a value for functions with non-void return type, + or change type to void, or add -Wno-return-type for test. + * testsuite/27_io/basic_ifstream/cons/char/path.cc (main): + Likewise. + * testsuite/27_io/basic_ofstream/open/char/path.cc (main): + Likewise. + 2017-11-06 Paolo Carlini * testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc index 4442c28c56b..51337ebd909 100644 --- a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc @@ -45,4 +45,5 @@ main() { test01(); test02(); + return 0; } diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc index 24286f5eeaf..a0de4ba55b2 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc @@ -45,4 +45,5 @@ main() { test01(); test02(); + return 0; } diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc index a3fc0c7ff68..38078c97ef7 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc @@ -47,4 +47,5 @@ main() { test01(); test02(); + return 0; }