On 07/08/2011 05:27 AM, Bruno Haible wrote: > The statement > gl_thread_t t = gl_thread_self (); > gives a gcc warning about assignment from a pointer to an integer. This fixes > it: > > > 2011-07-08 Bruno Haible <br...@clisp.org> > > thread: Avoid gcc warnings when using gl_thread_self(). > * lib/glthread/thread.h (gl_thread_self): Return a pthread_t, not a > 'void *'. > (gl_thread_self_pointer): Update. > > --- lib/glthread/thread.h.orig Fri Jul 8 13:22:25 2011 > +++ lib/glthread/thread.h Fri Jul 8 13:11:25 2011 > @@ -161,9 +161,9 @@ > extern const gl_thread_t gl_null_thread; > # else > # define gl_thread_self() \ > - (pthread_in_use () ? (void *) pthread_self () : NULL) > + (pthread_in_use () ? pthread_self () : (pthread_t) NULL)
This not portable. POSIX allows pthread_t to be a non-pointer type, so you can't necessarily cast NULL to pthread_t. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature