[libvirt] [PATCH 2/2] build: silence compiler warning on BSD

Eric Blake eblake at redhat.com
Fri Nov 4 22:37:07 UTC 2011


Building on 64-bit FreeBSD 8.2 complained about a cast between
a pointer and a smaller integer.  Going through an intermediate
cast shuts up the compiler.

* src/util/threads-pthread.c (virThreadSelfID): Silence a warning.
---

Pushing under the trivial rule.  It's sad that we have to use
not 1, not 2, but 3 consecutive casts, just for a debugging hack!

 src/util/threads-pthread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/threads-pthread.c b/src/util/threads-pthread.c
index 82ce5c6..5b8fd5b 100644
--- a/src/util/threads-pthread.c
+++ b/src/util/threads-pthread.c
@@ -216,7 +216,7 @@ int virThreadSelfID(void)
     tid = syscall(SYS_gettid);
     return (int)tid;
 #else
-    return (int)(void *)pthread_self();
+    return (int)(intptr_t)(void *)pthread_self();
 #endif
 }

-- 
1.7.4.4




More information about the libvir-list mailing list