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 ba387eff57..6822582544 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 a77ca51ad2..0862d84a36 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 13a98c4657..b01030fda8 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 a55e21fa4a..f98c6469e8 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 79279806c6..845d3a04c9 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 ef62374850..5acfefab69 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 00e779f742..ee001b4c61 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 ca626647ab..70fd521605 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 af71e8dbe5..02d9852629 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 342b76a661..dbf956b675 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 d754e930af..ac90a9645b 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 d42e205e0c..59b93c448e 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 a57938d188..6458920aa6 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 ed86647892..ea5d94da49 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 bd6b1bece7..e65c685a1c 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 3414c89c42..cc648898ee 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 a820cf7be1..8a98aec4ea 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 2b7a865d0d..c77dc13f37 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 0b2201544c..1ad521f0f7 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 eec5d50bcf..56675e9cd4 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 a212e4d86d..36a8b45006 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