[PATCH][BZ #14188] Allow pthread_cleanup_push to build with compilers other than gcc
Siddhesh Poyarekar
siddhesh@redhat.com
Sat Jun 2 13:47:00 GMT 2012
On Fri, 1 Jun 2012 12:41:48 -0700 (PDT), Roland wrote:
> This is the only use of __builtin_expect in a public header now.
> But it seems reasonably likely that we'll have others eventually.
> So my inclination would be to put the macro in sys/cdefs.h and give
> it a different name. (Or perhaps also slightly different semantics,
> e.g. __glibc_unlikely(BOOL).)
>
OK, updated patch attached. I guess it would be a good idea to mandate
use of __glibc_unlikely() wherever applicable, purely because it makes
code prettier. It might not be worth hunting down and changing
everything in one go, but at least to ensure that future uses (and
modifications) of __builtin_expect(cond, 0) be discouraged in favour of
__glibc_unlikely throughout the code base.
Tested with tinycc (http://bellard.org/tcc/) to verify that correct
code is generated for pthread_cleanup_push and also with gcc on Fedora
to verify that there are no regressions.
Regards,
Siddhesh
ChangeLog:
2012-06-02 Siddhesh Poyarekar <siddhesh@redhat.com>
Jakub Jelinek <jakub@redhat.com>
[BZ #14188]
* misc/sys/cdefs.h (__glibc_unlikely): New macro to wrap cases
where __builtin_expect is unavailable.
nptl/ChangeLog:
2012-06-02 Siddhesh Poyarekar <siddhesh@redhat.com>
Jakub Jelinek <jakub@redhat.com>
[BZ #14188]
* sysdeps/pthread/pthread.h
[!(defined __GNUC__ && defined __EXCEPTIONS)]
(pthread_cleanup_push, pthread_cleanup_push_defer_np): Use
__libc_unlikely instead of __builtin_expect.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread-nongcc-2.patch
Type: text/x-patch
Size: 1592 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120602/2475ef65/attachment.bin>
More information about the Libc-alpha
mailing list