This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.

OK to push?

---

diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.c b/gdb/testsuite/gdb.arch/i386-bp_permanent.c
index a77ca51..0862d84 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 13a98c4..b01030f 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 <http://www.gnu.org/licenses/>.  */
 
 #include <stdlib.h>
+#include <unistd.h>
 
 static void
 marker () {}
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.c b/gdb/testsuite/gdb.base/siginfo-obj.c
index a55e21f..f98c646 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.c
+++ b/gdb/testsuite/gdb.base/siginfo-obj.c
@@ -19,6 +19,7 @@
 
 #include <signal.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
diff --git a/gdb/testsuite/gdb.base/siginfo-thread.c b/gdb/testsuite/gdb.base/siginfo-thread.c
index 7927980..845d3a0 100644
--- a/gdb/testsuite/gdb.base/siginfo-thread.c
+++ b/gdb/testsuite/gdb.base/siginfo-thread.c
@@ -19,6 +19,7 @@
 
 #include <signal.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
diff --git a/gdb/testsuite/gdb.mi/non-stop.c b/gdb/testsuite/gdb.mi/non-stop.c
index ef62374..5acfefa 100644
--- a/gdb/testsuite/gdb.mi/non-stop.c
+++ b/gdb/testsuite/gdb.mi/non-stop.c
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include <unistd.h>
 
 /* 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 00e779f..ee001b4 100644
--- a/gdb/testsuite/gdb.mi/nsthrexec.c
+++ b/gdb/testsuite/gdb.mi/nsthrexec.c
@@ -18,6 +18,7 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 static const char *image;
 
diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c
index ca62664..70fd521 100644
--- a/gdb/testsuite/gdb.mi/pthreads.c
+++ b/gdb/testsuite/gdb.mi/pthreads.c
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include <unistd.h>
 
 /* 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 af71e8d..02d9852 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 342b76a..dbf956b 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 d754e93..ac90a96 100644
--- a/gdb/testsuite/gdb.threads/create-fail.c
+++ b/gdb/testsuite/gdb.threads/create-fail.c
@@ -27,6 +27,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <assert.h>
+#include <unistd.h>
 
 /* 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 d42e205..59b93c4 100644
--- a/gdb/testsuite/gdb.threads/killed.c
+++ b/gdb/testsuite/gdb.threads/killed.c
@@ -20,6 +20,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 int pid;
 
diff --git a/gdb/testsuite/gdb.threads/linux-dp.c b/gdb/testsuite/gdb.threads/linux-dp.c
index a57938d..6458920 100644
--- a/gdb/testsuite/gdb.threads/linux-dp.c
+++ b/gdb/testsuite/gdb.threads/linux-dp.c
@@ -11,6 +11,7 @@
 #include <pthread.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 /* 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 ed86647..ea5d94d 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 <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <assert.h>
 
 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 bd6b1be..e65c685 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 <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <assert.h>
 
 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 3414c89..cc64889 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 <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <assert.h>
 
 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 a820cf7..8a98aec4 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 <pthread.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <assert.h>
 
 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 2b7a865..c77dc13 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
@@ -20,6 +20,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <time.h>
+#include <unistd.h>
 
 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 0b22015..1ad521f 100644
--- a/gdb/testsuite/gdb.threads/pthreads.c
+++ b/gdb/testsuite/gdb.threads/pthreads.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include <unistd.h>
 
 /* 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 eec5d50..56675e9 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 a212e4d..36a8b45 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
@@ -22,6 +22,9 @@
 #include <sys/wait.h>
 #include <stdio.h>
 #include <stdlib.h>
+
+/* pthread_yield is a GNU extension.  */
+#define _GNU_SOURCE
 #include <pthread.h>
 
 #include <asm/unistd.h>
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]