This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
yet more testsuite fixes seem with ubuntu's gcc
- From: Pedro Alves <pedro at codesourcery dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 23 Mar 2010 23:52:21 +0000
- Subject: yet more testsuite fixes seem with ubuntu's gcc
I just noticed that gcore-thread.exp and pthreads.exp were being skipped
untested on my ubuntu 9.10 box due to:
../../../src/gdb/testsuite/gdb.threads/pthreads.c: In function 'thread1':
../../../src/gdb/testsuite/gdb.threads/pthreads.c:76: warning: format '%0x' expects type 'unsigned int', but argument 2 has type 'void *'
../../../src/gdb/testsuite/gdb.threads/pthreads.c:79: warning: format '%d' expects type 'int', but argument 2 has type 'pthread_t'
../../../src/gdb/testsuite/gdb.threads/pthreads.c: In function 'thread2':
../../../src/gdb/testsuite/gdb.threads/pthreads.c:93: warning: format '%0x' expects type 'unsigned int', but argument 2 has type 'void *'
../../../src/gdb/testsuite/gdb.threads/pthreads.c:96: warning: format '%d' expects type 'int', but argument 2 has type 'pthread_t'
../../../src/gdb/testsuite/gdb.threads/pthreads.c: In function 'main':
../../../src/gdb/testsuite/gdb.threads/pthreads.c:149: warning: format '%d' expects type 'int', but argument 2 has type 'pthread_t'
../../../src/gdb/testsuite/gdb.threads/pthreads.c:157: warning: format '%d' expects type 'int', but argument 2 has type 'pthread_t'
../../../src/gdb/testsuite/gdb.threads/pthreads.c:163: warning: format '%d' expects type 'int', but argument 2 has type 'pthread_t'
Fixed with the patch below. Confirmed both gcore-thread.exp and
pthreads.exp pass on x86_64-linux -m{64,32}, and applied.
--
Pedro Alves
2010-03-23 Pedro Alves <pedro@codesourcery.com>
gdb/testsuite/
* gdb.threads/pthreads.c (thread1, thread2, main): Fix printf
format strings and add casts to avoid compiler warnings.
---
gdb/testsuite/gdb.threads/pthreads.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Index: src/gdb/testsuite/gdb.threads/pthreads.c
===================================================================
--- src.orig/gdb/testsuite/gdb.threads/pthreads.c 2010-03-23 23:29:43.000000000 +0000
+++ src/gdb/testsuite/gdb.threads/pthreads.c 2010-03-23 23:30:19.000000000 +0000
@@ -73,10 +73,10 @@ thread1 (void *arg)
int i;
int z = 0;
- if (verbose) printf ("thread1 (%0x) ; pid = %d\n", arg, getpid ());
+ if (verbose) printf ("thread1 (%0lx) ; pid = %d\n", (long) arg, getpid ());
for (i=1; i <= 10000000; i++)
{
- if (verbose) printf("thread1 %d\n", pthread_self ());
+ if (verbose) printf("thread1 %ld\n", (long) pthread_self ());
z += i;
common_routine (1);
sleep(1);
@@ -90,10 +90,10 @@ thread2 (void * arg)
int i;
int k = 0;
- if (verbose) printf ("thread2 (%0x) ; pid = %d\n", arg, getpid ());
+ if (verbose) printf ("thread2 (%0lx) ; pid = %d\n", (long) arg, getpid ());
for (i=1; i <= 10000000; i++)
{
- if (verbose) printf("thread2 %d\n", pthread_self ());
+ if (verbose) printf("thread2 %ld\n", (long) pthread_self ());
k += i;
common_routine (2);
sleep(1);
@@ -146,7 +146,7 @@ main(argc, argv)
perror ("pthread_create 1");
exit (1);
}
- if (verbose) printf ("Made thread %d\n", tid1);
+ if (verbose) printf ("Made thread %ld\n", (long) tid1);
sleep (1);
if (pthread_create (&tid2, PTHREAD_CREATE_NULL_ARG2, thread2, (void *) 0xdeadbeef))
@@ -154,13 +154,13 @@ main(argc, argv)
perror ("pthread_create 2");
exit (1);
}
- if (verbose) printf("Made thread %d\n", tid2);
+ if (verbose) printf("Made thread %ld\n", (long) tid2);
sleep (1);
for (j = 1; j <= 10000000; j++)
{
- if (verbose) printf("top %d\n", pthread_self ());
+ if (verbose) printf("top %ld\n", (long) pthread_self ());
common_routine (0);
sleep(1);
t += j;