[PATCH 16/16] GDB testsuite: Fix warnings with -std=gnu11

Andreas Arnez
2014-10-29T16:04:47Z

Since upstream GCC has changed the default C language dialect to
'gnu11', it yields multiple warnings in the GDB testsuite for missing
function return types and implicit function declarations. This patch
attempts to fix these.

gdb/testsuite/ChangeLog:

* gdb.ada/cond_lang/foo.c (callme): Add return type.
* gdb.base/call-sc.c (zed): Likewise.
* gdb.base/checkpoint.c (main): Likewise.
* gdb.base/dump.c (main): Likewise.
* gdb.base/gcore.c (main): Likewise.
* gdb.base/huge.c (main): Likewise.
* gdb.base/multi-forks.c (main): Likewise.
* gdb.base/pr10179-a.c (main): Likewise.
* gdb.base/savedregs.c (main): Likewise.
* gdb.base/sigaltstack.c (main): Likewise.
* gdb.base/siginfo.c (main): Likewise.
* gdb.base/structs.c (zed): Likewise.
* gdb.mi/mi-stack.c (callee3, callee2, callee1, main): Likewise.
* gdb.mi/mi-syn-frame.c (main): Likewise.
* gdb.mi/until.c (foo, main): Likewise.
* gdb.base/global-var-nested-by-dso.c (b_main, c_main): Declare.
* gdb.base/solib-weak.c (foo): Declare.
* gdb.base/attach-twice.c: Include stdio.h.
* gdb.base/weaklib1.c: Likewise.
* gdb.base/weaklib2.c: Likewise.
* gdb.base/catch-signal-fork.c: Include stdio.h and sys/wait.h.
* gdb.mi/mi-condbreak-call-thr-state-mt.c: Include stdio.h and
unistd.h.
* gdb.base/attach-pie-misread.c: Include stdlib.h.
* gdb.mi/mi-exit-code.c: Likewise.
* gdb.base/break-interp-lib.c: Include string.h.
* gdb.base/coremaker.c: Likewise.
* gdb.base/testenv.c: Likewise.
* gdb.python/py-finish-breakpoint.c: Likewise.
* gdb.base/inferior-died.c: Include sys/wait.h.
* gdb.base/fileio.c: Include time.h.
* gdb.base/async-shell.c: Include unistd.h.
* gdb.base/dprintf-non-stop.c: Likewise.
* gdb.base/info-os.c: Likewise.
* gdb.mi/mi-console.c: Likewise.
* gdb.mi/watch-nonstop.c: Likewise.
* gdb.python/py-events.c: Likewise.
* gdb.base/async.c (baz): Move up before its invocation.
* gdb.base/code_elim2.c (my_global_func): Likewise.
* gdb.base/skip-solib-lib.c (multiply): Likewise.
* gdb.base/advance.c (func2): Likewise.
---
gdb/testsuite/gdb.ada/cond_lang/foo.c | 2 +-
gdb/testsuite/gdb.base/advance.c | 10 +++++-----
gdb/testsuite/gdb.base/async-shell.c | 2 ++
gdb/testsuite/gdb.base/async.c | 13 ++++++-------
gdb/testsuite/gdb.base/attach-pie-misread.c | 1 +
gdb/testsuite/gdb.base/attach-twice.c | 1 +
gdb/testsuite/gdb.base/break-interp-lib.c | 1 +
gdb/testsuite/gdb.base/call-sc.c | 2 +-
gdb/testsuite/gdb.base/catch-signal-fork.c | 2 ++
gdb/testsuite/gdb.base/checkpoint.c | 7 ++++---
gdb/testsuite/gdb.base/code_elim2.c | 12 ++++++------
gdb/testsuite/gdb.base/coremaker.c | 1 +
gdb/testsuite/gdb.base/dprintf-non-stop.c | 2 ++
gdb/testsuite/gdb.base/dump.c | 2 ++
gdb/testsuite/gdb.base/fileio.c | 1 +
gdb/testsuite/gdb.base/gcore.c | 1 +
gdb/testsuite/gdb.base/global-var-nested-by-dso.c | 3 +++
gdb/testsuite/gdb.base/huge.c | 1 +
gdb/testsuite/gdb.base/inferior-died.c | 1 +
gdb/testsuite/gdb.base/info-os.c | 1 +
gdb/testsuite/gdb.base/multi-forks.c | 3 ++-
gdb/testsuite/gdb.base/pr10179-a.c | 1 +
gdb/testsuite/gdb.base/savedregs.c | 2 ++
gdb/testsuite/gdb.base/sigaltstack.c | 2 ++
gdb/testsuite/gdb.base/siginfo.c | 1 +
gdb/testsuite/gdb.base/skip-solib-lib.c | 8 ++++----
gdb/testsuite/gdb.base/solib-weak.c | 2 ++
gdb/testsuite/gdb.base/structs.c | 1 +
gdb/testsuite/gdb.base/testenv.c | 1 +
gdb/testsuite/gdb.base/weaklib1.c | 2 ++
gdb/testsuite/gdb.base/weaklib2.c | 2 ++
gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c | 2 ++
gdb/testsuite/gdb.mi/mi-console.c | 2 ++
gdb/testsuite/gdb.mi/mi-exit-code.c | 2 ++
gdb/testsuite/gdb.mi/mi-stack.c | 9 +++++----
gdb/testsuite/gdb.mi/mi-syn-frame.c | 2 ++
gdb/testsuite/gdb.mi/until.c | 2 ++
gdb/testsuite/gdb.mi/watch-nonstop.c | 2 ++
gdb/testsuite/gdb.python/py-events.c | 2 ++
gdb/testsuite/gdb.python/py-finish-breakpoint.c | 1 +
40 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/cond_lang/foo.c b/gdb/testsuite/gdb.ada/cond_lang/foo.c
index 3861da7..d701f62 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/foo.c
+++ b/gdb/testsuite/gdb.ada/cond_lang/foo.c
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

-extern callme (void);
+extern void callme (void);

void
c_function (void)
diff --git a/gdb/testsuite/gdb.base/advance.c b/gdb/testsuite/gdb.base/advance.c
index 8066dee..ab86b0e 100644
--- a/gdb/testsuite/gdb.base/advance.c
+++ b/gdb/testsuite/gdb.base/advance.c
@@ -13,15 +13,15 @@ int bar (int y)
return z;
}

-void func()
+int func2 ()
{
- x = x + 5;
- func2 ();
+ x = 6;
}

-int func2 ()
+void func()
{
- x = 6;
+ x = x + 5;
+ func2 ();
}

int func3 ()
diff --git a/gdb/testsuite/gdb.base/async-shell.c b/gdb/testsuite/gdb.base/async-shell.c
index 3629d77..1b63be1 100644
--- a/gdb/testsuite/gdb.base/async-shell.c
+++ b/gdb/testsuite/gdb.base/async-shell.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unistd.h>
+
int
main (void)
{
diff --git a/gdb/testsuite/gdb.base/async.c b/gdb/testsuite/gdb.base/async.c
index 32779d9..9148b19 100644
--- a/gdb/testsuite/gdb.base/async.c
+++ b/gdb/testsuite/gdb.base/async.c
@@ -13,6 +13,12 @@ foo (void)
}

int
+baz (void)
+{
+ return 5;
+}
+
+int
main (void)
{
int y, z;
@@ -25,10 +31,3 @@ main (void)
y = baz ();
return 0; /* until here */
}
-
-
-int
-baz (void)
-{
- return 5;
-}
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.c b/gdb/testsuite/gdb.base/attach-pie-misread.c
index 7de2ad3..08789d0 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.c
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.c
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */

#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>

const char stub[] = {
diff --git a/gdb/testsuite/gdb.base/attach-twice.c b/gdb/testsuite/gdb.base/attach-twice.c
index 74ee332..efe14f0 100644
--- a/gdb/testsuite/gdb.base/attach-twice.c
+++ b/gdb/testsuite/gdb.base/attach-twice.c
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ptrace.h>
diff --git a/gdb/testsuite/gdb.base/break-interp-lib.c b/gdb/testsuite/gdb.base/break-interp-lib.c
index 314dc66..0df2934 100644
--- a/gdb/testsuite/gdb.base/break-interp-lib.c
+++ b/gdb/testsuite/gdb.base/break-interp-lib.c
@@ -19,6 +19,7 @@
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
+#include <string.h>

/* Force REL->RELA conversion on i386, see "Prelink", March 4, 2004. */
volatile int v[2];
diff --git a/gdb/testsuite/gdb.base/call-sc.c b/gdb/testsuite/gdb.base/call-sc.c
index 56c18da..98c0229 100644
--- a/gdb/testsuite/gdb.base/call-sc.c
+++ b/gdb/testsuite/gdb.base/call-sc.c
@@ -46,7 +46,7 @@ void Fun(T foo)
L = foo;
}

-zed ()
+void zed ()
{
L = 'Z';
}
diff --git a/gdb/testsuite/gdb.base/catch-signal-fork.c b/gdb/testsuite/gdb.base/catch-signal-fork.c
index 87fe417..5ae83d6 100644
--- a/gdb/testsuite/gdb.base/catch-signal-fork.c
+++ b/gdb/testsuite/gdb.base/catch-signal-fork.c
@@ -14,8 +14,10 @@

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
+#include <sys/wait.h>
#include <unistd.h>

void
diff --git a/gdb/testsuite/gdb.base/checkpoint.c b/gdb/testsuite/gdb.base/checkpoint.c
index b6f7ecd..8f9d6da 100644
--- a/gdb/testsuite/gdb.base/checkpoint.c
+++ b/gdb/testsuite/gdb.base/checkpoint.c
@@ -17,10 +17,11 @@

#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>

long lines = 0;

-main()
+int main()
{
char linebuf[128];
FILE *in, *out;
@@ -34,7 +35,7 @@ main()
if (!in || !out)
{
fprintf (stderr, "File open failed\n");
- exit (1);
+ return 1;
}

for (i = 0; ; i++)
@@ -55,5 +56,5 @@ main()
fclose (out);
printf ("Deleting copy.\n"); /* breakpoint 3 */
unlink (COPY1_TXT);
- exit (0); /* breakpoint 4 */
+ return 0; /* breakpoint 4 */
}
diff --git a/gdb/testsuite/gdb.base/code_elim2.c b/gdb/testsuite/gdb.base/code_elim2.c
index 64ecc04..875228a 100644
--- a/gdb/testsuite/gdb.base/code_elim2.c
+++ b/gdb/testsuite/gdb.base/code_elim2.c
@@ -20,15 +20,15 @@ int my_global_symbol = 42;
static int my_static_symbol;

int
-main ()
-{
- return my_global_func ();
-}
-
-int
my_global_func ()
{
my_static_symbol = my_global_symbol;
my_global_symbol = my_static_symbol + my_global_symbol;
return my_global_symbol;
}
+
+int
+main ()
+{
+ return my_global_func ();
+}
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
index f05a111..22c1442 100644
--- a/gdb/testsuite/gdb.base/coremaker.c
+++ b/gdb/testsuite/gdb.base/coremaker.c
@@ -25,6 +25,7 @@
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>

#ifndef __STDC__
#define const /**/
diff --git a/gdb/testsuite/gdb.base/dprintf-non-stop.c b/gdb/testsuite/gdb.base/dprintf-non-stop.c
index 23c55fa..c7eeca9 100644
--- a/gdb/testsuite/gdb.base/dprintf-non-stop.c
+++ b/gdb/testsuite/gdb.base/dprintf-non-stop.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unistd.h>
+
void
foo ()
{
diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c
index bc68778..bdcafbf 100644
--- a/gdb/testsuite/gdb.base/dump.c
+++ b/gdb/testsuite/gdb.base/dump.c
@@ -27,6 +27,7 @@ zero_all ()
memset ((char *) &intstruct2, 0, sizeof (intstruct2));
}

+int
main()
{
int i;
@@ -43,4 +44,5 @@ main()
intstruct.g = 12 * 7;

checkpoint1 ();
+ return 0;
}
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index b8c2698..12a268b 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -9,6 +9,7 @@
#include <errno.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <time.h>
/* TESTS :
* - open(const char *pathname, int flags, mode_t mode);
1) Attempt to create file that already exists - EEXIST
diff --git a/gdb/testsuite/gdb.base/gcore.c b/gdb/testsuite/gdb.base/gcore.c
index ee826a5..f74516d 100644
--- a/gdb/testsuite/gdb.base/gcore.c
+++ b/gdb/testsuite/gdb.base/gcore.c
@@ -58,6 +58,7 @@ int factorial_func (int value)
return (value);
}

+int
main()
{
factorial_func (6);
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso.c b/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
index 3b63096..a77b8c2 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
@@ -15,6 +15,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+extern void b_main (void);
+extern void c_main (void);
+
int
main (int argc, char *argv[])
{
diff --git a/gdb/testsuite/gdb.base/huge.c b/gdb/testsuite/gdb.base/huge.c
index 27ba04e..57727e9 100644
--- a/gdb/testsuite/gdb.base/huge.c
+++ b/gdb/testsuite/gdb.base/huge.c
@@ -12,6 +12,7 @@
#endif
static int a[CRASH_GDB], b[CRASH_GDB];

+int
main()
{
memcpy (a, b, sizeof (a));
diff --git a/gdb/testsuite/gdb.base/inferior-died.c b/gdb/testsuite/gdb.base/inferior-died.c
index 5c4c5b2..bb635c0 100644
--- a/gdb/testsuite/gdb.base/inferior-died.c
+++ b/gdb/testsuite/gdb.base/inferior-died.c
@@ -17,6 +17,7 @@

#include <stdlib.h>
#include <sys/types.h>
+#include <sys/wait.h>
#include <unistd.h>

void function(void)
diff --git a/gdb/testsuite/gdb.base/info-os.c b/gdb/testsuite/gdb.base/info-os.c
index 1a52348..23257d4 100644
--- a/gdb/testsuite/gdb.base/info-os.c
+++ b/gdb/testsuite/gdb.base/info-os.c
@@ -22,6 +22,7 @@
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/socket.h>
+#include <unistd.h>

static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

diff --git a/gdb/testsuite/gdb.base/multi-forks.c b/gdb/testsuite/gdb.base/multi-forks.c
index c090c57..bbe06c3 100644
--- a/gdb/testsuite/gdb.base/multi-forks.c
+++ b/gdb/testsuite/gdb.base/multi-forks.c
@@ -22,6 +22,7 @@

pid_t pids[4];

+int
main()
{
int i;
@@ -32,5 +33,5 @@ main()
printf ("%d ready\n", getpid ());
sleep (2);
printf ("%d done\n", getpid ());
- exit (0); /* Set exit breakpoint here. */
+ return 0; /* Set exit breakpoint here. */
}
diff --git a/gdb/testsuite/gdb.base/pr10179-a.c b/gdb/testsuite/gdb.base/pr10179-a.c
index de5dcde..56bce9d 100644
--- a/gdb/testsuite/gdb.base/pr10179-a.c
+++ b/gdb/testsuite/gdb.base/pr10179-a.c
@@ -12,6 +12,7 @@ bar1()
{
}

+int
main()
{
}
diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c
index b886787..7b93b9b 100644
--- a/gdb/testsuite/gdb.base/savedregs.c
+++ b/gdb/testsuite/gdb.base/savedregs.c
@@ -61,9 +61,11 @@ thrower (void)

}

+int
main ()
{
signal (SIGILL, catcher);
signal (SIGSEGV, catcher);
thrower ();
+ return 0;
}
diff --git a/gdb/testsuite/gdb.base/sigaltstack.c b/gdb/testsuite/gdb.base/sigaltstack.c
index 338501b..2ee1b1d 100644
--- a/gdb/testsuite/gdb.base/sigaltstack.c
+++ b/gdb/testsuite/gdb.base/sigaltstack.c
@@ -72,6 +72,7 @@ catcher (int signal)
}

+int
main ()
{
/* Set up the altstack. */
@@ -90,4 +91,5 @@ main ()
}
level = MAIN;
catcher (0);
+ return 0;
}
diff --git a/gdb/testsuite/gdb.base/siginfo.c b/gdb/testsuite/gdb.base/siginfo.c
index 518083c..041102f 100644
--- a/gdb/testsuite/gdb.base/siginfo.c
+++ b/gdb/testsuite/gdb.base/siginfo.c
@@ -38,6 +38,7 @@ handler (int sig)
} /* handler */
#endif

+int
main ()
{
/* Set up the signal handler. */
diff --git a/gdb/testsuite/gdb.base/skip-solib-lib.c b/gdb/testsuite/gdb.base/skip-solib-lib.c
index 792cd01..b2c4d86 100644
--- a/gdb/testsuite/gdb.base/skip-solib-lib.c
+++ b/gdb/testsuite/gdb.base/skip-solib-lib.c
@@ -1,11 +1,11 @@
/* Simple shared library */

-int square(int num)
+int multiply(int a, int b)
{
- return multiply(num, num);
+ return a * b;
}

-int multiply(int a, int b)
+int square(int num)
{
- return a * b;
+ return multiply(num, num);
}
diff --git a/gdb/testsuite/gdb.base/solib-weak.c b/gdb/testsuite/gdb.base/solib-weak.c
index f54ea3d..c1ee8d4 100644
--- a/gdb/testsuite/gdb.base/solib-weak.c
+++ b/gdb/testsuite/gdb.base/solib-weak.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+extern void foo (void);
+
int
main()
{
diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c
index 1fb4250..1f45239 100644
--- a/gdb/testsuite/gdb.base/structs.c
+++ b/gdb/testsuite/gdb.base/structs.c
@@ -266,6 +266,7 @@ void Fun18(struct struct18 foo18)
L18 = foo18;
}

+void
zed ()
{

diff --git a/gdb/testsuite/gdb.base/testenv.c b/gdb/testsuite/gdb.base/testenv.c
index ef8035a..3eb9dd4 100644
--- a/gdb/testsuite/gdb.base/testenv.c
+++ b/gdb/testsuite/gdb.base/testenv.c
@@ -22,6 +22,7 @@
inferior environment list. */

#include <stdio.h>
+#include <string.h>

int main (int argc, char **argv, char **envp)

diff --git a/gdb/testsuite/gdb.base/weaklib1.c b/gdb/testsuite/gdb.base/weaklib1.c
index 95360ac..8782be1 100644
--- a/gdb/testsuite/gdb.base/weaklib1.c
+++ b/gdb/testsuite/gdb.base/weaklib1.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <stdio.h>
+
void __attribute__((weak))
bar (void)
{
diff --git a/gdb/testsuite/gdb.base/weaklib2.c b/gdb/testsuite/gdb.base/weaklib2.c
index ecd8321..b6458c0 100644
--- a/gdb/testsuite/gdb.base/weaklib2.c
+++ b/gdb/testsuite/gdb.base/weaklib2.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <stdio.h>
+
void bar (void);
void
foo (void)
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
index e9ca92d..a466c54 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
@@ -19,6 +19,8 @@

#include <stdlib.h>
#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>

extern int test (void);

diff --git a/gdb/testsuite/gdb.mi/mi-console.c b/gdb/testsuite/gdb.mi/mi-console.c
index 0cd2243..5ca046f 100644
--- a/gdb/testsuite/gdb.mi/mi-console.c
+++ b/gdb/testsuite/gdb.mi/mi-console.c
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
void
hello ()
{
diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.c b/gdb/testsuite/gdb.mi/mi-exit-code.c
index df711a6..47bf15c 100644
--- a/gdb/testsuite/gdb.mi/mi-exit-code.c
+++ b/gdb/testsuite/gdb.mi/mi-exit-code.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/>. */

+#include <stdlib.h>
+
int exit_code = 0;

int
diff --git a/gdb/testsuite/gdb.mi/mi-stack.c b/gdb/testsuite/gdb.mi/mi-stack.c
index 5f2452c..d41f9a0 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.c
+++ b/gdb/testsuite/gdb.mi/mi-stack.c
@@ -32,22 +32,23 @@ int callee4 (void)
C = A + B;
return 0;
}
-callee3 (char *strarg)
+
+void callee3 (char *strarg)
{
callee4 ();
}

-callee2 (int intarg, char *strarg)
+void callee2 (int intarg, char *strarg)
{
callee3 (strarg);
}

-callee1 (int intarg, char *strarg, double fltarg)
+void callee1 (int intarg, char *strarg, double fltarg)
{
callee2 (intarg, strarg);
}

-main ()
+int main ()
{
callee1 (2, "A string argument.", 3.5);
callee1 (2, "A string argument.", 3.5);
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.c b/gdb/testsuite/gdb.mi/mi-syn-frame.c
index 332f246..c260112 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.c
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.c
@@ -9,12 +9,14 @@ void subroutine (int);
void handler (int);
void have_a_very_merry_interrupt (void);

+int
main ()
{
foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */

have_a_very_merry_interrupt ();
+ return 0;
}

void
diff --git a/gdb/testsuite/gdb.mi/until.c b/gdb/testsuite/gdb.mi/until.c
index df4a68d..21bdeda 100644
--- a/gdb/testsuite/gdb.mi/until.c
+++ b/gdb/testsuite/gdb.mi/until.c
@@ -1,3 +1,4 @@
+void
foo (void)
{
int i, x, y, z;
@@ -17,6 +18,7 @@ foo (void)
y = 10;
}

+int
main ()
{
int a = 1;
diff --git a/gdb/testsuite/gdb.mi/watch-nonstop.c b/gdb/testsuite/gdb.mi/watch-nonstop.c
index 3f8a18c..ea4406b 100644
--- a/gdb/testsuite/gdb.mi/watch-nonstop.c
+++ b/gdb/testsuite/gdb.mi/watch-nonstop.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unistd.h>
+
int global;

int main ()
diff --git a/gdb/testsuite/gdb.python/py-events.c b/gdb/testsuite/gdb.python/py-events.c
index 17e9f21..2dabdbd 100644
--- a/gdb/testsuite/gdb.python/py-events.c
+++ b/gdb/testsuite/gdb.python/py-events.c
@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unistd.h>
+
extern void do_nothing (void);

int second(){
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.c b/gdb/testsuite/gdb.python/py-finish-breakpoint.c
index 0eda8b9..5c8663a 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.c
@@ -17,6 +17,7 @@

#include <setjmp.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>

/* Defined in py-events-shlib.h. */
--
1.8.4.2