From 37bc665e4e8b2386fe15680a41173bfbfb085ac4 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 25 Jan 2015 16:42:05 +0100 Subject: [PATCH] Remove testsuite compile errors with GCC5. GCC5 defaults to the GNU11 standard for C and warns by default for implicit function declarations and implicit return types. https://gcc.gnu.org/gcc-5/porting_to.html Fixing these issues in the testsuite turns 9 untested and 17 unsupported testcases into 417 new passes when compiling with GCC5. gdb/testsuite/ChangeLog: * gdb.arch/i386-bp_permanent.c (standard): New declaration. * gdb.base/disp-step-fork.c: Include unistd.h. * gdb.base/siginfo-obj.c: Include stdio.h. * gdb.base/siginfo-thread.c: Likewise. * gdb.mi/non-stop.c: Include unistd.h. * gdb.mi/nsthrexec.c: Include stdio.h. * gdb.mi/pthreads.c: Include unistd.h. * gdb.modula2/unbounded1.c (main): Declare returns int. * gdb.reverse/consecutive-reverse.c: Likewise. * gdb.threads/create-fail.c: Include unistd.h. * gdb.threads/killed.c: Likewise. * gdb.threads/linux-dp.c: Likewise. * gdb.threads/non-ldr-exc-1.c: Include stdio.h and string.h. * gdb.threads/non-ldr-exc-2.c: Likewise. * gdb.threads/non-ldr-exc-3.c: Likewise. * gdb.threads/non-ldr-exc-4.c: Likewise. * gdb.threads/pthreads.c: Include unistd.h. (main): Declare returns int. * gdb.threads/tls-main.c (foo): New declaration. * gdb.threads/watchpoint-fork-mt.c: Define _GNU_SOURCE. --- gdb/testsuite/ChangeLog | 23 +++++++++++++++++++ gdb/testsuite/gdb.arch/i386-bp_permanent.c | 2 ++ gdb/testsuite/gdb.base/disp-step-fork.c | 1 + gdb/testsuite/gdb.base/siginfo-obj.c | 1 + gdb/testsuite/gdb.base/siginfo-thread.c | 1 + gdb/testsuite/gdb.mi/non-stop.c | 1 + gdb/testsuite/gdb.mi/nsthrexec.c | 1 + gdb/testsuite/gdb.mi/pthreads.c | 1 + gdb/testsuite/gdb.modula2/unbounded1.c | 2 +- .../gdb.reverse/consecutive-reverse.c | 1 + gdb/testsuite/gdb.threads/create-fail.c | 1 + gdb/testsuite/gdb.threads/killed.c | 1 + gdb/testsuite/gdb.threads/linux-dp.c | 1 + gdb/testsuite/gdb.threads/non-ldr-exc-1.c | 2 ++ gdb/testsuite/gdb.threads/non-ldr-exc-2.c | 2 ++ gdb/testsuite/gdb.threads/non-ldr-exc-3.c | 2 ++ gdb/testsuite/gdb.threads/non-ldr-exc-4.c | 2 ++ gdb/testsuite/gdb.threads/pthread_cond_wait.c | 1 + gdb/testsuite/gdb.threads/pthreads.c | 2 ++ gdb/testsuite/gdb.threads/tls-main.c | 1 + .../gdb.threads/watchpoint-fork-mt.c | 3 +++ 21 files changed, 51 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ba387eff571..68225825442 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,26 @@ +2015-01-25 Mark Wielaard + + * gdb.arch/i386-bp_permanent.c (standard): New declaration. + * gdb.base/disp-step-fork.c: Include unistd.h. + * gdb.base/siginfo-obj.c: Include stdio.h. + * gdb.base/siginfo-thread.c: Likewise. + * gdb.mi/non-stop.c: Include unistd.h. + * gdb.mi/nsthrexec.c: Include stdio.h. + * gdb.mi/pthreads.c: Include unistd.h. + * gdb.modula2/unbounded1.c (main): Declare returns int. + * gdb.reverse/consecutive-reverse.c: Likewise. + * gdb.threads/create-fail.c: Include unistd.h. + * gdb.threads/killed.c: Likewise. + * gdb.threads/linux-dp.c: Likewise. + * gdb.threads/non-ldr-exc-1.c: Include stdio.h and string.h. + * gdb.threads/non-ldr-exc-2.c: Likewise. + * gdb.threads/non-ldr-exc-3.c: Likewise. + * gdb.threads/non-ldr-exc-4.c: Likewise. + * gdb.threads/pthreads.c: Include unistd.h. + (main): Declare returns int. + * gdb.threads/tls-main.c (foo): New declaration. + * gdb.threads/watchpoint-fork-mt.c: Define _GNU_SOURCE. + 2015-01-23 Simon Marchi * gdb.mi/mi-var-list-children-invalid-grandchild.c: New file. diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.c b/gdb/testsuite/gdb.arch/i386-bp_permanent.c index a77ca51ad21..0862d84a363 100644 --- a/gdb/testsuite/gdb.arch/i386-bp_permanent.c +++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.c @@ -21,6 +21,8 @@ #define SYMBOL(str) #str #endif +void standard (void); + int main (void) { diff --git a/gdb/testsuite/gdb.base/disp-step-fork.c b/gdb/testsuite/gdb.base/disp-step-fork.c index 13a98c46576..b01030fda8f 100644 --- a/gdb/testsuite/gdb.base/disp-step-fork.c +++ b/gdb/testsuite/gdb.base/disp-step-fork.c @@ -16,6 +16,7 @@ along with this program. If not, see . */ #include +#include static void marker () {} diff --git a/gdb/testsuite/gdb.base/siginfo-obj.c b/gdb/testsuite/gdb.base/siginfo-obj.c index a55e21fa4ab..f98c6469e89 100644 --- a/gdb/testsuite/gdb.base/siginfo-obj.c +++ b/gdb/testsuite/gdb.base/siginfo-obj.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/gdb/testsuite/gdb.base/siginfo-thread.c b/gdb/testsuite/gdb.base/siginfo-thread.c index 79279806c69..845d3a04c9f 100644 --- a/gdb/testsuite/gdb.base/siginfo-thread.c +++ b/gdb/testsuite/gdb.base/siginfo-thread.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/gdb/testsuite/gdb.mi/non-stop.c b/gdb/testsuite/gdb.mi/non-stop.c index ef62374850c..5acfefab696 100644 --- a/gdb/testsuite/gdb.mi/non-stop.c +++ b/gdb/testsuite/gdb.mi/non-stop.c @@ -19,6 +19,7 @@ #include #include #include +#include /* Under HPUX 10, the second arg of pthread_create is prototyped to be just a "pthread_attr_t", while under Solaris it diff --git a/gdb/testsuite/gdb.mi/nsthrexec.c b/gdb/testsuite/gdb.mi/nsthrexec.c index 00e779f7425..ee001b4c61c 100644 --- a/gdb/testsuite/gdb.mi/nsthrexec.c +++ b/gdb/testsuite/gdb.mi/nsthrexec.c @@ -18,6 +18,7 @@ #include #include #include +#include static const char *image; diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c index ca626647abf..70fd521605d 100644 --- a/gdb/testsuite/gdb.mi/pthreads.c +++ b/gdb/testsuite/gdb.mi/pthreads.c @@ -23,6 +23,7 @@ #include #include #include +#include /* Under HPUX 10, the second arg of pthread_create is prototyped to be just a "pthread_attr_t", while under Solaris it diff --git a/gdb/testsuite/gdb.modula2/unbounded1.c b/gdb/testsuite/gdb.modula2/unbounded1.c index af71e8dbe5b..02d9852629b 100644 --- a/gdb/testsuite/gdb.modula2/unbounded1.c +++ b/gdb/testsuite/gdb.modula2/unbounded1.c @@ -30,7 +30,7 @@ foo (unbounded a) return 1; } - +int main () { unbounded t; diff --git a/gdb/testsuite/gdb.reverse/consecutive-reverse.c b/gdb/testsuite/gdb.reverse/consecutive-reverse.c index 342b76a6614..dbf956b6750 100644 --- a/gdb/testsuite/gdb.reverse/consecutive-reverse.c +++ b/gdb/testsuite/gdb.reverse/consecutive-reverse.c @@ -27,6 +27,7 @@ int foo () return a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6]; } +int main() { foo (); diff --git a/gdb/testsuite/gdb.threads/create-fail.c b/gdb/testsuite/gdb.threads/create-fail.c index d754e930afc..ac90a9645b1 100644 --- a/gdb/testsuite/gdb.threads/create-fail.c +++ b/gdb/testsuite/gdb.threads/create-fail.c @@ -27,6 +27,7 @@ #include #include #include +#include /* Count the number of tasks/threads in the PID thread group. */ diff --git a/gdb/testsuite/gdb.threads/killed.c b/gdb/testsuite/gdb.threads/killed.c index d42e205e0c2..59b93c448ec 100644 --- a/gdb/testsuite/gdb.threads/killed.c +++ b/gdb/testsuite/gdb.threads/killed.c @@ -20,6 +20,7 @@ #include #include #include +#include int pid; diff --git a/gdb/testsuite/gdb.threads/linux-dp.c b/gdb/testsuite/gdb.threads/linux-dp.c index a57938d1886..6458920aa6e 100644 --- a/gdb/testsuite/gdb.threads/linux-dp.c +++ b/gdb/testsuite/gdb.threads/linux-dp.c @@ -11,6 +11,7 @@ #include #include #include +#include /* The number of philosophers at the table. */ int num_philosophers; diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.c b/gdb/testsuite/gdb.threads/non-ldr-exc-1.c index ed866478929..ea5d94da49a 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.c +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include static const char *image; diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.c b/gdb/testsuite/gdb.threads/non-ldr-exc-2.c index bd6b1bece7c..e65c685a1c4 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.c +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include static const char *image; diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.c b/gdb/testsuite/gdb.threads/non-ldr-exc-3.c index 3414c89c424..cc648898ee4 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.c +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include static const char *image; diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.c b/gdb/testsuite/gdb.threads/non-ldr-exc-4.c index a820cf7be13..8a98aec4ea7 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.c +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include static const char *image; diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c index 2b7a865d0d4..c77dc13f37f 100644 --- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c +++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c @@ -20,6 +20,7 @@ #include #include #include +#include void cond_wait (pthread_cond_t *cond, pthread_mutex_t *mut) diff --git a/gdb/testsuite/gdb.threads/pthreads.c b/gdb/testsuite/gdb.threads/pthreads.c index 0b2201544ce..1ad521f0f74 100644 --- a/gdb/testsuite/gdb.threads/pthreads.c +++ b/gdb/testsuite/gdb.threads/pthreads.c @@ -22,6 +22,7 @@ #include #include #include +#include /* Under HPUX 10, the second arg of pthread_create is prototyped to be just a "pthread_attr_t", while under Solaris it @@ -110,6 +111,7 @@ foo (a, b, c) if (verbose) printf("a=%d\n", a); } +int main(argc, argv) int argc; char **argv; diff --git a/gdb/testsuite/gdb.threads/tls-main.c b/gdb/testsuite/gdb.threads/tls-main.c index eec5d50bcf4..56675e9cd45 100644 --- a/gdb/testsuite/gdb.threads/tls-main.c +++ b/gdb/testsuite/gdb.threads/tls-main.c @@ -1,3 +1,4 @@ +int foo (void); __thread int i_tls = 2; int main () { diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c index a212e4d86d6..36a8b450063 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c @@ -22,6 +22,9 @@ #include #include #include + +/* pthread_yield is a GNU extension. */ +#define _GNU_SOURCE #include #include -- 2.30.2