From: Gary Benson Date: Fri, 15 May 2020 14:03:42 +0000 (+0100) Subject: Fix "control reaches end of non-void function" errors in testsuite X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86e4e63d7cabb94a80a5ce767f670b65add5a083;p=binutils-gdb.git Fix "control reaches end of non-void function" errors in testsuite When running the testsuite with clang, a number of testcases fail to build with the following errors: warning: control reaches end of non-void function [-Wreturn-type] warning: control may reach end of non-void function [-Wreturn-type] This prevents a number of testcases from executing. This commit fixes. gdb/testsuite/ChangeLog: * gdb.base/info-os.c (main): Add return statement. * gdb.base/info_minsym.c (minsym_fun): Likewise. * gdb.base/large-frame-2.c (func): Likewise. * gdb.base/pr10179-a.c (foo1, bar1): Likewise. * gdb.base/pr10179-b.c (foo2): Likewise. * gdb.base/valgrind-disp-step.c (foo): Likewise. * gdb.base/watch-cond.c (func): Likewise. * gdb.multi/goodbye.c (verylongfun): Likewise. * gdb.multi/hello.c (commonfun): Likewise. * gdb.python/py-finish-breakpoint.c (call_longjmp): Likewise. * gdb.threads/fork-plus-threads.c (thread_func): Likewise. * gdb.threads/forking-threads-plus-breakpoint.c (thread_forks): Likewise. * gdb.threads/hand-call-new-thread.c (foo): Likewise. * gdb.threads/interrupt-while-step-over.c (child_function): Likewise. * gdb.trace/actions-changed.c (end): Likewise. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3702032fb68..dda5b684732 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2020-05-15 Gary Benson + + * gdb.base/info-os.c (main): Add return statement. + * gdb.base/info_minsym.c (minsym_fun): Likewise. + * gdb.base/large-frame-2.c (func): Likewise. + * gdb.base/pr10179-a.c (foo1, bar1): Likewise. + * gdb.base/pr10179-b.c (foo2): Likewise. + * gdb.base/valgrind-disp-step.c (foo): Likewise. + * gdb.base/watch-cond.c (func): Likewise. + * gdb.multi/goodbye.c (verylongfun): Likewise. + * gdb.multi/hello.c (commonfun): Likewise. + * gdb.python/py-finish-breakpoint.c (call_longjmp): Likewise. + * gdb.threads/fork-plus-threads.c (thread_func): Likewise. + * gdb.threads/forking-threads-plus-breakpoint.c (thread_forks): + Likewise. + * gdb.threads/hand-call-new-thread.c (foo): Likewise. + * gdb.threads/interrupt-while-step-over.c (child_function): + Likewise. + * gdb.trace/actions-changed.c (end): Likewise. + 2020-05-15 Gary Benson * gdb.opencl/callfuncs.exp: Report when test skipped. diff --git a/gdb/testsuite/gdb.base/info-os.c b/gdb/testsuite/gdb.base/info-os.c index f08407f02f2..5b88c2661ee 100644 --- a/gdb/testsuite/gdb.base/info-os.c +++ b/gdb/testsuite/gdb.base/info-os.c @@ -48,6 +48,8 @@ thread_proc (void *args) { pthread_mutex_lock (&mutex); pthread_mutex_unlock (&mutex); + + return NULL; } int diff --git a/gdb/testsuite/gdb.base/info_minsym.c b/gdb/testsuite/gdb.base/info_minsym.c index b4e3a3f3391..6f774b6fe68 100644 --- a/gdb/testsuite/gdb.base/info_minsym.c +++ b/gdb/testsuite/gdb.base/info_minsym.c @@ -20,6 +20,7 @@ static int minsym_var; static int minsym_fun (void) { minsym_var++; + return 0; } int diff --git a/gdb/testsuite/gdb.base/large-frame-2.c b/gdb/testsuite/gdb.base/large-frame-2.c index bc2cc8482aa..7a88f57c5cd 100644 --- a/gdb/testsuite/gdb.base/large-frame-2.c +++ b/gdb/testsuite/gdb.base/large-frame-2.c @@ -22,4 +22,5 @@ func (void) { int a[4096]; blah (a); + return 0; } diff --git a/gdb/testsuite/gdb.base/pr10179-a.c b/gdb/testsuite/gdb.base/pr10179-a.c index 56bce9df92e..584b1bc32a4 100644 --- a/gdb/testsuite/gdb.base/pr10179-a.c +++ b/gdb/testsuite/gdb.base/pr10179-a.c @@ -5,11 +5,13 @@ extern int foo2(); int foo1() { + return 0; } int bar1() { + return 0; } int diff --git a/gdb/testsuite/gdb.base/pr10179-b.c b/gdb/testsuite/gdb.base/pr10179-b.c index dcc5d9bb8b3..2f328ba5f39 100644 --- a/gdb/testsuite/gdb.base/pr10179-b.c +++ b/gdb/testsuite/gdb.base/pr10179-b.c @@ -3,4 +3,5 @@ int foo2() { + return 0; } diff --git a/gdb/testsuite/gdb.base/valgrind-disp-step.c b/gdb/testsuite/gdb.base/valgrind-disp-step.c index 3a397ac1619..10de4aa2dc7 100644 --- a/gdb/testsuite/gdb.base/valgrind-disp-step.c +++ b/gdb/testsuite/gdb.base/valgrind-disp-step.c @@ -18,6 +18,7 @@ static int foo (void) { + return 0; } int diff --git a/gdb/testsuite/gdb.base/watch-cond.c b/gdb/testsuite/gdb.base/watch-cond.c index fe6fe9028f8..435f0b89c3d 100644 --- a/gdb/testsuite/gdb.base/watch-cond.c +++ b/gdb/testsuite/gdb.base/watch-cond.c @@ -23,6 +23,7 @@ int func(int *foo) (*foo)++; global++; global2++; + return 0; } void func2(int *foo) diff --git a/gdb/testsuite/gdb.multi/goodbye.c b/gdb/testsuite/gdb.multi/goodbye.c index 35a8d140e9c..7348d13f6a0 100644 --- a/gdb/testsuite/gdb.multi/goodbye.c +++ b/gdb/testsuite/gdb.multi/goodbye.c @@ -37,6 +37,7 @@ int verylongfun() glob *= 8; glob += 9; glob *= 9; + return 0; } void diff --git a/gdb/testsuite/gdb.multi/hello.c b/gdb/testsuite/gdb.multi/hello.c index ab535cd1829..d403addd72e 100644 --- a/gdb/testsuite/gdb.multi/hello.c +++ b/gdb/testsuite/gdb.multi/hello.c @@ -29,7 +29,7 @@ bar() exit(1); } -int commonfun() { bar(); } /* from hello */ +int commonfun() { bar(); return 0; } /* from hello */ int hello(int x) diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.c b/gdb/testsuite/gdb.python/py-finish-breakpoint.c index 8b4c58c5407..83d439c08bb 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.c +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.c @@ -56,6 +56,7 @@ int call_longjmp (jmp_buf *buf) { call_longjmp_1 (buf); + return 0; } void diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.c b/gdb/testsuite/gdb.threads/fork-plus-threads.c index 5600a9a8339..c29c4d9a95f 100644 --- a/gdb/testsuite/gdb.threads/fork-plus-threads.c +++ b/gdb/testsuite/gdb.threads/fork-plus-threads.c @@ -33,6 +33,7 @@ static void * thread_func (void *arg) { /* Empty. */ + return NULL; } static void diff --git a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c index 38b25c42e64..7dcaee37968 100644 --- a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c +++ b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c @@ -90,6 +90,8 @@ thread_forks (void *arg) exit (1); } } + + return NULL; } /* Set this to tell the thread_breakpoint thread to exit. */ diff --git a/gdb/testsuite/gdb.threads/hand-call-new-thread.c b/gdb/testsuite/gdb.threads/hand-call-new-thread.c index f4a315d3d58..74042e40baf 100644 --- a/gdb/testsuite/gdb.threads/hand-call-new-thread.c +++ b/gdb/testsuite/gdb.threads/hand-call-new-thread.c @@ -24,6 +24,7 @@ static int foo (void) { usleep (1); + return 0; } static void * diff --git a/gdb/testsuite/gdb.threads/interrupt-while-step-over.c b/gdb/testsuite/gdb.threads/interrupt-while-step-over.c index e9e08b2a605..f76988743ae 100644 --- a/gdb/testsuite/gdb.threads/interrupt-while-step-over.c +++ b/gdb/testsuite/gdb.threads/interrupt-while-step-over.c @@ -44,6 +44,8 @@ child_function (void *arg) pthread_barrier_wait (&threads_started_barrier); infinite_loop (); + + return NULL; } void diff --git a/gdb/testsuite/gdb.trace/actions-changed.c b/gdb/testsuite/gdb.trace/actions-changed.c index d3fead345a9..5b204d3c023 100644 --- a/gdb/testsuite/gdb.trace/actions-changed.c +++ b/gdb/testsuite/gdb.trace/actions-changed.c @@ -18,6 +18,7 @@ int end (int i) { + return 0; } int