[OB PATCH] Fix "control reaches end of non-void function" errors in testsuite
Gary Benson
gbenson@redhat.com
Fri May 15 14:04:36 GMT 2020
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.
---
gdb/testsuite/ChangeLog | 20 ++++++++++++++++++++
gdb/testsuite/gdb.base/info-os.c | 2 ++
gdb/testsuite/gdb.base/info_minsym.c | 1 +
gdb/testsuite/gdb.base/large-frame-2.c | 1 +
gdb/testsuite/gdb.base/pr10179-a.c | 2 ++
gdb/testsuite/gdb.base/pr10179-b.c | 1 +
gdb/testsuite/gdb.base/valgrind-disp-step.c | 1 +
gdb/testsuite/gdb.base/watch-cond.c | 1 +
gdb/testsuite/gdb.multi/goodbye.c | 1 +
gdb/testsuite/gdb.multi/hello.c | 2 +-
gdb/testsuite/gdb.python/py-finish-breakpoint.c | 1 +
gdb/testsuite/gdb.threads/fork-plus-threads.c | 1 +
.../gdb.threads/forking-threads-plus-breakpoint.c | 2 ++
gdb/testsuite/gdb.threads/hand-call-new-thread.c | 1 +
.../gdb.threads/interrupt-while-step-over.c | 2 ++
gdb/testsuite/gdb.trace/actions-changed.c | 1 +
16 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/info-os.c b/gdb/testsuite/gdb.base/info-os.c
index f08407f..5b88c26 100644
--- a/gdb/testsuite/gdb.base/info-os.c
+++ b/gdb/testsuite/gdb.base/info-os.c
@@ -48,6 +48,8 @@
{
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 b4e3a3f..6f774b6 100644
--- a/gdb/testsuite/gdb.base/info_minsym.c
+++ b/gdb/testsuite/gdb.base/info_minsym.c
@@ -20,6 +20,7 @@
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 bc2cc84..7a88f57 100644
--- a/gdb/testsuite/gdb.base/large-frame-2.c
+++ b/gdb/testsuite/gdb.base/large-frame-2.c
@@ -22,4 +22,5 @@
{
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 56bce9d..584b1bc 100644
--- a/gdb/testsuite/gdb.base/pr10179-a.c
+++ b/gdb/testsuite/gdb.base/pr10179-a.c
@@ -5,11 +5,13 @@
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 dcc5d9b..2f328ba 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 3a397ac..10de4aa 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 fe6fe90..435f0b8 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 35a8d14..7348d13 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 ab535cd..d403add 100644
--- a/gdb/testsuite/gdb.multi/hello.c
+++ b/gdb/testsuite/gdb.multi/hello.c
@@ -29,7 +29,7 @@
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 8b4c58c..83d439c 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.c
@@ -56,6 +56,7 @@ void increase (int *a)
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 5600a9a..c29c4d9 100644
--- a/gdb/testsuite/gdb.threads/fork-plus-threads.c
+++ b/gdb/testsuite/gdb.threads/fork-plus-threads.c
@@ -33,6 +33,7 @@
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 38b25c4..7dcaee3 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 @@
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 f4a315d..74042e4 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 @@
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 e9e08b2..f769887 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 @@
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 d3fead3..5b204d3 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
--
1.8.3.1
More information about the Gdb-patches
mailing list