[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thread: fix some gcc warnings
From: |
Eric Blake |
Subject: |
Re: thread: fix some gcc warnings |
Date: |
Fri, 08 Jul 2011 07:07:41 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
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 <address@hidden>
>
> 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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature