This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA/TESTSUITE] build schedlock.c on 64-bit platforms
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 8 Apr 2003 17:20:19 -0400
- Subject: [RFA/TESTSUITE] build schedlock.c on 64-bit platforms
I was getting warnings when compiling the test on 64-bit because of the casts.
/home/ezannoni/gdb-sources/src/gdb/testsuite/gdb.threads/schedlock.c: In function `main':
/home/ezannoni/gdb-sources/src/gdb/testsuite/gdb.threads/schedlock.c:21: warning: cast to pointer from integer of different size
/home/ezannoni/gdb-sources/src/gdb/testsuite/gdb.threads/schedlock.c:26: warning: cast to pointer from integer of different size
/home/ezannoni/gdb-sources/src/gdb/testsuite/gdb.threads/schedlock.c: In function `thread_function':
/home/ezannoni/gdb-sources/src/gdb/testsuite/gdb.threads/schedlock.c:32: warning: cast from pointer to integer of different size
Michael, Daniel?
elena
2003-04-08 Elena Zannoni <ezannoni at redhat dot com>
* gdb.threads/schedlock.c: Cast to thread function argument to
long, for 64-bit platforms.
Index: schedlock.c
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.threads/schedlock.c,v
retrieving revision 1.2
diff -u -p -r1.2 schedlock.c
--- schedlock.c 23 Oct 2002 03:22:56 -0000 1.2
+++ schedlock.c 8 Apr 2003 20:56:31 -0000
@@ -18,18 +18,21 @@ int main() {
for (i = 0; i < NUM; i++)
{
args[i] = 1;
- res = pthread_create(&threads[i], NULL, thread_function, (void *)i);
+ res = pthread_create(&threads[i],
+ NULL,
+ thread_function,
+ (void *) (long) i);
}
/* schedlock.exp: last thread start. */
args[i] = 1;
- thread_function ((void *) i);
+ thread_function ((void *) (long) i);
exit(EXIT_SUCCESS);
}
void *thread_function(void *arg) {
- int my_number = (int) arg;
+ int my_number = (long) arg;
int *myp = &args[my_number];
/* Don't run forever. Run just short of it :) */