diff options
author | Zack Weinberg <zackw@panix.com> | 2018-06-01 12:53:59 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2018-06-12 10:02:27 -0400 |
commit | 2ba9f2eb978b27ddfa39cd769b73136d0ac4c4ae (patch) | |
tree | fabc08af34d8fbe8227e072ade54be411c6a4123 /elf/dl-fini.c | |
parent | 329ea513b451ae8322aa7a24ed84da13992af2dd (diff) | |
download | glibc-zack/elf-builtin-expect-conversion.tar glibc-zack/elf-builtin-expect-conversion.tar.gz glibc-zack/elf-builtin-expect-conversion.tar.bz2 glibc-zack/elf-builtin-expect-conversion.zip |
Convert __builtin_expect to __glibc_(un)likely throughout elf/.zack/elf-builtin-expect-conversion
In the previous patch I didn't change a use of __builtin_expect to
__glibc_(un)likely that happened to be right next to the code I was
actually working on; Andreas asked why not, and I said that there were
a bunch more uses of __builtin_expect in that file and I would convert
them all in a separate patch. This is that patch, converting all of
elf/.
I would appreciate someone checking over this patch very carefully
indeed. In a whole bunch of places, __builtin_expect was used in a
way that did not map mechanically to the newer convention. The test
suite caught one mistake; I'm not confident I didn't make any more.
Writing this patch gave me a deeper appreciation for why we _want_ to
switch to __glibc_(un)likely, but also for how difficult it can be. I
now think that people should _not_ be asked to change existing uses of
__builtin_expect in a patch whose purpose is something else.
* elf/dl-addr.c, elf/dl-cache.c, elf/dl-close.c, elf/dl-deps.c
* elf/dl-environ.c, elf/dl-error-skeleton.c, elf/dl-fini.c
* elf/dl-fptr.c, elf/dl-init.c, elf/dl-libc.c, elf/dl-minimal.c
* elf/dl-open.c, elf/dl-reloc.c, elf/dl-runtime.c
* elf/dl-sysdep.c, elf/dl-tls.c, elf/dl-version.c, elf/ldconfig.c
* elf/rtld.c: Replace __builtin_expect with __glibc_likely or
__glibc_unlikely, as appropriate, throughout.
Diffstat (limited to 'elf/dl-fini.c')
-rw-r--r-- | elf/dl-fini.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 3cfc262400..28d9704559 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -120,8 +120,8 @@ _dl_fini (void) || l->l_info[DT_FINI] != NULL) { /* When debugging print a message first. */ - if (__builtin_expect (GLRO(dl_debug_mask) - & DL_DEBUG_IMPCALLS, 0)) + if (__glibc_unlikely ((GLRO(dl_debug_mask) + & DL_DEBUG_IMPCALLS) != 0)) _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n", DSO_FILENAME (l->l_name), ns); @@ -146,7 +146,7 @@ _dl_fini (void) #ifdef SHARED /* Auditing checkpoint: another object closed. */ - if (!do_audit && __builtin_expect (GLRO(dl_naudit) > 0, 0)) + if (!do_audit && __glibc_unlikely (GLRO(dl_naudit) > 0)) { struct audit_ifaces *afct = GLRO(dl_audit); for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) |