Fix "control reaches end of non-void function" errors in testsuite
authorGary Benson <gbenson@redhat.com>
Fri, 15 May 2020 14:03:42 +0000 (15:03 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 15 May 2020 14:03:42 +0000 (15:03 +0100)
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.

16 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/info-os.c
gdb/testsuite/gdb.base/info_minsym.c
gdb/testsuite/gdb.base/large-frame-2.c
gdb/testsuite/gdb.base/pr10179-a.c
gdb/testsuite/gdb.base/pr10179-b.c
gdb/testsuite/gdb.base/valgrind-disp-step.c
gdb/testsuite/gdb.base/watch-cond.c
gdb/testsuite/gdb.multi/goodbye.c
gdb/testsuite/gdb.multi/hello.c
gdb/testsuite/gdb.python/py-finish-breakpoint.c
gdb/testsuite/gdb.threads/fork-plus-threads.c
gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c
gdb/testsuite/gdb.threads/hand-call-new-thread.c
gdb/testsuite/gdb.threads/interrupt-while-step-over.c
gdb/testsuite/gdb.trace/actions-changed.c

index 3702032fb68f98483d685ab1f4c1d6ac99a755af..dda5b68473223c1d5082eb5ea4afb315347ad5a0 100644 (file)
@@ -1,3 +1,23 @@
+2020-05-15  Gary Benson <gbenson@redhat.com>
+
+       * 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 <gbenson@redhat.com>
 
        * gdb.opencl/callfuncs.exp: Report when test skipped.
index f08407f02f2ec873bb1571cbb73484b4375d4902..5b88c2661ee0a958863bb6fe253914add103d459 100644 (file)
@@ -48,6 +48,8 @@ thread_proc (void *args)
 {
   pthread_mutex_lock (&mutex);
   pthread_mutex_unlock (&mutex);
+
+  return NULL;
 }
 
 int
index b4e3a3f33911123d53168672e233cd88f64c4bdb..6f774b6fe685e0b829d2372bec5a79e1ce444861 100644 (file)
@@ -20,6 +20,7 @@ static int minsym_var;
 static int minsym_fun (void)
 {
    minsym_var++;
+   return 0;
 }
 
 int
index bc2cc8482aa2e3d85ff65e1bb76e2ec2a1df604a..7a88f57c5cd8fc383c22649045351f37c600de8d 100644 (file)
@@ -22,4 +22,5 @@ func (void)
 {
   int a[4096];
   blah (a);
+  return 0;
 }
index 56bce9df92ed4a05b17c677758154f5991bf50b5..584b1bc32a4f700afc33ab9b53ef3da9b10bbcec 100644 (file)
@@ -5,11 +5,13 @@ extern int foo2();
 int
 foo1()
 {
+  return 0;
 }
 
 int
 bar1()
 {
+  return 0;
 }
 
 int
index dcc5d9bb8b3cf7624d9032bceeeaea79ee0903c3..2f328ba5f393ee8b7e3950c567d201f878daee87 100644 (file)
@@ -3,4 +3,5 @@
 int
 foo2()
 {
+  return 0;
 }
index 3a397ac1619bb6491f7fef8363f2a3597d45c132..10de4aa2dc77d72de6e5d842269971c1845608a9 100644 (file)
@@ -18,6 +18,7 @@
 static int
 foo (void)
 {
+  return 0;
 }
 
 int
index fe6fe9028f89080986df689f23243514d53411c9..435f0b89c3db118b1a99bd93beb1bee7e8e13b33 100644 (file)
@@ -23,6 +23,7 @@ int func(int *foo)
   (*foo)++;
   global++;
   global2++;
+  return 0;
 }
 
 void func2(int *foo)
index 35a8d140e9c0442020716c9c40c5eb1a6e9703af..7348d13f6a0d9fecf2a433be20c7314032f35715 100644 (file)
@@ -37,6 +37,7 @@ int verylongfun()
   glob *= 8;
   glob += 9;
   glob *= 9;
+  return 0;
 }
 
 void
index ab535cd18297d7d1d518f18fa69d97a2b97ff94a..d403addd72e8dbdf96038de2e392ab99d6d487d5 100644 (file)
@@ -29,7 +29,7 @@ bar()
     exit(1);
 }
 
-int commonfun() { bar(); } /* from hello */
+int commonfun() { bar(); return 0; } /* from hello */
 
 int
 hello(int x)
index 8b4c58c5407c36c20ca9f277fcbb8230668192ac..83d439c08bb9419a9039b9dcc96d2bb1799637b8 100644 (file)
@@ -56,6 +56,7 @@ int
 call_longjmp (jmp_buf *buf)
 {
   call_longjmp_1 (buf);
+  return 0;
 }
 
 void
index 5600a9a83394044c5a3e729f8232f6f7b8b7bc14..c29c4d9a95f727106954b573d88976d186f2dd3c 100644 (file)
@@ -33,6 +33,7 @@ static void *
 thread_func (void *arg)
 {
   /* Empty.  */
+  return NULL;
 }
 
 static void
index 38b25c42e6435cb8226c12df319e8dc2ab9a05b7..7dcaee379687f61993ef2cce79b3d48021d0c645 100644 (file)
@@ -90,6 +90,8 @@ thread_forks (void *arg)
          exit (1);
        }
     }
+
+  return NULL;
 }
 
 /* Set this to tell the thread_breakpoint thread to exit.  */
index f4a315d3d58966f6989e0b9e0b5c4920173f5f8f..74042e40bafb2c44200c489f1ad72824bbb66893 100644 (file)
@@ -24,6 +24,7 @@ static int
 foo (void)
 {
   usleep (1);
+  return 0;
 }
 
 static void *
index e9e08b2a605aa59cb20b66f135b1d4396af4e7f5..f76988743ae80ee71bbef014d492d4c3b7c09162 100644 (file)
@@ -44,6 +44,8 @@ child_function (void *arg)
   pthread_barrier_wait (&threads_started_barrier);
 
   infinite_loop ();
+
+  return NULL;
 }
 
 void
index d3fead345a9d1db7fc0e58dced27c6da13be0265..5b204d3c023b8421d90fe8b409653cffda7f6628 100644 (file)
@@ -18,6 +18,7 @@
 int
 end (int i)
 {
+  return 0;
 }
 
 int