[pushed,gdb/testsuite] Add missing returns in gdb.threads/infcall-from-bp-cond-simple.c

Message ID 20250320113725.12351-1-tdevries@suse.de
State Committed
Headers
Series [pushed,gdb/testsuite] Add missing returns in gdb.threads/infcall-from-bp-cond-simple.c |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom de Vries March 20, 2025, 11:37 a.m. UTC
  While investigating PR32785 I noticed a missing return statement in
worker_func, and compiling with -Wreturn-type showed another in
function_that_segfaults:
...
$ gcc gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c -Wreturn-type
infcall-from-bp-cond-simple.c: In function ‘function_that_segfaults’:
infcall-from-bp-cond-simple.c:46:1: warning: \
  control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
infcall-from-bp-cond-simple.c: In function ‘worker_func’:
infcall-from-bp-cond-simple.c:58:1: warning: \
  control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^
...

Fix these by adding the missing returns.
---
 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c | 2 ++
 1 file changed, 2 insertions(+)


base-commit: d3d4840e802ef6ee4353872401ded5cc5cf87ecb
  

Patch

diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
index 2e23f1229c5..d0707cd2e9f 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
@@ -43,6 +43,7 @@  function_that_segfaults ()
 {
   int *p = 0;
   *p = 1;	/* Segfault happens here.   */
+  return 0;
 }
 
 int
@@ -55,6 +56,7 @@  void *
 worker_func (void *arg)
 {
   int a = 42;	/* Breakpoint here.  */
+  return NULL;
 }
 
 void