[PATCH][BZ #14188] Allow pthread_cleanup_push to build with compilers other than gcc

Siddhesh Poyarekar siddhesh@redhat.com
Fri Jun 1 19:31:00 GMT 2012


On Fri, 1 Jun 2012 17:24:33 +0200, Jakub wrote:
> IMHO that is not a good idea, it can interfere with other projects
> that want to handle lack of __builtin_expect somehow.  Furthermore,
> __builtin_expect is only available in recent gcc (3.2+?).
> 
> libio.h uses
> #if  __GNUC__ >= 3
> # define _IO_BE(expr, res) __builtin_expect ((expr), res)
> #else
> # define _IO_BE(expr, res) (expr)
> #endif
> 
> so you could do something similar (just s/_IO_BE/__pthread_expect/ or
> similar).
> 

Thanks, changed patch as per your suggestions. Looks OK now?

Regards,
Siddhesh


nptl/ChangeLog:

2012-06-01  Siddhesh Poyarekar  <siddhesh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>

	[BZ #14188]
	* sysdeps/pthread/pthread.h (__pthread_builtin_expect): New
	macro to wrap cases where __builtin_expect is unavailable.
	[!(defined __GNUC__ && defined __EXCEPTIONS)]
	(pthread_cleanup_push, pthread_cleanup_push_defer_np): Use it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread-nongcc-2.patch
Type: text/x-patch
Size: 1714 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120601/5bf5ce15/attachment.bin>


More information about the Libc-alpha mailing list