aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:45:42 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 15:07:12 +0100
commita1ffb40e32741f992c743e7b16c061fefa3747ac (patch)
tree246a29a87b26cfd5d07b17070f85eb3785018de9
parentFix previous commit. (diff)
downloadglibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.bz2
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip
Use glibc_likely instead __builtin_expect.
-rw-r--r--ChangeLog496
-rw-r--r--assert/assert.c2
-rw-r--r--benchtests/bench-memmem.c2
-rw-r--r--catgets/open_catalog.c4
-rw-r--r--csu/libc-start.c8
-rw-r--r--debug/confstr_chk.c2
-rw-r--r--debug/fread_chk.c2
-rw-r--r--debug/fread_u_chk.c2
-rw-r--r--debug/getgroups_chk.c4
-rw-r--r--debug/mbsnrtowcs_chk.c2
-rw-r--r--debug/mbsrtowcs_chk.c2
-rw-r--r--debug/mbstowcs_chk.c2
-rw-r--r--debug/memcpy_chk.c2
-rw-r--r--debug/memmove_chk.c2
-rw-r--r--debug/mempcpy_chk.c2
-rw-r--r--debug/memset_chk.c2
-rw-r--r--debug/stpcpy_chk.c2
-rw-r--r--debug/strcat_chk.c4
-rw-r--r--debug/strcpy_chk.c2
-rw-r--r--debug/strncat_chk.c14
-rw-r--r--debug/vsnprintf_chk.c2
-rw-r--r--debug/vswprintf_chk.c4
-rw-r--r--debug/wcpcpy_chk.c2
-rw-r--r--debug/wcpncpy_chk.c2
-rw-r--r--debug/wcscat_chk.c4
-rw-r--r--debug/wcscpy_chk.c4
-rw-r--r--debug/wcsncat_chk.c14
-rw-r--r--debug/wcsncpy_chk.c2
-rw-r--r--debug/wcsnrtombs_chk.c2
-rw-r--r--debug/wcsrtombs_chk.c2
-rw-r--r--debug/wcstombs_chk.c2
-rw-r--r--debug/wmemcpy_chk.c2
-rw-r--r--debug/wmemmove_chk.c2
-rw-r--r--debug/wmempcpy_chk.c2
-rw-r--r--debug/wmemset_chk.c2
-rw-r--r--dirent/scandirat.c2
-rw-r--r--dlfcn/dladdr.c2
-rw-r--r--dlfcn/dladdr1.c2
-rw-r--r--dlfcn/dlclose.c2
-rw-r--r--dlfcn/dlerror.c2
-rw-r--r--dlfcn/dlinfo.c2
-rw-r--r--dlfcn/dlmopen.c4
-rw-r--r--dlfcn/dlopen.c2
-rw-r--r--dlfcn/dlopenold.c2
-rw-r--r--dlfcn/dlsym.c2
-rw-r--r--dlfcn/dlvsym.c2
-rw-r--r--elf/dl-cache.c4
-rw-r--r--elf/dl-close.c18
-rw-r--r--elf/dl-conflict.c2
-rw-r--r--elf/dl-deps.c12
-rw-r--r--elf/dl-dst.h2
-rw-r--r--elf/dl-fini.c10
-rw-r--r--elf/dl-fptr.c2
-rw-r--r--elf/dl-hwcaps.c2
-rw-r--r--elf/dl-init.c6
-rw-r--r--elf/dl-libc.c6
-rw-r--r--elf/dl-load.c50
-rw-r--r--elf/dl-lookup.c28
-rw-r--r--elf/dl-minimal.c2
-rw-r--r--elf/dl-open.c30
-rw-r--r--elf/dl-reloc.c6
-rw-r--r--elf/dl-runtime.c4
-rw-r--r--elf/dl-sym.c8
-rw-r--r--elf/dl-tls.c16
-rw-r--r--elf/dl-version.c10
-rw-r--r--elf/dl-writev.h2
-rw-r--r--elf/ldconfig.c4
-rw-r--r--elf/rtld.c40
-rw-r--r--elf/setup-vdso.h2
-rw-r--r--grp/compat-initgroups.c2
-rw-r--r--grp/fgetgrent.c2
-rw-r--r--grp/initgroups.c4
-rw-r--r--grp/putgrent.c2
-rw-r--r--hesiod/nss_hesiod/hesiod-grp.c2
-rw-r--r--hurd/hurdinit.c2
-rw-r--r--iconv/gconv_cache.c2
-rw-r--r--iconv/gconv_close.c2
-rw-r--r--iconv/gconv_open.c4
-rw-r--r--iconv/gconv_simple.c58
-rw-r--r--iconv/iconv.c2
-rw-r--r--iconv/iconv_close.c2
-rw-r--r--iconv/loop.c4
-rw-r--r--iconv/skeleton.c18
-rw-r--r--iconvdata/8bit-gap.c2
-rw-r--r--iconvdata/ansi_x3.110.c2
-rw-r--r--iconvdata/big5.c4
-rw-r--r--iconvdata/big5hkscs.c18
-rw-r--r--iconvdata/cp1255.c10
-rw-r--r--iconvdata/cp1258.c8
-rw-r--r--iconvdata/cp932.c4
-rw-r--r--iconvdata/euc-cn.c6
-rw-r--r--iconvdata/euc-jisx0213.c24
-rw-r--r--iconvdata/euc-jp-ms.c12
-rw-r--r--iconvdata/euc-jp.c8
-rw-r--r--iconvdata/euc-kr.c6
-rw-r--r--iconvdata/gb18030.c4
-rw-r--r--iconvdata/gbbig5.c14
-rw-r--r--iconvdata/gbgbk.c10
-rw-r--r--iconvdata/gbk.c2
-rw-r--r--iconvdata/ibm1364.c16
-rw-r--r--iconvdata/ibm930.c14
-rw-r--r--iconvdata/ibm932.c10
-rw-r--r--iconvdata/ibm933.c14
-rw-r--r--iconvdata/ibm935.c14
-rw-r--r--iconvdata/ibm937.c14
-rw-r--r--iconvdata/ibm939.c14
-rw-r--r--iconvdata/ibm943.c10
-rw-r--r--iconvdata/iso-2022-cn-ext.c2
-rw-r--r--iconvdata/iso-2022-cn.c16
-rw-r--r--iconvdata/iso-2022-jp-3.c40
-rw-r--r--iconvdata/iso-2022-jp.c44
-rw-r--r--iconvdata/iso-2022-kr.c12
-rw-r--r--iconvdata/iso646.c2
-rw-r--r--iconvdata/iso8859-1.c2
-rw-r--r--iconvdata/iso_11548-1.c2
-rw-r--r--iconvdata/iso_6937-2.c6
-rw-r--r--iconvdata/iso_6937.c8
-rw-r--r--iconvdata/johab.c12
-rw-r--r--iconvdata/shift_jisx0213.c20
-rw-r--r--iconvdata/sjis.c8
-rw-r--r--iconvdata/t.61.c4
-rw-r--r--iconvdata/tcvn5712-1.c6
-rw-r--r--iconvdata/tscii.c44
-rw-r--r--iconvdata/uhc.c12
-rw-r--r--iconvdata/unicode.c8
-rw-r--r--iconvdata/utf-16.c22
-rw-r--r--iconvdata/utf-32.c10
-rw-r--r--iconvdata/utf-7.c12
-rw-r--r--include/atomic.h2
-rw-r--r--inet/inet6_option.c2
-rw-r--r--intl/bindtextdom.c18
-rw-r--r--intl/dcigettext.c20
-rw-r--r--intl/loadmsgcat.c4
-rw-r--r--intl/localealias.c4
-rw-r--r--libio/filedoalloc.c2
-rw-r--r--libio/fileops.c10
-rw-r--r--libio/fmemopen.c4
-rw-r--r--libio/iofgets.c2
-rw-r--r--libio/iofgets_u.c2
-rw-r--r--libio/iofgetws.c2
-rw-r--r--libio/iofgetws_u.c2
-rw-r--r--libio/iogetdelim.c2
-rw-r--r--libio/wfileops.c12
-rw-r--r--locale/findlocale.c4
-rw-r--r--locale/loadarchive.c8
-rw-r--r--locale/loadlocale.c10
-rw-r--r--locale/setlocale.c2
-rw-r--r--login/programs/pt_chown.c2
-rw-r--r--malloc/arena.c8
-rw-r--r--malloc/malloc.c14
-rw-r--r--malloc/memusage.c24
-rw-r--r--math/e_exp2l.c2
-rw-r--r--math/e_scalb.c6
-rw-r--r--math/e_scalbf.c6
-rw-r--r--math/e_scalbl.c6
-rw-r--r--math/s_catan.c4
-rw-r--r--math/s_catanf.c4
-rw-r--r--math/s_catanh.c4
-rw-r--r--math/s_catanhf.c4
-rw-r--r--math/s_catanhl.c4
-rw-r--r--math/s_catanl.c4
-rw-r--r--math/s_ccosh.c10
-rw-r--r--math/s_ccoshf.c12
-rw-r--r--math/s_ccoshl.c12
-rw-r--r--math/s_cexp.c12
-rw-r--r--math/s_cexpf.c12
-rw-r--r--math/s_cexpl.c12
-rw-r--r--math/s_clog.c4
-rw-r--r--math/s_clog10.c4
-rw-r--r--math/s_clog10f.c4
-rw-r--r--math/s_clog10l.c4
-rw-r--r--math/s_clogf.c4
-rw-r--r--math/s_clogl.c4
-rw-r--r--math/s_csin.c8
-rw-r--r--math/s_csinf.c8
-rw-r--r--math/s_csinh.c10
-rw-r--r--math/s_csinhf.c12
-rw-r--r--math/s_csinhl.c12
-rw-r--r--math/s_csinl.c8
-rw-r--r--math/s_csqrt.c6
-rw-r--r--math/s_csqrtf.c6
-rw-r--r--math/s_csqrtl.c6
-rw-r--r--math/s_ctan.c4
-rw-r--r--math/s_ctanf.c4
-rw-r--r--math/s_ctanh.c4
-rw-r--r--math/s_ctanhf.c4
-rw-r--r--math/s_ctanhl.c4
-rw-r--r--math/s_ctanl.c4
-rw-r--r--math/w_pow.c2
-rw-r--r--math/w_powf.c2
-rw-r--r--math/w_powl.c2
-rw-r--r--math/w_scalb.c2
-rw-r--r--math/w_scalbf.c2
-rw-r--r--math/w_scalbl.c2
-rw-r--r--misc/error.c2
-rw-r--r--misc/pselect.c2
-rw-r--r--nis/nis_call.c2
-rw-r--r--nis/nis_callback.c10
-rw-r--r--nis/nis_creategroup.c2
-rw-r--r--nis/nis_domain_of_r.c2
-rw-r--r--nis/nis_findserv.c4
-rw-r--r--nis/nis_getservlist.c12
-rw-r--r--nis/nis_lookup.c4
-rw-r--r--nis/nis_subr.c14
-rw-r--r--nis/nis_table.c18
-rw-r--r--nis/nis_xdr.c2
-rw-r--r--nis/nss_compat/compat-grp.c12
-rw-r--r--nis/nss_compat/compat-initgroups.c6
-rw-r--r--nis/nss_compat/compat-pwd.c12
-rw-r--r--nis/nss_compat/compat-spwd.c8
-rw-r--r--nis/nss_nis/nis-alias.c16
-rw-r--r--nis/nss_nis/nis-ethers.c16
-rw-r--r--nis/nss_nis/nis-grp.c24
-rw-r--r--nis/nss_nis/nis-hosts.c34
-rw-r--r--nis/nss_nis/nis-initgroups.c8
-rw-r--r--nis/nss_nis/nis-netgrp.c6
-rw-r--r--nis/nss_nis/nis-network.c24
-rw-r--r--nis/nss_nis/nis-proto.c16
-rw-r--r--nis/nss_nis/nis-publickey.c4
-rw-r--r--nis/nss_nis/nis-pwd.c30
-rw-r--r--nis/nss_nis/nis-rpc.c18
-rw-r--r--nis/nss_nis/nis-service.c30
-rw-r--r--nis/nss_nis/nis-spwd.c12
-rw-r--r--nis/nss_nisplus/nisplus-alias.c4
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c8
-rw-r--r--nis/nss_nisplus/nisplus-grp.c10
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c8
-rw-r--r--nis/nss_nisplus/nisplus-initgroups.c4
-rw-r--r--nis/nss_nisplus/nisplus-network.c4
-rw-r--r--nis/nss_nisplus/nisplus-proto.c4
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c10
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c2
-rw-r--r--nis/nss_nisplus/nisplus-service.c10
-rw-r--r--nis/nss_nisplus/nisplus-spwd.c6
-rw-r--r--nis/ypclnt.c8
-rw-r--r--nptl/ChangeLog73
-rw-r--r--nptl/allocatestack.c14
-rw-r--r--nptl/cancellation.c4
-rw-r--r--nptl/cleanup_defer.c6
-rw-r--r--nptl/cleanup_defer_compat.c6
-rw-r--r--nptl/cond-perf.c2
-rw-r--r--nptl/nptl-init.c4
-rw-r--r--nptl/perf.c4
-rw-r--r--nptl/pthread_barrier_destroy.c2
-rw-r--r--nptl/pthread_barrier_init.c2
-rw-r--r--nptl/pthread_cond_timedwait.c6
-rw-r--r--nptl/pthread_cond_wait.c2
-rw-r--r--nptl/pthread_create.c18
-rw-r--r--nptl/pthread_getattr_np.c2
-rw-r--r--nptl/pthread_getspecific.c4
-rw-r--r--nptl/pthread_join.c2
-rw-r--r--nptl/pthread_key_delete.c2
-rw-r--r--nptl/pthread_mutex_init.c4
-rw-r--r--nptl/pthread_mutex_lock.c20
-rw-r--r--nptl/pthread_mutex_timedlock.c16
-rw-r--r--nptl/pthread_mutex_trylock.c14
-rw-r--r--nptl/pthread_mutex_unlock.c2
-rw-r--r--nptl/pthread_rwlock_rdlock.c4
-rw-r--r--nptl/pthread_rwlock_timedrdlock.c2
-rw-r--r--nptl/pthread_rwlock_timedwrlock.c2
-rw-r--r--nptl/pthread_rwlock_tryrdlock.c2
-rw-r--r--nptl/pthread_setcancelstate.c2
-rw-r--r--nptl/pthread_setcanceltype.c2
-rw-r--r--nptl/pthread_setschedprio.c2
-rw-r--r--nptl/pthread_setspecific.c2
-rw-r--r--nptl/sem_init.c4
-rw-r--r--nptl/sem_open.c4
-rw-r--r--nptl/sigaction.c2
-rw-r--r--nptl/sockperf.c4
-rw-r--r--nptl/sysdeps/pthread/createthread.c12
-rw-r--r--nptl/sysdeps/pthread/setxid.h2
-rw-r--r--nptl/sysdeps/pthread/timer_create.c4
-rw-r--r--nptl/sysdeps/pthread/unwind-forcedunwind.c10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/getpid.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/mq_notify.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pt-raise.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_kill.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/raise.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c2
-rw-r--r--nptl/unwind.c2
-rw-r--r--nscd/aicache.c4
-rw-r--r--nscd/cache.c16
-rw-r--r--nscd/connections.c20
-rw-r--r--nscd/grpcache.c4
-rw-r--r--nscd/hstcache.c4
-rw-r--r--nscd/initgrcache.c4
-rw-r--r--nscd/mem.c12
-rw-r--r--nscd/netgroupcache.c8
-rw-r--r--nscd/nscd-client.h4
-rw-r--r--nscd/nscd_getai.c4
-rw-r--r--nscd/nscd_getgr_r.c12
-rw-r--r--nscd/nscd_gethst_r.c6
-rw-r--r--nscd/nscd_getpw_r.c8
-rw-r--r--nscd/nscd_getserv_r.c4
-rw-r--r--nscd/nscd_helper.c18
-rw-r--r--nscd/nscd_initgroups.c2
-rw-r--r--nscd/nscd_netgroup.c4
-rw-r--r--nscd/pwdcache.c4
-rw-r--r--nscd/selinux.c2
-rw-r--r--nscd/servicescache.c4
-rw-r--r--nss/nss_files/files-XXX.c2
-rw-r--r--posix/fnmatch.c16
-rw-r--r--posix/getopt.c2
-rw-r--r--posix/glob.c42
-rw-r--r--posix/wordexp.c2
-rw-r--r--resolv/nss_dns/dns-host.c44
-rw-r--r--resolv/nss_dns/dns-network.c2
-rw-r--r--resolv/res_init.c2
-rw-r--r--resolv/res_mkquery.c4
-rw-r--r--resolv/res_query.c2
-rw-r--r--resolv/res_send.c36
-rw-r--r--stdio-common/_i18n_number.h2
-rw-r--r--stdio-common/perror.c2
-rw-r--r--stdio-common/printf_fp.c8
-rw-r--r--stdio-common/tmpnam.c2
-rw-r--r--stdio-common/vfscanf.c74
-rw-r--r--stdlib/cxa_finalize.c2
-rw-r--r--stdlib/cxa_thread_atexit_impl.c2
-rw-r--r--stdlib/drand48-iter.c2
-rw-r--r--stdlib/putenv.c2
-rw-r--r--stdlib/setenv.c6
-rw-r--r--stdlib/strtod_l.c12
-rw-r--r--stdlib/strtol_l.c8
-rw-r--r--string/memmem.c2
-rw-r--r--string/strerror.c2
-rw-r--r--string/strnlen.c2
-rw-r--r--string/test-memmem.c2
-rw-r--r--sunrpc/clnt_udp.c2
-rw-r--r--sunrpc/pm_getport.c4
-rw-r--r--sysdeps/gnu/unwind-resume.c4
-rw-r--r--sysdeps/i386/dl-irel.h2
-rw-r--r--sysdeps/i386/dl-machine.h22
-rw-r--r--sysdeps/ieee754/dbl-64/e_atanh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_fmod.c10
-rw-r--r--sysdeps/ieee754/dbl-64/e_gamma_r.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_hypot.c2
-rw-r--r--sysdeps/ieee754/dbl-64/e_j1.c12
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c12
-rw-r--r--sysdeps/ieee754/dbl-64/e_log.c10
-rw-r--r--sysdeps/ieee754/dbl-64/e_log10.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_log2.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_sinh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_asinh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_fma.c8
-rw-r--r--sysdeps/ieee754/dbl-64/s_log1p.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_logb.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_modf.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_scalbln.c10
-rw-r--r--sysdeps/ieee754/dbl-64/s_scalbn.c10
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c4
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_round.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_atanhf.c4
-rw-r--r--sysdeps/ieee754/flt-32/e_gammaf_r.c6
-rw-r--r--sysdeps/ieee754/flt-32/s_logbf.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_fmal.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/math_ldbl.h6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lrintl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lroundl.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/e_gammal_r.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j0l.c16
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j1l.c16
-rw-r--r--sysdeps/ieee754/ldbl-96/e_jnl.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fma.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fmal.c6
-rw-r--r--sysdeps/posix/clock_getres.c6
-rw-r--r--sysdeps/posix/fdopendir.c6
-rw-r--r--sysdeps/posix/getaddrinfo.c4
-rw-r--r--sysdeps/posix/opendir.c4
-rw-r--r--sysdeps/posix/sleep.c2
-rw-r--r--sysdeps/posix/tempname.c2
-rw-r--r--sysdeps/powerpc/powerpc32/dl-irel.h2
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c10
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.h4
-rw-r--r--sysdeps/powerpc/powerpc64/dl-irel.h4
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h6
-rw-r--r--sysdeps/pthread/aio_notify.c2
-rw-r--r--sysdeps/pthread/aio_suspend.c4
-rw-r--r--sysdeps/s390/dl-irel.h2
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h14
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h14
-rw-r--r--sysdeps/s390/s390-64/utf16-utf32-z9.c10
-rw-r--r--sysdeps/s390/s390-64/utf8-utf16-z9.c26
-rw-r--r--sysdeps/s390/s390-64/utf8-utf32-z9.c32
-rw-r--r--sysdeps/sh/dl-machine.h4
-rw-r--r--sysdeps/sparc/sparc32/dl-irel.h4
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h10
-rw-r--r--sysdeps/sparc/sparc64/dl-irel.h4
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h10
-rw-r--r--sysdeps/sparc/sparc64/dl-plt.h2
-rw-r--r--sysdeps/unix/clock_gettime.c4
-rw-r--r--sysdeps/unix/clock_settime.c4
-rw-r--r--sysdeps/unix/grantpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/accept4.c2
-rw-r--r--sysdeps/unix/sysv/linux/adjtime.c2
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c2
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h4
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c4
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c4
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c6
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c6
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate64.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/get_clockfreq.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fallocate64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/scandir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c8
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_unlink.c2
-rw-r--r--sysdeps/unix/sysv/linux/openat.c4
-rw-r--r--sysdeps/unix/sysv/linux/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/posix_fallocate64.c4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c4
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/recvmmsg.c2
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/sched_setaffinity.c2
-rw-r--r--sysdeps/unix/sysv/linux/sendmmsg.c2
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c6
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c2
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c2
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c6
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c4
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c2
-rw-r--r--sysdeps/x86_64/dl-irel.h2
-rw-r--r--sysdeps/x86_64/dl-machine.h22
-rw-r--r--time/asctime.c2
-rw-r--r--time/tzfile.c36
-rw-r--r--time/tzset.c12
-rw-r--r--wcsmbs/mbrtoc16.c2
-rw-r--r--wcsmbs/mbrtowc.c2
-rw-r--r--wcsmbs/wcsmbsload.c2
-rw-r--r--wcsmbs/wcsmbsload.h4
466 files changed, 2224 insertions, 1655 deletions
diff --git a/ChangeLog b/ChangeLog
index cf1b17d161..eadce522e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,501 @@
2014-02-10 Ondřej Bílka <neleai@seznam.cz>
+ * assert/assert.c (__assert_fail_base): Use glibc_likely instead __builtin_expect.
+ * benchtests/bench-memmem.c (simple_memmem): Likewise.
+ * catgets/open_catalog.c (__open_catalog): Likewise.
+ * csu/libc-start.c (LIBC_START_MAIN): Likewise.
+ * debug/confstr_chk.c: Likewise.
+ * debug/fread_chk.c (__fread_chk): Likewise.
+ * debug/fread_u_chk.c (__fread_unlocked_chk): Likewise.
+ * debug/getgroups_chk.c: Likewise.
+ * debug/mbsnrtowcs_chk.c: Likewise.
+ * debug/mbsrtowcs_chk.c: Likewise.
+ * debug/mbstowcs_chk.c: Likewise.
+ * debug/memcpy_chk.c: Likewise.
+ * debug/memmove_chk.c: Likewise.
+ * debug/mempcpy_chk.c: Likewise.
+ * debug/memset_chk.c: Likewise.
+ * debug/stpcpy_chk.c (__stpcpy_chk): Likewise.
+ * debug/strcat_chk.c (__strcat_chk): Likewise.
+ * debug/strcpy_chk.c (__strcpy_chk): Likewise.
+ * debug/strncat_chk.c (__strncat_chk): Likewise.
+ * debug/vsnprintf_chk.c (___vsnprintf_chk): Likewise.
+ * debug/vswprintf_chk.c (__vswprintf_chk): Likewise.
+ * debug/wcpcpy_chk.c (__wcpcpy_chk): Likewise.
+ * debug/wcpncpy_chk.c: Likewise.
+ * debug/wcscat_chk.c (__wcscat_chk): Likewise.
+ * debug/wcscpy_chk.c (__wcscpy_chk): Likewise.
+ * debug/wcsncat_chk.c (__wcsncat_chk): Likewise.
+ * debug/wcsncpy_chk.c: Likewise.
+ * debug/wcsnrtombs_chk.c: Likewise.
+ * debug/wcsrtombs_chk.c: Likewise.
+ * debug/wcstombs_chk.c: Likewise.
+ * debug/wmemcpy_chk.c: Likewise.
+ * debug/wmemmove_chk.c: Likewise.
+ * debug/wmempcpy_chk.c: Likewise.
+ * debug/wmemset_chk.c: Likewise.
+ * dirent/scandirat.c (SCANDIRAT): Likewise.
+ * dlfcn/dladdr1.c (dladdr1): Likewise.
+ * dlfcn/dladdr.c (dladdr): Likewise.
+ * dlfcn/dlclose.c (dlclose_doit): Likewise.
+ * dlfcn/dlerror.c (__dlerror): Likewise.
+ * dlfcn/dlinfo.c (dlinfo_doit): Likewise.
+ * dlfcn/dlmopen.c (dlmopen_doit): Likewise.
+ * dlfcn/dlopen.c (dlopen_doit): Likewise.
+ * dlfcn/dlopenold.c (__dlopen_nocheck): Likewise.
+ * dlfcn/dlsym.c (dlsym_doit): Likewise.
+ * dlfcn/dlvsym.c (dlvsym_doit): Likewise.
+ * elf/dl-cache.c (_dl_load_cache_lookup): Likewise.
+ * elf/dl-close.c (remove_slotinfo, _dl_close_worker, _dl_close):
+ Likewise.
+ * elf/dl-conflict.c: Likewise.
+ * elf/dl-deps.c (_dl_build_local_scope, _dl_map_object_deps): Likewise.
+ * elf/dl-dst.h: Likewise.
+ * elf/dl-fini.c (_dl_sort_fini, _dl_fini): Likewise.
+ * elf/dl-fptr.c (_dl_make_fptr): Likewise.
+ * elf/dl-hwcaps.c (_dl_important_hwcaps): Likewise.
+ * elf/dl-init.c (call_init, _dl_init): Likewise.
+ * elf/dl-libc.c (__libc_dlopen_mode, __libc_dlsym): Likewise.
+ * elf/dl-load.c (_dl_dst_substitute, fillin_rpath, _dl_init_paths,
+ _dl_map_object_from_fd, open_verify, open_path,
+ _dl_map_object): Likewise.
+ * elf/dl-lookup.c (do_lookup_x, add_dependency, _dl_lookup_symbol_x):
+ Likewise.
+ * elf/dl-minimal.c (__libc_memalign): Likewise.
+ * elf/dl-open.c (add_to_global, dl_open_worker, _dl_open): Likewise.
+ * elf/dl-reloc.c (_dl_relocate_object): Likewise.
+ * elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Likewise.
+ * elf/dl-sym.c (do_sym): Likewise.
+ * elf/dl-tls.c (tls_get_addr_tail, update_get_addr, __tls_get_addr,
+ _dl_tls_get_addr_soft): Likewise.
+ * elf/dl-version.c (match_symbol, _dl_check_map_versions): Likewise.
+ * elf/dl-writev.h (_dl_writev): Likewise.
+ * elf/ldconfig.c (search_dir): Likewise.
+ * elf/rtld.c (_dl_start_final, _dl_start, init_tls, do_preload,
+ dl_main): Likewise.
+ * elf/setup-vdso.h (setup_vdso): Likewise.
+ * grp/compat-initgroups.c (compat_call): Likewise.
+ * grp/fgetgrent.c (fgetgrent): Likewise.
+ * grp/initgroups.c (getgrouplist, initgroups): Likewise.
+ * grp/putgrent.c (putgrent): Likewise.
+ * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_initgroups_dyn):
+ Likewise.
+ * hurd/hurdinit.c: Likewise.
+ * iconvdata/8bit-gap.c (struct): Likewise.
+ * iconvdata/ansi_x3.110.c : Likewise.
+ * iconvdata/big5.c : Likewise.
+ * iconvdata/big5hkscs.c : Likewise.
+ * iconvdata/cp1255.c: Likewise.
+ * iconvdata/cp1258.c : Likewise.
+ * iconvdata/cp932.c : Likewise.
+ * iconvdata/euc-cn.c: Likewise.
+ * iconvdata/euc-jisx0213.c : Likewise.
+ * iconvdata/euc-jp.c: Likewise.
+ * iconvdata/euc-jp-ms.c : Likewise.
+ * iconvdata/euc-kr.c (euckr_from_ucs4): Likewise.
+ * iconvdata/gb18030.c : Likewise.
+ * iconvdata/gbbig5.c (const): Likewise.
+ * iconvdata/gbgbk.c: Likewise.
+ * iconvdata/gbk.c : Likewise.
+ * iconvdata/ibm1364.c : Likewise.
+ * iconvdata/ibm930.c : Likewise.
+ * iconvdata/ibm932.c: Likewise.
+ * iconvdata/ibm933.c : Likewise.
+ * iconvdata/ibm935.c : Likewise.
+ * iconvdata/ibm937.c : Likewise.
+ * iconvdata/ibm939.c : Likewise.
+ * iconvdata/ibm943.c: Likewise.
+ * iconvdata/iso_11548-1.c: Likewise.
+ * iconvdata/iso-2022-cn.c : Likewise.
+ * iconvdata/iso-2022-cn-ext.c : Likewise.
+ * iconvdata/iso-2022-jp-3.c: Likewise.
+ * iconvdata/iso-2022-jp.c (gconv_end): Likewise.
+ * iconvdata/iso-2022-kr.c : Likewise.
+ * iconvdata/iso646.c (gconv_end): Likewise.
+ * iconvdata/iso_6937-2.c : Likewise.
+ * iconvdata/iso_6937.c : Likewise.
+ * iconvdata/iso8859-1.c: Likewise.
+ * iconvdata/johab.c (johab_sym_hanja_to_ucs): Likewise.
+ * iconvdata/shift_jisx0213.c : Likewise.
+ * iconvdata/sjis.c : Likewise.
+ * iconvdata/t.61.c : Likewise.
+ * iconvdata/tcvn5712-1.c : Likewise.
+ * iconvdata/tscii.c: Likewise.
+ * iconvdata/uhc.c : Likewise.
+ * iconvdata/unicode.c (gconv_end): Likewise.
+ * iconvdata/utf-16.c (gconv_end): Likewise.
+ * iconvdata/utf-32.c (gconv_end): Likewise.
+ * iconvdata/utf-7.c (base64): Likewise.
+ * iconv/gconv_cache.c (__gconv_load_cache): Likewise.
+ * iconv/gconv_close.c (__gconv_close): Likewise.
+ * iconv/gconv_open.c (__gconv_open): Likewise.
+ * iconv/gconv_simple.c (internal_ucs4_loop_single, ucs4_internal_loop,
+ ucs4_internal_loop_unaligned, ucs4_internal_loop_single,
+ internal_ucs4le_loop_single, ucs4le_internal_loop,
+ ucs4le_internal_loop_unaligned, ucs4le_internal_loop_single): Likewise.
+ * iconv/iconv.c (iconv): Likewise.
+ * iconv/iconv_close.c: Likewise.
+ * iconv/loop.c (SINGLE): Likewise.
+ * iconv/skeleton.c (FUNCTION_NAME): Likewise.
+ * include/atomic.h: Likewise.
+ * inet/inet6_option.c (option_alloc): Likewise.
+ * intl/bindtextdom.c (set_binding_values): Likewise.
+ * intl/dcigettext.c (DCIGETTEXT, _nl_find_msg): Likewise.
+ * intl/loadmsgcat.c (_nl_load_domain): Likewise.
+ * intl/localealias.c (read_alias_file): Likewise.
+ * libio/filedoalloc.c (_IO_file_doallocate): Likewise.
+ * libio/fileops.c (_IO_file_open, _IO_file_underflow_mmap,
+ _IO_new_file_overflow, _IO_file_xsgetn_mmap): Likewise.
+ * libio/fmemopen.c (fmemopen): Likewise.
+ * libio/iofgets.c (_IO_fgets): Likewise.
+ * libio/iofgets_u.c (fgets_unlocked): Likewise.
+ * libio/iofgetws.c (fgetws): Likewise.
+ * libio/iofgetws_u.c (fgetws_unlocked): Likewise.
+ * libio/iogetdelim.c (_IO_getdelim): Likewise.
+ * libio/wfileops.c (_IO_wfile_underflow, _IO_wfile_underflow_mmap,
+ adjust_wide_data, _IO_wfile_seekoff): Likewise.
+ * locale/findlocale.c (_nl_find_locale): Likewise.
+ * locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
+ * locale/loadlocale.c (_nl_intern_locale_data, _nl_load_locale):
+ Likewise.
+ * locale/setlocale.c (setlocale): Likewise.
+ * login/programs/pt_chown.c (main): Likewise.
+ * malloc/arena.c (ptmalloc_init, shrink_heap, arena_get2): Likewise.
+ * malloc/malloc.c (_int_malloc, _int_free): Likewise.
+ * malloc/memusage.c (update_data, malloc, realloc, calloc, free,
+ mmap, mmap64, mremap, munmap): Likewise.
+ * math/e_exp2l.c: Likewise.
+ * math/e_scalb.c (invalid_fn, __ieee754_scalb): Likewise.
+ * math/e_scalbf.c (invalid_fn, __ieee754_scalbf): Likewise.
+ * math/e_scalbl.c (invalid_fn, __ieee754_scalbl): Likewise.
+ * math/s_catan.c (__catan): Likewise.
+ * math/s_catanf.c (__catanf): Likewise.
+ * math/s_catanh.c (__catanh): Likewise.
+ * math/s_catanhf.c (__catanhf): Likewise.
+ * math/s_catanhl.c (__catanhl): Likewise.
+ * math/s_catanl.c (__catanl): Likewise.
+ * math/s_ccosh.c (__ccosh): Likewise.
+ * math/s_ccoshf.c (__ccoshf): Likewise.
+ * math/s_ccoshl.c (__ccoshl): Likewise.
+ * math/s_cexp.c (__cexp): Likewise.
+ * math/s_cexpf.c (__cexpf): Likewise.
+ * math/s_cexpl.c (__cexpl): Likewise.
+ * math/s_clog10.c (__clog10): Likewise.
+ * math/s_clog10f.c (__clog10f): Likewise.
+ * math/s_clog10l.c (__clog10l): Likewise.
+ * math/s_clog.c (__clog): Likewise.
+ * math/s_clogf.c (__clogf): Likewise.
+ * math/s_clogl.c (__clogl): Likewise.
+ * math/s_csin.c (__csin): Likewise.
+ * math/s_csinf.c (__csinf): Likewise.
+ * math/s_csinh.c (__csinh): Likewise.
+ * math/s_csinhf.c (__csinhf): Likewise.
+ * math/s_csinhl.c (__csinhl): Likewise.
+ * math/s_csinl.c (__csinl): Likewise.
+ * math/s_csqrt.c (__csqrt): Likewise.
+ * math/s_csqrtf.c (__csqrtf): Likewise.
+ * math/s_csqrtl.c (__csqrtl): Likewise.
+ * math/s_ctan.c (__ctan): Likewise.
+ * math/s_ctanf.c (__ctanf): Likewise.
+ * math/s_ctanh.c (__ctanh): Likewise.
+ * math/s_ctanhf.c (__ctanhf): Likewise.
+ * math/s_ctanhl.c (__ctanhl): Likewise.
+ * math/s_ctanl.c (__ctanl): Likewise.
+ * math/w_pow.c: Likewise.
+ * math/w_powf.c: Likewise.
+ * math/w_powl.c: Likewise.
+ * math/w_scalb.c (sysv_scalb): Likewise.
+ * math/w_scalbf.c (sysv_scalbf): Likewise.
+ * math/w_scalbl.c (sysv_scalbl): Likewise.
+ * misc/error.c (error_tail): Likewise.
+ * misc/pselect.c (__pselect): Likewise.
+ * nis/nis_callback.c (__nis_create_callback): Likewise.
+ * nis/nis_call.c (__nisfind_server): Likewise.
+ * nis/nis_creategroup.c (nis_creategroup): Likewise.
+ * nis/nis_domain_of_r.c (nis_domain_of_r): Likewise.
+ * nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
+ * nis/nis_getservlist.c (nis_getservlist): Likewise.
+ * nis/nis_lookup.c (nis_lookup): Likewise.
+ * nis/nis_subr.c (nis_leaf_of_r, nis_getnames): Likewise.
+ * nis/nis_table.c (__create_ib_request, nis_list, nis_add_entry,
+ nis_modify_entry, nis_first_entry, nis_next_entry): Likewise.
+ * nis/nis_xdr.c (xdr_endpoint): Likewise.
+ * nis/nss_compat/compat-grp.c (getgrent_next_file, internal_getgrnam_r,
+ internal_getgrgid_r): Likewise.
+ * nis/nss_compat/compat-initgroups.c (add_group, internal_getgrent_r):
+ Likewise.
+ * nis/nss_compat/compat-pwd.c (getpwent_next_file, internal_getpwnam_r,
+ internal_getpwuid_r): Likewise.
+ * nis/nss_compat/compat-spwd.c (getspent_next_file,
+ internal_getspnam_r): Likewise.
+ * nis/nss_nis/nis-alias.c (internal_nis_getaliasent_r,
+ _nss_nis_getaliasbyname_r): Likewise.
+ * nis/nss_nis/nis-ethers.c (_nss_nis_gethostton_r,
+ _nss_nis_getntohost_r): Likewise.
+ * nis/nss_nis/nis-grp.c (internal_nis_setgrent,
+ internal_nis_getgrent_r, _nss_nis_getgrnam_r, _nss_nis_getgrgid_r):
+ Likewise.
+ * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent,
+ internal_nis_gethostent_r, internal_gethostbyname2_r,
+ _nss_nis_gethostbyname_r, _nss_nis_gethostbyaddr_r,
+ _nss_nis_gethostbyname4_r): Likewise.
+ * nis/nss_nis/nis-initgroups.c (internal_getgrent_r,
+ initgroups_netid): Likewise.
+ * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise.
+ * nis/nss_nis/nis-network.c (internal_nis_getnetent_r,
+ _nss_nis_getnetbyname_r, _nss_nis_getnetbyaddr_r): Likewise.
+ * nis/nss_nis/nis-proto.c (_nss_nis_getprotobyname_r,
+ _nss_nis_getprotobynumber_r): Likewise.
+ * nis/nss_nis/nis-publickey.c (_nss_nis_getpublickey,
+ _nss_nis_getsecretkey): Likewise.
+ * nis/nss_nis/nis-pwd.c (_nis_saveit, internal_nis_setpwent,
+ internal_nis_getpwent_r, _nss_nis_getpwnam_r, _nss_nis_getpwuid_r):
+ Likewise.
+ * nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r,
+ _nss_nis_getrpcbyname_r, _nss_nis_getrpcbynumber_r): Likewise.
+ * nis/nss_nis/nis-service.c (dosearch, internal_nis_getservent_r,
+ _nss_nis_getservbyname_r, _nss_nis_getservbyport_r): Likewise.
+ * nis/nss_nis/nis-spwd.c (_nss_nis_setspent, internal_nis_getspent_r,
+ _nss_nis_getspnam_r): Likewise.
+ * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
+ Likewise.
+ * nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_gethostton_r,
+ _nss_nisplus_getntohost_r): Likewise.
+ * nis/nss_nisplus/nisplus-grp.c (internal_nisplus_getgrent_r,
+ _nss_nisplus_getgrnam_r, _nss_nisplus_getgrgid_r): Likewise.
+ * nis/nss_nisplus/nisplus-hosts.c (internal_gethostbyname2_r,
+ _nss_nisplus_gethostbyaddr_r, _nss_nisplus_gethostbyname4_r): Likewise.
+ * nis/nss_nisplus/nisplus-initgroups.c (_nss_nisplus_initgroups_dyn):
+ Likewise.
+ * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyname_r,
+ _nss_nisplus_getnetbyaddr_r): Likewise.
+ * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_getprotobyname_r,
+ _nss_nisplus_getprotobynumber_r): Likewise.
+ * nis/nss_nisplus/nisplus-pwd.c (internal_nisplus_getpwent_r,
+ _nss_nisplus_getpwnam_r, _nss_nisplus_getpwuid_r): Likewise.
+ * nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_getrpcbyname_r):
+ Likewise.
+ * nis/nss_nisplus/nisplus-service.c (internal_nisplus_getservent_r,
+ _nss_nisplus_getservbyname_r, _nss_nisplus_getservbyport_r): Likewise.
+ * nis/nss_nisplus/nisplus-spwd.c (internal_nisplus_getspent_r,
+ _nss_nisplus_getspnam_r): Likewise.
+ * nis/ypclnt.c (__yp_bind, yp_match, yp_all, yp_maplist): Likewise.
+ * nscd/aicache.c (addhstaiX): Likewise.
+ * nscd/cache.c (cache_search, prune_cache): Likewise.
+ * nscd/connections.c (register_traced_file, send_ro_fd, handle_request,
+ nscd_run_prune, nscd_run_worker, fd_ready, main_loop_epoll): Likewise.
+ * nscd/grpcache.c (addgrbyX): Likewise.
+ * nscd/hstcache.c (addhstbyX): Likewise.
+ * nscd/initgrcache.c (addinitgroupsX): Likewise.
+ * nscd/mem.c (gc, mempool_alloc): Likewise.
+ * nscd/netgroupcache.c (do_notfound, addgetnetgrentX, addinnetgrX):
+ Likewise.
+ * nscd/nscd-client.h (__nscd_acquire_maplock, __nscd_drop_map_ref):
+ Likewise.
+ * nscd/nscd_getai.c (__nscd_getai): Likewise.
+ * nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
+ * nscd/nscd_gethst_r.c (__nscd_get_nl_timestamp, nscd_gethst_r):
+ Likewise.
+ * nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
+ * nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
+ * nscd/nscd_helper.c (__readvall, open_socket,
+ __nscd_get_mapping, __nscd_get_map_ref): Likewise.
+ * nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
+ * nscd/nscd_netgroup.c (__nscd_setnetgrent, __nscd_innetgr): Likewise.
+ * nscd/pwdcache.c (addpwbyX): Likewise.
+ * nscd/selinux.c (preserve_capabilities): Likewise.
+ * nscd/servicescache.c (addservbyX): Likewise.
+ * nss/nss_files/files-XXX.c (internal_getent): Likewise.
+ * posix/fnmatch.c (fnmatch): Likewise.
+ * posix/getopt.c (_getopt_internal_r): Likewise.
+ * posix/glob.c (glob, glob_in_dir): Likewise.
+ * posix/wordexp.c (exec_comm_child): Likewise.
+ * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r, getanswer_r,
+ gaih_getanswer_slice): Likewise.
+ * resolv/nss_dns/dns-network.c (getanswer_r): Likewise.
+ * resolv/res_init.c: Likewise.
+ * resolv/res_mkquery.c (res_nmkquery): Likewise.
+ * resolv/res_query.c (__libc_res_nquery): Likewise.
+ * resolv/res_send.c (__libc_res_nsend, send_vc, reopen, send_dg):
+ Likewise.
+ * stdio-common/_i18n_number.h (_i18n_number_rewrite): Likewise.
+ * stdio-common/perror.c (perror): Likewise.
+ * stdio-common/printf_fp.c (___printf_fp): Likewise.
+ * stdio-common/tmpnam.c (tmpnam): Likewise.
+ * stdio-common/vfscanf.c (_IO_vfscanf_internal): Likewise.
+ * stdlib/cxa_finalize.c (__cxa_finalize): Likewise.
+ * stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl): Likewise.
+ * stdlib/drand48-iter.c (__drand48_iterate): Likewise.
+ * stdlib/putenv.c (putenv): Likewise.
+ * stdlib/setenv.c (__add_to_environ): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * stdlib/strtol_l.c (INTERNAL): Likewise.
+ * string/memmem.c (memmem): Likewise.
+ * string/strerror.c (strerror): Likewise.
+ * string/strnlen.c (__strnlen): Likewise.
+ * string/test-memmem.c (simple_memmem): Likewise.
+ * sunrpc/clnt_udp.c (__libc_clntudp_bufcreate): Likewise.
+ * sunrpc/pm_getport.c (__get_socket): Likewise.
+ * sysdeps/gnu/unwind-resume.c (init, _Unwind_Resume): Likewise.
+ * sysdeps/i386/dl-irel.h (elf_irel): Likewise.
+ * sysdeps/i386/dl-machine.h (elf_machine_runtime_setup,
+ elf_machine_rel, elf_machine_lazy_rel, elf_machine_lazy_rela):
+ Likewise.
+ * sysdeps/ieee754/dbl-64/e_atanh.c (__ieee754_atanh): Likewise.
+ * sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Likewise.
+ * sysdeps/ieee754/dbl-64/e_fmod.c (__ieee754_fmod): Likewise.
+ * sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Likewise.
+ * sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Likewise.
+ * sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1, __ieee754_y1): Likewise.
+ * sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn, __ieee754_yn): Likewise.
+ * sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise.
+ * sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise.
+ * sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Likewise.
+ * sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
+ * sysdeps/ieee754/dbl-64/s_asinh.c (__asinh): Likewise.
+ * sysdeps/ieee754/dbl-64/s_fma.c (__fma): Likewise.
+ * sysdeps/ieee754/dbl-64/s_log1p.c (__log1p): Likewise.
+ * sysdeps/ieee754/dbl-64/s_logb.c (__logb): Likewise.
+ * sysdeps/ieee754/dbl-64/s_modf.c (__modf): Likewise.
+ * sysdeps/ieee754/dbl-64/s_scalbln.c (__scalbln): Likewise.
+ * sysdeps/ieee754/dbl-64/s_scalbn.c (__scalbn): Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c (__ieee754_acosh):
+ Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c (__ieee754_log10):
+ Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c (__ieee754_log2):
+ Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c (__frexp): Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c (__logb): Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo): Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_round.c (__round): Likewise.
+ * sysdeps/ieee754/flt-32/e_atanhf.c (__ieee754_atanhf): Likewise.
+ * sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r): Likewise.
+ * sysdeps/ieee754/flt-32/s_logbf.c (__logbf): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_nearbyint): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_llrintl.c (__llrintl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_llroundl.c (__llroundl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_lrintl.c (__lrintl): Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_lroundl.c (__lroundl): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
+ * sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r): Likewise.
+ * sysdeps/ieee754/ldbl-96/e_j0l.c (__ieee754_j0l, __ieee754_y0l):
+ Likewise.
+ * sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l, __ieee754_y1l):
+ Likewise.
+ * sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl, __ieee754_ynl):
+ Likewise.
+ * sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Likewise.
+ * sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.
+ * sysdeps/posix/clock_getres.c (hp_timing_getres, realtime_getres):
+ Likewise.
+ * sysdeps/posix/fdopendir.c (__fdopendir): Likewise.
+ * sysdeps/posix/getaddrinfo.c (gaih_inet, getaddrinfo): Likewise.
+ * sysdeps/posix/opendir.c (__opendirat): Likewise.
+ * sysdeps/posix/sleep.c: Likewise.
+ * sysdeps/posix/tempname.c: Likewise.
+ * sysdeps/powerpc/powerpc32/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/powerpc/powerpc32/dl-machine.c (__process_machine_rela):
+ Likewise.
+ * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_runtime_setup,
+ elf_machine_rela): Likewise.
+ * sysdeps/powerpc/powerpc64/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise.
+ * sysdeps/pthread/aio_notify.c (__aio_notify_only): Likewise.
+ * sysdeps/pthread/aio_suspend.c (do_aio_misc_wait, aio_suspend):
+ Likewise.
+ * sysdeps/s390/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup,
+ elf_machine_rela, elf_machine_lazy_rel): Likewise.
+ * sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup,
+ elf_machine_rela, elf_machine_lazy_rel): Likewise.
+ * sysdeps/s390/s390-64/utf16-utf32-z9.c (gconv_end): Likewise.
+ * sysdeps/s390/s390-64/utf8-utf16-z9.c (gconv_end): Likewise.
+ * sysdeps/s390/s390-64/utf8-utf32-z9.c (gconv_end): Likewise.
+ * sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
+ * sysdeps/sparc/sparc32/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela,
+ elf_machine_lazy_rel): Likewise.
+ * sysdeps/sparc/sparc64/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela,
+ elf_machine_lazy_rel): Likewise.
+ * sysdeps/sparc/sparc64/dl-plt.h (sparc64_fixup_plt): Likewise.
+ * sysdeps/unix/clock_gettime.c (hp_timing_gettime): Likewise.
+ * sysdeps/unix/clock_settime.c (hp_timing_settime): Likewise.
+ * sysdeps/unix/grantpt.c (grantpt): Likewise.
+ * sysdeps/unix/sysv/linux/accept4.c (accept4): Likewise.
+ * sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Likewise.
+ * sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise.
+ * sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard):
+ Likewise.
+ * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise.
+ * sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise.
+ * sysdeps/unix/sysv/linux/fchownat.c (fchownat): Likewise.
+ * sysdeps/unix/sysv/linux/futimesat.c (futimesat): Likewise.
+ * sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise.
+ * sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise.
+ * sysdeps/unix/sysv/linux/i386/fallocate64.c (fallocate64): Likewise.
+ * sysdeps/unix/sysv/linux/i386/fallocate.c (fallocate): Likewise.
+ * sysdeps/unix/sysv/linux/i386/fchownat.c (fchownat): Likewise.
+ * sysdeps/unix/sysv/linux/i386/fxstatat.c (__fxstatat): Likewise.
+ * sysdeps/unix/sysv/linux/i386/get_clockfreq.c (__get_clockfreq):
+ Likewise.
+ * sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
+ (__posix_fallocate64_l64): Likewise.
+ * sysdeps/unix/sysv/linux/i386/posix_fallocate.c
+ (posix_fallocate): Likewise.
+ * sysdeps/unix/sysv/linux/i386/scandir64.c (__old_scandir64): Likewise.
+ * sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request,
+ getifaddrs_internal): Likewise.
+ * sysdeps/unix/sysv/linux/linkat.c (linkat): Likewise.
+ * sysdeps/unix/sysv/linux/mkdirat.c (mkdirat): Likewise.
+ * sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise.
+ * sysdeps/unix/sysv/linux/openat.c (OPENAT_NOT_CANCEL): Likewise.
+ * sysdeps/unix/sysv/linux/posix_fallocate64.c
+ (__posix_fallocate64_l64): Likewise.
+ * sysdeps/unix/sysv/linux/posix_fallocate.c (posix_fallocate):
+ Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/fchownat.c (fchownat): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
+ Likewise.
+ * sysdeps/unix/sysv/linux/readlinkat.c (readlinkat): Likewise.
+ * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Likewise.
+ * sysdeps/unix/sysv/linux/renameat.c (renameat): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/sched_setaffinity.c: Likewise.
+ * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Likewise.
+ * sysdeps/unix/sysv/linux/shm_open.c (where_is_shmfs, shm_open):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sleep.c (__sleep): Likewise.
+ * sysdeps/unix/sysv/linux/symlinkat.c (symlinkat): Likewise.
+ * sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Likewise.
+ * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise.
+ * sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
+ * sysdeps/unix/sysv/linux/unlinkat.c (unlinkat): Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c (__fxstatat):
+ Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
+ (posix_fallocate): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise.
+ * sysdeps/x86_64/dl-irel.h (elf_irela): Likewise.
+ * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup,
+ elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel):
+ Likewise.
+ * time/asctime.c (asctime_internal): Likewise.
+ * time/tzfile.c (__tzfile_read, __tzfile_compute): Likewise.
+ * time/tzset.c (__tzset_parse_tz): Likewise.
+ * wcsmbs/mbrtoc16.c (mbrtoc16): Likewise.
+ * wcsmbs/mbrtowc.c (__mbrtowc): Likewise.
+ * wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Likewise.
+ * wcsmbs/wcsmbsload.h: Likewise.
+
+2014-02-10 Ondřej Bílka <neleai@seznam.cz>
+
[BZ #15894]
* stdlib/setenv.c (__add_to_environ): Remove duplicate code.
diff --git a/assert/assert.c b/assert/assert.c
index 2b85993e67..da7356a824 100644
--- a/assert/assert.c
+++ b/assert/assert.c
@@ -67,7 +67,7 @@ __assert_fail_base (const char *fmt, const char *assertion, const char *file,
total = (total + 1 + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
struct abort_msg_s *buf = __mmap (NULL, total, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
- if (__builtin_expect (buf != MAP_FAILED, 1))
+ if (__glibc_likely (buf != MAP_FAILED))
{
buf->size = total;
strcpy (buf->msg, str);
diff --git a/benchtests/bench-memmem.c b/benchtests/bench-memmem.c
index 6fe3bc666b..763fb5c5da 100644
--- a/benchtests/bench-memmem.c
+++ b/benchtests/bench-memmem.c
@@ -43,7 +43,7 @@ simple_memmem (const void *haystack, size_t haystack_len, const void *needle,
/* Sanity check, otherwise the loop might search through the whole
memory. */
- if (__builtin_expect (haystack_len < needle_len, 0))
+ if (__glibc_unlikely (haystack_len < needle_len))
return NULL;
for (begin = (const char *) haystack; begin <= last_possible; ++begin)
diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
index bc44f98247..d582270601 100644
--- a/catgets/open_catalog.c
+++ b/catgets/open_catalog.c
@@ -54,7 +54,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
{
const char *run_nlspath = nlspath;
#define ENOUGH(n) \
- if (__builtin_expect (bufact + (n) >= bufmax, 0)) \
+ if (__glibc_unlikely (bufact + (n) >= bufmax)) \
{ \
char *old_buf = buf; \
bufmax += 256 + (n); \
@@ -253,7 +253,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
/* Determine whether the file is a catalog file and if yes whether
it is written using the correct byte order. Else we have to swap
the values. */
- if (__builtin_expect (catalog->file_ptr->magic == CATGETS_MAGIC, 1))
+ if (__glibc_likely (catalog->file_ptr->magic == CATGETS_MAGIC))
swapping = 0;
else if (catalog->file_ptr->magic == SWAPU32 (CATGETS_MAGIC))
swapping = 1;
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 146e16ba46..3b7092b359 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -214,7 +214,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
#endif
/* Register the destructor of the dynamic linker if there is any. */
- if (__builtin_expect (rtld_fini != NULL, 1))
+ if (__glibc_likely (rtld_fini != NULL))
__cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL);
#ifndef SHARED
@@ -245,7 +245,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
#ifdef SHARED
/* Auditing checkpoint: we have a new object. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
struct audit_ifaces *afct = GLRO(dl_audit);
struct link_map *head = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
@@ -260,7 +260,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
#endif
#ifdef SHARED
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
@@ -270,7 +270,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
int not_first_call;
not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
- if (__builtin_expect (! not_first_call, 1))
+ if (__glibc_likely (! not_first_call))
{
struct pthread *self = THREAD_SELF;
diff --git a/debug/confstr_chk.c b/debug/confstr_chk.c
index 4253540c57..5807380faf 100644
--- a/debug/confstr_chk.c
+++ b/debug/confstr_chk.c
@@ -22,7 +22,7 @@
size_t
__confstr_chk (int name, char *buf, size_t len, size_t buflen)
{
- if (__builtin_expect (buflen < len, 0))
+ if (__glibc_unlikely (buflen < len))
__chk_fail ();
return confstr (name, buf, len);
diff --git a/debug/fread_chk.c b/debug/fread_chk.c
index 0f77a18029..44e96e868b 100644
--- a/debug/fread_chk.c
+++ b/debug/fread_chk.c
@@ -39,7 +39,7 @@ __fread_chk (void *__restrict ptr, size_t ptrlen,
__chk_fail ();
}
- if (__builtin_expect (bytes_requested > ptrlen, 0))
+ if (__glibc_unlikely (bytes_requested > ptrlen))
__chk_fail ();
CHECK_FILE (stream, 0);
diff --git a/debug/fread_u_chk.c b/debug/fread_u_chk.c
index 6d4d9693ea..f8a5bdbf2a 100644
--- a/debug/fread_u_chk.c
+++ b/debug/fread_u_chk.c
@@ -39,7 +39,7 @@ __fread_unlocked_chk (void *__restrict ptr, size_t ptrlen,
__chk_fail ();
}
- if (__builtin_expect (bytes_requested > ptrlen, 0))
+ if (__glibc_unlikely (bytes_requested > ptrlen))
__chk_fail ();
CHECK_FILE (stream, 0);
diff --git a/debug/getgroups_chk.c b/debug/getgroups_chk.c
index ec5728e43e..e426102096 100644
--- a/debug/getgroups_chk.c
+++ b/debug/getgroups_chk.c
@@ -22,13 +22,13 @@
int
__getgroups_chk (int size, __gid_t list[], size_t listlen)
{
- if (__builtin_expect (size < 0, 0))
+ if (__glibc_unlikely (size < 0))
{
__set_errno (EINVAL);
return -1;
}
- if (__builtin_expect (size * sizeof (__gid_t) > listlen, 0))
+ if (__glibc_unlikely (size * sizeof (__gid_t) > listlen))
__chk_fail ();
return __getgroups (size, list);
diff --git a/debug/mbsnrtowcs_chk.c b/debug/mbsnrtowcs_chk.c
index 4445f98fe8..aeb1c276a5 100644
--- a/debug/mbsnrtowcs_chk.c
+++ b/debug/mbsnrtowcs_chk.c
@@ -23,7 +23,7 @@ size_t
__mbsnrtowcs_chk (wchar_t *dst, const char **src, size_t nmc, size_t len,
mbstate_t *ps, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return __mbsnrtowcs (dst, src, nmc, len, ps);
diff --git a/debug/mbsrtowcs_chk.c b/debug/mbsrtowcs_chk.c
index 32ff7b2443..a5459b94cf 100644
--- a/debug/mbsrtowcs_chk.c
+++ b/debug/mbsrtowcs_chk.c
@@ -23,7 +23,7 @@ size_t
__mbsrtowcs_chk (wchar_t *dst, const char **src, size_t len,
mbstate_t *ps, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return __mbsrtowcs (dst, src, len, ps);
diff --git a/debug/mbstowcs_chk.c b/debug/mbstowcs_chk.c
index 4359e194f2..d624a79c56 100644
--- a/debug/mbstowcs_chk.c
+++ b/debug/mbstowcs_chk.c
@@ -23,7 +23,7 @@
size_t
__mbstowcs_chk (wchar_t *dst, const char *src, size_t len, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
mbstate_t state;
diff --git a/debug/memcpy_chk.c b/debug/memcpy_chk.c
index ab5adab6be..9bf5d9f6c0 100644
--- a/debug/memcpy_chk.c
+++ b/debug/memcpy_chk.c
@@ -29,7 +29,7 @@ __memcpy_chk (dstpp, srcpp, len, dstlen)
size_t len;
size_t dstlen;
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return memcpy (dstpp, srcpp, len);
diff --git a/debug/memmove_chk.c b/debug/memmove_chk.c
index aa0287384b..f8c4454462 100644
--- a/debug/memmove_chk.c
+++ b/debug/memmove_chk.c
@@ -33,7 +33,7 @@ MEMMOVE_CHK (dest, src, len, destlen)
size_t len;
size_t destlen;
{
- if (__builtin_expect (destlen < len, 0))
+ if (__glibc_unlikely (destlen < len))
__chk_fail ();
return memmove (dest, src, len);
diff --git a/debug/mempcpy_chk.c b/debug/mempcpy_chk.c
index 87db7e1e10..105356f978 100644
--- a/debug/mempcpy_chk.c
+++ b/debug/mempcpy_chk.c
@@ -30,7 +30,7 @@ __mempcpy_chk (dstpp, srcpp, len, dstlen)
size_t len;
size_t dstlen;
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return __mempcpy (dstpp, srcpp, len);
diff --git a/debug/memset_chk.c b/debug/memset_chk.c
index b48f740fb5..28e7faed5e 100644
--- a/debug/memset_chk.c
+++ b/debug/memset_chk.c
@@ -25,7 +25,7 @@ __memset_chk (dstpp, c, len, dstlen)
size_t len;
size_t dstlen;
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return memset (dstpp, c, len);
diff --git a/debug/stpcpy_chk.c b/debug/stpcpy_chk.c
index d7228ec91b..4516137937 100644
--- a/debug/stpcpy_chk.c
+++ b/debug/stpcpy_chk.c
@@ -34,7 +34,7 @@ __stpcpy_chk (dest, src, destlen)
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
*d++ = *s;
}
diff --git a/debug/strcat_chk.c b/debug/strcat_chk.c
index e4e91d30d7..653efb47be 100644
--- a/debug/strcat_chk.c
+++ b/debug/strcat_chk.c
@@ -33,7 +33,7 @@ __strcat_chk (dest, src, destlen)
/* Find the end of the string. */
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *s1++;
}
@@ -46,7 +46,7 @@ __strcat_chk (dest, src, destlen)
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
diff --git a/debug/strcpy_chk.c b/debug/strcpy_chk.c
index 92549ae71a..5df98a0a4a 100644
--- a/debug/strcpy_chk.c
+++ b/debug/strcpy_chk.c
@@ -56,7 +56,7 @@ __strcpy_chk (dest, src, destlen)
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *s;
*(s++ + off) = c;
diff --git a/debug/strncat_chk.c b/debug/strncat_chk.c
index 955fc830c2..ff8b33f367 100644
--- a/debug/strncat_chk.c
+++ b/debug/strncat_chk.c
@@ -33,7 +33,7 @@ __strncat_chk (s1, s2, n, s1len)
/* Find the end of S1. */
do
{
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s1++;
}
@@ -49,25 +49,25 @@ __strncat_chk (s1, s2, n, s1len)
size_t n4 = n >> 2;
do
{
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
if (c == '\0')
return s;
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
if (c == '\0')
return s;
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
if (c == '\0')
return s;
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
@@ -79,7 +79,7 @@ __strncat_chk (s1, s2, n, s1len)
while (n > 0)
{
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
@@ -90,7 +90,7 @@ __strncat_chk (s1, s2, n, s1len)
if (c != '\0')
{
- if (__builtin_expect (s1len-- == 0, 0))
+ if (__glibc_unlikely (s1len-- == 0))
__chk_fail ();
*++s1 = '\0';
}
diff --git a/debug/vsnprintf_chk.c b/debug/vsnprintf_chk.c
index f28d98ed47..25631ef1a3 100644
--- a/debug/vsnprintf_chk.c
+++ b/debug/vsnprintf_chk.c
@@ -33,7 +33,7 @@ ___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
Though, maxlen is supposed to be the size of buffer pointed
to by s, so a conforming program can't pass such maxlen
to *snprintf. */
- if (__builtin_expect (slen < maxlen, 0))
+ if (__glibc_unlikely (slen < maxlen))
__chk_fail ();
_IO_strnfile sf;
diff --git a/debug/vswprintf_chk.c b/debug/vswprintf_chk.c
index c8e6e4455b..d5262dce18 100644
--- a/debug/vswprintf_chk.c
+++ b/debug/vswprintf_chk.c
@@ -32,7 +32,7 @@ __vswprintf_chk (wchar_t *s, size_t maxlen, int flags, size_t slen,
Though, maxlen is supposed to be the size of buffer pointed
to by s, so a conforming program can't pass such maxlen
to *snprintf. */
- if (__builtin_expect (slen < maxlen, 0))
+ if (__glibc_unlikely (slen < maxlen))
__chk_fail ();
_IO_wstrnfile sf;
@@ -44,7 +44,7 @@ __vswprintf_chk (wchar_t *s, size_t maxlen, int flags, size_t slen,
/* We need to handle the special case where MAXLEN is 0. Use the
overflow buffer right from the start. */
- if (__builtin_expect (maxlen == 0, 0))
+ if (__glibc_unlikely (maxlen == 0))
/* Since we have to write at least the terminating L'\0' a buffer
length of zero always makes the function fail. */
return -1;
diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c
index 3972680e2e..aaf573cf55 100644
--- a/debug/wcpcpy_chk.c
+++ b/debug/wcpcpy_chk.c
@@ -33,7 +33,7 @@ __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = wcp[off];
*++wcp = c;
diff --git a/debug/wcpncpy_chk.c b/debug/wcpncpy_chk.c
index b552a2ece8..e03bee6ebd 100644
--- a/debug/wcpncpy_chk.c
+++ b/debug/wcpncpy_chk.c
@@ -23,7 +23,7 @@
wchar_t *
__wcpncpy_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
{
- if (__builtin_expect (destlen < n, 0))
+ if (__glibc_unlikely (destlen < n))
__chk_fail ();
/* This function is not often enough used to justify not using a
diff --git a/debug/wcscat_chk.c b/debug/wcscat_chk.c
index 2ee577ce16..1ad8c746bd 100644
--- a/debug/wcscat_chk.c
+++ b/debug/wcscat_chk.c
@@ -30,7 +30,7 @@ __wcscat_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
/* Find the end of the string. */
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *s1++;
}
@@ -43,7 +43,7 @@ __wcscat_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *s2++;
*++s1 = c;
diff --git a/debug/wcscpy_chk.c b/debug/wcscpy_chk.c
index c64a9f67d2..3164e401cb 100644
--- a/debug/wcscpy_chk.c
+++ b/debug/wcscpy_chk.c
@@ -35,7 +35,7 @@ __wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)
do
{
- if (__builtin_expect (n-- == 0, 0))
+ if (__glibc_unlikely (n-- == 0))
__chk_fail ();
c = *wcp++;
wcp[off] = c;
@@ -48,7 +48,7 @@ __wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)
do
{
- if (__builtin_expect (n-- == 0, 0))
+ if (__glibc_unlikely (n-- == 0))
__chk_fail ();
c = *src++;
*wcp++ = c;
diff --git a/debug/wcsncat_chk.c b/debug/wcsncat_chk.c
index 0de4e11d63..ec990248fb 100644
--- a/debug/wcsncat_chk.c
+++ b/debug/wcsncat_chk.c
@@ -29,7 +29,7 @@ __wcsncat_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
/* Find the end of DEST. */
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *dest++;
}
@@ -45,25 +45,25 @@ __wcsncat_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
size_t n4 = n >> 2;
do
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *src++;
*++dest = c;
if (c == L'\0')
return s;
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *src++;
*++dest = c;
if (c == L'\0')
return s;
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *src++;
*++dest = c;
if (c == L'\0')
return s;
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *src++;
*++dest = c;
@@ -75,7 +75,7 @@ __wcsncat_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
while (n > 0)
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
c = *src++;
*++dest = c;
@@ -86,7 +86,7 @@ __wcsncat_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
if (c != L'\0')
{
- if (__builtin_expect (destlen-- == 0, 0))
+ if (__glibc_unlikely (destlen-- == 0))
__chk_fail ();
*++dest = L'\0';
}
diff --git a/debug/wcsncpy_chk.c b/debug/wcsncpy_chk.c
index abecabf0da..3eac236a4f 100644
--- a/debug/wcsncpy_chk.c
+++ b/debug/wcsncpy_chk.c
@@ -23,7 +23,7 @@
wchar_t *
__wcsncpy_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
{
- if (__builtin_expect (destlen < n, 0))
+ if (__glibc_unlikely (destlen < n))
__chk_fail ();
/* This function is not often enough used to justify not using a
diff --git a/debug/wcsnrtombs_chk.c b/debug/wcsnrtombs_chk.c
index 122cd4b7f8..f8bde89da6 100644
--- a/debug/wcsnrtombs_chk.c
+++ b/debug/wcsnrtombs_chk.c
@@ -23,7 +23,7 @@ size_t
__wcsnrtombs_chk (char *dst, const wchar_t **src, size_t nwc, size_t len,
mbstate_t *ps, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return __wcsnrtombs (dst, src, nwc, len, ps);
diff --git a/debug/wcsrtombs_chk.c b/debug/wcsrtombs_chk.c
index 48ae91df41..9d8ea5d8c2 100644
--- a/debug/wcsrtombs_chk.c
+++ b/debug/wcsrtombs_chk.c
@@ -23,7 +23,7 @@ size_t
__wcsrtombs_chk (char *dst, const wchar_t **src, size_t len,
mbstate_t *ps, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
return __wcsrtombs (dst, src, len, ps);
diff --git a/debug/wcstombs_chk.c b/debug/wcstombs_chk.c
index f704cdc3ef..cb7ed9a5ff 100644
--- a/debug/wcstombs_chk.c
+++ b/debug/wcstombs_chk.c
@@ -23,7 +23,7 @@
size_t
__wcstombs_chk (char *dst, const wchar_t *src, size_t len, size_t dstlen)
{
- if (__builtin_expect (dstlen < len, 0))
+ if (__glibc_unlikely (dstlen < len))
__chk_fail ();
mbstate_t state;
diff --git a/debug/wmemcpy_chk.c b/debug/wmemcpy_chk.c
index daeb44e037..40c7d0b02a 100644
--- a/debug/wmemcpy_chk.c
+++ b/debug/wmemcpy_chk.c
@@ -23,7 +23,7 @@
wchar_t *
__wmemcpy_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
{
- if (__builtin_expect (ns1 < n, 0))
+ if (__glibc_unlikely (ns1 < n))
__chk_fail ();
return (wchar_t *) memcpy ((char *) s1, (char *) s2, n * sizeof (wchar_t));
}
diff --git a/debug/wmemmove_chk.c b/debug/wmemmove_chk.c
index 59462cda3b..c82b4d0d23 100644
--- a/debug/wmemmove_chk.c
+++ b/debug/wmemmove_chk.c
@@ -23,7 +23,7 @@
wchar_t *
__wmemmove_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
{
- if (__builtin_expect (ns1 < n, 0))
+ if (__glibc_unlikely (ns1 < n))
__chk_fail ();
return (wchar_t *) memmove ((char *) s1, (char *) s2, n * sizeof (wchar_t));
}
diff --git a/debug/wmempcpy_chk.c b/debug/wmempcpy_chk.c
index 10be83c68c..cb62ab9478 100644
--- a/debug/wmempcpy_chk.c
+++ b/debug/wmempcpy_chk.c
@@ -23,7 +23,7 @@
wchar_t *
__wmempcpy_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
{
- if (__builtin_expect (ns1 < n, 0))
+ if (__glibc_unlikely (ns1 < n))
__chk_fail ();
return (wchar_t *) __mempcpy ((char *) s1, (char *) s2,
n * sizeof (wchar_t));
diff --git a/debug/wmemset_chk.c b/debug/wmemset_chk.c
index 4caabbe420..025b3c14d2 100644
--- a/debug/wmemset_chk.c
+++ b/debug/wmemset_chk.c
@@ -22,7 +22,7 @@
wchar_t *
__wmemset_chk (wchar_t *s, wchar_t c, size_t n, size_t dstlen)
{
- if (__builtin_expect (dstlen < n, 0))
+ if (__glibc_unlikely (dstlen < n))
__chk_fail ();
return wmemset (s, c, n);
diff --git a/dirent/scandirat.c b/dirent/scandirat.c
index 1076f28d26..01fc046864 100644
--- a/dirent/scandirat.c
+++ b/dirent/scandirat.c
@@ -98,7 +98,7 @@ SCANDIRAT (dfd, dir, namelist, select, cmp)
/* Ignore errors from select or readdir */
__set_errno (0);
- if (__builtin_expect (c.cnt == vsize, 0))
+ if (__glibc_unlikely (c.cnt == vsize))
{
DIRENT_TYPE **new;
if (vsize == 0)
diff --git a/dlfcn/dladdr.c b/dlfcn/dladdr.c
index 2b93cec210..922ca44dae 100644
--- a/dlfcn/dladdr.c
+++ b/dlfcn/dladdr.c
@@ -32,7 +32,7 @@ int
__dladdr (const void *address, Dl_info *info)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dladdr (address, info);
# endif
return _dl_addr (address, info, NULL, NULL);
diff --git a/dlfcn/dladdr1.c b/dlfcn/dladdr1.c
index a8f10beed3..0efc0dcd3d 100644
--- a/dlfcn/dladdr1.c
+++ b/dlfcn/dladdr1.c
@@ -32,7 +32,7 @@ int
__dladdr1 (const void *address, Dl_info *info, void **extra, int flags)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dladdr1 (address, info, extra, flags);
# endif
diff --git a/dlfcn/dlclose.c b/dlfcn/dlclose.c
index 8b5decc46c..ca55b5f293 100644
--- a/dlfcn/dlclose.c
+++ b/dlfcn/dlclose.c
@@ -39,7 +39,7 @@ int
__dlclose (void *handle)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlclose (handle);
# endif
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index d9bbecf495..6dd47a7eaf 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -63,7 +63,7 @@ __dlerror (void)
struct dl_action_result *result;
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlerror ();
# endif
diff --git a/dlfcn/dlinfo.c b/dlfcn/dlinfo.c
index f2527fee72..1876d9dfe7 100644
--- a/dlfcn/dlinfo.c
+++ b/dlfcn/dlinfo.c
@@ -111,7 +111,7 @@ int
__dlinfo (void *handle, int request, void *arg DL_CALLER_DECL)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlinfo (handle, request, arg,
DL_CALLER);
# endif
diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c
index 1e2cbcfdb4..115f6e9e28 100644
--- a/dlfcn/dlmopen.c
+++ b/dlfcn/dlmopen.c
@@ -64,7 +64,7 @@ dlmopen_doit (void *a)
/* It makes no sense to use RTLD_GLOBAL when loading a DSO into
a namespace other than the base namespace. */
- if (__builtin_expect (args->mode & RTLD_GLOBAL, 0))
+ if (__glibc_unlikely (args->mode & RTLD_GLOBAL))
GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid mode"));
}
@@ -79,7 +79,7 @@ void *
__dlmopen (Lmid_t nsid, const char *file, int mode DL_CALLER_DECL)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
# endif
diff --git a/dlfcn/dlopen.c b/dlfcn/dlopen.c
index 2db6610a77..fa58c4cebf 100644
--- a/dlfcn/dlopen.c
+++ b/dlfcn/dlopen.c
@@ -74,7 +74,7 @@ void *
__dlopen (const char *file, int mode DL_CALLER_DECL)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlopen (file, mode, DL_CALLER);
# endif
diff --git a/dlfcn/dlopenold.c b/dlfcn/dlopenold.c
index 6d3a430cf6..67fac16d1d 100644
--- a/dlfcn/dlopenold.c
+++ b/dlfcn/dlopenold.c
@@ -70,7 +70,7 @@ __dlopen_nocheck (const char *file, int mode)
mode |= RTLD_LAZY;
args.mode = mode;
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlopen (file, mode, RETURN_ADDRESS (0));
return _dlerror_run (dlopen_doit, &args) ? NULL : args.new;
diff --git a/dlfcn/dlsym.c b/dlfcn/dlsym.c
index a1e2e01775..7bcc78d50e 100644
--- a/dlfcn/dlsym.c
+++ b/dlfcn/dlsym.c
@@ -55,7 +55,7 @@ void *
__dlsym (void *handle, const char *name DL_CALLER_DECL)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlsym (handle, name, DL_CALLER);
# endif
diff --git a/dlfcn/dlvsym.c b/dlfcn/dlvsym.c
index 5d05d97963..d7a766b283 100644
--- a/dlfcn/dlvsym.c
+++ b/dlfcn/dlvsym.c
@@ -58,7 +58,7 @@ __dlvsym (void *handle, const char *name, const char *version_str
DL_CALLER_DECL)
{
# ifdef SHARED
- if (__builtin_expect (_dlfcn_hook != NULL, 0))
+ if (__glibc_unlikely (_dlfcn_hook != NULL))
return _dlfcn_hook->dlvsym (handle, name, version_str, DL_CALLER);
# endif
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index d36623f09e..91fef9578e 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -65,7 +65,7 @@ do \
\
/* Actually compare the entry with the key. */ \
cmpres = _dl_cache_libcmp (name, cache_data + key); \
- if (__builtin_expect (cmpres == 0, 0)) \
+ if (__glibc_unlikely (cmpres == 0)) \
{ \
/* Found it. LEFT now marks the last entry for which we \
know the name is correct. */ \
@@ -187,7 +187,7 @@ _dl_load_cache_lookup (const char *name)
const char *best;
/* Print a message if the loading of libs is traced. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
if (cache == NULL)
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 5bf1de7d28..f36ea0f779 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -73,7 +73,7 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
/* The entry might still be in its unused state if we are closing an
object that wasn't fully set up. */
- if (__builtin_expect (old_map != NULL, 1))
+ if (__glibc_likely (old_map != NULL))
{
assert (old_map->l_tls_modid == idx);
@@ -123,7 +123,7 @@ _dl_close_worker (struct link_map *map)
dl_close_state = rerun;
/* There are still references to this object. Do nothing more. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
map->l_name, map->l_direct_opencount);
@@ -280,7 +280,7 @@ _dl_close_worker (struct link_map *map)
#ifdef SHARED
/* Auditing checkpoint: we remove an object. */
- if (__builtin_expect (do_audit, 0))
+ if (__glibc_unlikely (do_audit))
{
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
@@ -452,7 +452,7 @@ _dl_close_worker (struct link_map *map)
#ifdef SHARED
/* Auditing checkpoint: we will start deleting objects. */
- if (__builtin_expect (do_audit, 0))
+ if (__glibc_unlikely (do_audit))
{
struct link_map *head = ns->_ns_loaded;
struct audit_ifaces *afct = GLRO(dl_audit);
@@ -536,7 +536,7 @@ _dl_close_worker (struct link_map *map)
object. We can unmap it. */
/* Remove the object from the dtv slotinfo array if it uses TLS. */
- if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
+ if (__glibc_unlikely (imap->l_tls_blocksize > 0))
{
any_tls = true;
@@ -662,7 +662,7 @@ _dl_close_worker (struct link_map *map)
free (imap->l_reldeps);
/* Print debugging message. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
imap->l_name, imap->l_ns);
@@ -704,7 +704,7 @@ _dl_close_worker (struct link_map *map)
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls)
{
- if (__builtin_expect (++GL(dl_tls_generation) == 0, 0))
+ if (__glibc_unlikely (++GL(dl_tls_generation) == 0))
_dl_fatal_printf ("TLS generation counter wrapped! Please report as described in "REPORT_BUGS_TO".\n");
if (tls_free_end == GL(dl_tls_static_used))
@@ -713,7 +713,7 @@ _dl_close_worker (struct link_map *map)
#ifdef SHARED
/* Auditing checkpoint: we have deleted all objects. */
- if (__builtin_expect (do_audit, 0))
+ if (__glibc_unlikely (do_audit))
{
struct link_map *head = ns->_ns_loaded;
/* Do not call the functions for any auditing object. */
@@ -757,7 +757,7 @@ _dl_close (void *_map)
struct link_map *map = _map;
/* First see whether we can remove the object at all. */
- if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0))
+ if (__glibc_unlikely (map->l_flags_1 & DF_1_NODELETE))
{
assert (map->l_init_called);
/* Nope. Do nothing. */
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
index 8034077567..d0f25e3436 100644
--- a/elf/dl-conflict.c
+++ b/elf/dl-conflict.c
@@ -32,7 +32,7 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
ElfW(Rela) *conflictend)
{
#if ! ELF_MACHINE_NO_RELA
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
_dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
{
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 20c294e5b8..9c83c81779 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -127,7 +127,7 @@ empty dynamic string token substitution")); \
else \
{ \
/* This is for DT_AUXILIARY. */ \
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))\
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
_dl_debug_printf (N_("\
cannot load auxiliary `%s' because of empty dynamic string token " \
"substitution\n"), __str); \
@@ -253,7 +253,7 @@ _dl_map_object_deps (struct link_map *map,
bool malloced;
int err = _dl_catch_error (&objname, &errstring, &malloced,
openaux, &args);
- if (__builtin_expect (errstring != NULL, 0))
+ if (__glibc_unlikely (errstring != NULL))
{
char *new_errstring = strdupa (errstring);
objname = strdupa (objname);
@@ -317,7 +317,7 @@ _dl_map_object_deps (struct link_map *map,
bool malloced;
(void) _dl_catch_error (&objname, &errstring, &malloced,
openaux, &args);
- if (__builtin_expect (errstring != NULL, 0))
+ if (__glibc_unlikely (errstring != NULL))
{
/* We are not interested in the error message. */
assert (errstring != NULL);
@@ -342,7 +342,7 @@ _dl_map_object_deps (struct link_map *map,
bool malloced;
int err = _dl_catch_error (&objname, &errstring, &malloced,
openaux, &args);
- if (__builtin_expect (errstring != NULL, 0))
+ if (__glibc_unlikely (errstring != NULL))
{
char *new_errstring = strdupa (errstring);
objname = strdupa (objname);
@@ -622,7 +622,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
itself will always be initialize last. */
memcpy (l_initfini, map->l_searchlist.r_list,
nlist * sizeof (struct link_map *));
- if (__builtin_expect (nlist > 1, 1))
+ if (__glibc_likely (nlist > 1))
{
/* We can skip looking for the binary itself which is at the front
of the search list. */
@@ -645,7 +645,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
if (runp != NULL)
/* Look through the dependencies of the object. */
while (*runp != NULL)
- if (__builtin_expect (*runp++ == thisp, 0))
+ if (__glibc_unlikely (*runp++ == thisp))
{
/* Move the current object to the back past the last
object with it as the dependency. */
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index a00e921583..cbc59d42dd 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -25,7 +25,7 @@
size_t __cnt = 0; \
const char *__sf = strchr (name, '$'); \
\
- if (__builtin_expect (__sf != NULL, 0)) \
+ if (__glibc_unlikely (__sf != NULL)) \
__cnt = _dl_dst_count (__sf, is_path); \
\
__cnt; })
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 05bbd68aee..c35577565e 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -60,7 +60,7 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
if (runp != NULL)
/* Look through the dependencies of the object. */
while (*runp != NULL)
- if (__builtin_expect (*runp++ == thisp, 0))
+ if (__glibc_unlikely (*runp++ == thisp))
{
move:
/* Move the current object to the back past the last
@@ -90,21 +90,21 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
goto next;
}
- if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
+ if (__glibc_unlikely (maps[k]->l_reldeps != NULL))
{
unsigned int m = maps[k]->l_reldeps->act;
struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
/* Look through the relocation dependencies of the object. */
while (m-- > 0)
- if (__builtin_expect (relmaps[m] == thisp, 0))
+ if (__glibc_unlikely (relmaps[m] == thisp))
{
/* If a cycle exists with a link time dependency,
preserve the latter. */
struct link_map **runp = thisp->l_initfini;
if (runp != NULL)
while (*runp != NULL)
- if (__builtin_expect (*runp++ == maps[k], 0))
+ if (__glibc_unlikely (*runp++ == maps[k]))
goto ignore;
goto move;
}
@@ -286,7 +286,7 @@ _dl_fini (void)
goto again;
}
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
_dl_debug_printf ("\nruntime linker statistics:\n"
" final number of relocations: %lu\n"
"final number of relocations from cache: %lu\n",
diff --git a/elf/dl-fptr.c b/elf/dl-fptr.c
index 8088db3d4f..40cb40a3f1 100644
--- a/elf/dl-fptr.c
+++ b/elf/dl-fptr.c
@@ -209,7 +209,7 @@ _dl_make_fptr (struct link_map *map, const ElfW(Sym) *sym,
Elf_Symndx symidx;
struct local *l;
- if (__builtin_expect (ftab == NULL, 0))
+ if (__glibc_unlikely (ftab == NULL))
ftab = make_fptr_table (map);
symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
index 86d9e9cd6d..e7c60f2fbf 100644
--- a/elf/dl-hwcaps.c
+++ b/elf/dl-hwcaps.c
@@ -133,7 +133,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
len = strlen (p);
/* Skip entries that are not enabled in the mask word. */
- if (__builtin_expect (mask & ((ElfW(Word)) 1 << bit), 1))
+ if (__glibc_likely (mask & ((ElfW(Word)) 1 << bit)))
{
temp[m].str = p;
temp[m].len = len;
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 28a6ff6d8a..598df3b4aa 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -52,7 +52,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
return;
/* Print a debug message if wanted. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
_dl_debug_printf ("\ncalling init: %s\n\n",
DSO_FILENAME (l->l_name));
@@ -88,7 +88,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
ElfW(Dyn) *preinit_array_size = main_map->l_info[DT_PREINIT_ARRAYSZ];
unsigned int i;
- if (__builtin_expect (GL(dl_initfirst) != NULL, 0))
+ if (__glibc_unlikely (GL(dl_initfirst) != NULL))
{
call_init (GL(dl_initfirst), argc, argv, env);
GL(dl_initfirst) = NULL;
@@ -102,7 +102,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
ElfW(Addr) *addrs;
unsigned int cnt;
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
_dl_debug_printf ("\ncalling preinit: %s\n\n",
DSO_FILENAME (main_map->l_name));
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index ceac3caeb2..6d1e9819dc 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -158,7 +158,7 @@ __libc_dlopen_mode (const char *name, int mode)
args.caller_dlopen = RETURN_ADDRESS (0);
#ifdef SHARED
- if (__builtin_expect (_dl_open_hook != NULL, 0))
+ if (__glibc_unlikely (_dl_open_hook != NULL))
return _dl_open_hook->dlopen_mode (name, mode);
return (dlerror_run (do_dlopen, &args) ? NULL : (void *) args.map);
#else
@@ -204,7 +204,7 @@ __libc_dlsym (void *map, const char *name)
args.name = name;
#ifdef SHARED
- if (__builtin_expect (_dl_open_hook != NULL, 0))
+ if (__glibc_unlikely (_dl_open_hook != NULL))
return _dl_open_hook->dlsym (map, name);
#endif
return (dlerror_run (do_dlsym, &args) ? NULL
@@ -216,7 +216,7 @@ int
__libc_dlclose (void *map)
{
#ifdef SHARED
- if (__builtin_expect (_dl_open_hook != NULL, 0))
+ if (__glibc_unlikely (_dl_open_hook != NULL))
return _dl_open_hook->dlclose (map);
#endif
return dlerror_run (do_dlclose, map);
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1be7a3ca96..6501ff2dca 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -333,7 +333,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
do
{
- if (__builtin_expect (*name == '$', 0))
+ if (__glibc_unlikely (*name == '$'))
{
const char *repl = NULL;
size_t len;
@@ -565,7 +565,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
dirp->status[cnt] = init_val;
dirp->what = what;
- if (__builtin_expect (where != NULL, 1))
+ if (__glibc_likely (where != NULL))
dirp->where = memcpy ((char *) dirp + sizeof (*dirp) + len + 1
+ (ncapstr * sizeof (enum r_dir_status)),
where, where_len);
@@ -836,7 +836,7 @@ _dl_init_paths (const char *llp)
#ifdef SHARED
/* Expand DSTs. */
size_t cnt = DL_DST_COUNT (llp, 1);
- if (__builtin_expect (cnt == 0, 1))
+ if (__glibc_likely (cnt == 0))
llp_tmp = strdupa (llp);
else
{
@@ -935,7 +935,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
bool make_consistent = false;
/* Get file information. */
- if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st) < 0, 0))
+ if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &st) < 0))
{
errstring = N_("cannot stat shared object");
call_lose_errno:
@@ -999,7 +999,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
}
/* Print debugging message. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
/* This is the ELF header. We read it in `open_verify'. */
@@ -1057,7 +1057,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* Enter the new object in the list of loaded objects. */
l = _dl_new_object (realname, name, l_type, loader, mode, nsid);
- if (__builtin_expect (l == NULL, 0))
+ if (__glibc_unlikely (l == NULL))
{
#ifdef SHARED
fail_new:
@@ -1226,7 +1226,7 @@ cannot allocate TLS data structures for initial thread");
/* Now we install the TCB in the thread register. */
errstring = TLS_INIT_TP (tcb, 0);
- if (__builtin_expect (errstring == NULL, 1))
+ if (__glibc_likely (errstring == NULL))
{
/* Now we are all good. */
l->l_tls_modid = ++GL(dl_tls_max_dtv_idx);
@@ -1256,7 +1256,7 @@ cannot allocate TLS data structures for initial thread");
break;
}
- if (__builtin_expect (nloadcmds == 0, 0))
+ if (__glibc_unlikely (nloadcmds == 0))
{
/* This only happens for a bogus object that will be caught with
another error below. But we don't want to go through the
@@ -1294,7 +1294,7 @@ cannot allocate TLS data structures for initial thread");
c->prot,
MAP_COPY|MAP_FILE,
fd, c->mapoff);
- if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
+ if (__glibc_unlikely ((void *) l->l_map_start == MAP_FAILED))
{
map_error:
errstring = N_("failed to map segment from shared object");
@@ -1321,7 +1321,7 @@ cannot allocate TLS data structures for initial thread");
/* This object is loaded at a fixed address. This must never
happen for objects loaded with dlopen(). */
- if (__builtin_expect ((mode & __RTLD_OPENEXEC) == 0, 0))
+ if (__glibc_unlikely ((mode & __RTLD_OPENEXEC) == 0))
{
errstring = N_("cannot dynamically load executable");
goto call_lose;
@@ -1379,7 +1379,7 @@ cannot allocate TLS data structures for initial thread");
if (zeropage > zero)
{
/* Zero the final part of the last page of the segment. */
- if (__builtin_expect ((c->prot & PROT_WRITE) == 0, 0))
+ if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0))
{
/* Dag nab it. */
if (__mprotect ((caddr_t) (zero
@@ -1391,7 +1391,7 @@ cannot allocate TLS data structures for initial thread");
}
}
memset ((void *) zero, '\0', zeropage - zero);
- if (__builtin_expect ((c->prot & PROT_WRITE) == 0, 0))
+ if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0))
__mprotect ((caddr_t) (zero & ~(GLRO(dl_pagesize) - 1)),
GLRO(dl_pagesize), c->prot);
}
@@ -1403,7 +1403,7 @@ cannot allocate TLS data structures for initial thread");
mapat = __mmap ((caddr_t) zeropage, zeroend - zeropage,
c->prot, MAP_ANON|MAP_PRIVATE|MAP_FIXED,
-1, 0);
- if (__builtin_expect (mapat == MAP_FAILED, 0))
+ if (__glibc_unlikely (mapat == MAP_FAILED))
{
errstring = N_("cannot map zero-fill pages");
goto call_lose_errno;
@@ -1417,7 +1417,7 @@ cannot allocate TLS data structures for initial thread");
if (l->l_ld == 0)
{
- if (__builtin_expect (type == ET_DYN, 0))
+ if (__glibc_unlikely (type == ET_DYN))
{
errstring = N_("object file has no dynamic section");
goto call_lose;
@@ -1467,7 +1467,7 @@ cannot allocate TLS data structures for initial thread");
/* Adjust the PT_PHDR value by the runtime load address. */
l->l_phdr = (ElfW(Phdr) *) ((ElfW(Addr)) l->l_phdr + l->l_addr);
- if (__builtin_expect ((stack_flags &~ GL(dl_stack_flags)) & PF_X, 0))
+ if (__glibc_unlikely ((stack_flags &~ GL(dl_stack_flags)) & PF_X))
{
if (__builtin_expect (__check_caller (RETURN_ADDRESS (0), allow_ldso),
0) != 0)
@@ -1490,7 +1490,7 @@ cannot allocate TLS data structures for initial thread");
const uintptr_t relro_end = ((m->l_addr + m->l_relro_addr
+ m->l_relro_size)
& -GLRO(dl_pagesize));
- if (__builtin_expect (p + s <= relro_end, 1))
+ if (__glibc_likely (p + s <= relro_end))
{
/* The variable lies in the region protected by RELRO. */
if (__mprotect ((void *) p, s, PROT_READ|PROT_WRITE) < 0)
@@ -1526,7 +1526,7 @@ cannot enable executable stack as shared object requires");
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
/* We are done mapping in the file. We no longer need the descriptor. */
- if (__builtin_expect (__close (fd) != 0, 0))
+ if (__glibc_unlikely (__close (fd) != 0))
{
errstring = N_("cannot close file descriptor");
goto call_lose_errno;
@@ -1539,7 +1539,7 @@ cannot enable executable stack as shared object requires");
l->l_entry += l->l_addr;
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("\
dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
@@ -1754,7 +1754,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
ehdr = (ElfW(Ehdr) *) fbp->buf;
/* Now run the tests. */
- if (__builtin_expect (fbp->len < (ssize_t) sizeof (ElfW(Ehdr)), 0))
+ if (__glibc_unlikely (fbp->len < (ssize_t) sizeof (ElfW(Ehdr))))
{
errval = errno;
errstring = (errval == 0
@@ -1939,7 +1939,7 @@ open_path (const char *name, size_t namelen, int secure,
const char *current_what = NULL;
int any = 0;
- if (__builtin_expect (dirs == NULL, 0))
+ if (__glibc_unlikely (dirs == NULL))
/* We're called before _dl_init_paths when loading the main executable
given on the command line when rtld is run directly. */
return -1;
@@ -1977,7 +1977,7 @@ open_path (const char *name, size_t namelen, int secure,
- buf);
/* Print name we try if this is wanted. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf (" trying file=%s\n", buf);
fd = open_verify (buf, fbp, loader, whatcode, found_other_class,
@@ -2059,7 +2059,7 @@ open_path (const char *name, size_t namelen, int secure,
while (*++dirs != NULL);
/* Remove the whole path if none of the directories exists. */
- if (__builtin_expect (! any, 0))
+ if (__glibc_unlikely (! any))
{
/* Paths which were allocated using the minimal malloc() in ld.so
must not be freed using the general free() in libc. */
@@ -2165,7 +2165,7 @@ _dl_map_object (struct link_map *loader, const char *name,
size_t namelen = strlen (name) + 1;
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
fd = -1;
@@ -2268,7 +2268,7 @@ _dl_map_object (struct link_map *loader, const char *name,
fd = open_verify (cached,
&fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
LA_SER_CONFIG, &found_other_class, false);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
realname = local_strdup (cached);
if (realname == NULL)
@@ -2291,7 +2291,7 @@ _dl_map_object (struct link_map *loader, const char *name,
&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
/* Add another newline when we are tracing the library loading. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
}
else
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index a58e5bc72a..690f4046c5 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -110,7 +110,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
continue;
/* Print some debugging info if wanted. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
_dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
undef_name, DSO_FILENAME (map->l_name),
map->l_ns);
@@ -143,7 +143,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
#define ALLOWED_STT \
((1 << STT_NOTYPE) | (1 << STT_OBJECT) | (1 << STT_FUNC) \
| (1 << STT_COMMON) | (1 << STT_TLS) | (1 << STT_GNU_IFUNC))
- if (__builtin_expect (((1 << stt) & ALLOWED_STT) == 0, 0))
+ if (__glibc_unlikely (((1 << stt) & ALLOWED_STT) == 0))
return NULL;
if (sym != ref && strcmp (strtab + sym->st_name, undef_name))
@@ -153,7 +153,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
const ElfW(Half) *verstab = map->l_versyms;
if (version != NULL)
{
- if (__builtin_expect (verstab == NULL, 0))
+ if (__glibc_unlikely (verstab == NULL))
{
/* We need a versioned symbol but haven't found any. If
this is the object which is referenced in the verneed
@@ -223,7 +223,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
const ElfW(Sym) *sym;
const ElfW(Addr) *bitmask = map->l_gnu_bitmask;
- if (__builtin_expect (bitmask != NULL, 1))
+ if (__glibc_likely (bitmask != NULL))
{
ElfW(Addr) bitmask_word
= bitmask[(new_hash / __ELF_NATIVE_CLASS)
@@ -287,7 +287,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
{
case STB_WEAK:
/* Weak definition. Use this value if we don't find another. */
- if (__builtin_expect (GLRO(dl_dynamic_weak), 0))
+ if (__glibc_unlikely (GLRO(dl_dynamic_weak)))
{
if (! result->s)
{
@@ -412,7 +412,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
LD_TRACE_PRELINKING in _dl_debug_bindings. Don't
allocate anything and don't enter anything into the
hash table. */
- if (__builtin_expect (tab->size, 0))
+ if (__glibc_unlikely (tab->size))
{
assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
__rtld_lock_unlock_recursive (tab->lock);
@@ -530,7 +530,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
unsigned long long serial = map->l_serial;
/* Make sure nobody can unload the object while we are at it. */
- if (__builtin_expect (flags & DL_LOOKUP_GSCOPE_LOCK, 0))
+ if (__glibc_unlikely (flags & DL_LOOKUP_GSCOPE_LOCK))
{
/* We can't just call __rtld_lock_lock_recursive (GL(dl_load_lock))
here, that can result in ABBA deadlock. */
@@ -617,7 +617,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
}
/* Add the reference now. */
- if (__builtin_expect (l_reldepsact >= undef_map->l_reldepsmax, 0))
+ if (__glibc_unlikely (l_reldepsact >= undef_map->l_reldepsmax))
{
/* Allocate more memory for the dependency list. Since this
can never happen during the startup phase we can use
@@ -663,7 +663,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
}
/* Display information if we are debugging. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("\
\nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
DSO_FILENAME (map->l_name),
@@ -679,7 +679,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
/* Release the lock. */
__rtld_lock_unlock_recursive (GL(dl_load_lock));
- if (__builtin_expect (flags & DL_LOOKUP_GSCOPE_LOCK, 0))
+ if (__glibc_unlikely (flags & DL_LOOKUP_GSCOPE_LOCK))
THREAD_GSCOPE_SET_FLAG ();
return result;
@@ -726,7 +726,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
== 0);
size_t i = 0;
- if (__builtin_expect (skip_map != NULL, 0))
+ if (__glibc_unlikely (skip_map != NULL))
/* Search the relevant loaded objects for a definition. */
while ((*scope)->r_list[i] != skip_map)
++i;
@@ -763,7 +763,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
}
}
- if (__builtin_expect (current_value.s == NULL, 0))
+ if (__glibc_unlikely (current_value.s == NULL))
{
if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
&& skip_map == NULL
@@ -787,7 +787,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
int protected = (*ref
&& ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED);
- if (__builtin_expect (protected != 0, 0))
+ if (__glibc_unlikely (protected != 0))
{
/* It is very tricky. We need to figure out what value to
return for the protected symbol. */
@@ -835,7 +835,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
version, type_class, flags, skip_map);
/* The object is used. */
- if (__builtin_expect (current_value.m->l_used == 0, 0))
+ if (__glibc_unlikely (current_value.m->l_used == 0))
current_value.m->l_used = 1;
if (__builtin_expect (GLRO(dl_debug_mask)
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index 22d0b3c8af..20a672ae41 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -68,7 +68,7 @@ __libc_memalign (size_t align, size_t n)
/* Insufficient space left; allocate another page. */
caddr_t page;
size_t nup = (n + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
- if (__builtin_expect (nup == 0, 0))
+ if (__glibc_unlikely (nup == 0))
{
if (n)
return NULL;
diff --git a/elf/dl-open.c b/elf/dl-open.c
index a9ca6b3b44..7cc4cc16e1 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -147,7 +147,7 @@ add_to_global (struct link_map *new)
ns->_ns_main_searchlist->r_list[new_nlist++] = map;
/* We modify the global scope. Report this. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
_dl_debug_printf ("\nadd %s [%lu] to global scope\n",
map->l_name, map->l_ns);
}
@@ -232,7 +232,7 @@ dl_open_worker (void *a)
return;
}
- if (__builtin_expect (mode & __RTLD_SPROF, 0))
+ if (__glibc_unlikely (mode & __RTLD_SPROF))
/* This happens only if we load a DSO for 'sprof'. */
return;
@@ -240,10 +240,10 @@ dl_open_worker (void *a)
++new->l_direct_opencount;
/* It was already open. */
- if (__builtin_expect (new->l_searchlist.r_list != NULL, 0))
+ if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
{
/* Let the user know about the opencount. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
new->l_name, new->l_ns, new->l_direct_opencount);
@@ -269,7 +269,7 @@ dl_open_worker (void *a)
#ifdef SHARED
/* Auditing checkpoint: we have added all objects. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
struct link_map *head = GL(dl_ns)[new->l_ns]._ns_loaded;
/* Do not call the functions for any auditing object. */
@@ -294,7 +294,7 @@ dl_open_worker (void *a)
LIBC_PROBE (map_complete, 3, args->nsid, r, new);
/* Print scope information. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
_dl_show_scope (new, 0);
/* Only do lazy relocation if `LD_BIND_NOW' is not set. */
@@ -344,7 +344,7 @@ dl_open_worker (void *a)
if (runp != NULL)
/* Look through the dependencies of the object. */
while (*runp != NULL)
- if (__builtin_expect (*runp++ == thisp, 0))
+ if (__glibc_unlikely (*runp++ == thisp))
{
/* Move the current object to the back past the last
object with it as the dependency. */
@@ -391,7 +391,7 @@ dl_open_worker (void *a)
}
#ifdef SHARED
- if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
+ if (__glibc_unlikely (GLRO(dl_profile) != NULL))
{
/* If this here is the shared object which we want to profile
make sure the profile is started. We can find out whether
@@ -444,7 +444,7 @@ dl_open_worker (void *a)
/* Avoid duplicates. */
continue;
- if (__builtin_expect (cnt + 1 >= imap->l_scope_max, 0))
+ if (__glibc_unlikely (cnt + 1 >= imap->l_scope_max))
{
/* The 'r_scope' array is too small. Allocate a new one
dynamically. */
@@ -511,7 +511,7 @@ dl_open_worker (void *a)
}
/* Print scope information. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
_dl_show_scope (imap, from_scope);
}
@@ -574,7 +574,7 @@ cannot load any more object with static TLS"));
/* Mark the object as not deletable if the RTLD_NODELETE flags was
passed. */
- if (__builtin_expect (mode & RTLD_NODELETE, 0))
+ if (__glibc_unlikely (mode & RTLD_NODELETE))
new->l_flags_1 |= DF_1_NODELETE;
#ifndef SHARED
@@ -584,7 +584,7 @@ cannot load any more object with static TLS"));
#endif
/* Let the user know about the opencount. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
new->l_name, new->l_ns, new->l_direct_opencount);
}
@@ -601,14 +601,14 @@ _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid,
/* Make sure we are alone. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
- if (__builtin_expect (nsid == LM_ID_NEWLM, 0))
+ if (__glibc_unlikely (nsid == LM_ID_NEWLM))
{
/* Find a new namespace. */
for (nsid = 1; DL_NNS > 1 && nsid < GL(dl_nns); ++nsid)
if (GL(dl_ns)[nsid]._ns_loaded == NULL)
break;
- if (__builtin_expect (nsid == DL_NNS, 0))
+ if (__glibc_unlikely (nsid == DL_NNS))
{
/* No more namespace available. */
__rtld_lock_unlock_recursive (GL(dl_load_lock));
@@ -656,7 +656,7 @@ no more namespaces available for dlmopen()"));
#endif
/* See if an error occurred during loading. */
- if (__builtin_expect (errstring != NULL, 0))
+ if (__glibc_unlikely (errstring != NULL))
{
/* Remove the object from memory. It may be in an inconsistent
state if relocation failed, for example. */
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 1f66fccee2..d2c6dac69e 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -183,14 +183,14 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
&& __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
lazy = 0;
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
_dl_debug_printf ("\nrelocation processing: %s%s\n",
DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
/* DT_TEXTREL is now in level 2 and might phase out at some time.
But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
testing easier and therefore it will be available at all time. */
- if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
+ if (__glibc_unlikely (l->l_info[DT_TEXTREL] != NULL))
{
/* Bletch. We must make read-only segments writable
long enough to relocate them. */
@@ -264,7 +264,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc);
#ifndef PROF
- if (__builtin_expect (consider_profiling, 0))
+ if (__glibc_unlikely (consider_profiling))
{
/* Allocate the array which will contain the already found
relocations. If the shared object lacks a PLT (for example
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 655623b425..773cb42610 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -142,7 +142,7 @@ _dl_fixup (
value = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (value));
/* Finally, fix up the plt itself. */
- if (__builtin_expect (GLRO(dl_bind_not), 0))
+ if (__glibc_unlikely (GLRO(dl_bind_not)))
return value;
return elf_machine_fixup_plt (l, result, reloc, rel_addr, value);
@@ -347,7 +347,7 @@ _dl_profile_fixup (
#endif
/* Store the result for later runs. */
- if (__builtin_expect (! GLRO(dl_bind_not), 1))
+ if (__glibc_likely (! GLRO(dl_bind_not)))
*resultp = value;
}
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index f00975de77..69671c172f 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -128,7 +128,7 @@ do_sym (void *handle, const char *name, void *who,
THREAD_GSCOPE_RESET_FLAG ();
- if (__builtin_expect (errstring != NULL, 0))
+ if (__glibc_unlikely (errstring != NULL))
{
/* The lookup was unsuccessful. Rethrow the error. */
char *errstring_dup = strdupa (errstring);
@@ -145,7 +145,7 @@ do_sym (void *handle, const char *name, void *who,
}
else if (handle == RTLD_NEXT)
{
- if (__builtin_expect (match == GL(dl_ns)[LM_ID_BASE]._ns_loaded, 0))
+ if (__glibc_unlikely (match == GL(dl_ns)[LM_ID_BASE]._ns_loaded))
{
if (match == NULL
|| caller < match->l_map_start
@@ -183,7 +183,7 @@ RTLD_NEXT used in code not dynamically loaded"));
value = DL_SYMBOL_ADDRESS (result, ref);
/* Resolve indirect function address. */
- if (__builtin_expect (ELFW(ST_TYPE) (ref->st_info) == STT_GNU_IFUNC, 0))
+ if (__glibc_unlikely (ELFW(ST_TYPE) (ref->st_info) == STT_GNU_IFUNC))
{
DL_FIXUP_VALUE_TYPE fixup
= DL_FIXUP_MAKE_VALUE (result, (ElfW(Addr)) value);
@@ -195,7 +195,7 @@ RTLD_NEXT used in code not dynamically loaded"));
/* Auditing checkpoint: we have a new binding. Provide the
auditing libraries the possibility to change the value and
tell us whether further auditing is wanted. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
const char *strtab = (const char *) D_PTR (result,
l_info[DT_STRTAB]);
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index dbaea0aa91..9454d06d72 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -720,7 +720,7 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
!= FORCED_DYNAMIC_TLS_OFFSET, 0))
{
__rtld_lock_lock_recursive (GL(dl_load_lock));
- if (__builtin_expect (the_map->l_tls_offset == NO_TLS_OFFSET, 1))
+ if (__glibc_likely (the_map->l_tls_offset == NO_TLS_OFFSET))
{
the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
__rtld_lock_unlock_recursive (GL(dl_load_lock));
@@ -732,7 +732,7 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
!= FORCED_DYNAMIC_TLS_OFFSET, 1))
{
void *p = dtv[GET_ADDR_MODULE].pointer.val;
- if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+ if (__glibc_unlikely (p == TLS_DTV_UNALLOCATED))
goto again;
return (char *) p + GET_ADDR_OFFSET;
@@ -755,7 +755,7 @@ update_get_addr (GET_ADDR_ARGS)
void *p = dtv[GET_ADDR_MODULE].pointer.val;
- if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+ if (__glibc_unlikely (p == TLS_DTV_UNALLOCATED))
return tls_get_addr_tail (GET_ADDR_PARAM, dtv, the_map);
return (void *) p + GET_ADDR_OFFSET;
@@ -769,12 +769,12 @@ __tls_get_addr (GET_ADDR_ARGS)
{
dtv_t *dtv = THREAD_DTV ();
- if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
+ if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation)))
return update_get_addr (GET_ADDR_PARAM);
void *p = dtv[GET_ADDR_MODULE].pointer.val;
- if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+ if (__glibc_unlikely (p == TLS_DTV_UNALLOCATED))
return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL);
return (char *) p + GET_ADDR_OFFSET;
@@ -787,12 +787,12 @@ __tls_get_addr (GET_ADDR_ARGS)
void *
_dl_tls_get_addr_soft (struct link_map *l)
{
- if (__builtin_expect (l->l_tls_modid == 0, 0))
+ if (__glibc_unlikely (l->l_tls_modid == 0))
/* This module has no TLS segment. */
return NULL;
dtv_t *dtv = THREAD_DTV ();
- if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
+ if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation)))
{
/* This thread's DTV is not completely current,
but it might already cover this module. */
@@ -817,7 +817,7 @@ _dl_tls_get_addr_soft (struct link_map *l)
}
void *data = dtv[l->l_tls_modid].pointer.val;
- if (__builtin_expect (data == TLS_DTV_UNALLOCATED, 0))
+ if (__glibc_unlikely (data == TLS_DTV_UNALLOCATED))
/* The DTV is current, but this thread has not yet needed
to allocate this module's segment. */
data = NULL;
diff --git a/elf/dl-version.c b/elf/dl-version.c
index 651d4cf4ed..525e9d52e5 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -82,13 +82,13 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
int result = 0;
/* Display information about what we are doing while debugging. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
_dl_debug_printf ("\
checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
string, DSO_FILENAME (map->l_name),
map->l_ns, name, ns);
- if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
+ if (__glibc_unlikely (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL))
{
/* The file has no symbol versioning. I.e., the dependent
object was linked against another version of this file. We
@@ -145,7 +145,7 @@ no version information available (required by ", name, ")");
}
/* Symbol not found. If it was a weak reference it is not fatal. */
- if (__builtin_expect (weak, 1))
+ if (__glibc_likely (weak))
{
if (verbose)
{
@@ -291,7 +291,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
section. */
map->l_versions = (struct r_found_version *)
calloc (ndx_high + 1, sizeof (*map->l_versions));
- if (__builtin_expect (map->l_versions == NULL, 0))
+ if (__glibc_unlikely (map->l_versions == NULL))
{
errstring = N_("cannot allocate version reference table");
errval = ENOMEM;
@@ -316,7 +316,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
{
ElfW(Half) ndx = aux->vna_other & 0x7fff;
/* In trace mode, dependencies may be missing. */
- if (__builtin_expect (ndx < map->l_nversions, 1))
+ if (__glibc_likely (ndx < map->l_nversions))
{
map->l_versions[ndx].hash = aux->vna_hash;
map->l_versions[ndx].hidden = aux->vna_other & 0x8000;
diff --git a/elf/dl-writev.h b/elf/dl-writev.h
index ad67c1d82c..a5ce6c5166 100644
--- a/elf/dl-writev.h
+++ b/elf/dl-writev.h
@@ -42,7 +42,7 @@ _dl_writev (int fd, const struct iovec *iov, size_t niov)
errno when it's being used by another thread that cares about it.
Yet we must be sure not to try calling the lock functions before
the thread library is fully initialized. */
- if (__builtin_expect (INTUSE (_dl_starting_up), 0))
+ if (__glibc_unlikely (INTUSE (_dl_starting_up)))
__writev (fd, iov, niov);
else
{
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 46d295064f..4211f4c9cf 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -770,7 +770,7 @@ search_dir (const struct dir_entry *entry)
lstat_buf.st_mode = DTTOIF (direntry->d_type);
else
#endif
- if (__builtin_expect (lstat64 (real_file_name, &lstat_buf), 0))
+ if (__glibc_unlikely (lstat64 (real_file_name, &lstat_buf)))
{
error (0, errno, _("Cannot lstat %s"), file_name);
continue;
@@ -794,7 +794,7 @@ search_dir (const struct dir_entry *entry)
continue;
}
}
- if (__builtin_expect (stat64 (target_name, &stat_buf), 0))
+ if (__glibc_unlikely (stat64 (target_name, &stat_buf)))
{
if (opt_verbose)
error (0, errno, _("Cannot stat %s"), file_name);
diff --git a/elf/rtld.c b/elf/rtld.c
index 6dcbabc284..aa50cab0a9 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -344,7 +344,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
}
#endif
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
{
#ifndef HP_TIMING_NONAVAIL
print_statistics (&rtld_total_time);
@@ -517,7 +517,7 @@ _dl_start (void *arg)
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- if (__builtin_expect (lossage != NULL, 0))
+ if (__glibc_unlikely (lossage != NULL))
_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
lossage);
@@ -779,7 +779,7 @@ cannot allocate TLS data structures for initial thread");
#else
= TLS_INIT_TP (tcbp, 0);
#endif
- if (__builtin_expect (lossage != NULL, 0))
+ if (__glibc_unlikely (lossage != NULL))
_dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
tls_init_tp_called = true;
@@ -813,7 +813,7 @@ do_preload (char *fname, struct link_map *main_map, const char *where)
unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
(void) _dl_catch_error (&objname, &err_str, &malloced, map_doit, &args);
- if (__builtin_expect (err_str != NULL, 0))
+ if (__glibc_unlikely (err_str != NULL))
{
_dl_error_printf ("\
ERROR: ld.so: object '%s' from %s cannot be preloaded (%s): ignored.\n",
@@ -1067,7 +1067,7 @@ of this helper program; chances are you did not intend to run this program.\n\
args.mode = __RTLD_OPENEXEC;
(void) _dl_catch_error (&objname, &err_str, &malloced, map_doit,
&args);
- if (__builtin_expect (err_str != NULL, 0))
+ if (__glibc_unlikely (err_str != NULL))
/* We don't free the returned string, the programs stops
anyway. */
_exit (EXIT_FAILURE);
@@ -1394,7 +1394,7 @@ of this helper program; chances are you did not intend to run this program.\n\
GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
/* If we have auditing DSOs to load, do it now. */
- if (__builtin_expect (audit_list != NULL, 0))
+ if (__glibc_unlikely (audit_list != NULL))
{
/* Iterate over all entries in the list. The order is important. */
struct audit_ifaces *last_audit = NULL;
@@ -1428,7 +1428,7 @@ of this helper program; chances are you did not intend to run this program.\n\
bool malloced;
(void) _dl_catch_error (&objname, &err_str, &malloced, dlmopen_doit,
&dlmargs);
- if (__builtin_expect (err_str != NULL, 0))
+ if (__glibc_unlikely (err_str != NULL))
{
not_loaded:
_dl_error_printf ("\
@@ -1544,7 +1544,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* If we have any auditing modules, announce that we already
have two objects loaded. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
struct link_map *ls[2] = { main_map, &GL(dl_rtld_map) };
@@ -1593,7 +1593,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* Auditing checkpoint: we are ready to signal that the initial map
is being constructed. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
@@ -1612,7 +1612,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
struct link_map **preloads = NULL;
unsigned int npreloads = 0;
- if (__builtin_expect (preloadlist != NULL, 0))
+ if (__glibc_unlikely (preloadlist != NULL))
{
/* The LD_PRELOAD environment variable gives list of libraries
separated by white space or colons that are loaded before the
@@ -1643,12 +1643,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
the work but this does not matter, since it is not for production
use. */
static const char preload_file[] = "/etc/ld.so.preload";
- if (__builtin_expect (__access (preload_file, R_OK) == 0, 0))
+ if (__glibc_unlikely (__access (preload_file, R_OK) == 0))
{
/* Read the contents of the file. */
file = _dl_sysdep_read_whole_file (preload_file, &file_size,
PROT_READ | PROT_WRITE);
- if (__builtin_expect (file != MAP_FAILED, 0))
+ if (__glibc_unlikely (file != MAP_FAILED))
{
/* Parse the file. It contains names of libraries to be loaded,
separated by white spaces or `:'. It may also contain
@@ -1720,7 +1720,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
}
}
- if (__builtin_expect (*first_preload != NULL, 0))
+ if (__glibc_unlikely (*first_preload != NULL))
{
/* Set up PRELOADS with a vector of the preloaded libraries. */
struct link_map *l = *first_preload;
@@ -1757,7 +1757,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
break;
bool rtld_multiple_ref = false;
- if (__builtin_expect (i < main_map->l_searchlist.r_nlist, 1))
+ if (__glibc_likely (i < main_map->l_searchlist.r_nlist))
{
/* Some DT_NEEDED entry referred to the interpreter object itself, so
put it back in the list of visible objects. We insert it into the
@@ -1815,7 +1815,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (tcbp == NULL)
tcbp = init_tls ();
- if (__builtin_expect (audit_list == NULL, 1))
+ if (__glibc_likely (audit_list == NULL))
/* Initialize security features. But only if we have not done it
earlier. */
security_init ();
@@ -2099,7 +2099,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (r_list == r_listend && liblist == liblistend)
prelinked = true;
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\nprelink checking: %s\n",
prelinked ? "ok" : "failed");
}
@@ -2117,7 +2117,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
/* Print scope information. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
{
_dl_debug_printf ("\nInitial object scopes\n");
@@ -2215,7 +2215,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
this has to go here because the calls it makes should use the
rtld versions of the functions (particularly calloc()), but it
needs to have _dl_profile_map set up by the relocator. */
- if (__builtin_expect (GL(dl_profile_map) != NULL, 0))
+ if (__glibc_unlikely (GL(dl_profile_map) != NULL))
/* We must prepare the profiling. */
_dl_start_profile ();
}
@@ -2238,7 +2238,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
#else
= TLS_INIT_TP (tcbp, 0);
#endif
- if (__builtin_expect (lossage != NULL, 0))
+ if (__glibc_unlikely (lossage != NULL))
_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
lossage);
}
@@ -2279,7 +2279,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
#ifdef SHARED
/* Auditing checkpoint: we have added all objects. */
- if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
+ if (__glibc_unlikely (GLRO(dl_naudit) > 0))
{
struct link_map *head = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
/* Do not call the functions for any auditing object. */
diff --git a/elf/setup-vdso.h b/elf/setup-vdso.h
index f3716b693d..1057cf0003 100644
--- a/elf/setup-vdso.h
+++ b/elf/setup-vdso.h
@@ -31,7 +31,7 @@ setup_vdso (struct link_map *main_map __attribute__ ((unused)),
mapped and relocated it normally. */
struct link_map *l = _dl_new_object ((char *) "", "", lt_library, NULL,
0, LM_ID_BASE);
- if (__builtin_expect (l != NULL, 1))
+ if (__glibc_likely (l != NULL))
{
static ElfW(Dyn) dyn_temp[DL_RO_DYN_TEMP_CNT] attribute_relro;
diff --git a/grp/compat-initgroups.c b/grp/compat-initgroups.c
index 260c4826c2..ff10e247f4 100644
--- a/grp/compat-initgroups.c
+++ b/grp/compat-initgroups.c
@@ -82,7 +82,7 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
{
/* Matches user and not yet on the list. Insert
this group. */
- if (__builtin_expect (*start == *size, 0))
+ if (__glibc_unlikely (*start == *size))
{
/* Need a bigger buffer. */
gid_t *newgroups;
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c
index 2ab64d23fd..38c83833ae 100644
--- a/grp/fgetgrent.c
+++ b/grp/fgetgrent.c
@@ -57,7 +57,7 @@ fgetgrent (FILE *stream)
char *new_buf;
buffer_size += NSS_BUFLEN_GROUP;
new_buf = realloc (buffer, buffer_size);
- if (__builtin_expect (new_buf == NULL, 0))
+ if (__glibc_unlikely (new_buf == NULL))
{
/* We are out of memory. Free the current buffer so that the
process gets a chance for a normal termination. */
diff --git a/grp/initgroups.c b/grp/initgroups.c
index a2b6d31fd9..bdde097b0f 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -159,7 +159,7 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
long int size = MAX (1, *ngroups);
gid_t *newgroups = (gid_t *) malloc (size * sizeof (gid_t));
- if (__builtin_expect (newgroups == NULL, 0))
+ if (__glibc_unlikely (newgroups == NULL))
/* No more memory. */
// XXX This is wrong. The user provided memory, we have to use
// XXX it. The internal functions must be called with the user
@@ -212,7 +212,7 @@ initgroups (const char *user, gid_t group)
size = 16;
groups = (gid_t *) malloc (size * sizeof (gid_t));
- if (__builtin_expect (groups == NULL, 0))
+ if (__glibc_unlikely (groups == NULL))
/* No more memory. */
return -1;
diff --git a/grp/putgrent.c b/grp/putgrent.c
index bb429277e5..029415fcbd 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -33,7 +33,7 @@ putgrent (gr, stream)
{
int retval;
- if (__builtin_expect (gr == NULL, 0) || __builtin_expect (stream == NULL, 0))
+ if (__glibc_unlikely (gr == NULL) || __glibc_unlikely (stream == NULL))
{
__set_errno (EINVAL);
return -1;
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
index 9f66a3b857..327bbf4888 100644
--- a/hesiod/nss_hesiod/hesiod-grp.c
+++ b/hesiod/nss_hesiod/hesiod-grp.c
@@ -227,7 +227,7 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
if (status == NSS_STATUS_SUCCESS
&& !internal_gid_in_list (groups, group, *start))
{
- if (__builtin_expect (*start == *size, 0))
+ if (__glibc_unlikely (*start == *size))
{
/* Need a bigger buffer. */
gid_t *newgroups;
diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c
index 81d94eab0e..132e20bbd7 100644
--- a/hurd/hurdinit.c
+++ b/hurd/hurdinit.c
@@ -38,7 +38,7 @@ int __libc_argc;
error_t
_hurd_ports_use (int which, error_t (*operate) (mach_port_t))
{
- if (__builtin_expect (_hurd_ports == NULL, 0))
+ if (__glibc_unlikely (_hurd_ports == NULL))
/* This means that _hurd_init has not been called yet, which is
normally only the case in the bootstrap filesystem, and there
only in the early phases of booting. */
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index 41a4688f2a..f3a4337812 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -79,7 +79,7 @@ __gconv_load_cache (void)
cache_size = st.st_size;
#ifdef _POSIX_MAPPED_FILES
gconv_cache = __mmap (NULL, cache_size, PROT_READ, MAP_SHARED, fd, 0);
- if (__builtin_expect (gconv_cache == MAP_FAILED, 0))
+ if (__glibc_unlikely (gconv_cache == MAP_FAILED))
#endif
{
size_t already_read;
diff --git a/iconv/gconv_close.c b/iconv/gconv_close.c
index 9d01f146cc..81f0e0b319 100644
--- a/iconv/gconv_close.c
+++ b/iconv/gconv_close.c
@@ -45,7 +45,7 @@ __gconv_close (__gconv_t cd)
struct __gconv_trans_data *curp = transp;
transp = transp->__next;
- if (__builtin_expect (curp->__trans_end_fct != NULL, 0))
+ if (__glibc_unlikely (curp->__trans_end_fct != NULL))
curp->__trans_end_fct (curp->__data);
free (curp);
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 69a1f65eb2..bfbe22bff6 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -45,7 +45,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
errhand = strchr (toset, '/');
if (errhand != NULL)
errhand = strchr (errhand + 1, '/');
- if (__builtin_expect (errhand != NULL, 1))
+ if (__glibc_likely (errhand != NULL))
{
if (*++errhand == '\0')
errhand = NULL;
@@ -318,7 +318,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
struct __gconv_trans_data *curp = transp;
transp = transp->__next;
- if (__builtin_expect (curp->__trans_end_fct != NULL, 0))
+ if (__glibc_unlikely (curp->__trans_end_fct != NULL))
curp->__trans_end_fct (curp->__data);
free (curp);
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 27acb5e892..e11e2eea2d 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -177,7 +177,7 @@ internal_ucs4_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -249,7 +249,7 @@ ucs4_internal_loop (struct __gconv_step *step,
inval = *(const uint32_t *) inptr;
#endif
- if (__builtin_expect (inval > 0x7fffffff, 0))
+ if (__glibc_unlikely (inval > 0x7fffffff))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -308,7 +308,7 @@ ucs4_internal_loop_unaligned (struct __gconv_step *step,
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
{
- if (__builtin_expect (inptr[0] > 0x80, 0))
+ if (__glibc_unlikely (inptr[0] > 0x80))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -376,7 +376,7 @@ ucs4_internal_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -546,7 +546,7 @@ internal_ucs4le_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -617,7 +617,7 @@ ucs4le_internal_loop (struct __gconv_step *step,
inval = *(const uint32_t *) inptr;
#endif
- if (__builtin_expect (inval > 0x7fffffff, 0))
+ if (__glibc_unlikely (inval > 0x7fffffff))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -677,7 +677,7 @@ ucs4le_internal_loop_unaligned (struct __gconv_step *step,
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
{
- if (__builtin_expect (inptr[3] > 0x80, 0))
+ if (__glibc_unlikely (inptr[3] > 0x80))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -749,7 +749,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -810,7 +810,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (__builtin_expect (*inptr > '\x7f', 0)) \
+ if (__glibc_unlikely (*inptr > '\x7f')) \
{ \
/* The value is too large. We don't try transliteration here since \
this is not an error because of the lack of possibilities to \
@@ -846,7 +846,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (__builtin_expect (*((const uint32_t *) inptr) > 0x7f, 0)) \
+ if (__glibc_unlikely (*((const uint32_t *) inptr) > 0x7f)) \
{ \
UNICODE_TAG_HANDLER (*((const uint32_t *) inptr), 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
@@ -883,10 +883,10 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint32_t wc = *((const uint32_t *) inptr); \
\
- if (__builtin_expect (wc < 0x80, 1)) \
+ if (__glibc_likely (wc < 0x80)) \
/* It's an one byte sequence. */ \
*outptr++ = (unsigned char) wc; \
- else if (__builtin_expect (wc <= 0x7fffffff, 1)) \
+ else if (__glibc_likely (wc <= 0x7fffffff)) \
{ \
size_t step; \
unsigned char *start; \
@@ -895,7 +895,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if ((wc & (~(uint32_t)0 << (5 * step + 1))) == 0) \
break; \
\
- if (__builtin_expect (outptr + step > outend, 0)) \
+ if (__glibc_unlikely (outptr + step > outend)) \
{ \
/* Too long. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -946,7 +946,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
/* Next input byte. */ \
uint32_t ch = *inptr; \
\
- if (__builtin_expect (ch < 0x80, 1)) \
+ if (__glibc_likely (ch < 0x80)) \
{ \
/* One byte sequence. */ \
++inptr; \
@@ -964,25 +964,25 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
ch &= 0x03; \
} \
- else if (__builtin_expect ((ch & 0xfe) == 0xfc, 1)) \
+ else if (__glibc_likely ((ch & 0xfe) == 0xfc)) \
{ \
/* We expect six bytes. */ \
cnt = 6; \
@@ -1003,7 +1003,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
- if (__builtin_expect (inptr + cnt > inend, 0)) \
+ if (__glibc_unlikely (inptr + cnt > inend)) \
{ \
/* We don't have enough input. But before we report that check \
that all the bytes are correct. */ \
@@ -1011,7 +1011,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -1073,19 +1073,19 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
@@ -1164,7 +1164,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint16_t u1 = get16 (inptr); \
\
- if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \
+ if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000)) \
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
@@ -1198,12 +1198,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint32_t val = *((const uint32_t *) inptr); \
\
- if (__builtin_expect (val >= 0x10000, 0)) \
+ if (__glibc_unlikely (val >= 0x10000)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
+ else if (__glibc_unlikely (val >= 0xd800 && val < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this, because the UCS-2 output might be \
@@ -1248,7 +1248,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint16_t u1 = bswap_16 (get16 (inptr)); \
\
- if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \
+ if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000)) \
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
@@ -1288,12 +1288,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define BODY \
{ \
uint32_t val = *((const uint32_t *) inptr); \
- if (__builtin_expect (val >= 0x10000, 0)) \
+ if (__glibc_unlikely (val >= 0x10000)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
+ else if (__glibc_unlikely (val >= 0xd800 && val < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this, because the UCS-2 output might be \
diff --git a/iconv/iconv.c b/iconv/iconv.c
index 30b3564df5..a45b90ea4f 100644
--- a/iconv/iconv.c
+++ b/iconv/iconv.c
@@ -36,7 +36,7 @@ iconv (iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf,
size_t irreversible;
int result;
- if (__builtin_expect (inbuf == NULL || *inbuf == NULL, 0))
+ if (__glibc_unlikely (inbuf == NULL || *inbuf == NULL))
{
if (outbuf == NULL || *outbuf == NULL)
result = __gconv (gcd, NULL, NULL, NULL, NULL, &irreversible);
diff --git a/iconv/iconv_close.c b/iconv/iconv_close.c
index 1bf17939bf..304b4126b9 100644
--- a/iconv/iconv_close.c
+++ b/iconv/iconv_close.c
@@ -26,7 +26,7 @@
int
iconv_close (iconv_t cd)
{
- if (__builtin_expect (cd == (iconv_t *) -1L, 0))
+ if (__glibc_unlikely (cd == (iconv_t *) -1L))
{
__set_errno (EBADF);
return -1;
diff --git a/iconv/loop.c b/iconv/loop.c
index b4af6d418b..f836d08c37 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -241,7 +241,7 @@
/* If any of them recognized the input continue with the loop. */ \
if (result != __GCONV_ILLEGAL_INPUT) \
{ \
- if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0)) \
+ if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \
break; \
\
continue; \
@@ -442,7 +442,7 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
bytes from the state and at least one more, or the character is still
incomplete, or we have some other error (like illegal input character,
no space in output buffer). */
- if (__builtin_expect (inptr != bytebuf, 1))
+ if (__glibc_likely (inptr != bytebuf))
{
/* We found a new character. */
assert (inptr - bytebuf > (state->__count & 7));
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 7743216835..14318a6a53 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -410,7 +410,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If the function is called with no input this means we have to reset
to the initial state. The possibly partly converted input is
dropped. */
- if (__builtin_expect (do_flush, 0))
+ if (__glibc_unlikely (do_flush))
{
/* This should never happen during error handling. */
assert (outbufstart == NULL);
@@ -461,7 +461,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
/* We have a problem. Undo the conversion. */
outbuf = outstart;
@@ -604,7 +604,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
SAVE_RESET_STATE (1);
#endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -635,7 +635,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If we were called as part of an error handling module we
don't do anything else here. */
- if (__builtin_expect (outbufstart != NULL, 0))
+ if (__glibc_unlikely (outbufstart != NULL))
{
*outbufstart = outbuf;
return status;
@@ -653,7 +653,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If this is the last step leave the loop, there is nothing
we can do. */
- if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
+ if (__glibc_unlikely (data->__flags & __GCONV_IS_LAST))
{
/* Store information about how many bytes are available. */
data->__outbuf = outbuf;
@@ -666,7 +666,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
}
/* Write out all output which was produced. */
- if (__builtin_expect (outbuf > outstart, 1))
+ if (__glibc_likely (outbuf > outstart))
{
const unsigned char *outerr = data->__outbuf;
int result;
@@ -677,7 +677,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
#ifdef RESET_INPUT_BUFFER
RESET_INPUT_BUFFER;
@@ -695,7 +695,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
SAVE_RESET_STATE (0);
# endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -738,7 +738,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If we haven't consumed a single byte decrement
the invocation counter. */
- if (__builtin_expect (outbuf == outstart, 0))
+ if (__glibc_unlikely (outbuf == outstart))
--data->__invocation_counter;
#endif /* reset input buffer */
}
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index bc210260ec..b33a6eafdb 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -88,7 +88,7 @@ struct gap
uint32_t ch = get32 (inptr); \
unsigned char res; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
rp = NULL; \
diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c
index 8b490d182a..9b67e62dc3 100644
--- a/iconvdata/ansi_x3.110.c
+++ b/iconvdata/ansi_x3.110.c
@@ -567,7 +567,7 @@ static const char from_ucs4[][2] =
/* Now test for a possible second byte and write this if possible. */ \
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
--outptr; \
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index 2a5887b1f0..4c8df8e7e0 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -8401,7 +8401,7 @@ static const char from_ucs4_tab15[][2] =
uint32_t ch2; \
int idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -8426,7 +8426,7 @@ static const char from_ucs4_tab15[][2] =
ch = big5_to_ucs[idx]; \
\
/* Is this character defined? */ \
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index 90a9bfcf89..6084bd81c8 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -17774,7 +17774,7 @@ static struct
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -17787,7 +17787,7 @@ static struct
} \
else \
{ \
- if (__builtin_expect (outbuf + 2 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 2 <= outend)) \
{ \
/* Write out the last character. */ \
uint32_t lasttwo = data->__statep->__count >> 3; \
@@ -17814,7 +17814,7 @@ static struct
\
/* Determine whether there is a buffered character pending. */ \
ch = *statep >> 3; \
- if (__builtin_expect (ch == 0, 1)) \
+ if (__glibc_likely (ch == 0)) \
{ \
/* No - so look at the next input byte. */ \
ch = *inptr; \
@@ -17826,7 +17826,7 @@ static struct
uint32_t ch2; \
int idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -17887,7 +17887,7 @@ static struct
\
inptr += 2; \
} \
- else if (__builtin_expect (ch == 0xff, 0)) \
+ else if (__glibc_unlikely (ch == 0xff)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
@@ -17937,7 +17937,7 @@ static struct
goto not_combining; \
\
/* Output the combined character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -17950,7 +17950,7 @@ static struct
\
not_combining: \
/* Output the buffered character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -17992,7 +17992,7 @@ static struct
else \
{ \
/* Check for possible combining character. */ \
- if (__builtin_expect (ch == 0xca || ch == 0xea, 0)) \
+ if (__glibc_unlikely (ch == 0xca || ch == 0xea)) \
{ \
*statep = ((cp[0] << 8) | cp[1]) << 3; \
inptr += 4; \
@@ -18009,7 +18009,7 @@ static struct
} \
\
*outptr++ = cp[0]; \
- if (__builtin_expect (cp[1] != '\0', 1)) \
+ if (__glibc_likely (cp[1] != '\0')) \
*outptr++ = cp[1]; \
} \
} \
diff --git a/iconvdata/cp1255.c b/iconvdata/cp1255.c
index 9a05d3020c..3106d2062f 100644
--- a/iconvdata/cp1255.c
+++ b/iconvdata/cp1255.c
@@ -65,7 +65,7 @@
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -201,7 +201,7 @@ static const struct { unsigned int idx; unsigned int len; } comp_table[8] = {
if (ch >= 0x80) \
{ \
ch = to_ucs4[ch - 0x80]; \
- if (__builtin_expect (ch == L'\0', 0)) \
+ if (__glibc_unlikely (ch == L'\0')) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -463,7 +463,7 @@ static const struct {
res = 0; \
} \
\
- if (__builtin_expect (res != 0, 1)) \
+ if (__glibc_likely (res != 0)) \
{ \
*outptr++ = res; \
inptr += 4; \
@@ -515,7 +515,7 @@ static const struct {
if (decomp_table[i].comb2 < 0) \
{ \
/* See whether we have room for two bytes. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -527,7 +527,7 @@ static const struct {
else \
{ \
/* See whether we have room for three bytes. */ \
- if (__builtin_expect (outptr + 2 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/cp1258.c b/iconvdata/cp1258.c
index bafa28cc18..6dc13b2bdf 100644
--- a/iconvdata/cp1258.c
+++ b/iconvdata/cp1258.c
@@ -66,7 +66,7 @@
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -375,7 +375,7 @@ static const struct
if (ch >= 0x80) \
{ \
ch = to_ucs4[ch - 0x80]; \
- if (__builtin_expect (ch == L'\0', 0)) \
+ if (__glibc_unlikely (ch == L'\0')) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -802,7 +802,7 @@ static const struct
res = 0; \
} \
\
- if (__builtin_expect (res != 0, 1)) \
+ if (__glibc_likely (res != 0)) \
{ \
*outptr++ = res; \
inptr += 4; \
@@ -845,7 +845,7 @@ static const struct
} \
\
/* See whether we have room for two bytes. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/cp932.c b/iconvdata/cp932.c
index b8269ac061..c467aaa2bb 100644
--- a/iconvdata/cp932.c
+++ b/iconvdata/cp932.c
@@ -4574,7 +4574,7 @@ static const char from_ucs4_extra[229][2] =
uint32_t ch2; \
uint_fast32_t idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -4704,7 +4704,7 @@ static const char from_ucs4_extra[229][2] =
/* Now test for a possible second byte and write this if possible. */\
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c
index 0b8a74b706..246ef5d70c 100644
--- a/iconvdata/euc-cn.c
+++ b/iconvdata/euc-cn.c
@@ -56,7 +56,7 @@
next byte is also available. */ \
const unsigned char *endp; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -67,14 +67,14 @@
ch = inptr[1]; \
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
- if (__builtin_expect (ch < 0xa1, 0)) \
+ if (__glibc_unlikely (ch < 0xa1)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* This is code set 1: GB 2312-80. */ \
endp = inptr; \
\
ch = gb2312_to_ucs4 (&endp, 2, 0x80); \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index 2737842de1..ff4e46fdda 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -79,7 +79,7 @@
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -92,7 +92,7 @@
} \
else \
{ \
- if (__builtin_expect (outbuf + 2 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 2 <= outend)) \
{ \
/* Write out the last character. */ \
uint32_t lasttwo = data->__statep->__count >> 3; \
@@ -119,7 +119,7 @@
\
/* Determine whether there is a buffered character pending. */ \
ch = *statep >> 3; \
- if (__builtin_expect (ch == 0, 1)) \
+ if (__glibc_likely (ch == 0)) \
{ \
/* No - so look at the next input byte. */ \
ch = *inptr; \
@@ -132,7 +132,7 @@
/* Two or three byte character. */ \
uint32_t ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -142,7 +142,7 @@
ch2 = inptr[1]; \
\
/* The second byte must be >= 0xa1 and <= 0xfe. */ \
- if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \
+ if (__glibc_unlikely (ch2 < 0xa1 || ch2 > 0xfe)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -151,7 +151,7 @@
if (ch == 0x8e) \
{ \
/* Half-width katakana. */ \
- if (__builtin_expect (ch2 > 0xdf, 0)) \
+ if (__glibc_unlikely (ch2 > 0xdf)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
ch = ch2 + 0xfec0; \
@@ -166,7 +166,7 @@
/* JISX 0213 plane 2. */ \
uint32_t ch3; \
\
- if (__builtin_expect (inptr + 2 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 2 >= inend)) \
{ \
/* The third byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -323,7 +323,7 @@ static const struct
if (len > 0) \
{ \
/* Output the combined character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -338,7 +338,7 @@ static const struct
\
not_combining: \
/* Output the buffered character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -355,7 +355,7 @@ static const struct
else if (ch >= 0xff61 && ch <= 0xff9f) \
{ \
/* Half-width katakana. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -389,7 +389,7 @@ static const struct
if (jch & 0x8000) \
{ \
/* JISX 0213 plane 2. */ \
- if (__builtin_expect (outptr + 2 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -399,7 +399,7 @@ static const struct
else \
{ \
/* JISX 0213 plane 1. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/euc-jp-ms.c b/iconvdata/euc-jp-ms.c
index 5ec40ad6cc..854e3017fe 100644
--- a/iconvdata/euc-jp-ms.c
+++ b/iconvdata/euc-jp-ms.c
@@ -4673,7 +4673,7 @@ static const unsigned char from_ucs4_extra[229][2] =
character is also available. */ \
unsigned char ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -4684,7 +4684,7 @@ static const unsigned char from_ucs4_extra[229][2] =
ch2 = (unsigned char)inptr[1]; \
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
- if (__builtin_expect (ch2 < 0xa1, 0)) \
+ if (__glibc_unlikely (ch2 < 0xa1)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -4703,7 +4703,7 @@ static const unsigned char from_ucs4_extra[229][2] =
/* This is code set 2: half-width katakana. */ \
ch = jisx0201_to_ucs4 (ch2); \
/*if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR)*/ \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
/* Illegal character. */ \
if (! ignore_errors_p ()) \
@@ -4896,15 +4896,15 @@ static const unsigned char from_ucs4_extra[229][2] =
/* Now test for a possible second byte and write this if possible. */\
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (cp[1] < 0x80, 0)) \
+ if (__glibc_unlikely (cp[1] < 0x80)) \
{ \
- if (__builtin_expect (outptr + 2 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c
index b903091ff7..a7f2ae351c 100644
--- a/iconvdata/euc-jp.c
+++ b/iconvdata/euc-jp.c
@@ -57,7 +57,7 @@
byte is also available. */ \
int ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second byte is not available. Store the \
intermediate result. */ \
@@ -68,7 +68,7 @@
ch2 = inptr[1]; \
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
- if (__builtin_expect (ch2 < 0xa1, 0)) \
+ if (__glibc_unlikely (ch2 < 0xa1)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
if (ch == 0x8e) \
@@ -105,7 +105,7 @@
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
/* Illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
@@ -151,7 +151,7 @@
size_t found; \
\
/* See whether we have room for at least two characters. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index d4f0e00ca4..f14d989385 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -93,13 +93,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
/* Two-byte character. First test whether the next byte \
is also available. */ \
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80); \
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
@@ -144,7 +144,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
/* Now test for a possible second byte and write this if possible. */ \
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
--outptr; \
diff --git a/iconvdata/gb18030.c b/iconvdata/gb18030.c
index 4302fbf817..4eaa8b5e65 100644
--- a/iconvdata/gb18030.c
+++ b/iconvdata/gb18030.c
@@ -24212,7 +24212,7 @@ static const unsigned char __ucs_to_gb18030_tab2[][2] =
\
inptr += 4; \
} \
- else if (__builtin_expect (ch2 >= 0x40, 1)) \
+ else if (__glibc_likely (ch2 >= 0x40)) \
{ \
/* A two-byte character */ \
idx = (ch - 0x81) * 192 + (ch2 - 0x40); \
@@ -24375,7 +24375,7 @@ static const unsigned char __ucs_to_gb18030_tab2[][2] =
{ \
/* See whether there is enough room for all four bytes we \
write. */ \
- if (__builtin_expect (outptr + 3 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 >= outend)) \
{ \
/* We have not enough room. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/gbbig5.c b/iconvdata/gbbig5.c
index 9a68c5cc7d..1eb1067bb1 100644
--- a/iconvdata/gbbig5.c
+++ b/iconvdata/gbbig5.c
@@ -4805,7 +4805,7 @@ const char __from_big5_to_gb2312 [13973][2] =
const char *cp; \
int idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -4817,7 +4817,7 @@ const char __from_big5_to_gb2312 [13973][2] =
ch = inptr[1]; \
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
- if (__builtin_expect (ch < 0xa1, 0)) \
+ if (__glibc_unlikely (ch < 0xa1)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -4827,7 +4827,7 @@ const char __from_big5_to_gb2312 [13973][2] =
\
/* Get the value from the table. */ \
cp = __from_gb2312_to_big5[idx]; \
- if (__builtin_expect (cp[0] == '\0', 0)) \
+ if (__glibc_unlikely (cp[0] == '\0')) \
{ \
/* We do not have a mapping for this character. \
If ignore errors, map it to 0xa1bc - big5 box character */ \
@@ -4836,7 +4836,7 @@ const char __from_big5_to_gb2312 [13973][2] =
break; \
\
/* See if there is enough room to write the second byte. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -4894,7 +4894,7 @@ const char __from_big5_to_gb2312 [13973][2] =
const char *cp; \
int idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -4918,7 +4918,7 @@ const char __from_big5_to_gb2312 [13973][2] =
\
/* Get the value from the table. */ \
cp = __from_big5_to_gb2312 [idx]; \
- if (__builtin_expect (cp[0] == '\0', 0)) \
+ if (__glibc_unlikely (cp[0] == '\0')) \
{ \
/* We do not have a mapping for this character. \
If ignore errors, map it to 0xa1f5 - gb box character */ \
@@ -4927,7 +4927,7 @@ const char __from_big5_to_gb2312 [13973][2] =
break; \
\
/* See if there is enough room to write the second byte. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/gbgbk.c b/iconvdata/gbgbk.c
index b870d9d8fb..88f9cd994e 100644
--- a/iconvdata/gbgbk.c
+++ b/iconvdata/gbgbk.c
@@ -73,7 +73,7 @@
UCS4 -> GB2312 -> GBK -> UCS4 \
\
might not produce identical text. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -81,7 +81,7 @@
break; \
} \
\
- if (__builtin_expect (outend - outptr < 2, 0)) \
+ if (__glibc_unlikely (outend - outptr < 2)) \
{ \
/* We ran out of space. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -91,7 +91,7 @@
ch = (ch << 8) | inptr[1]; \
\
/* Map 0xA844 (U2015 in GBK) to 0xA1AA (U2015 in GB2312). */ \
- if (__builtin_expect (ch == 0xa844, 0)) \
+ if (__glibc_unlikely (ch == 0xa844)) \
ch = 0xa1aa; \
\
/* Now determine whether the character is valid. */ \
@@ -134,7 +134,7 @@
\
if (ch > 0x7f) \
{ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -142,7 +142,7 @@
break; \
} \
\
- if (__builtin_expect (outend - outptr < 2, 0)) \
+ if (__glibc_unlikely (outend - outptr < 2)) \
{ \
/* We ran out of space. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index 2f7d7fb886..05d7eb8114 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.c
@@ -13157,7 +13157,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
uint32_t ch2; \
int idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c
index 373d49a743..9de32c576a 100644
--- a/iconvdata/ibm1364.c
+++ b/iconvdata/ibm1364.c
@@ -77,7 +77,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -120,7 +120,7 @@ enum
else \
{ \
/* This is a combined character. Make sure we have room. */ \
- if (__builtin_expect (outptr + 8 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 8 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -204,7 +204,7 @@ enum
{ \
assert (curcs == db); \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -274,7 +274,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -301,7 +301,7 @@ enum
{ \
uint32_t ch = get32 (inptr); \
\
- if (__builtin_expect (ch >= UCS_LIMIT, 0)) \
+ if (__glibc_unlikely (ch >= UCS_LIMIT)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
@@ -353,7 +353,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -364,13 +364,13 @@ enum
} \
else \
{ \
- if (__builtin_expect (curcs == db, 0)) \
+ if (__glibc_unlikely (curcs == db)) \
{ \
/* We know there is room for at least one byte. */ \
*outptr++ = SI; \
curcs = sb; \
\
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 83276905a0..1c50f1f3ac 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -61,7 +61,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -150,7 +150,7 @@ enum
\
assert (curcs == db); \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -197,7 +197,7 @@ enum
const struct gap *rp2 = __ucs4_to_ibm930db_idx; \
const char *cp; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
@@ -227,7 +227,7 @@ enum
{ \
if (curcs == sb) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -236,7 +236,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -249,7 +249,7 @@ enum
{ \
if (curcs == db) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -257,7 +257,7 @@ enum
*outptr++ = SI; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm932.c b/iconvdata/ibm932.c
index 4ceeaae5b9..cd43619963 100644
--- a/iconvdata/ibm932.c
+++ b/iconvdata/ibm932.c
@@ -64,7 +64,7 @@
if (__builtin_expect (res == 0, 0) && ch != 0) \
{ \
/* Use the IBM932 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. \
Store the intermediate result. */ \
@@ -134,7 +134,7 @@
uint32_t high; \
uint16_t pccode; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
rp = NULL; \
@@ -156,7 +156,7 @@
high = (sizeof (__ucs4_to_ibm932db) >> 1) \
/ sizeof (__ucs4_to_ibm932db[0][FROM]); \
pccode = ch; \
- if (__builtin_expect (rp != NULL, 1)) \
+ if (__glibc_likely (rp != NULL)) \
while (low < high) \
{ \
i = (low + high) >> 1; \
@@ -173,7 +173,7 @@
} \
if (found) \
{ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -189,7 +189,7 @@
} \
else \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm933.c b/iconvdata/ibm933.c
index 4723df4890..149902b42c 100644
--- a/iconvdata/ibm933.c
+++ b/iconvdata/ibm933.c
@@ -61,7 +61,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -149,7 +149,7 @@ enum
assert (curcs == db); \
\
/* Use the IBM933 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -196,7 +196,7 @@ enum
const struct gap *rp2 = __ucs4_to_ibm933db_idx; \
const char *cp; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
@@ -226,7 +226,7 @@ enum
{ \
if (curcs == sb) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -235,7 +235,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -248,7 +248,7 @@ enum
{ \
if (curcs == db) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -256,7 +256,7 @@ enum
*outptr++ = SI; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm935.c b/iconvdata/ibm935.c
index 1ed311b01f..9a7a862ef2 100644
--- a/iconvdata/ibm935.c
+++ b/iconvdata/ibm935.c
@@ -61,7 +61,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -149,7 +149,7 @@ enum
assert (curcs == db); \
\
/* Use the IBM935 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. \
Store the intermediate result. */ \
@@ -196,7 +196,7 @@ enum
const struct gap *rp2 = __ucs4_to_ibm935db_idx; \
const char *cp; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
@@ -226,7 +226,7 @@ enum
{ \
if (curcs == sb) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -235,7 +235,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -248,7 +248,7 @@ enum
{ \
if (curcs == db) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -256,7 +256,7 @@ enum
*outptr++ = SI; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm937.c b/iconvdata/ibm937.c
index 1edaf624d0..5a4ab92131 100644
--- a/iconvdata/ibm937.c
+++ b/iconvdata/ibm937.c
@@ -61,7 +61,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -149,7 +149,7 @@ enum
assert (curcs == db); \
\
/* Use the IBM937 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. \
Store the intermediate result. */ \
@@ -196,7 +196,7 @@ enum
const struct gap *rp2 = __ucs4_to_ibm937db_idx; \
const char *cp; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
@@ -226,7 +226,7 @@ enum
{ \
if (curcs == sb) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -235,7 +235,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -248,7 +248,7 @@ enum
{ \
if (curcs == db) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -256,7 +256,7 @@ enum
*outptr++ = SI; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c
index b40c486540..b50792879c 100644
--- a/iconvdata/ibm939.c
+++ b/iconvdata/ibm939.c
@@ -61,7 +61,7 @@
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -149,7 +149,7 @@ enum
\
assert (curcs == db); \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -196,7 +196,7 @@ enum
const struct gap *rp2 = __ucs4_to_ibm939db_idx; \
const char *cp; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
goto ibm939_invalid_char; \
@@ -226,7 +226,7 @@ enum
{ \
if (curcs == sb) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -235,7 +235,7 @@ enum
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -248,7 +248,7 @@ enum
{ \
if (curcs == db) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -256,7 +256,7 @@ enum
*outptr++ = SI; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/ibm943.c b/iconvdata/ibm943.c
index 495e37909e..0ca3327f29 100644
--- a/iconvdata/ibm943.c
+++ b/iconvdata/ibm943.c
@@ -65,7 +65,7 @@
__builtin_expect (res == 0, 0) && ch != 0)) \
{ \
/* Use the IBM943 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. \
Store the intermediate result. */ \
@@ -135,7 +135,7 @@
uint32_t high; \
uint16_t pccode; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
rp = NULL; \
@@ -157,7 +157,7 @@
high = (sizeof (__ucs4_to_ibm943db) >> 1) \
/ sizeof (__ucs4_to_ibm943db[0][FROM]); \
pccode = ch; \
- if (__builtin_expect (rp != NULL, 1)) \
+ if (__glibc_likely (rp != NULL)) \
while (low < high) \
{ \
i = (low + high) >> 1; \
@@ -174,7 +174,7 @@
} \
if (found) \
{ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -190,7 +190,7 @@
} \
else \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c
index 64196ac792..147f869158 100644
--- a/iconvdata/iso-2022-cn-ext.c
+++ b/iconvdata/iso-2022-cn-ext.c
@@ -137,7 +137,7 @@ enum
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf == outend, 0)) \
+ if (__glibc_unlikely (outbuf == outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c
index 0e5a6aabe7..a282806809 100644
--- a/iconvdata/iso-2022-cn.c
+++ b/iconvdata/iso-2022-cn.c
@@ -88,7 +88,7 @@ enum
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf == outend, 0)) \
+ if (__glibc_unlikely (outbuf == outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -121,7 +121,7 @@ enum
uint32_t ch = *inptr; \
\
/* This is a 7bit character set, disallow all 8bit characters. */ \
- if (__builtin_expect (ch >= 0x7f, 0)) \
+ if (__glibc_unlikely (ch >= 0x7f)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* Recognize escape sequences. */ \
@@ -246,7 +246,7 @@ enum
{ \
*outptr++ = SI; \
set = ASCII_set; \
- if (__builtin_expect (outptr == outend, 0)) \
+ if (__glibc_unlikely (outptr == outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -319,7 +319,7 @@ enum
{ \
const char *escseq; \
\
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -342,7 +342,7 @@ enum
\
if (used == CNS11643_2_set) \
{ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -357,7 +357,7 @@ enum
SO charset. */ \
if (set == ASCII_set) \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -368,13 +368,13 @@ enum
\
/* Always test the length here since we have used up all the \
guaranteed output buffer slots. */ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
} \
- else if (__builtin_expect (outptr + 2 > outend, 0)) \
+ else if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
index e90d68a444..b676aa19a4 100644
--- a/iconvdata/iso-2022-jp-3.c
+++ b/iconvdata/iso-2022-jp-3.c
@@ -96,7 +96,7 @@ enum
+ ((data->__statep->__count & CURRENT_SEL_MASK) != ASCII_set \
? 3 : 0); \
\
- if (__builtin_expect (outbuf + need > outend, 0)) \
+ if (__glibc_unlikely (outbuf + need > outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -153,7 +153,7 @@ enum
uint32_t ch = *inptr; \
\
/* Recognize escape sequences. */ \
- if (__builtin_expect (ch == ESC, 0)) \
+ if (__glibc_unlikely (ch == ESC)) \
{ \
/* We now must be prepared to read two to three more bytes. \
If we have a match in the first byte but then the input buffer \
@@ -242,7 +242,7 @@ enum
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch); \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
@@ -252,7 +252,7 @@ enum
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch + 0x80); \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
@@ -266,19 +266,19 @@ enum
provide the appropriate tables. */ \
ch = jisx0208_to_ucs4 (&inptr, inend - inptr, 0); \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else /* (set == JISX0213_1_2004_set || set == JISX0213_2_set) */ \
{ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -416,7 +416,7 @@ static const struct
|| (set != JISX0213_1_2000_set && set != JISX0213_1_2004_set) \
? 4 : 0); \
\
- if (__builtin_expect (outptr + need + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + need + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -444,7 +444,7 @@ static const struct
{ \
size_t need = (lasttwo >> 16 ? 3 : 0); \
\
- if (__builtin_expect (outptr + need + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + need + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -520,7 +520,7 @@ static const struct
inptr += 4; \
continue; \
} \
- if (__builtin_expect (written == 0, 0)) \
+ if (__glibc_unlikely (written == 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -558,7 +558,7 @@ static const struct
continue; \
} \
\
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -578,7 +578,7 @@ static const struct
{ \
/* We must encode using ASCII. First write out the escape \
sequence. */ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -589,7 +589,7 @@ static const struct
*outptr++ = 'B'; \
set = ASCII_set; \
\
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -606,7 +606,7 @@ static const struct
{ \
if (set != JISX0201_Roman_set) \
{ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -617,7 +617,7 @@ static const struct
set = JISX0201_Roman_set; \
} \
\
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -644,7 +644,7 @@ static const struct
\
if (set != JISX0208_1983_set) \
{ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -655,7 +655,7 @@ static const struct
set = JISX0208_1983_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -677,7 +677,7 @@ static const struct
\
if (set != new_set) \
{ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -703,7 +703,7 @@ static const struct
continue; \
} \
\
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -732,7 +732,7 @@ static const struct
set = JISX0201_Kana_set; \
} \
\
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index e9d5db4b68..3428c3211e 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -231,7 +231,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* We are not in the initial state. To switch back we have \
to emit the sequence `Esc ( B'. */ \
- if (__builtin_expect (outbuf + 3 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 3 > outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -404,7 +404,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch); \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
++inptr; \
} \
@@ -412,7 +412,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch + 0x80); \
- if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
++inptr; \
} \
@@ -438,12 +438,12 @@ gconv_end (struct __gconv_step *data)
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0); \
} \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
@@ -493,7 +493,7 @@ static const cvlist_t conversion_lists[4] =
if (var == iso2022jp2) \
{ \
/* Handle Unicode tag characters (range U+E0000..U+E007F). */ \
- if (__builtin_expect ((ch >> 7) == (0xe0000 >> 7), 0)) \
+ if (__glibc_unlikely ((ch >> 7) == (0xe0000 >> 7))) \
{ \
ch &= 0x7f; \
if (ch >= 'A' && ch <= 'Z') \
@@ -529,7 +529,7 @@ static const cvlist_t conversion_lists[4] =
\
/* Non-tag characters reset the tag parsing state, if the current \
state is a temporary state. */ \
- if (__builtin_expect (tag >= TAG_language, 0)) \
+ if (__glibc_unlikely (tag >= TAG_language)) \
tag = TAG_none; \
} \
\
@@ -613,7 +613,7 @@ static const cvlist_t conversion_lists[4] =
else \
written = __UNKNOWN_10646_CHAR; \
\
- if (__builtin_expect (written == 0, 0)) \
+ if (__glibc_unlikely (written == 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -629,7 +629,7 @@ static const cvlist_t conversion_lists[4] =
{ \
if (ch >= 0x80 && ch <= 0xff) \
{ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -643,7 +643,7 @@ static const cvlist_t conversion_lists[4] =
} \
else if (set2 == ISO88597_set) \
{ \
- if (__builtin_expect (ch < 0xffff, 1)) \
+ if (__glibc_likely (ch < 0xffff)) \
{ \
const struct gap *rp = from_idx; \
\
@@ -655,7 +655,7 @@ static const cvlist_t conversion_lists[4] =
iso88597_from_ucs4[ch - 0xa0 + rp->idx]; \
if (res != '\0') \
{ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -685,7 +685,7 @@ static const cvlist_t conversion_lists[4] =
{ \
/* We must encode using ASCII. First write out the \
escape sequence. */ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -696,7 +696,7 @@ static const cvlist_t conversion_lists[4] =
*outptr++ = 'B'; \
set = ASCII_set; \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -742,7 +742,7 @@ static const cvlist_t conversion_lists[4] =
set2 = ISO88591_set; \
} \
\
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -755,7 +755,7 @@ static const cvlist_t conversion_lists[4] =
} \
\
/* Try ISO 8859-7 upper half. */ \
- if (__builtin_expect (ch < 0xffff, 1)) \
+ if (__glibc_likely (ch < 0xffff)) \
{ \
const struct gap *rp = from_idx; \
\
@@ -817,7 +817,7 @@ static const cvlist_t conversion_lists[4] =
set = JISX0201_Roman_set; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -844,7 +844,7 @@ static const cvlist_t conversion_lists[4] =
set = JISX0208_1983_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -855,7 +855,7 @@ static const cvlist_t conversion_lists[4] =
break; \
} \
\
- if (__builtin_expect (var == iso2022jp, 0)) \
+ if (__glibc_unlikely (var == iso2022jp)) \
/* Don't use the other Japanese character sets. */ \
break; \
\
@@ -877,7 +877,7 @@ static const cvlist_t conversion_lists[4] =
set = JISX0212_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -910,7 +910,7 @@ static const cvlist_t conversion_lists[4] =
set = GB2312_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -944,7 +944,7 @@ static const cvlist_t conversion_lists[4] =
set = KSC5601_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
@@ -979,7 +979,7 @@ static const cvlist_t conversion_lists[4] =
set = JISX0201_Kana_set; \
} \
\
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
res = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c
index 2377ae5f2a..14080c10c4 100644
--- a/iconvdata/iso-2022-kr.c
+++ b/iconvdata/iso-2022-kr.c
@@ -86,7 +86,7 @@ enum
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf == outend, 0)) \
+ if (__glibc_unlikely (outbuf == outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
@@ -118,7 +118,7 @@ enum
uint32_t ch = *inptr; \
\
/* This is a 7bit character set, disallow all 8bit characters. */ \
- if (__builtin_expect (ch > 0x7f, 0)) \
+ if (__glibc_unlikely (ch > 0x7f)) \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* Recognize escape sequences. */ \
@@ -171,12 +171,12 @@ enum
/* Use the KSC 5601 table. */ \
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0); \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
@@ -209,7 +209,7 @@ enum
{ \
*outptr++ = SI; \
set = ASCII_set; \
- if (__builtin_expect (outptr == outend, 0)) \
+ if (__glibc_unlikely (outptr == outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -243,7 +243,7 @@ enum
set = KSC5601_set; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c
index 35fe93d880..b450fcc962 100644
--- a/iconvdata/iso646.c
+++ b/iconvdata/iso646.c
@@ -870,7 +870,7 @@ gconv_end (struct __gconv_step *data)
ch = 0x5d; \
break; \
default: \
- if (__builtin_expect (ch > 0x7f, 0)) \
+ if (__glibc_unlikely (ch > 0x7f)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
failure = __GCONV_ILLEGAL_INPUT; \
diff --git a/iconvdata/iso8859-1.c b/iconvdata/iso8859-1.c
index 6aa6e3550c..6610cae415 100644
--- a/iconvdata/iso8859-1.c
+++ b/iconvdata/iso8859-1.c
@@ -50,7 +50,7 @@
#define BODY \
{ \
uint32_t ch = *((const uint32_t *) inptr); \
- if (__builtin_expect (ch > 0xff, 0)) \
+ if (__glibc_unlikely (ch > 0xff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
diff --git a/iconvdata/iso_11548-1.c b/iconvdata/iso_11548-1.c
index 51aed763e8..37f55c0d42 100644
--- a/iconvdata/iso_11548-1.c
+++ b/iconvdata/iso_11548-1.c
@@ -53,7 +53,7 @@
#define BODY \
{ \
uint32_t ch = *((const uint32_t *) inptr); \
- if (__builtin_expect ((ch & 0xffffff00u) != BRAILLE_UCS_BASE, 0)) \
+ if (__glibc_unlikely ((ch & 0xffffff00u) != BRAILLE_UCS_BASE)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
diff --git a/iconvdata/iso_6937-2.c b/iconvdata/iso_6937-2.c
index d5e09a3795..03f08734e9 100644
--- a/iconvdata/iso_6937-2.c
+++ b/iconvdata/iso_6937-2.c
@@ -397,7 +397,7 @@ static const char from_ucs4[][2] =
is also available. */ \
int ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -416,7 +416,7 @@ static const char from_ucs4[][2] =
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* Illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
@@ -536,7 +536,7 @@ static const char from_ucs4[][2] =
/* Now test for a possible second byte and write this if possible. */ \
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
--outptr; \
diff --git a/iconvdata/iso_6937.c b/iconvdata/iso_6937.c
index 66d86b1dce..71a829a71b 100644
--- a/iconvdata/iso_6937.c
+++ b/iconvdata/iso_6937.c
@@ -397,7 +397,7 @@ static const char from_ucs4[][2] =
is also available. */ \
int ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -416,7 +416,7 @@ static const char from_ucs4[][2] =
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* Illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
@@ -520,7 +520,7 @@ static const char from_ucs4[][2] =
fail = 1; \
} \
\
- if (__builtin_expect (fail, 0)) \
+ if (__glibc_unlikely (fail)) \
{ \
/* Illegal characters. */ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
@@ -538,7 +538,7 @@ static const char from_ucs4[][2] =
/* Now test for a possible second byte and write this if possible. */ \
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
--outptr; \
diff --git a/iconvdata/johab.c b/iconvdata/johab.c
index fb280a368f..07d6b6d9f8 100644
--- a/iconvdata/johab.c
+++ b/iconvdata/johab.c
@@ -192,7 +192,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
uint32_t ch2; \
uint_fast32_t idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -202,7 +202,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
\
ch2 = inptr[1]; \
idx = ch * 256 + ch2; \
- if (__builtin_expect (ch <= 0xd3, 1)) \
+ if (__glibc_likely (ch <= 0xd3)) \
{ \
/* Hangul */ \
int_fast32_t i, m, f; \
@@ -262,7 +262,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
} \
} \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
@@ -313,7 +313,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
{ \
if (ch >= 0xac00 && ch <= 0xd7a3) \
{ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -334,7 +334,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
{ \
ch = jamo_from_ucs_table[ch - 0x3131]; \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -355,7 +355,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (written == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
diff --git a/iconvdata/shift_jisx0213.c b/iconvdata/shift_jisx0213.c
index 94a2d155d6..a6c19acf3c 100644
--- a/iconvdata/shift_jisx0213.c
+++ b/iconvdata/shift_jisx0213.c
@@ -79,7 +79,7 @@
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -92,7 +92,7 @@
} \
else \
{ \
- if (__builtin_expect (outbuf + 2 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 2 <= outend)) \
{ \
/* Write out the last character. */ \
uint32_t lasttwo = data->__statep->__count >> 3; \
@@ -119,7 +119,7 @@
\
/* Determine whether there is a buffered character pending. */ \
ch = *statep >> 3; \
- if (__builtin_expect (ch == 0, 1)) \
+ if (__glibc_likely (ch == 0)) \
{ \
/* No - so look at the next input byte. */ \
ch = *inptr; \
@@ -127,9 +127,9 @@
if (ch < 0x80) \
{ \
/* Plain ISO646-JP character. */ \
- if (__builtin_expect (ch == 0x5c, 0)) \
+ if (__glibc_unlikely (ch == 0x5c)) \
ch = 0xa5; \
- else if (__builtin_expect (ch == 0x7e, 0)) \
+ else if (__glibc_unlikely (ch == 0x7e)) \
ch = 0x203e; \
++inptr; \
} \
@@ -144,7 +144,7 @@
/* Two byte character. */ \
uint32_t ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -154,7 +154,7 @@
ch2 = inptr[1]; \
\
/* The second byte must be in the range 0x{40..7E,80..FC}. */ \
- if (__builtin_expect (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc, 0))\
+ if (__glibc_unlikely (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -332,7 +332,7 @@ static const struct
if (len > 0) \
{ \
/* Output the combined character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -347,7 +347,7 @@ static const struct
\
not_combining: \
/* Output the buffered character. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -421,7 +421,7 @@ static const struct
} \
\
/* Output the shifted representation. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index 34df564201..b0eacd112a 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -4361,7 +4361,7 @@ static const char from_ucs4_extra[0x100][2] =
uint32_t ch2; \
uint_fast32_t idx; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second byte is not available. Store \
the intermediate result. */ \
@@ -4371,7 +4371,7 @@ static const char from_ucs4_extra[0x100][2] =
\
ch2 = inptr[1]; \
idx = ch * 256 + ch2; \
- if (__builtin_expect (ch2 < 0x40, 0)) \
+ if (__glibc_unlikely (ch2 < 0x40)) \
{ \
/* This is illegal. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -4398,7 +4398,7 @@ static const char from_ucs4_extra[0x100][2] =
else \
ch = cjk_block4[(ch - 0xe0) * 192 + ch2 - 0x40]; \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
@@ -4469,7 +4469,7 @@ static const char from_ucs4_extra[0x100][2] =
/* Now test for a possible second byte and write this if possible. */\
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/t.61.c b/iconvdata/t.61.c
index e820eb907c..e20ff863ff 100644
--- a/iconvdata/t.61.c
+++ b/iconvdata/t.61.c
@@ -390,7 +390,7 @@ static const char from_ucs4[][2] =
is also available. */ \
uint32_t ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -487,7 +487,7 @@ static const char from_ucs4[][2] =
/* Now test for a possible second byte and write this if possible. */ \
if (cp[1] != '\0') \
{ \
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
/* The result does not fit into the buffer. */ \
--outptr; \
diff --git a/iconvdata/tcvn5712-1.c b/iconvdata/tcvn5712-1.c
index 7a3ab455fa..21e1d4540a 100644
--- a/iconvdata/tcvn5712-1.c
+++ b/iconvdata/tcvn5712-1.c
@@ -64,7 +64,7 @@
{ \
if (FROM_DIRECTION) \
{ \
- if (__builtin_expect (outbuf + 4 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 4 <= outend)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf) = data->__statep->__count >> 3; \
@@ -652,7 +652,7 @@ static const struct
res = 0; \
} \
\
- if (__builtin_expect (res != 0, 1)) \
+ if (__glibc_likely (res != 0)) \
{ \
*outptr++ = res; \
inptr += 4; \
@@ -696,7 +696,7 @@ static const struct
} \
\
/* See whether we have room for two bytes. */ \
- if (__builtin_expect (outptr + 1 >= outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/tscii.c b/iconvdata/tscii.c
index e8363d12c9..8b98a0eaa2 100644
--- a/iconvdata/tscii.c
+++ b/iconvdata/tscii.c
@@ -90,7 +90,7 @@
{ \
do \
{ \
- if (__builtin_expect (outbuf + 4 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 4 > outend)) \
{ \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
@@ -108,10 +108,10 @@
else \
{ \
uint32_t last = data->__statep->__count >> 3; \
- if (__builtin_expect (last >> 8, 0)) \
+ if (__glibc_unlikely (last >> 8)) \
{ \
/* Write out the last character, two bytes. */ \
- if (__builtin_expect (outbuf + 2 <= outend, 1)) \
+ if (__glibc_likely (outbuf + 2 <= outend)) \
{ \
*outbuf++ = last & 0xff; \
*outbuf++ = (last >> 8) & 0xff; \
@@ -124,7 +124,7 @@
else \
{ \
/* Write out the last character, a single byte. */ \
- if (__builtin_expect (outbuf < outend, 1)) \
+ if (__glibc_likely (outbuf < outend)) \
{ \
*outbuf++ = last & 0xff; \
data->__statep->__count = 0; \
@@ -384,7 +384,7 @@ static const uint32_t tscii_next_state[6] =
/* See whether we have room for two characters. Otherwise \
store only the first character now, and put the second \
one into the queue. */ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = u2 << 8; \
result = __GCONV_FULL_OUTPUT; \
@@ -421,7 +421,7 @@ static const uint32_t tscii_next_state[6] =
inptr++; \
put32 (outptr, 0x0BB8); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BCD << 8) + (4 << 4); \
result = __GCONV_FULL_OUTPUT; \
@@ -429,7 +429,7 @@ static const uint32_t tscii_next_state[6] =
} \
put32 (outptr, 0x0BCD); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BB0 << 8) + (2 << 4); \
result = __GCONV_FULL_OUTPUT; \
@@ -437,7 +437,7 @@ static const uint32_t tscii_next_state[6] =
} \
put32 (outptr, 0x0BB0); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BC0 << 8); \
result = __GCONV_FULL_OUTPUT; \
@@ -454,7 +454,7 @@ static const uint32_t tscii_next_state[6] =
inptr++; \
put32 (outptr, 0x0B95); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BCD << 8) + (1 << 4); \
result = __GCONV_FULL_OUTPUT; \
@@ -462,7 +462,7 @@ static const uint32_t tscii_next_state[6] =
} \
put32 (outptr, 0x0BCD); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BB7 << 8); \
result = __GCONV_FULL_OUTPUT; \
@@ -479,7 +479,7 @@ static const uint32_t tscii_next_state[6] =
inptr++; \
put32 (outptr, 0x0B95); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BCD << 8) + (5 << 4); \
result = __GCONV_FULL_OUTPUT; \
@@ -487,7 +487,7 @@ static const uint32_t tscii_next_state[6] =
} \
put32 (outptr, 0x0BCD); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BB7 << 8) + (3 << 4); \
result = __GCONV_FULL_OUTPUT; \
@@ -495,7 +495,7 @@ static const uint32_t tscii_next_state[6] =
} \
put32 (outptr, 0x0BB7); \
outptr += 4; \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
*statep = (0x0BCD << 8); \
result = __GCONV_FULL_OUTPUT; \
@@ -592,7 +592,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BC6) \
{ \
- if (__builtin_expect (outptr + 2 <= outend, 1)) \
+ if (__glibc_likely (outptr + 2 <= outend)) \
{ \
*outptr++ = 0xa6; \
*outptr++ = last; \
@@ -608,7 +608,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BC7) \
{ \
- if (__builtin_expect (outptr + 2 <= outend, 1)) \
+ if (__glibc_likely (outptr + 2 <= outend)) \
{ \
*outptr++ = 0xa7; \
*outptr++ = last; \
@@ -624,7 +624,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BC8) \
{ \
- if (__builtin_expect (outptr + 2 <= outend, 1)) \
+ if (__glibc_likely (outptr + 2 <= outend)) \
{ \
*outptr++ = 0xa8; \
*outptr++ = last; \
@@ -640,7 +640,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BCA) \
{ \
- if (__builtin_expect (outptr + 3 <= outend, 1)) \
+ if (__glibc_likely (outptr + 3 <= outend)) \
{ \
*outptr++ = 0xa6; \
*outptr++ = last; \
@@ -657,7 +657,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BCB) \
{ \
- if (__builtin_expect (outptr + 3 <= outend, 1)) \
+ if (__glibc_likely (outptr + 3 <= outend)) \
{ \
*outptr++ = 0xa7; \
*outptr++ = last; \
@@ -674,7 +674,7 @@ static const uint8_t consonant_with_virama[18] =
} \
if (ch == 0x0BCC) \
{ \
- if (__builtin_expect (outptr + 3 <= outend, 1)) \
+ if (__glibc_likely (outptr + 3 <= outend)) \
{ \
*outptr++ = 0xa7; \
*outptr++ = last; \
@@ -771,9 +771,9 @@ static const uint8_t consonant_with_virama[18] =
} \
\
/* Output the buffered character. */ \
- if (__builtin_expect (last >> 8, 0)) \
+ if (__glibc_unlikely (last >> 8)) \
{ \
- if (__builtin_expect (outptr + 2 <= outend, 1)) \
+ if (__glibc_likely (outptr + 2 <= outend)) \
{ \
*outptr++ = last & 0xff; \
*outptr++ = (last >> 8) & 0xff; \
@@ -808,7 +808,7 @@ static const uint8_t consonant_with_virama[18] =
else if (ch >= 0x0BCA && ch <= 0x0BCC) \
{ \
/* See whether we have room for two bytes. */ \
- if (__builtin_expect (outptr + 2 <= outend, 1)) \
+ if (__glibc_likely (outptr + 2 <= outend)) \
{ \
*outptr++ = (ch == 0x0BCA ? 0xa6 : 0xa7); \
*outptr++ = (ch != 0x0BCC ? 0xa1 : 0xaa); \
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c
index 4f5e71486d..318c3492b3 100644
--- a/iconvdata/uhc.c
+++ b/iconvdata/uhc.c
@@ -3076,7 +3076,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
is also available. */ \
uint32_t ch2; \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -3123,7 +3123,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
? (ch - 0x81) * 178 \
: 5696 + (ch - 0xa1) * 84)]; \
\
- if (__builtin_expect (ch == 0, 0)) \
+ if (__glibc_unlikely (ch == 0)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
@@ -3173,7 +3173,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
{ \
const char *s = uhc_hangul_from_ucs[ch - 0xac00]; \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -3186,12 +3186,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
{ \
size_t written = ucs4_to_ksc5601_hanja (ch, outptr, outend - outptr); \
\
- if (__builtin_expect (written == 0, 0)) \
+ if (__glibc_unlikely (written == 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0)) \
+ if (__glibc_unlikely (written == __UNKNOWN_10646_CHAR)) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
@@ -3213,7 +3213,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
UNICODE_TAG_HANDLER (ch, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- if (__builtin_expect (written == 0, 0)) \
+ if (__glibc_unlikely (written == 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c
index 00d63ef338..ed74582bad 100644
--- a/iconvdata/unicode.c
+++ b/iconvdata/unicode.c
@@ -64,7 +64,7 @@
else if (!data->__internal_use && data->__invocation_counter == 0) \
{ \
/* Emit the Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 2 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 2 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put16u (outbuf, BOM); \
@@ -150,12 +150,12 @@ gconv_end (struct __gconv_step *data)
{ \
uint32_t c = get32 (inptr); \
\
- if (__builtin_expect (c >= 0x10000, 0)) \
+ if (__glibc_unlikely (c >= 0x10000)) \
{ \
UNICODE_TAG_HANDLER (c, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0)) \
+ else if (__glibc_unlikely (c >= 0xd800 && c < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this, because the UCS-2 output might be \
@@ -195,7 +195,7 @@ gconv_end (struct __gconv_step *data)
if (swap) \
u1 = bswap_16 (u1); \
\
- if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \
+ if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000)) \
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c
index 43be4be9c1..48edfa35f3 100644
--- a/iconvdata/utf-16.c
+++ b/iconvdata/utf-16.c
@@ -43,7 +43,7 @@
#define PREPARE_LOOP \
enum direction dir = ((struct utf16_data *) step->__data)->dir; \
enum variant var = ((struct utf16_data *) step->__data)->var; \
- if (__builtin_expect (data->__invocation_counter == 0, 0)) \
+ if (__glibc_unlikely (data->__invocation_counter == 0)) \
{ \
if (var == UTF_16) \
{ \
@@ -67,7 +67,7 @@
else if (!FROM_DIRECTION && !data->__internal_use) \
{ \
/* Emit the Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 2 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 2 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put16u (outbuf, BOM); \
@@ -200,7 +200,7 @@ gconv_end (struct __gconv_step *data)
{ \
uint32_t c = get32 (inptr); \
\
- if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0)) \
+ if (__glibc_unlikely (c >= 0xd800 && c < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this. If we let surrogates pass through, \
@@ -216,15 +216,15 @@ gconv_end (struct __gconv_step *data)
\
if (swap) \
{ \
- if (__builtin_expect (c >= 0x10000, 0)) \
+ if (__glibc_unlikely (c >= 0x10000)) \
{ \
- if (__builtin_expect (c >= 0x110000, 0)) \
+ if (__glibc_unlikely (c >= 0x110000)) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -240,15 +240,15 @@ gconv_end (struct __gconv_step *data)
} \
else \
{ \
- if (__builtin_expect (c >= 0x10000, 0)) \
+ if (__glibc_unlikely (c >= 0x10000)) \
{ \
- if (__builtin_expect (c >= 0x110000, 0)) \
+ if (__glibc_unlikely (c >= 0x110000)) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -296,7 +296,7 @@ gconv_end (struct __gconv_step *data)
\
/* It's a surrogate character. At least the first word says \
it is. */ \
- if (__builtin_expect (inptr + 4 > inend, 0)) \
+ if (__glibc_unlikely (inptr + 4 > inend)) \
{ \
/* We don't have enough input for another complete input \
character. */ \
@@ -330,7 +330,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* It's a surrogate character. At least the first word says \
it is. */ \
- if (__builtin_expect (inptr + 4 > inend, 0)) \
+ if (__glibc_unlikely (inptr + 4 > inend)) \
{ \
/* We don't have enough input for another complete input \
character. */ \
diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c
index f21f2be041..7705d47265 100644
--- a/iconvdata/utf-32.c
+++ b/iconvdata/utf-32.c
@@ -44,7 +44,7 @@
int swap; \
if (FROM_DIRECTION && var == UTF_32) \
{ \
- if (__builtin_expect (data->__invocation_counter == 0, 0)) \
+ if (__glibc_unlikely (data->__invocation_counter == 0)) \
{ \
/* We have to find out which byte order the file is encoded in. */ \
if (inptr + 4 > inend) \
@@ -65,7 +65,7 @@
&& data->__invocation_counter == 0) \
{ \
/* Emit the Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 4 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 4 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put32u (outbuf, BOM); \
@@ -196,11 +196,11 @@ gconv_end (struct __gconv_step *data)
{ \
uint32_t c = get32 (inptr); \
\
- if (__builtin_expect (c >= 0x110000, 0)) \
+ if (__glibc_unlikely (c >= 0x110000)) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0)) \
+ else if (__glibc_unlikely (c >= 0xd800 && c < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this. If we let surrogates pass through, \
@@ -238,7 +238,7 @@ gconv_end (struct __gconv_step *data)
if (swap) \
u1 = bswap_32 (u1); \
\
- if (__builtin_expect (u1 >= 0x110000, 0)) \
+ if (__glibc_unlikely (u1 >= 0x110000)) \
{ \
/* This is illegal. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (4); \
diff --git a/iconvdata/utf-7.c b/iconvdata/utf-7.c
index 17a9fea656..99c255e4cb 100644
--- a/iconvdata/utf-7.c
+++ b/iconvdata/utf-7.c
@@ -167,9 +167,9 @@ base64 (unsigned int i)
put32 (outptr, ch); \
outptr += 4; \
} \
- else if (__builtin_expect (ch == '+', 1)) \
+ else if (__glibc_likely (ch == '+')) \
{ \
- if (__builtin_expect (inptr + 2 > inend, 0)) \
+ if (__glibc_unlikely (inptr + 2 > inend)) \
{ \
/* Not enough input available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -340,7 +340,7 @@ base64 (unsigned int i)
else \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
\
- if (__builtin_expect (outptr + count > outend, 0)) \
+ if (__glibc_unlikely (outptr + count > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -381,7 +381,7 @@ base64 (unsigned int i)
size_t count; \
\
count = ((statep->__count & 0x18) >= 0x10) + isxbase64 (ch) + 1; \
- if (__builtin_expect (outptr + count > outend, 0)) \
+ if (__glibc_unlikely (outptr + count > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -405,7 +405,7 @@ base64 (unsigned int i)
else \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
\
- if (__builtin_expect (outptr + count > outend, 0)) \
+ if (__glibc_unlikely (outptr + count > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -509,7 +509,7 @@ base64 (unsigned int i)
/* Deactivate base64 encoding. */ \
size_t count = ((state & 0x18) >= 0x10) + 1; \
\
- if (__builtin_expect (outbuf + count > outend, 0)) \
+ if (__glibc_unlikely (outbuf + count > outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
diff --git a/include/atomic.h b/include/atomic.h
index 5a5319a582..3e82b6a777 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -375,7 +375,7 @@
do \
{ \
__atg11_oldval = *__atg11_memp; \
- if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ if (__glibc_unlikely (__atg11_oldval <= 0)) \
break; \
} \
while (__builtin_expect \
diff --git a/inet/inet6_option.c b/inet/inet6_option.c
index a828697a9c..d184ed9427 100644
--- a/inet/inet6_option.c
+++ b/inet/inet6_option.c
@@ -190,7 +190,7 @@ option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
int dsize = cmsg->cmsg_len - CMSG_LEN (0);
/* The first two bytes of the option are for the extended header. */
- if (__builtin_expect (dsize == 0, 0))
+ if (__glibc_unlikely (dsize == 0))
{
cmsg->cmsg_len += sizeof (struct ip6_ext);
dsize = sizeof (struct ip6_ext);
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index 20c37b2863..c3624961a8 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -158,12 +158,12 @@ set_binding_values (domainname, dirnamep, codesetp)
#else
size_t len = strlen (dirname) + 1;
result = (char *) malloc (len);
- if (__builtin_expect (result != NULL, 1))
+ if (__glibc_likely (result != NULL))
memcpy (result, dirname, len);
#endif
}
- if (__builtin_expect (result != NULL, 1))
+ if (__glibc_likely (result != NULL))
{
if (binding->dirname != _nl_default_dirname)
free (binding->dirname);
@@ -196,11 +196,11 @@ set_binding_values (domainname, dirnamep, codesetp)
#else
size_t len = strlen (codeset) + 1;
result = (char *) malloc (len);
- if (__builtin_expect (result != NULL, 1))
+ if (__glibc_likely (result != NULL))
memcpy (result, codeset, len);
#endif
- if (__builtin_expect (result != NULL, 1))
+ if (__glibc_likely (result != NULL))
{
free (binding->codeset);
@@ -228,7 +228,7 @@ set_binding_values (domainname, dirnamep, codesetp)
struct binding *new_binding =
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
- if (__builtin_expect (new_binding == NULL, 0))
+ if (__glibc_unlikely (new_binding == NULL))
goto failed;
memcpy (new_binding->domainname, domainname, len);
@@ -249,12 +249,12 @@ set_binding_values (domainname, dirnamep, codesetp)
char *result;
#if defined _LIBC || defined HAVE_STRDUP
result = strdup (dirname);
- if (__builtin_expect (result == NULL, 0))
+ if (__glibc_unlikely (result == NULL))
goto failed_dirname;
#else
size_t len = strlen (dirname) + 1;
result = (char *) malloc (len);
- if (__builtin_expect (result == NULL, 0))
+ if (__glibc_unlikely (result == NULL))
goto failed_dirname;
memcpy (result, dirname, len);
#endif
@@ -278,12 +278,12 @@ set_binding_values (domainname, dirnamep, codesetp)
#if defined _LIBC || defined HAVE_STRDUP
result = strdup (codeset);
- if (__builtin_expect (result == NULL, 0))
+ if (__glibc_unlikely (result == NULL))
goto failed_codeset;
#else
size_t len = strlen (codeset) + 1;
result = (char *) malloc (len);
- if (__builtin_expect (result == NULL, 0))
+ if (__glibc_unlikely (result == NULL))
goto failed_codeset;
memcpy (result, codeset, len);
#endif
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index f3d97fb0be..723dd7ef46 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -640,7 +640,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
/* Resource problems are not fatal, instead we return no
translation. */
- if (__builtin_expect (retval == (char *) -1, 0))
+ if (__glibc_unlikely (retval == (char *) -1))
goto no_translation;
if (retval != NULL)
@@ -654,7 +654,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
/* Returning -1 means that some resource problem exists
(likely memory) and that the strings could not be
converted. Return the original strings. */
- if (__builtin_expect (retval == (char *) -1, 0))
+ if (__glibc_unlikely (retval == (char *) -1))
goto no_translation;
if (retval != NULL)
@@ -904,7 +904,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
realloc (domain->conversions,
(nconversions + 1) * sizeof (struct converted_domain));
- if (__builtin_expect (new_conversions == NULL, 0))
+ if (__glibc_unlikely (new_conversions == NULL))
{
/* Nothing we can do, no more memory. We cannot use the
translation because it might be encoded incorrectly. */
@@ -917,7 +917,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
/* Copy the 'encoding' string to permanent storage. */
encoding = strdup (encoding);
- if (__builtin_expect (encoding == NULL, 0))
+ if (__glibc_unlikely (encoding == NULL))
/* Nothing we can do, no more memory. We cannot use the
translation because it might be encoded incorrectly. */
goto unlock_fail;
@@ -948,7 +948,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
/* Resource problems are fatal. If we continue onwards we will
only attempt to calloc a new conv_tab and fail later. */
- if (__builtin_expect (nullentry == (char *) -1, 0))
+ if (__glibc_unlikely (nullentry == (char *) -1))
return (char *) -1;
if (nullentry != NULL)
@@ -981,12 +981,12 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
charset = norm_add_slashes (charset, "");
int r = __gconv_open (outcharset, charset, &convd->conv,
GCONV_AVOID_NOCONV);
- if (__builtin_expect (r != __GCONV_OK, 0))
+ if (__glibc_unlikely (r != __GCONV_OK))
{
/* If the output encoding is the same there is
nothing to do. Otherwise do not use the
translation at all. */
- if (__builtin_expect (r != __GCONV_NULCONV, 1))
+ if (__glibc_likely (r != __GCONV_NULCONV))
{
__libc_rwlock_unlock (domain->conversions_lock);
free ((char *) encoding);
@@ -1053,7 +1053,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
handle this case by converting RESULTLEN bytes, including
NULs. */
- if (__builtin_expect (convd->conv_tab == NULL, 0))
+ if (__glibc_unlikely (convd->conv_tab == NULL))
{
__libc_lock_lock (lock);
if (convd->conv_tab == NULL)
@@ -1069,7 +1069,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
__libc_lock_unlock (lock);
}
- if (__builtin_expect (convd->conv_tab == (char **) -1, 0))
+ if (__glibc_unlikely (convd->conv_tab == (char **) -1))
/* Nothing we can do, no more memory. We cannot use the
translation because it might be encoded incorrectly. */
return (char *) -1;
@@ -1190,7 +1190,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
/* Fall through and return -1. */
# endif
}
- if (__builtin_expect (newmem == NULL, 0))
+ if (__glibc_unlikely (newmem == NULL))
{
freemem = NULL;
freemem_size = 0;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 18bd501139..b96a997819 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -829,7 +829,7 @@ _nl_load_domain (domain_file, domainbinding)
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
MAP_PRIVATE, fd, 0);
- if (__builtin_expect (data != MAP_FAILED, 1))
+ if (__glibc_likely (data != MAP_FAILED))
{
/* mmap() call was successful. */
close (fd);
@@ -1257,7 +1257,7 @@ _nl_load_domain (domain_file, domainbinding)
/* Get the header entry and look for a plural specification. */
nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
- if (__builtin_expect (nullentry == (char *) -1, 0))
+ if (__glibc_unlikely (nullentry == (char *) -1))
{
__libc_rwlock_fini (domain->conversions_lock);
goto invalid;
diff --git a/intl/localealias.c b/intl/localealias.c
index ef826c0dc9..9ab432885b 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -293,7 +293,7 @@ read_alias_file (fname, fname_len)
*cp++ = '\0';
if (nmap >= maxmap)
- if (__builtin_expect (extend_alias_table (), 0))
+ if (__glibc_unlikely (extend_alias_table ()))
goto out;
alias_len = strlen (alias) + 1;
@@ -309,7 +309,7 @@ read_alias_file (fname, fname_len)
if (new_pool == NULL)
goto out;
- if (__builtin_expect (string_space != new_pool, 0))
+ if (__glibc_unlikely (string_space != new_pool))
{
size_t i;
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index 3b66ec6bb6..79005773f9 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -103,7 +103,7 @@ _IO_file_doallocate (fp)
function it points to. This is to make sure _IO_cleanup gets called
on exit. We call it from _IO_file_doallocate, since that is likely
to get called by any program that does buffered I/O. */
- if (__builtin_expect (_IO_cleanup_registration_needed != NULL, 0))
+ if (__glibc_unlikely (_IO_cleanup_registration_needed != NULL))
(*_IO_cleanup_registration_needed) ();
#endif
diff --git a/libio/fileops.c b/libio/fileops.c
index 36bea49992..a3499be460 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -220,7 +220,7 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
{
int fdesc;
#ifdef _LIBC
- if (__builtin_expect (fp->_flags2 & _IO_FLAGS2_NOTCANCEL, 0))
+ if (__glibc_unlikely (fp->_flags2 & _IO_FLAGS2_NOTCANCEL))
fdesc = open_not_cancel (filename,
posix_mode | (is32not64 ? 0 : O_LARGEFILE), prot);
else
@@ -726,7 +726,7 @@ _IO_file_underflow_mmap (_IO_FILE *fp)
if (fp->_IO_read_ptr < fp->_IO_read_end)
return *(unsigned char *) fp->_IO_read_ptr;
- if (__builtin_expect (mmap_remap_check (fp), 0))
+ if (__glibc_unlikely (mmap_remap_check (fp)))
/* We punted to the regular file functions. */
return _IO_UNDERFLOW (fp);
@@ -836,7 +836,7 @@ _IO_new_file_overflow (f, ch)
makes room for subsequent output.
Otherwise, set the read pointers to _IO_read_end (leaving that
alone, so it can continue to correspond to the external position). */
- if (__builtin_expect (_IO_in_backup (f), 0))
+ if (__glibc_unlikely (_IO_in_backup (f)))
{
size_t nbackup = f->_IO_read_end - f->_IO_read_ptr;
_IO_free_backup_area (f);
@@ -1464,7 +1464,7 @@ _IO_file_xsgetn_mmap (fp, data, n)
if (have < n)
{
- if (__builtin_expect (_IO_in_backup (fp), 0))
+ if (__glibc_unlikely (_IO_in_backup (fp)))
{
#ifdef _LIBC
s = __mempcpy (s, read_ptr, have);
@@ -1481,7 +1481,7 @@ _IO_file_xsgetn_mmap (fp, data, n)
if (have < n)
{
/* Check that we are mapping all of the file, in case it grew. */
- if (__builtin_expect (mmap_remap_check (fp), 0))
+ if (__glibc_unlikely (mmap_remap_check (fp)))
/* We punted mmap, so complete with the vanilla code. */
return s - (char *) data + _IO_XSGETN (fp, data, n);
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index e370a8b9e7..aee26963a3 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -202,7 +202,7 @@ fmemopen (void *buf, size_t len, const char *mode)
cookie_io_functions_t iof;
fmemopen_cookie_t *c;
- if (__builtin_expect (len == 0, 0))
+ if (__glibc_unlikely (len == 0))
{
einval:
__set_errno (EINVAL);
@@ -228,7 +228,7 @@ fmemopen (void *buf, size_t len, const char *mode)
}
else
{
- if (__builtin_expect ((uintptr_t) len > -(uintptr_t) buf, 0))
+ if (__glibc_unlikely ((uintptr_t) len > -(uintptr_t) buf))
{
free (c);
goto einval;
diff --git a/libio/iofgets.c b/libio/iofgets.c
index bf7f84ad3e..1b708cad0d 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -39,7 +39,7 @@ _IO_fgets (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
index 128327e49b..b2d4d8fe2b 100644
--- a/libio/iofgets_u.c
+++ b/libio/iofgets_u.c
@@ -39,7 +39,7 @@ fgets_unlocked (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgetws.c b/libio/iofgetws.c
index 193c1a9946..fcbdda8765 100644
--- a/libio/iofgetws.c
+++ b/libio/iofgetws.c
@@ -39,7 +39,7 @@ fgetws (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgetws_u.c b/libio/iofgetws_u.c
index 14c4898ea2..1126d7bd3b 100644
--- a/libio/iofgetws_u.c
+++ b/libio/iofgetws_u.c
@@ -39,7 +39,7 @@ fgetws_unlocked (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index e2e0b0775e..a817050d8f 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -89,7 +89,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len);
if (t != NULL)
len = (t - fp->_IO_read_ptr) + 1;
- if (__builtin_expect (len >= SSIZE_MAX - cur_len, 0))
+ if (__glibc_unlikely (len >= SSIZE_MAX - cur_len))
{
__set_errno (EOVERFLOW);
result = -1;
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 877fc1f829..9cebe77126 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -123,7 +123,7 @@ _IO_wfile_underflow (fp)
enum __codecvt_result status;
_IO_ssize_t count;
- if (__builtin_expect (fp->_flags & _IO_NO_READS, 0))
+ if (__glibc_unlikely (fp->_flags & _IO_NO_READS))
{
fp->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
@@ -264,7 +264,7 @@ _IO_wfile_underflow (fp)
const char *from = fp->_IO_read_ptr;
const char *to = fp->_IO_read_end;
size_t to_copy = count;
- if (__builtin_expect (naccbuf != 0, 0))
+ if (__glibc_unlikely (naccbuf != 0))
{
to_copy = MIN (sizeof (accbuf) - naccbuf, count);
to = __mempcpy (&accbuf[naccbuf], from, to_copy);
@@ -277,7 +277,7 @@ _IO_wfile_underflow (fp)
fp->_wide_data->_IO_buf_end,
&fp->_wide_data->_IO_read_end);
- if (__builtin_expect (naccbuf != 0, 0))
+ if (__glibc_unlikely (naccbuf != 0))
fp->_IO_read_ptr += MAX (0, read_ptr_copy - &accbuf[naccbuf - to_copy]);
else
fp->_IO_read_ptr = (char *) read_ptr_copy;
@@ -341,7 +341,7 @@ _IO_wfile_underflow_mmap (_IO_FILE *fp)
struct _IO_codecvt *cd;
const char *read_stop;
- if (__builtin_expect (fp->_flags & _IO_NO_READS, 0))
+ if (__glibc_unlikely (fp->_flags & _IO_NO_READS))
{
fp->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
@@ -581,7 +581,7 @@ adjust_wide_data (_IO_FILE *fp, bool do_convert)
&fp->_wide_data->_IO_read_end);
/* Should we return EILSEQ? */
- if (__builtin_expect (status == __codecvt_error, 0))
+ if (__glibc_unlikely (status == __codecvt_error))
{
fp->_flags |= _IO_ERR_SEEN;
return -1;
@@ -755,7 +755,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
/* If there was an error, then return WEOF.
TODO: set buffer state. */
- if (__builtin_expect (status == __codecvt_error, 0))
+ if (__glibc_unlikely (status == __codecvt_error))
return WEOF;
}
while (delta > 0);
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 0c42b99251..bbaf708017 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -101,11 +101,11 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
/* We really have to load some data. First we try the archive,
but only if there was no LOCPATH environment variable specified. */
- if (__builtin_expect (locale_path == NULL, 1))
+ if (__glibc_likely (locale_path == NULL))
{
struct __locale_data *data
= _nl_load_locale_from_archive (category, name);
- if (__builtin_expect (data != NULL, 1))
+ if (__glibc_likely (data != NULL))
return data;
/* Nothing in the archive. Set the default path to search below. */
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index e14535e7c0..22ac90d139 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -263,7 +263,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
}
/* If there is no archive or it cannot be loaded for some reason fail. */
- if (__builtin_expect (headmap.ptr == NULL, 0))
+ if (__glibc_unlikely (headmap.ptr == NULL))
goto close_and_out;
/* We have the archive available. To find the name we first have to
@@ -459,11 +459,11 @@ _nl_load_locale_from_archive (int category, const char **namep)
Now we need the expected data structures to point into the data. */
lia = malloc (sizeof *lia);
- if (__builtin_expect (lia == NULL, 0))
+ if (__glibc_unlikely (lia == NULL))
return NULL;
lia->name = strdup (*namep);
- if (__builtin_expect (lia->name == NULL, 0))
+ if (__glibc_unlikely (lia->name == NULL))
{
free (lia);
return NULL;
@@ -478,7 +478,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
lia->data[cnt] = _nl_intern_locale_data (cnt,
results[cnt].addr,
results[cnt].len);
- if (__builtin_expect (lia->data[cnt] != NULL, 1))
+ if (__glibc_likely (lia->data[cnt] != NULL))
{
/* _nl_intern_locale_data leaves us these fields to initialize. */
lia->data[cnt]->alloc = ld_archive;
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index f926036208..13eecea4e5 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -107,7 +107,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
for (cnt = 0; cnt < newdata->nstrings; ++cnt)
{
size_t idx = filedata->strindex[cnt];
- if (__builtin_expect (idx > (size_t) newdata->filesize, 0))
+ if (__glibc_unlikely (idx > (size_t) newdata->filesize))
{
puntdata:
free (newdata);
@@ -183,7 +183,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
close_not_cancel_no_status (fd);
return;
}
- if (__builtin_expect (S_ISDIR (st.st_mode), 0))
+ if (__glibc_unlikely (S_ISDIR (st.st_mode)))
{
/* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo
instead. */
@@ -221,7 +221,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
# endif
filedata = __mmap ((caddr_t) 0, st.st_size,
PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
- if (__builtin_expect (filedata == MAP_FAILED, 0))
+ if (__glibc_unlikely (filedata == MAP_FAILED))
{
filedata = NULL;
if (__builtin_expect (errno, ENOSYS) == ENOSYS)
@@ -258,12 +258,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
/* We have mapped the data, so we no longer need the descriptor. */
close_not_cancel_no_status (fd);
- if (__builtin_expect (filedata == NULL, 0))
+ if (__glibc_unlikely (filedata == NULL))
/* We failed to map or read the data. */
return;
newdata = _nl_intern_locale_data (category, filedata, st.st_size);
- if (__builtin_expect (newdata == NULL, 0))
+ if (__glibc_unlikely (newdata == NULL))
/* Bad data. */
{
#ifdef _POSIX_MAPPED_FILES
diff --git a/locale/setlocale.c b/locale/setlocale.c
index b70fa6cbce..94584683f7 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -278,7 +278,7 @@ setlocale (int category, const char *locale)
if (category != LC_ALL)
newnames[category] = (char *) locale;
- if (__builtin_expect (strchr (locale, ';') != NULL, 0))
+ if (__glibc_unlikely (strchr (locale, ';') != NULL))
{
/* This is a composite name. Make a copy and split it up. */
char *np = strdupa (locale);
diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c
index f33f603adf..55f1027004 100644
--- a/login/programs/pt_chown.c
+++ b/login/programs/pt_chown.c
@@ -170,7 +170,7 @@ main (int argc, char *argv[])
cap_free (caps);
- if (__builtin_expect (res != 0, 0))
+ if (__glibc_unlikely (res != 0))
return FAIL_EXEC;
}
#endif
diff --git a/malloc/arena.c b/malloc/arena.c
index 71678a9dc4..60ae9a4c31 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -376,7 +376,7 @@ ptmalloc_init (void)
tsd_setspecific (arena_key, (void *) &main_arena);
thread_atfork (ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_unlock_all2);
const char *s = NULL;
- if (__builtin_expect (_environ != NULL, 1))
+ if (__glibc_likely (_environ != NULL))
{
char **runp = _environ;
char *envline;
@@ -624,7 +624,7 @@ shrink_heap (heap_info *h, long diff)
/* Try to re-map the extra heap space freshly to save memory, and make it
inaccessible. See malloc-sysdep.h to know when this is true. */
- if (__builtin_expect (check_may_shrink_heap (), 0))
+ if (__glibc_unlikely (check_may_shrink_heap ()))
{
if ((char *) MMAP ((char *) h + new_size, diff, PROT_NONE,
MAP_FIXED) == (char *) MAP_FAILED)
@@ -863,12 +863,12 @@ arena_get2 (mstate a_tsd, size_t size, mstate avoid_arena)
narenas_limit is 0. There is no possibility for narenas to
be too big for the test to always fail since there is not
enough address space to create that many arenas. */
- if (__builtin_expect (n <= narenas_limit - 1, 0))
+ if (__glibc_unlikely (n <= narenas_limit - 1))
{
if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
goto repeat;
a = _int_new_arena (size);
- if (__builtin_expect (a == NULL, 0))
+ if (__glibc_unlikely (a == NULL))
catomic_decrement (&narenas);
}
else
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4f209995ad..9a45707ee7 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3368,7 +3368,7 @@ _int_malloc (mstate av, size_t bytes)
else
{
bck = victim->bk;
- if (__builtin_expect (bck->fd != victim, 0))
+ if (__glibc_unlikely (bck->fd != victim))
{
errstr = "malloc(): smallbin double linked list corrupted";
goto errout;
@@ -3591,7 +3591,7 @@ _int_malloc (mstate av, size_t bytes)
have to perform a complete insert here. */
bck = unsorted_chunks (av);
fwd = bck->fd;
- if (__builtin_expect (fwd->bk != bck, 0))
+ if (__glibc_unlikely (fwd->bk != bck))
{
errstr = "malloc(): corrupted unsorted chunks";
goto errout;
@@ -3698,7 +3698,7 @@ _int_malloc (mstate av, size_t bytes)
have to perform a complete insert here. */
bck = unsorted_chunks (av);
fwd = bck->fd;
- if (__builtin_expect (fwd->bk != bck, 0))
+ if (__glibc_unlikely (fwd->bk != bck))
{
errstr = "malloc(): corrupted unsorted chunks 2";
goto errout;
@@ -3824,7 +3824,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
}
/* We know that each chunk is at least MINSIZE bytes in size or a
multiple of MALLOC_ALIGNMENT. */
- if (__builtin_expect (size < MINSIZE || !aligned_OK (size), 0))
+ if (__glibc_unlikely (size < MINSIZE || !aligned_OK (size)))
{
errstr = "free(): invalid size";
goto errout;
@@ -3922,7 +3922,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
/* Lightweight tests: check whether the block is already the
top block. */
- if (__builtin_expect (p == av->top, 0))
+ if (__glibc_unlikely (p == av->top))
{
errstr = "double free or corruption (top)";
goto errout;
@@ -3936,7 +3936,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
goto errout;
}
/* Or whether the block is actually not marked used. */
- if (__builtin_expect (!prev_inuse(nextchunk), 0))
+ if (__glibc_unlikely (!prev_inuse(nextchunk)))
{
errstr = "double free or corruption (!prev)";
goto errout;
@@ -3979,7 +3979,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
bck = unsorted_chunks(av);
fwd = bck->fd;
- if (__builtin_expect (fwd->bk != bck, 0))
+ if (__glibc_unlikely (fwd->bk != bck))
{
errstr = "free(): corrupted unsorted chunks";
goto errout;
diff --git a/malloc/memusage.c b/malloc/memusage.c
index bfbaecc289..bd8bcd9db0 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -137,20 +137,20 @@ update_data (struct header *result, size_t len, size_t old_len)
value. The base stack pointer might not be set if this is not
the main thread and it is the first call to any of these
functions. */
- if (__builtin_expect (!start_sp, 0))
+ if (__glibc_unlikely (!start_sp))
start_sp = GETSP ();
uintptr_t sp = GETSP ();
#ifdef STACK_GROWS_UPWARD
/* This can happen in threads where we didn't catch the thread's
stack early enough. */
- if (__builtin_expect (sp < start_sp, 0))
+ if (__glibc_unlikely (sp < start_sp))
start_sp = sp;
size_t current_stack = sp - start_sp;
#else
/* This can happen in threads where we didn't catch the thread's
stack early enough. */
- if (__builtin_expect (sp > start_sp, 0))
+ if (__glibc_unlikely (sp > start_sp))
start_sp = sp;
size_t current_stack = start_sp - sp;
#endif
@@ -330,7 +330,7 @@ malloc (size_t len)
struct header *result = NULL;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -382,7 +382,7 @@ realloc (void *old, size_t len)
size_t old_len;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -476,7 +476,7 @@ calloc (size_t n, size_t len)
size_t size = n * len;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -526,7 +526,7 @@ free (void *ptr)
struct header *real;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return;
@@ -578,7 +578,7 @@ mmap (void *start, size_t len, int prot, int flags, int fd, off_t offset)
void *result = NULL;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -631,7 +631,7 @@ mmap64 (void *start, size_t len, int prot, int flags, int fd, off64_t offset)
void *result = NULL;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -689,7 +689,7 @@ mremap (void *start, size_t old_len, size_t len, int flags, ...)
va_end (ap);
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return NULL;
@@ -750,7 +750,7 @@ munmap (void *start, size_t len)
int result;
/* Determine real implementation if not already happened. */
- if (__builtin_expect (initialized <= 0, 0))
+ if (__glibc_unlikely (initialized <= 0))
{
if (initialized == -1)
return -1;
@@ -766,7 +766,7 @@ munmap (void *start, size_t len)
/* Keep track of number of calls. */
catomic_increment (&calls[idx_munmap]);
- if (__builtin_expect (result == 0, 1))
+ if (__glibc_likely (result == 0))
{
/* Keep track of total memory freed using `free'. */
catomic_add (&total[idx_munmap], len);
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index 0bea7726af..c0edfbe2a3 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -23,7 +23,7 @@
long double
__ieee754_exp2l (long double x)
{
- if (__builtin_expect (isless (x, (long double) LDBL_MAX_EXP), 1))
+ if (__glibc_likely (isless (x, (long double) LDBL_MAX_EXP)))
{
if (__builtin_expect (isgreaterequal (x, (long double) (LDBL_MIN_EXP
- LDBL_MANT_DIG
diff --git a/math/e_scalb.c b/math/e_scalb.c
index 487f4413c2..bddedfa032 100644
--- a/math/e_scalb.c
+++ b/math/e_scalb.c
@@ -40,9 +40,9 @@ invalid_fn (double x, double fn)
double
__ieee754_scalb (double x, double fn)
{
- if (__builtin_expect (__isnan (x), 0))
+ if (__glibc_unlikely (__isnan (x)))
return x * fn;
- if (__builtin_expect (!__finite (fn), 0))
+ if (__glibc_unlikely (!__finite (fn)))
{
if (__isnan (fn) || fn > 0.0)
return x * fn;
@@ -50,7 +50,7 @@ __ieee754_scalb (double x, double fn)
return x;
return x / -fn;
}
- if (__builtin_expect ((double) (int) fn != fn, 0))
+ if (__glibc_unlikely ((double) (int) fn != fn))
return invalid_fn (x, fn);
return __scalbn (x, (int) fn);
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
index 68e6c5fcce..319752c993 100644
--- a/math/e_scalbf.c
+++ b/math/e_scalbf.c
@@ -40,9 +40,9 @@ invalid_fn (float x, float fn)
float
__ieee754_scalbf (float x, float fn)
{
- if (__builtin_expect (__isnanf (x), 0))
+ if (__glibc_unlikely (__isnanf (x)))
return x * fn;
- if (__builtin_expect (!__finitef (fn), 0))
+ if (__glibc_unlikely (!__finitef (fn)))
{
if (__isnanf (fn) || fn > 0.0f)
return x * fn;
@@ -50,7 +50,7 @@ __ieee754_scalbf (float x, float fn)
return x;
return x / -fn;
}
- if (__builtin_expect ((float) (int) fn != fn, 0))
+ if (__glibc_unlikely ((float) (int) fn != fn))
return invalid_fn (x, fn);
return __scalbnf (x, (int) fn);
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
index 256e7b131f..5815a0d67b 100644
--- a/math/e_scalbl.c
+++ b/math/e_scalbl.c
@@ -40,9 +40,9 @@ invalid_fn (long double x, long double fn)
long double
__ieee754_scalbl (long double x, long double fn)
{
- if (__builtin_expect (__isnanl (x), 0))
+ if (__glibc_unlikely (__isnanl (x)))
return x * fn;
- if (__builtin_expect (!__finitel (fn), 0))
+ if (__glibc_unlikely (!__finitel (fn)))
{
if (__isnanl (fn) || fn > 0.0L)
return x * fn;
@@ -50,7 +50,7 @@ __ieee754_scalbl (long double x, long double fn)
return x;
return x / -fn;
}
- if (__builtin_expect ((long double) (int) fn != fn, 0))
+ if (__glibc_unlikely ((long double) (int) fn != fn))
return invalid_fn (x, fn);
return __scalbnl (x, (int) fn);
diff --git a/math/s_catan.c b/math/s_catan.c
index 87cdd31295..d6552d8b7c 100644
--- a/math/s_catan.c
+++ b/math/s_catan.c
@@ -29,7 +29,7 @@ __catan (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (rcls == FP_INFINITE)
{
@@ -55,7 +55,7 @@ __catan (__complex__ double x)
__imag__ res = __nan ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_catanf.c b/math/s_catanf.c
index 80a34744e1..41e419d8b0 100644
--- a/math/s_catanf.c
+++ b/math/s_catanf.c
@@ -29,7 +29,7 @@ __catanf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (rcls == FP_INFINITE)
{
@@ -55,7 +55,7 @@ __catanf (__complex__ float x)
__imag__ res = __nanf ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_catanh.c b/math/s_catanh.c
index 0c8b268418..2ba1298bb6 100644
--- a/math/s_catanh.c
+++ b/math/s_catanh.c
@@ -29,7 +29,7 @@ __catanh (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -50,7 +50,7 @@ __catanh (__complex__ double x)
__imag__ res = __nan ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_catanhf.c b/math/s_catanhf.c
index ebb7b8232d..0ee69a5ba0 100644
--- a/math/s_catanhf.c
+++ b/math/s_catanhf.c
@@ -29,7 +29,7 @@ __catanhf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -50,7 +50,7 @@ __catanhf (__complex__ float x)
__imag__ res = __nanf ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_catanhl.c b/math/s_catanhl.c
index d45f1d1986..537bb3e28d 100644
--- a/math/s_catanhl.c
+++ b/math/s_catanhl.c
@@ -36,7 +36,7 @@ __catanhl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -57,7 +57,7 @@ __catanhl (__complex__ long double x)
__imag__ res = __nanl ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_catanl.c b/math/s_catanl.c
index 32a4424962..cea9282a54 100644
--- a/math/s_catanl.c
+++ b/math/s_catanl.c
@@ -36,7 +36,7 @@ __catanl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (rcls == FP_INFINITE)
{
@@ -62,7 +62,7 @@ __catanl (__complex__ long double x)
__imag__ res = __nanl ("");
}
}
- else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
res = x;
}
diff --git a/math/s_ccosh.c b/math/s_ccosh.c
index 3ee40b1153..a3b93271f0 100644
--- a/math/s_ccosh.c
+++ b/math/s_ccosh.c
@@ -30,16 +30,16 @@ __ccosh (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
@@ -108,12 +108,12 @@ __ccosh (__complex__ double x)
else if (rcls == FP_INFINITE)
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_ccoshf.c b/math/s_ccoshf.c
index 4a9e94d004..084fc6d650 100644
--- a/math/s_ccoshf.c
+++ b/math/s_ccoshf.c
@@ -30,16 +30,16 @@ __ccoshf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
@@ -105,15 +105,15 @@ __ccoshf (__complex__ float x)
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_ccoshl.c b/math/s_ccoshl.c
index bb79aad28e..e958c496d3 100644
--- a/math/s_ccoshl.c
+++ b/math/s_ccoshl.c
@@ -30,16 +30,16 @@ __ccoshl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
@@ -105,15 +105,15 @@ __ccoshl (__complex__ long double x)
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_cexp.c b/math/s_cexp.c
index dcb3228b99..a636e35dc4 100644
--- a/math/s_cexp.c
+++ b/math/s_cexp.c
@@ -30,16 +30,16 @@ __cexp (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
@@ -97,10 +97,10 @@ __cexp (__complex__ double x)
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
@@ -115,7 +115,7 @@ __cexp (__complex__ double x)
{
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_cexpf.c b/math/s_cexpf.c
index 8bfc7e251d..d0cdf79786 100644
--- a/math/s_cexpf.c
+++ b/math/s_cexpf.c
@@ -30,16 +30,16 @@ __cexpf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
@@ -97,10 +97,10 @@ __cexpf (__complex__ float x)
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
@@ -115,7 +115,7 @@ __cexpf (__complex__ float x)
{
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_cexpl.c b/math/s_cexpl.c
index bd5572db88..3b64fd181a 100644
--- a/math/s_cexpl.c
+++ b/math/s_cexpl.c
@@ -30,16 +30,16 @@ __cexpl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
@@ -97,10 +97,10 @@ __cexpl (__complex__ long double x)
feraiseexcept (FE_INVALID);
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
@@ -115,7 +115,7 @@ __cexpl (__complex__ long double x)
{
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_clog.c b/math/s_clog.c
index e2b5846f2f..8639868bbf 100644
--- a/math/s_clog.c
+++ b/math/s_clog.c
@@ -29,7 +29,7 @@ __clog (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -37,7 +37,7 @@ __clog (__complex__ double x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabs (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
double absx = fabs (__real__ x), absy = fabs (__imag__ x);
diff --git a/math/s_clog10.c b/math/s_clog10.c
index 0274db3617..417d56186c 100644
--- a/math/s_clog10.c
+++ b/math/s_clog10.c
@@ -32,7 +32,7 @@ __clog10 (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -40,7 +40,7 @@ __clog10 (__complex__ double x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabs (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
double absx = fabs (__real__ x), absy = fabs (__imag__ x);
diff --git a/math/s_clog10f.c b/math/s_clog10f.c
index dc676b23fc..a9120e03f8 100644
--- a/math/s_clog10f.c
+++ b/math/s_clog10f.c
@@ -32,7 +32,7 @@ __clog10f (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -40,7 +40,7 @@ __clog10f (__complex__ float x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabsf (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
diff --git a/math/s_clog10l.c b/math/s_clog10l.c
index f7c3ec43a3..ac33a8f140 100644
--- a/math/s_clog10l.c
+++ b/math/s_clog10l.c
@@ -39,7 +39,7 @@ __clog10l (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
@@ -47,7 +47,7 @@ __clog10l (__complex__ long double x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabsl (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
diff --git a/math/s_clogf.c b/math/s_clogf.c
index 73c2928116..79117df622 100644
--- a/math/s_clogf.c
+++ b/math/s_clogf.c
@@ -29,7 +29,7 @@ __clogf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -37,7 +37,7 @@ __clogf (__complex__ float x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabsf (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
diff --git a/math/s_clogl.c b/math/s_clogl.c
index ec2ff84036..bdf82c155a 100644
--- a/math/s_clogl.c
+++ b/math/s_clogl.c
@@ -36,7 +36,7 @@ __clogl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
{
/* Real and imaginary part are 0.0. */
__imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
@@ -44,7 +44,7 @@ __clogl (__complex__ long double x)
/* Yes, the following line raises an exception. */
__real__ result = -1.0 / fabsl (__real__ x);
}
- else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
{
/* Neither real nor imaginary part is NaN. */
long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
diff --git a/math/s_csin.c b/math/s_csin.c
index 48a4a901ab..b4c8a1b2cf 100644
--- a/math/s_csin.c
+++ b/math/s_csin.c
@@ -33,16 +33,16 @@ __csin (__complex__ double x)
__real__ x = fabs (__real__ x);
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincos (__real__ x, &sinix, &cosix);
}
@@ -136,7 +136,7 @@ __csin (__complex__ double x)
/* Real part is finite. */
double sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincos (__real__ x, &sinix, &cosix);
}
diff --git a/math/s_csinf.c b/math/s_csinf.c
index 26c4bb0a2f..1faefd1df6 100644
--- a/math/s_csinf.c
+++ b/math/s_csinf.c
@@ -33,16 +33,16 @@ __csinf (__complex__ float x)
__real__ x = fabsf (__real__ x);
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
float sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincosf (__real__ x, &sinix, &cosix);
}
@@ -136,7 +136,7 @@ __csinf (__complex__ float x)
/* Real part is finite. */
float sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincosf (__real__ x, &sinix, &cosix);
}
diff --git a/math/s_csinh.c b/math/s_csinh.c
index 3fc737b493..428add6c85 100644
--- a/math/s_csinh.c
+++ b/math/s_csinh.c
@@ -33,16 +33,16 @@ __csinh (__complex__ double x)
__real__ x = fabs (__real__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
@@ -125,12 +125,12 @@ __csinh (__complex__ double x)
else if (rcls == FP_INFINITE)
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_csinhf.c b/math/s_csinhf.c
index 081c7592d6..d31f705a51 100644
--- a/math/s_csinhf.c
+++ b/math/s_csinhf.c
@@ -33,16 +33,16 @@ __csinhf (__complex__ float x)
__real__ x = fabsf (__real__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
@@ -122,15 +122,15 @@ __csinhf (__complex__ float x)
}
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
float sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_csinhl.c b/math/s_csinhl.c
index 3c4ba0d617..c6e58f1a0d 100644
--- a/math/s_csinhl.c
+++ b/math/s_csinhl.c
@@ -33,16 +33,16 @@ __csinhl (__complex__ long double x)
__real__ x = fabsl (__real__ x);
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
@@ -122,15 +122,15 @@ __csinhl (__complex__ long double x)
}
}
}
- else if (__builtin_expect (rcls == FP_INFINITE, 1))
+ else if (__glibc_likely (rcls == FP_INFINITE))
{
/* Real part is infinite. */
- if (__builtin_expect (icls > FP_ZERO, 1))
+ if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
long double sinix, cosix;
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_csinl.c b/math/s_csinl.c
index 5ae8969aac..a3316d3470 100644
--- a/math/s_csinl.c
+++ b/math/s_csinl.c
@@ -33,16 +33,16 @@ __csinl (__complex__ long double x)
__real__ x = fabsl (__real__ x);
- if (__builtin_expect (icls >= FP_ZERO, 1))
+ if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
- if (__builtin_expect (rcls >= FP_ZERO, 1))
+ if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
long double sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincosl (__real__ x, &sinix, &cosix);
}
@@ -136,7 +136,7 @@ __csinl (__complex__ long double x)
/* Real part is finite. */
long double sinix, cosix;
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincosl (__real__ x, &sinix, &cosix);
}
diff --git a/math/s_csqrt.c b/math/s_csqrt.c
index 2bbd2b8adf..a19bb34a81 100644
--- a/math/s_csqrt.c
+++ b/math/s_csqrt.c
@@ -30,7 +30,7 @@ __csqrt (__complex__ double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -59,7 +59,7 @@ __csqrt (__complex__ double x)
}
else
{
- if (__builtin_expect (icls == FP_ZERO, 0))
+ if (__glibc_unlikely (icls == FP_ZERO))
{
if (__real__ x < 0.0)
{
@@ -73,7 +73,7 @@ __csqrt (__complex__ double x)
__imag__ res = __copysign (0.0, __imag__ x);
}
}
- else if (__builtin_expect (rcls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO))
{
double r;
if (fabs (__imag__ x) >= 2.0 * DBL_MIN)
diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c
index b2a11dec81..1c22df84c1 100644
--- a/math/s_csqrtf.c
+++ b/math/s_csqrtf.c
@@ -30,7 +30,7 @@ __csqrtf (__complex__ float x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -59,7 +59,7 @@ __csqrtf (__complex__ float x)
}
else
{
- if (__builtin_expect (icls == FP_ZERO, 0))
+ if (__glibc_unlikely (icls == FP_ZERO))
{
if (__real__ x < 0.0)
{
@@ -73,7 +73,7 @@ __csqrtf (__complex__ float x)
__imag__ res = __copysignf (0.0, __imag__ x);
}
}
- else if (__builtin_expect (rcls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO))
{
float r;
if (fabsf (__imag__ x) >= 2.0f * FLT_MIN)
diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c
index a72bac1835..2dab3dbaab 100644
--- a/math/s_csqrtl.c
+++ b/math/s_csqrtl.c
@@ -30,7 +30,7 @@ __csqrtl (__complex__ long double x)
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
{
if (icls == FP_INFINITE)
{
@@ -59,7 +59,7 @@ __csqrtl (__complex__ long double x)
}
else
{
- if (__builtin_expect (icls == FP_ZERO, 0))
+ if (__glibc_unlikely (icls == FP_ZERO))
{
if (__real__ x < 0.0)
{
@@ -73,7 +73,7 @@ __csqrtl (__complex__ long double x)
__imag__ res = __copysignl (0.0, __imag__ x);
}
}
- else if (__builtin_expect (rcls == FP_ZERO, 0))
+ else if (__glibc_unlikely (rcls == FP_ZERO))
{
long double r;
if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN)
diff --git a/math/s_ctan.c b/math/s_ctan.c
index 6fed4fe465..407ff5a7fc 100644
--- a/math/s_ctan.c
+++ b/math/s_ctan.c
@@ -28,7 +28,7 @@ __ctan (__complex__ double x)
{
__complex__ double res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_ns (__imag__ x))
{
@@ -58,7 +58,7 @@ __ctan (__complex__ double x)
/* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
= (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincos (__real__ x, &sinrx, &cosrx);
}
diff --git a/math/s_ctanf.c b/math/s_ctanf.c
index a2343dd54e..e6f345a231 100644
--- a/math/s_ctanf.c
+++ b/math/s_ctanf.c
@@ -28,7 +28,7 @@ __ctanf (__complex__ float x)
{
__complex__ float res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_nsf (__imag__ x))
{
@@ -57,7 +57,7 @@ __ctanf (__complex__ float x)
/* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
= (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
- if (__builtin_expect (fpclassify(__real__ x) != FP_SUBNORMAL, 1))
+ if (__glibc_likely (fpclassify(__real__ x) != FP_SUBNORMAL))
{
__sincosf (__real__ x, &sinrx, &cosrx);
}
diff --git a/math/s_ctanh.c b/math/s_ctanh.c
index 0ca35e0990..be3e47e45f 100644
--- a/math/s_ctanh.c
+++ b/math/s_ctanh.c
@@ -28,7 +28,7 @@ __ctanh (__complex__ double x)
{
__complex__ double res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_ns (__real__ x))
{
@@ -58,7 +58,7 @@ __ctanh (__complex__ double x)
/* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
= (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2). */
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincos (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c
index 8938d70186..39a335ef2d 100644
--- a/math/s_ctanhf.c
+++ b/math/s_ctanhf.c
@@ -28,7 +28,7 @@ __ctanhf (__complex__ float x)
{
__complex__ float res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_nsf (__real__ x))
{
@@ -57,7 +57,7 @@ __ctanhf (__complex__ float x)
/* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
= (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2). */
- if (__builtin_expect (fpclassify(__imag__ x) != FP_SUBNORMAL, 1))
+ if (__glibc_likely (fpclassify(__imag__ x) != FP_SUBNORMAL))
{
__sincosf (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index 098e009184..64e448baa8 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -28,7 +28,7 @@ __ctanhl (__complex__ long double x)
{
__complex__ long double res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_nsl (__real__ x))
{
@@ -58,7 +58,7 @@ __ctanhl (__complex__ long double x)
/* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
= (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2). */
- if (__builtin_expect (icls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (icls != FP_SUBNORMAL))
{
__sincosl (__imag__ x, &sinix, &cosix);
}
diff --git a/math/s_ctanl.c b/math/s_ctanl.c
index 98fdac0c8d..282febdd89 100644
--- a/math/s_ctanl.c
+++ b/math/s_ctanl.c
@@ -28,7 +28,7 @@ __ctanl (__complex__ long double x)
{
__complex__ long double res;
- if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
+ if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (__isinf_nsl (__imag__ x))
{
@@ -58,7 +58,7 @@ __ctanl (__complex__ long double x)
/* tan(x+iy) = (sin(2x) + i*sinh(2y))/(cos(2x) + cosh(2y))
= (sin(x)*cos(x) + i*sinh(y)*cosh(y)/(cos(x)^2 + sinh(y)^2). */
- if (__builtin_expect (rcls != FP_SUBNORMAL, 1))
+ if (__glibc_likely (rcls != FP_SUBNORMAL))
{
__sincosl (__real__ x, &sinrx, &cosrx);
}
diff --git a/math/w_pow.c b/math/w_pow.c
index 713d7a8719..26790b91d8 100644
--- a/math/w_pow.c
+++ b/math/w_pow.c
@@ -25,7 +25,7 @@ double
__pow (double x, double y)
{
double z = __ieee754_pow (x, y);
- if (__builtin_expect (!__finite (z), 0))
+ if (__glibc_unlikely (!__finite (z)))
{
if (_LIB_VERSION != _IEEE_)
{
diff --git a/math/w_powf.c b/math/w_powf.c
index 1ba22c0560..fa9e0071c8 100644
--- a/math/w_powf.c
+++ b/math/w_powf.c
@@ -25,7 +25,7 @@ float
__powf (float x, float y)
{
float z = __ieee754_powf (x, y);
- if (__builtin_expect (!__finitef (z), 0))
+ if (__glibc_unlikely (!__finitef (z)))
{
if (_LIB_VERSION != _IEEE_)
{
diff --git a/math/w_powl.c b/math/w_powl.c
index eba9202f23..7c8d9f8ba4 100644
--- a/math/w_powl.c
+++ b/math/w_powl.c
@@ -25,7 +25,7 @@ long double
__powl (long double x, long double y)
{
long double z = __ieee754_powl (x, y);
- if (__builtin_expect (!__finitel (z), 0))
+ if (__glibc_unlikely (!__finitel (z)))
{
if (_LIB_VERSION != _IEEE_)
{
diff --git a/math/w_scalb.c b/math/w_scalb.c
index 21b0c792d3..dbfefaf9d5 100644
--- a/math/w_scalb.c
+++ b/math/w_scalb.c
@@ -27,7 +27,7 @@ sysv_scalb (double x, double fn)
{
double z = __ieee754_scalb (x, fn);
- if (__builtin_expect (__isinf (z), 0))
+ if (__glibc_unlikely (__isinf (z)))
{
if (__finite (x))
return __kernel_standard (x, fn, 32); /* scalb overflow */
diff --git a/math/w_scalbf.c b/math/w_scalbf.c
index c23e35ba34..244fd1e91b 100644
--- a/math/w_scalbf.c
+++ b/math/w_scalbf.c
@@ -27,7 +27,7 @@ sysv_scalbf (float x, float fn)
{
float z = __ieee754_scalbf (x, fn);
- if (__builtin_expect (__isinff (z), 0))
+ if (__glibc_unlikely (__isinff (z)))
{
if (__finitef (x))
return __kernel_standard_f (x, fn, 132); /* scalb overflow */
diff --git a/math/w_scalbl.c b/math/w_scalbl.c
index 4252af3bf8..cffaa67cc7 100644
--- a/math/w_scalbl.c
+++ b/math/w_scalbl.c
@@ -27,7 +27,7 @@ sysv_scalbl (long double x, long double fn)
{
long double z = __ieee754_scalbl (x, fn);
- if (__builtin_expect (__isinfl (z), 0))
+ if (__glibc_unlikely (__isinfl (z)))
{
if (__finitel (x))
return __kernel_standard_l (x, fn, 232); /* scalb overflow */
diff --git a/misc/error.c b/misc/error.c
index dfaa240857..63bd309f22 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -165,7 +165,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (res != len)
break;
- if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
+ if (__glibc_unlikely (len >= SIZE_MAX / sizeof (wchar_t) / 2))
{
/* This really should not happen if everything is fine. */
res = (size_t) -1;
diff --git a/misc/pselect.c b/misc/pselect.c
index 2f6517b2a0..478dcce330 100644
--- a/misc/pselect.c
+++ b/misc/pselect.c
@@ -45,7 +45,7 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
{
/* Catch bugs which would be hidden by the TIMESPEC_TO_TIMEVAL
computations. The division by 1000 truncates values. */
- if (__builtin_expect (timeout->tv_nsec < 0, 0))
+ if (__glibc_unlikely (timeout->tv_nsec < 0))
{
__set_errno (EINVAL);
return -1;
diff --git a/nis/nis_call.c b/nis/nis_call.c
index c437732c69..df926a3476 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -797,7 +797,7 @@ __prepare_niscall (const_nis_name name, directory_obj **dirp,
dir_binding *bptrp, unsigned int flags)
{
nis_error retcode = __nisfind_server (name, 1, dirp, bptrp, flags);
- if (__builtin_expect (retcode != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (retcode != NIS_SUCCESS))
return retcode;
do
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 958c49f122..e3527339a7 100644
--- a/nis/nis_callback.c
+++ b/nis/nis_callback.c
@@ -271,18 +271,18 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
cb = (struct nis_cb *) calloc (1,
sizeof (struct nis_cb) + sizeof (nis_server));
- if (__builtin_expect (cb == NULL, 0))
+ if (__glibc_unlikely (cb == NULL))
goto failed;
cb->serv = (nis_server *) (cb + 1);
cb->serv->name = strdup (nis_local_principal ());
- if (__builtin_expect (cb->serv->name == NULL, 0))
+ if (__glibc_unlikely (cb->serv->name == NULL))
goto failed;
cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));
- if (__builtin_expect (cb->serv->ep.ep_val == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val == NULL))
goto failed;
cb->serv->ep.ep_len = 1;
cb->serv->ep.ep_val[0].family = strdup ("inet");
- if (__builtin_expect (cb->serv->ep.ep_val[0].family == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val[0].family == NULL))
goto failed;
cb->callback = callback;
cb->userdata = userdata;
@@ -314,7 +314,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
}
cb->serv->ep.ep_val[0].proto = strdup ((flags & USE_DGRAM) ? "udp" : "tcp");
- if (__builtin_expect (cb->serv->ep.ep_val[0].proto == NULL, 0))
+ if (__glibc_unlikely (cb->serv->ep.ep_val[0].proto == NULL))
goto failed;
cb->xprt = ((flags & USE_DGRAM)
? svcudp_bufcreate (sock, 100, 8192)
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index a9167348c3..dd7f317b82 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -46,7 +46,7 @@ nis_creategroup (const_nis_name group, unsigned int flags)
return NIS_BADNAME;
obj = calloc (1, sizeof (nis_object));
- if (__builtin_expect (obj == NULL, 0))
+ if (__glibc_unlikely (obj == NULL))
return NIS_NOMEMORY;
obj->zo_oid.ctime = obj->zo_oid.mtime = time (NULL);
diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c
index 52af9cc9cd..5216f49434 100644
--- a/nis/nis_domain_of_r.c
+++ b/nis/nis_domain_of_r.c
@@ -50,7 +50,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
return strcpy (buffer, ".");
}
- if (__builtin_expect (cptr_len >= buflen, 0))
+ if (__glibc_unlikely (cptr_len >= buflen))
{
__set_errno (ERANGE);
return NULL;
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index b566425015..8adad82e1e 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -89,7 +89,7 @@ __nis_findfastest_with_timeout (dir_binding *bind,
pings = malloc (sizeof (struct findserv_req) * pings_max);
xid_seed = (u_int32_t) (time (NULL) ^ getpid ());
- if (__builtin_expect (pings == NULL, 0))
+ if (__glibc_unlikely (pings == NULL))
return -1;
memset (&sin, '\0', sizeof (sin));
@@ -118,7 +118,7 @@ __nis_findfastest_with_timeout (dir_binding *bind,
pings_max += 10;
new_pings = realloc (pings, sizeof (struct findserv_req) *
pings_max);
- if (__builtin_expect (new_pings == NULL, 0))
+ if (__glibc_unlikely (new_pings == NULL))
{
free (pings);
return -1;
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index ac9278e227..f180bad0dd 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -38,7 +38,7 @@ nis_getservlist (const_nis_name dir)
serv =
malloc (sizeof (nis_server *) *
(NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
- if (__builtin_expect (serv == NULL, 0))
+ if (__glibc_unlikely (serv == NULL))
{
nis_freeresult (res);
return NULL;
@@ -50,7 +50,7 @@ nis_getservlist (const_nis_name dir)
server =
&NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
serv[i] = calloc (1, sizeof (nis_server));
- if (__builtin_expect (serv[i] == NULL, 0))
+ if (__glibc_unlikely (serv[i] == NULL))
{
free_all:
while (i-- > 0)
@@ -81,7 +81,7 @@ nis_getservlist (const_nis_name dir)
if (server->name != NULL)
{
serv[i]->name = strdup (server->name);
- if (__builtin_expect (serv[i]->name == NULL, 0))
+ if (__glibc_unlikely (serv[i]->name == NULL))
{
++i;
goto free_all;
@@ -95,7 +95,7 @@ nis_getservlist (const_nis_name dir)
serv[i]->ep.ep_val =
malloc (server->ep.ep_len * sizeof (endpoint));
- if (__builtin_expect (serv[i]->ep.ep_val == NULL, 0))
+ if (__glibc_unlikely (serv[i]->ep.ep_val == NULL))
{
++i;
goto free_all;
@@ -126,7 +126,7 @@ nis_getservlist (const_nis_name dir)
if (server->pkey.n_len > 0)
{
serv[i]->pkey.n_bytes = malloc (server->pkey.n_len);
- if (__builtin_expect (serv[i]->pkey.n_bytes == NULL, 0))
+ if (__glibc_unlikely (serv[i]->pkey.n_bytes == NULL))
{
++i;
goto free_all;
@@ -140,7 +140,7 @@ nis_getservlist (const_nis_name dir)
else
{
serv = malloc (sizeof (nis_server *));
- if (__builtin_expect (serv != NULL, 0))
+ if (__glibc_unlikely (serv != NULL))
serv[0] = NULL;
}
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index a41f121855..b9096c9ea4 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -63,7 +63,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
req.ns_object.ns_object_val = NULL;
status = __prepare_niscall (req.ns_name, &dir, &bptr, flags);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = status;
goto out;
@@ -147,7 +147,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
dir = NULL;
status = __prepare_niscall (req.ns_name, &dir,
&bptr, flags);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = status;
goto out;
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 4a4580a1e6..8f6f1d71f3 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -38,7 +38,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
while (name[i] != '.' && name[i] != '\0')
i++;
- if (__builtin_expect (i >= buflen, 0))
+ if (__glibc_unlikely (i >= buflen))
{
__set_errno (ERANGE);
return NULL;
@@ -118,7 +118,7 @@ nis_getnames (const_nis_name name)
int count = 2;
nis_name *getnames = malloc ((count + 1) * sizeof (char *));
- if (__builtin_expect (getnames == NULL, 0))
+ if (__glibc_unlikely (getnames == NULL))
return NULL;
/* Do we have a fully qualified NIS+ name ? If yes, give it back */
@@ -200,12 +200,12 @@ nis_getnames (const_nis_name name)
count += 5;
nis_name *newp = realloc (getnames,
(count + 1) * sizeof (char *));
- if (__builtin_expect (newp == NULL, 0))
+ if (__glibc_unlikely (newp == NULL))
goto free_null;
getnames = newp;
}
tmp = malloc (strlen (cptr) + local_domain_len + name_len + 2);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
getnames[pos] = tmp;
@@ -235,7 +235,7 @@ nis_getnames (const_nis_name name)
char *p;
tmp = malloc (cplen + local_domain_len + name_len + 2);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
p = __stpcpy (tmp, name);
@@ -251,7 +251,7 @@ nis_getnames (const_nis_name name)
char *p;
tmp = malloc (cplen + name_len + 3);
- if (__builtin_expect (tmp == NULL, 0))
+ if (__glibc_unlikely (tmp == NULL))
goto free_null;
p = __mempcpy (tmp, name, name_len);
@@ -267,7 +267,7 @@ nis_getnames (const_nis_name name)
count += 5;
nis_name *newp = realloc (getnames,
(count + 1) * sizeof (char *));
- if (__builtin_expect (newp == NULL, 0))
+ if (__glibc_unlikely (newp == NULL))
goto free_null;
getnames = newp;
}
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 9344a1f7b3..bb74873d9d 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -92,7 +92,7 @@ __create_ib_request (const_nis_name name, unsigned int flags)
if (cptr != NULL)
*cptr++ = '\0';
- if (__builtin_expect (val == NULL, 0))
+ if (__glibc_unlikely (val == NULL))
{
nis_free_request (ibreq);
return NULL;
@@ -282,7 +282,7 @@ nis_list (const_nis_name name, unsigned int flags,
}
while (__nisbind_connect (&bptr) != NIS_SUCCESS)
- if (__builtin_expect (__nisbind_next (&bptr) != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (__nisbind_next (&bptr) != NIS_SUCCESS))
{
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
goto fail;
@@ -302,7 +302,7 @@ nis_list (const_nis_name name, unsigned int flags,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, RPCTIMEOUT);
- if (__builtin_expect (clnt_status != RPC_SUCCESS, 0))
+ if (__glibc_unlikely (clnt_status != RPC_SUCCESS))
NIS_RES_STATUS (res) = NIS_RPCERROR;
else
switch (NIS_RES_STATUS (res))
@@ -316,7 +316,7 @@ nis_list (const_nis_name name, unsigned int flags,
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
/* If we hit the link limit, bail. */
- if (__builtin_expect (count_links > NIS_MAXLINKS, 0))
+ if (__glibc_unlikely (count_links > NIS_MAXLINKS))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -491,7 +491,7 @@ nis_list (const_nis_name name, unsigned int flags,
/* Try the next domainname if we don't follow a link. */
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
- if (__builtin_expect (count_links, 0))
+ if (__glibc_unlikely (count_links))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -597,7 +597,7 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
(caddr_t) ibreq,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -654,7 +654,7 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2,
(xdrproc_t) _xdr_ib_request,
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -739,7 +739,7 @@ nis_first_entry (const_nis_name name)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -782,7 +782,7 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (__builtin_expect (status != NIS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NIS_SUCCESS))
NIS_RES_STATUS (res) = status;
if (cookie != NULL)
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index d7ca81910e..c391d9c280 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -75,7 +75,7 @@ xdr_endpoint (XDR *xdrs, endpoint *objp)
if (__builtin_expect (res, TRUE))
{
res = xdr_string (xdrs, &objp->family, ~0);
- if (__builtin_expect (res, 1))
+ if (__glibc_likely (res))
res = xdr_string (xdrs, &objp->proto, ~0);
}
return res;
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 2d57461fed..78e14d6d3c 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -288,7 +288,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -321,7 +321,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -421,7 +421,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -454,7 +454,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -552,7 +552,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -585,7 +585,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
!(parse_res = _nss_files_parse_grent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index fa1523891e..c5ba606e1c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -214,7 +214,7 @@ add_group (long int *start, long int *size, gid_t **groupsp, long int limit,
gid_t *groups = *groupsp;
/* Matches user. Insert this group. */
- if (__builtin_expect (*start == *size, 0))
+ if (__glibc_unlikely (*start == *size))
{
/* Need a bigger buffer. */
gid_t *newgroups;
@@ -420,7 +420,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -453,7 +453,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
!(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 021fb18d19..127673c596 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -528,7 +528,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -561,7 +561,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -727,7 +727,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -761,7 +761,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -934,7 +934,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -967,7 +967,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_pwent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 1c2ec3d875..4890ce6f90 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -485,7 +485,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -515,7 +515,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
|| !(parse_res = _nss_files_parse_spent (p, result, data,
buflen, errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
@@ -685,7 +685,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
do
{
/* We need at least 3 characters for one line. */
- if (__builtin_expect (buflen < 3, 0))
+ if (__glibc_unlikely (buflen < 3))
{
erange:
*errnop = ERANGE;
@@ -718,7 +718,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
!(parse_res = _nss_files_parse_spent (p, result, data, buflen,
errnop)));
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
/* The parser ran out of space. */
goto erange_reset;
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 2f708c185c..995e610859 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -125,7 +125,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
alias->alias_local = 0;
@@ -147,7 +147,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -156,7 +156,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -170,7 +170,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*errnop = ERANGE;
@@ -213,7 +213,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
size_t namlen = strlen (name);
@@ -244,7 +244,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
if (!use_alloca)
free (name2);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -253,7 +253,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -269,7 +269,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
alias->alias_local = 0;
int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index a803c27ac6..59190cf5fa 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -188,7 +188,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -196,7 +196,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -205,7 +205,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -220,7 +220,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -241,7 +241,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[33];
@@ -257,7 +257,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
int len;
int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -266,7 +266,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -281,7 +281,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 53368073a7..20211de0de 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -85,7 +85,7 @@ internal_nis_setgrent (void)
{
/* We have to read all the data now. */
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct ypall_callback ypcb;
@@ -152,7 +152,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
handle_batch_read:
bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -191,7 +191,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
yperr = yp_next (domain, "group.byname", oldkey, oldkeylen,
&outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -201,7 +201,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
}
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
if (!batch_read)
free (result);
@@ -218,7 +218,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
if (!batch_read)
free (outkey);
@@ -267,7 +267,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -275,7 +275,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
int yperr = yp_match (domain, "group.byname", name, strlen (name), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -284,7 +284,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -314,7 +314,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -324,7 +324,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
int len;
int yperr = yp_match (domain, "group.bygid", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -333,7 +333,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -348,7 +348,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index f73a0eccb2..462176ea03 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -136,14 +136,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
int af, int flags)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
buffer += pad;
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -168,7 +168,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -188,7 +188,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*h_errnop = NETDB_INTERNAL;
@@ -203,7 +203,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
free (result);
parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*h_errnop = NETDB_INTERNAL;
@@ -281,7 +281,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
int len;
int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -296,7 +296,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
}
const size_t linebuflen = buffer + buflen - data->linebuffer;
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*h_errnop = NETDB_INTERNAL;
@@ -312,7 +312,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
int parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
- if (__builtin_expect (parse_res < 1 || host->h_addrtype != af, 0))
+ if (__glibc_unlikely (parse_res < 1 || host->h_addrtype != af))
{
if (parse_res == -1)
{
@@ -373,14 +373,14 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int *errnop, int *h_errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
buffer += pad;
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -395,7 +395,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int yperr = yp_match (domain, "hosts.byaddr", buf, strlen (buf), &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -411,7 +411,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
}
const size_t linebuflen = buffer + buflen - data->linebuffer;
- if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > linebuflen))
{
free (result);
*errnop = ERANGE;
@@ -428,7 +428,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
int parse_res = parse_line (p, host, data, buflen, errnop, af,
((_res.options & RES_USE_INET6)
? AI_V4MAPPED : 0));
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -472,7 +472,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
int len;
int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -493,7 +493,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
{
erange:
free (result);
@@ -512,14 +512,14 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
struct parser_data *data = (void *) buffer;
- if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof *data + 1 + pad))
goto erange;
buflen -= pad;
struct hostent host;
int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC,
0);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 30bc90f691..e8fcca1bb1 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -72,7 +72,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (intern->offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern->offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -88,7 +88,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
++intern->offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -106,7 +106,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern->offset += len;
@@ -160,7 +160,7 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
int reslen;
int yperr = yp_match (domainname, "netid.byname", key, keylen, &result,
&reslen);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
return yperr2nss (yperr);
/* Parse the result: following the colon is a comma separated list of
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index d4b2e569d3..d03d71593f 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -54,16 +54,16 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp)
status = NSS_STATUS_SUCCESS;
- if (__builtin_expect (group == NULL || group[0] == '\0', 0))
+ if (__glibc_unlikely (group == NULL || group[0] == '\0'))
return NSS_STATUS_UNAVAIL;
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group),
&netgrp->data, &len));
- if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
+ if (__glibc_likely (status == NSS_STATUS_SUCCESS))
{
/* Our implementation of yp_match already allocates a buffer
which is one byte larger than the value in LEN specifies
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index da28860003..f28fbdaa4f 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -74,7 +74,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
struct parser_data *data = (void *) buffer;
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* Get the next entry until we found a correct one. */
@@ -94,7 +94,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
yperr = yp_next (domain, "networks.byname", oldkey, oldkeylen, &outkey,
&keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -106,7 +106,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -121,7 +121,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
free (result);
parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
free (outkey);
*herrnop = NETDB_INTERNAL;
@@ -166,7 +166,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct parser_data *data = (void *) buffer;
@@ -191,7 +191,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
int yperr = yp_match (domain, "networks.byname", name2, namlen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -203,7 +203,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -219,7 +219,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
int parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
@@ -237,7 +237,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int *herrnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct in_addr in = { .s_addr = htonl (addr) };
@@ -252,7 +252,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int yperr = yp_match (domain, "networks.byaddr", buf, blen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -277,7 +277,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
}
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -294,7 +294,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
int parse_res = _nss_files_parse_netent (p, net, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index eff2eddd6c..e165f10200 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -185,7 +185,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char *result;
@@ -193,7 +193,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
int yperr = yp_match (domain, "protocols.byname", name, strlen (name),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -202,7 +202,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -217,7 +217,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -232,7 +232,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -243,7 +243,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
int yperr = yp_match (domain, "protocols.bynumber", buf, nlen, &result,
&len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -252,7 +252,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -267,7 +267,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index cec43e2b24..7a133418ef 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -56,7 +56,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -102,7 +102,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
&result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 6726efde57..aab14c64df 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -57,7 +57,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (bucket == NULL, 0))
+ if (__glibc_unlikely (bucket == NULL))
{
#define MINSIZE 4096 - 4 * sizeof (void *)
const size_t minsize = MAX (MINSIZE, 2 * (invallen + 1));
@@ -92,7 +92,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval,
}
char *p = mempcpy (&bucket->mem[intern->offset], inval, invallen);
- if (__builtin_expect (p[-1] != '\0', 0))
+ if (__glibc_unlikely (p[-1] != '\0'))
{
*p = '\0';
++invallen;
@@ -143,7 +143,7 @@ internal_nis_setpwent (void)
{
/* We have to read all the data now. */
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
struct ypall_callback ypcb;
@@ -210,7 +210,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
handle_batch_read:
bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -249,7 +249,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
yperr = yp_next (domain, "passwd.byname", oldkey, oldkeylen,
&outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -312,7 +312,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -330,7 +330,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
if (!batch_read)
free (outkey);
@@ -379,7 +379,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
size_t namelen = strlen (name);
@@ -388,7 +388,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
int len;
int yperr = yp_match (domain, "passwd.byname", name, namelen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -447,7 +447,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -464,7 +464,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -480,7 +480,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -490,7 +490,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
int len;
int yperr = yp_match (domain, "passwd.byuid", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -552,7 +552,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
else
{
non_adjunct:
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -569,7 +569,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index a2fff630c4..cb4b0895c6 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -124,7 +124,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
{
struct response_t *bucket = intern->next;
- if (__builtin_expect (intern->offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern->offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -139,7 +139,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
++intern->offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -156,7 +156,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
p = memcpy (buffer, &bucket->mem[intern->offset], len);
parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern->offset += len;
@@ -193,7 +193,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
intern_t data = { NULL, NULL, 0 };
enum nss_status status = internal_nis_setrpcent (&data);
- if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (status != NSS_STATUS_SUCCESS))
return status;
int found = 0;
@@ -222,7 +222,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
internal_nis_endrpcent (&data);
- if (__builtin_expect (!found && status == NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (!found && status == NSS_STATUS_SUCCESS))
return NSS_STATUS_NOTFOUND;
return status;
@@ -233,7 +233,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
char *buffer, size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
char buf[32];
@@ -243,7 +243,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
int len;
int yperr = yp_match (domain, "rpc.bynumber", buf, nlen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -252,7 +252,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
return retval;
}
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -267,7 +267,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
int parse_res = _nss_files_parse_rpcent (p, rpc, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index fd79d3fe07..f9b4a86d76 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -56,12 +56,12 @@ dosearch (int instatus, char *inkey, int inkeylen, char *inval,
{
struct search_t *req = (struct search_t *) indata;
- if (__builtin_expect (instatus != YP_TRUE, 0))
+ if (__glibc_unlikely (instatus != YP_TRUE))
return 1;
if (inkey && inkeylen > 0 && inval && invallen > 0)
{
- if (__builtin_expect ((size_t) (invallen + 1) > req->buflen, 0))
+ if (__glibc_unlikely ((size_t) (invallen + 1) > req->buflen))
{
*req->errnop = ERANGE;
req->status = NSS_STATUS_TRYAGAIN;
@@ -196,7 +196,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
{
struct response_t *bucket = intern.next;
- if (__builtin_expect (intern.offset >= bucket->size, 0))
+ if (__glibc_unlikely (intern.offset >= bucket->size))
{
if (bucket->next == NULL)
return NSS_STATUS_NOTFOUND;
@@ -211,7 +211,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
++intern.offset;
size_t len = strlen (p) + 1;
- if (__builtin_expect (len > buflen, 0))
+ if (__glibc_unlikely (len > buflen))
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
@@ -228,7 +228,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
p = memcpy (buffer, &bucket->mem[intern.offset], len);
parse_res = _nss_files_parse_servent (p, serv, pdata, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
return NSS_STATUS_TRYAGAIN;
intern.offset += len;
@@ -265,7 +265,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
}
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* If the protocol is given, we could try if our NIS server knows
@@ -289,9 +289,9 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (__builtin_expect (status == YPERR_SUCCESS, 1))
+ if (__glibc_likely (status == YPERR_SUCCESS))
{
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -306,7 +306,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 0, 0))
+ if (__glibc_unlikely (parse_res < 0))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -336,7 +336,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
req.status = NSS_STATUS_NOTFOUND;
status = yp_all (domain, "services.byname", &ypcb);
- if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (status != YPERR_SUCCESS))
return yperr2nss (status);
return req.status;
@@ -348,7 +348,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
size_t buflen, int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* If the protocol is given, we only need one query.
@@ -370,9 +370,9 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (__builtin_expect (status == YPERR_SUCCESS, 1))
+ if (__glibc_likely (status == YPERR_SUCCESS))
{
- if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + 1) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -386,7 +386,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
free (result);
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
buflen, errnop);
- if (__builtin_expect (parse_res < 0, 0))
+ if (__glibc_unlikely (parse_res < 0))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
@@ -417,7 +417,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
req.status = NSS_STATUS_NOTFOUND;
int status = yp_all (domain, "services.byname", &ypcb);
- if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (status != YPERR_SUCCESS))
return yperr2nss (status);
return req.status;
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index d024c0d22c..7cfc3ce617 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -71,7 +71,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
int *errnop)
{
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
/* Get the next entry until we found a correct one. */
@@ -102,7 +102,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
? "passwd.adjunct.byname" : "shadow.byname"),
oldkey, oldkeylen, &outkey, &keylen, &result, &len);
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -177,7 +177,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
const size_t name_len = strlen (name);
char *domain;
- if (__builtin_expect (yp_get_default_domain (&domain), 0))
+ if (__glibc_unlikely (yp_get_default_domain (&domain)))
return NSS_STATUS_UNAVAIL;
bool adjunct_used = false;
@@ -194,7 +194,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
adjunct_used = true;
}
- if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+ if (__glibc_unlikely (yperr != YPERR_SUCCESS))
{
enum nss_status retval = yperr2nss (yperr);
@@ -203,7 +203,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
return retval;
}
- if (__builtin_expect ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen, 0))
+ if (__glibc_unlikely ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen))
{
free (result);
*errnop = ERANGE;
@@ -224,7 +224,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
int parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
errnop);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index e3a82ffc49..9e3849bd65 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -310,7 +310,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -323,7 +323,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index cc7695f037..a962166bd3 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -264,7 +264,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -277,7 +277,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
@@ -331,7 +331,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
nis_freeresult (result);
@@ -344,7 +344,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
/* We do not need the lookup result anymore. */
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index 8667532977..58f31c8c2b 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -242,7 +242,7 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_grent (&result, gr,
buffer, buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
*errnop = ERANGE;
retval = NSS_STATUS_TRYAGAIN;
@@ -316,7 +316,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -326,7 +326,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -371,7 +371,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -384,7 +384,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
__set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 62440f2459..b3e0df5883 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -439,7 +439,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
}
int retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -543,7 +543,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
}
retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -587,7 +587,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host,
buffer, buflen,
errnop, herrnop, 0);
- if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
+ if (__glibc_likely (status == NSS_STATUS_SUCCESS))
{
if (*pat == NULL)
{
@@ -596,7 +596,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
{
free (result);
*errnop = ERANGE;
diff --git a/nis/nss_nisplus/nisplus-initgroups.c b/nis/nss_nisplus/nisplus-initgroups.c
index 9df9643a28..c304f0e18c 100644
--- a/nis/nss_nisplus/nisplus-initgroups.c
+++ b/nis/nss_nisplus/nisplus-initgroups.c
@@ -67,7 +67,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -98,7 +98,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start,
gid_t gid;
char *endp;
- if (__builtin_expect (numstr[len - 1] != '\0', 0))
+ if (__glibc_unlikely (numstr[len - 1] != '\0'))
{
char numstrbuf[len + 1];
memcpy (numstrbuf, numstr, len);
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index ed4a8f35e4..43e955d14e 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -376,7 +376,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
}
retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (retval == NSS_STATUS_TRYAGAIN)
{
@@ -447,7 +447,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
return NSS_STATUS_TRYAGAIN;
}
enum nss_status retval = niserr2nss (result->status);
- if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
{
if (b2len > 2 && buf2[b2len - 2] == '.' && buf2[b2len - 1] == '0')
{
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index 358d7de216..cfe32f5fa7 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -347,7 +347,7 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -408,7 +408,7 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index 1a732bc813..811131c0ad 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -243,7 +243,7 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_pwent (&result, pw, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
*errnop = ERANGE;
retval = NSS_STATUS_TRYAGAIN;
@@ -317,7 +317,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -331,7 +331,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -376,7 +376,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -390,7 +390,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 5604a5f850..0bcd0fb3c5 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -351,7 +351,7 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index 805ccfb2fb..c32823b632 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -258,7 +258,7 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
parse_res = _nss_nisplus_parse_servent (result, serv, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
nis_freeresult (result);
result = saved_res;
@@ -360,7 +360,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -374,7 +374,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
@@ -429,7 +429,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -443,7 +443,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol,
errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c
index 5b671e2681..f3c7f9df82 100644
--- a/nis/nss_nisplus/nisplus-spwd.c
+++ b/nis/nss_nisplus/nisplus-spwd.c
@@ -124,7 +124,7 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
parse_res = _nss_nisplus_parse_spent (result, sp, buffer,
buflen, errnop);
- if (__builtin_expect (parse_res == -1, 0))
+ if (__glibc_unlikely (parse_res == -1))
{
nis_freeresult (result);
result = saved_res;
@@ -189,7 +189,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
return NSS_STATUS_TRYAGAIN;
}
- if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
+ if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
{
enum nss_status status = niserr2nss (result->status);
@@ -202,7 +202,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop);
nis_freeresult (result);
- if (__builtin_expect (parse_res < 1, 0))
+ if (__glibc_unlikely (parse_res < 1))
{
if (parse_res == -1)
{
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 400db0a7ee..dd1833bbf6 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -183,7 +183,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
{
is_new = 1;
ysd = (dom_binding *) calloc (1, sizeof *ysd);
- if (__builtin_expect (ysd == NULL, 0))
+ if (__glibc_unlikely (ysd == NULL))
return YPERR_RESRC;
}
@@ -471,7 +471,7 @@ yp_match (const char *indomain, const char *inmap, const char *inkey,
*outvallen = resp.val.valdat_len;
*outval = malloc (*outvallen + 1);
int status = YPERR_RESRC;
- if (__builtin_expect (*outval != NULL, 1))
+ if (__glibc_likely (*outval != NULL))
{
memcpy (*outval, resp.val.valdat_val, *outvallen);
(*outval)[*outvallen] = '\0';
@@ -770,7 +770,7 @@ yp_all (const char *indomain, const char *inmap,
(caddr_t) &req, (xdrproc_t) __xdr_ypresp_all,
(caddr_t) &data, RPCTIMEOUT);
- if (__builtin_expect (result != RPC_SUCCESS, 0))
+ if (__glibc_unlikely (result != RPC_SUCCESS))
{
/* Print the error message only on the last try. */
if (try == MAXTRIES - 1)
@@ -811,7 +811,7 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist)
(caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist,
(caddr_t) &resp);
- if (__builtin_expect (result == YPERR_SUCCESS, 1))
+ if (__glibc_likely (result == YPERR_SUCCESS))
{
*outmaplist = resp.maps;
/* We don't free the list, this will be done by ypserv
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 474a473bf8..f7241c51e4 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,76 @@
+2014-02-10 Ondřej Bílka <neleai@seznam.cz>
+
+ * allocatestack.c (queue_stack, allocate_stack,
+ __deallocate_stack, __reclaim_stacks): Use glibc_likely instead
+ __builtin_expect.
+ * cancellation.c (__pthread_enable_asynccancel,
+ __pthread_disable_asynccancel): Likewise.
+ * cleanup_defer.c (__pthread_register_cancel_defer,
+ __pthread_unregister_cancel_restore): Likewise.
+ * cleanup_defer_compat.c (_pthread_cleanup_push_defer,
+ _pthread_cleanup_pop_restore): Likewise.
+ * cond-perf.c (main): Likewise.
+ * nptl-init.c (sigcancel_handler, sighandler_setxid): Likewise.
+ * perf.c (get_clockfreq): Likewise.
+ * pthread_barrier_destroy.c (pthread_barrier_destroy): Likewise.
+ * pthread_barrier_init.c (pthread_barrier_init): Likewise.
+ * pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
+ * pthread_cond_wait.c (__pthread_cond_wait): Likewise.
+ * pthread_create.c (__free_tcb, start_thread, __pthread_create_2_1):
+ Likewise.
+ * pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * pthread_getspecific.c (__pthread_getspecific): Likewise.
+ * pthread_join.c (pthread_join): Likewise.
+ * pthread_key_delete.c (pthread_key_delete): Likewise.
+ * pthread_mutex_init.c (__pthread_mutex_init): Likewise.
+ * pthread_mutex_lock.c (__pthread_mutex_lock,
+ __pthread_mutex_lock_full): Likewise.
+ * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
+ * pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise.
+ * pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Likewise.
+ * pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Likewise.
+ * pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock): Likewise.
+ * pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock): Likewise.
+ * pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Likewise.
+ * pthread_setcancelstate.c (__pthread_setcancelstate): Likewise.
+ * pthread_setcanceltype.c (__pthread_setcanceltype): Likewise.
+ * pthread_setschedprio.c (pthread_setschedprio): Likewise.
+ * pthread_setspecific.c (__pthread_setspecific): Likewise.
+ * sem_init.c (__new_sem_init): Likewise.
+ * sem_open.c (__where_is_shmfs): Likewise.
+ * sigaction.c: Likewise.
+ * sockperf.c (get_clockfreq): Likewise.
+ * sysdeps/pthread/createthread.c (do_clone, create_thread): Likewise.
+ * sysdeps/pthread/setxid.h: Likewise.
+ * sysdeps/pthread/timer_create.c (timer_create): Likewise.
+ * sysdeps/pthread/unwind-forcedunwind.c (pthread_cancel_init,
+ __unwind_freeres, _Unwind_Resume, __gcc_personality_v0,
+ _Unwind_ForcedUnwind): Likewise.
+ * sysdeps/unix/sysv/linux/getpid.c (__getpid): Likewise.
+ * sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+ (__lll_robust_lock_wait, __lll_robust_timedlock_wait): Likewise.
+ * sysdeps/unix/sysv/linux/mq_notify.c (mq_notify): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
+ * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise.
+ * sysdeps/unix/sysv/linux/pthread_setaffinity.c
+ (__pthread_setaffinity_new): Likewise.
+ * sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue):
+ Likewise.
+ * sysdeps/unix/sysv/linux/pt-raise.c (raise): Likewise.
+ * sysdeps/unix/sysv/linux/raise.c (raise): Likewise.
+ * sysdeps/unix/sysv/linux/s390/lowlevellock.h (__lll_robust_trylock,
+ __lll_robust_lock, __lll_cond_lock, __lll_robust_timedlock): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (__lll_lock,
+ __lll_cond_lock, __lll_timedlock, __lll_robust_timedlock): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
+ (pthread_barrier_destroy): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
+ (pthread_barrier_init): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sem_init.c (__new_sem_init): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/timer_create.c (__timer_create_old):
+ Likewise.
+ * unwind.c (unwind_stop): Likewise.
+
2014-02-08 Mike Frysinger <vapier@gentoo.org>
* sem_open.c (__where_is_shmfs): Compare f.f_type to RAMFS_MAGIC too.
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 13eca47cf2..1e22f7da90 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -306,7 +306,7 @@ queue_stack (struct pthread *stack)
stack_list_add (&stack->list, &stack_cache);
stack_cache_actsize += stack->stackblock_size;
- if (__builtin_expect (stack_cache_actsize > stack_cache_maxsize, 0))
+ if (__glibc_unlikely (stack_cache_actsize > stack_cache_maxsize))
__free_stacks (stack_cache_maxsize);
}
@@ -368,7 +368,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
}
/* Get memory for the stack. */
- if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0))
+ if (__glibc_unlikely (attr->flags & ATTR_FLAG_STACKADDR))
{
uintptr_t adj;
@@ -504,7 +504,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
mem = mmap (NULL, size, prot,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
- if (__builtin_expect (mem == MAP_FAILED, 0))
+ if (__glibc_unlikely (mem == MAP_FAILED))
return errno;
/* SIZE is guaranteed to be greater than zero.
@@ -525,7 +525,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* Make sure the coloring offsets does not disturb the alignment
of the TCB and static TLS block. */
- if (__builtin_expect ((coloring & __static_tls_align_m1) != 0, 0))
+ if (__glibc_unlikely ((coloring & __static_tls_align_m1) != 0))
coloring = (((coloring + __static_tls_align_m1)
& ~(__static_tls_align_m1))
& ~pagesize_m1);
@@ -629,7 +629,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
}
/* Create or resize the guard area if necessary. */
- if (__builtin_expect (guardsize > pd->guardsize, 0))
+ if (__glibc_unlikely (guardsize > pd->guardsize))
{
#ifdef NEED_SEPARATE_REGISTER_STACK
char *guard = mem + (((size - guardsize) / 2) & ~pagesize_m1);
@@ -752,7 +752,7 @@ __deallocate_stack (struct pthread *pd)
not reset the 'used' flag in the 'tid' field. This is done by
the kernel. If no thread has been created yet this field is
still zero. */
- if (__builtin_expect (! pd->user_stack, 1))
+ if (__glibc_likely (! pd->user_stack))
(void) queue_stack (pd);
else
/* Free the memory associated with the ELF TLS. */
@@ -916,7 +916,7 @@ __reclaim_stacks (void)
INIT_LIST_HEAD (&stack_used);
INIT_LIST_HEAD (&__stack_user);
- if (__builtin_expect (THREAD_GETMEM (self, user_stack), 0))
+ if (__glibc_unlikely (THREAD_GETMEM (self, user_stack)))
list_add (&self->list, &__stack_user);
else
list_add (&self->list, &stack_used);
diff --git a/nptl/cancellation.c b/nptl/cancellation.c
index bddea1f3fa..aaf102dd0f 100644
--- a/nptl/cancellation.c
+++ b/nptl/cancellation.c
@@ -40,7 +40,7 @@ __pthread_enable_asynccancel (void)
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
@@ -79,7 +79,7 @@ __pthread_disable_asynccancel (int oldtype)
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
break;
/* Prepare the next round. */
diff --git a/nptl/cleanup_defer.c b/nptl/cleanup_defer.c
index 4049497155..a8fc40304e 100644
--- a/nptl/cleanup_defer.c
+++ b/nptl/cleanup_defer.c
@@ -34,14 +34,14 @@ __pthread_register_cancel_defer (__pthread_unwind_buf_t *buf)
int cancelhandling = THREAD_GETMEM (self, cancelhandling);
/* Disable asynchronous cancellation for now. */
- if (__builtin_expect (cancelhandling & CANCELTYPE_BITMASK, 0))
+ if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
while (1)
{
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
cancelhandling
& ~CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
@@ -78,7 +78,7 @@ __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *buf)
cancelhandling
| CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
diff --git a/nptl/cleanup_defer_compat.c b/nptl/cleanup_defer_compat.c
index b57fd4e285..9c52f5fc53 100644
--- a/nptl/cleanup_defer_compat.c
+++ b/nptl/cleanup_defer_compat.c
@@ -34,14 +34,14 @@ _pthread_cleanup_push_defer (buffer, routine, arg)
int cancelhandling = THREAD_GETMEM (self, cancelhandling);
/* Disable asynchronous cancellation for now. */
- if (__builtin_expect (cancelhandling & CANCELTYPE_BITMASK, 0))
+ if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
while (1)
{
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
cancelhandling
& ~CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
@@ -78,7 +78,7 @@ _pthread_cleanup_pop_restore (buffer, execute)
cancelhandling
| CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
diff --git a/nptl/cond-perf.c b/nptl/cond-perf.c
index e37914e6b7..9c9488e274 100644
--- a/nptl/cond-perf.c
+++ b/nptl/cond-perf.c
@@ -70,7 +70,7 @@ main (int argc, char *argv[])
pthread_t th[nthreads];
int i;
for (i = 0; __builtin_expect (i < nthreads, 1); ++i)
- if (__builtin_expect ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0, 0))
+ if (__glibc_unlikely ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0))
printf ("pthread_create: %s\n", strerror (err));
for (i = 0; __builtin_expect (i < nrounds, 1); ++i)
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 4d1f7d8721..794156ba8e 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -175,7 +175,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
+ if (__glibc_unlikely (pid < 0))
pid = -pid;
/* Safety check. It would be possible to call this function for
@@ -232,7 +232,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
+ if (__glibc_unlikely (pid < 0))
pid = -pid;
/* Safety check. It would be possible to call this function for
diff --git a/nptl/perf.c b/nptl/perf.c
index ceb30c6bcc..3ecab2ca56 100644
--- a/nptl/perf.c
+++ b/nptl/perf.c
@@ -633,7 +633,7 @@ get_clockfreq (void)
return result;
fd = open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
to a size of 4096 bytes. */
@@ -645,7 +645,7 @@ get_clockfreq (void)
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
int seen_decpoint = 0;
diff --git a/nptl/pthread_barrier_destroy.c b/nptl/pthread_barrier_destroy.c
index 60fe2dfbff..c59a861221 100644
--- a/nptl/pthread_barrier_destroy.c
+++ b/nptl/pthread_barrier_destroy.c
@@ -32,7 +32,7 @@ pthread_barrier_destroy (barrier)
lll_lock (ibarrier->lock, ibarrier->private ^ FUTEX_PRIVATE_FLAG);
- if (__builtin_expect (ibarrier->left == ibarrier->init_count, 1))
+ if (__glibc_likely (ibarrier->left == ibarrier->init_count))
/* The barrier is not used anymore. */
result = 0;
else
diff --git a/nptl/pthread_barrier_init.c b/nptl/pthread_barrier_init.c
index 0e603ba59e..ac180a9a5c 100644
--- a/nptl/pthread_barrier_init.c
+++ b/nptl/pthread_barrier_init.c
@@ -36,7 +36,7 @@ pthread_barrier_init (barrier, attr, count)
{
struct pthread_barrier *ibarrier;
- if (__builtin_expect (count == 0, 0))
+ if (__glibc_unlikely (count == 0))
return EINVAL;
const struct pthread_barrierattr *iattr
diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
index b975b8f126..1698085361 100644
--- a/nptl/pthread_cond_timedwait.c
+++ b/nptl/pthread_cond_timedwait.c
@@ -87,7 +87,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
goto timeout;
/* Remember the mutex we are using here. If there is already a
@@ -143,7 +143,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
--rt.tv_sec;
}
/* Did we already time out? */
- if (__builtin_expect (rt.tv_sec < 0, 0))
+ if (__glibc_unlikely (rt.tv_sec < 0))
{
if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
goto bc_out;
@@ -217,7 +217,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
break;
/* Not woken yet. Maybe the time expired? */
- if (__builtin_expect (err == -ETIMEDOUT, 0))
+ if (__glibc_unlikely (err == -ETIMEDOUT))
{
timeout:
/* Yep. Adjust the counters. */
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index 6222d922ff..9d2dfceec5 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -119,7 +119,7 @@ __pthread_cond_wait (cond, mutex)
/* Now we can release the mutex. */
err = __pthread_mutex_unlock_usercnt (mutex, 0);
- if (__builtin_expect (err, 0))
+ if (__glibc_unlikely (err))
{
lll_unlock (cond->__data.__lock, pshared);
return err;
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 9d7f52f57e..cee0806d52 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -211,7 +211,7 @@ __free_tcb (struct pthread *pd)
abort ();
/* Free TPP data. */
- if (__builtin_expect (pd->tpp != NULL, 0))
+ if (__glibc_unlikely (pd->tpp != NULL))
{
struct priority_protection_data *tpp = pd->tpp;
@@ -246,7 +246,7 @@ start_thread (void *arg)
__ctype_init ();
/* Allow setxid from now onwards. */
- if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0))
+ if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
#ifdef __NR_set_robust_list
@@ -265,7 +265,7 @@ start_thread (void *arg)
/* If the parent was running cancellation handlers while creating
the thread the new thread inherited the signal mask. Reset the
cancellation signal mask. */
- if (__builtin_expect (pd->parent_cancelhandling & CANCELING_BITMASK, 0))
+ if (__glibc_unlikely (pd->parent_cancelhandling & CANCELING_BITMASK))
{
INTERNAL_SYSCALL_DECL (err);
sigset_t mask;
@@ -285,12 +285,12 @@ start_thread (void *arg)
int not_first_call;
not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
- if (__builtin_expect (! not_first_call, 1))
+ if (__glibc_likely (! not_first_call))
{
/* Store the new cleanup handler info. */
THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
- if (__builtin_expect (pd->stopped_start, 0))
+ if (__glibc_unlikely (pd->stopped_start))
{
int oldtype = CANCEL_ASYNC ();
@@ -327,12 +327,12 @@ start_thread (void *arg)
/* If this is the last thread we terminate the process now. We
do not notify the debugger, it might just irritate it if there
is no thread left. */
- if (__builtin_expect (atomic_decrement_and_test (&__nptl_nthreads), 0))
+ if (__glibc_unlikely (atomic_decrement_and_test (&__nptl_nthreads)))
/* This was the last thread. */
exit (0);
/* Report the death of the thread if this is wanted. */
- if (__builtin_expect (pd->report_events, 0))
+ if (__glibc_unlikely (pd->report_events))
{
/* See whether TD_DEATH is in any of the mask. */
const int idx = __td_eventword (TD_DEATH);
@@ -412,7 +412,7 @@ start_thread (void *arg)
if (IS_DETACHED (pd))
/* Free the TCB. */
__free_tcb (pd);
- else if (__builtin_expect (pd->cancelhandling & SETXID_BITMASK, 0))
+ else if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK))
{
/* Some other thread might call any of the setXid functions and expect
us to reply. In this case wait until we did that. */
@@ -482,7 +482,7 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
int err = ALLOCATE_STACK (iattr, &pd);
int retval = 0;
- if (__builtin_expect (err != 0, 0))
+ if (__glibc_unlikely (err != 0))
/* Something went wrong. Maybe a parameter of the attributes is
invalid or we could not allocate memory. Note we have to
translate error codes. */
diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
index e79f282fee..21110c36b0 100644
--- a/nptl/pthread_getattr_np.c
+++ b/nptl/pthread_getattr_np.c
@@ -57,7 +57,7 @@ pthread_getattr_np (thread_id, attr)
iattr->guardsize = thread->reported_guardsize;
/* The sizes are subject to alignment. */
- if (__builtin_expect (thread->stackblock != NULL, 1))
+ if (__glibc_likely (thread->stackblock != NULL))
{
iattr->stacksize = thread->stackblock_size;
iattr->stackaddr = (char *) thread->stackblock + iattr->stacksize;
diff --git a/nptl/pthread_getspecific.c b/nptl/pthread_getspecific.c
index e0e7daca24..e0cc1993ad 100644
--- a/nptl/pthread_getspecific.c
+++ b/nptl/pthread_getspecific.c
@@ -28,7 +28,7 @@ __pthread_getspecific (key)
/* Special case access to the first 2nd-level block. This is the
usual case. */
- if (__builtin_expect (key < PTHREAD_KEY_2NDLEVEL_SIZE, 1))
+ if (__glibc_likely (key < PTHREAD_KEY_2NDLEVEL_SIZE))
data = &THREAD_SELF->specific_1stblock[key];
else
{
@@ -58,7 +58,7 @@ __pthread_getspecific (key)
{
uintptr_t seq = data->seq;
- if (__builtin_expect (seq != __pthread_keys[key].seq, 0))
+ if (__glibc_unlikely (seq != __pthread_keys[key].seq))
result = data->data = NULL;
}
diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c
index 69f844a860..5a43182d8a 100644
--- a/nptl/pthread_join.c
+++ b/nptl/pthread_join.c
@@ -99,7 +99,7 @@ pthread_join (threadid, thread_return)
pthread_cleanup_pop (0);
- if (__builtin_expect (result == 0, 1))
+ if (__glibc_likely (result == 0))
{
/* We mark the thread as terminated and as joined. */
pd->tid = -1;
diff --git a/nptl/pthread_key_delete.c b/nptl/pthread_key_delete.c
index a79a0ea52a..d2981b8af1 100644
--- a/nptl/pthread_key_delete.c
+++ b/nptl/pthread_key_delete.c
@@ -27,7 +27,7 @@ pthread_key_delete (key)
{
int result = EINVAL;
- if (__builtin_expect (key < PTHREAD_KEYS_MAX, 1))
+ if (__glibc_likely (key < PTHREAD_KEYS_MAX))
{
unsigned int seq = __pthread_keys[key].seq;
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index d67dcdb5e2..2b3468835c 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -59,7 +59,7 @@ __pthread_mutex_init (mutex, mutexattr)
case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT:
#ifndef __ASSUME_FUTEX_LOCK_PI
- if (__builtin_expect (tpi_supported == 0, 0))
+ if (__glibc_unlikely (tpi_supported == 0))
{
int lock = 0;
INTERNAL_SYSCALL_DECL (err);
@@ -68,7 +68,7 @@ __pthread_mutex_init (mutex, mutexattr)
assert (INTERNAL_SYSCALL_ERROR_P (ret, err));
tpi_supported = INTERNAL_SYSCALL_ERRNO (ret, err) == ENOSYS ? -1 : 1;
}
- if (__builtin_expect (tpi_supported < 0, 0))
+ if (__glibc_unlikely (tpi_supported < 0))
return ENOTSUP;
#endif
break;
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index add76e8a23..2c317770f9 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -71,7 +71,7 @@ __pthread_mutex_lock (mutex)
| PTHREAD_MUTEX_ELISION_FLAGS_NP), 0))
return __pthread_mutex_lock_full (mutex);
- if (__builtin_expect (type == PTHREAD_MUTEX_TIMED_NP, 1))
+ if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_NP))
{
FORCE_ELISION (mutex, goto elision);
simple:
@@ -80,7 +80,7 @@ __pthread_mutex_lock (mutex)
assert (mutex->__data.__owner == 0);
}
#ifdef HAVE_ELISION
- else if (__builtin_expect (type == PTHREAD_MUTEX_TIMED_ELISION_NP, 1))
+ else if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_ELISION_NP))
{
elision: __attribute__((unused))
/* This case can never happen on a system without elision,
@@ -101,7 +101,7 @@ __pthread_mutex_lock (mutex)
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -150,7 +150,7 @@ __pthread_mutex_lock (mutex)
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
assert (PTHREAD_MUTEX_TYPE (mutex) == PTHREAD_MUTEX_ERRORCHECK_NP);
/* Check whether we already hold the mutex. */
- if (__builtin_expect (mutex->__data.__owner == id, 0))
+ if (__glibc_unlikely (mutex->__data.__owner == id))
return EDEADLK;
goto simple;
}
@@ -229,7 +229,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -245,7 +245,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -296,7 +296,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -309,7 +309,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -359,7 +359,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -427,7 +427,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 8e7a52b54f..03619230ff 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -61,7 +61,7 @@ pthread_mutex_timedlock (mutex, abstime)
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -84,7 +84,7 @@ pthread_mutex_timedlock (mutex, abstime)
/* Error checking mutex. */
case PTHREAD_MUTEX_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
- if (__builtin_expect (mutex->__data.__owner == id, 0))
+ if (__glibc_unlikely (mutex->__data.__owner == id))
return EDEADLK;
/* FALLTHROUGH */
@@ -175,7 +175,7 @@ pthread_mutex_timedlock (mutex, abstime)
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -191,7 +191,7 @@ pthread_mutex_timedlock (mutex, abstime)
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -250,7 +250,7 @@ pthread_mutex_timedlock (mutex, abstime)
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -263,7 +263,7 @@ pthread_mutex_timedlock (mutex, abstime)
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -337,7 +337,7 @@ pthread_mutex_timedlock (mutex, abstime)
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -400,7 +400,7 @@ pthread_mutex_timedlock (mutex, abstime)
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 4d5f75d24f..e46f22ca2c 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -50,7 +50,7 @@ __pthread_mutex_trylock (mutex)
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -133,7 +133,7 @@ __pthread_mutex_trylock (mutex)
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -149,7 +149,7 @@ __pthread_mutex_trylock (mutex)
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -211,7 +211,7 @@ __pthread_mutex_trylock (mutex)
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -224,7 +224,7 @@ __pthread_mutex_trylock (mutex)
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -270,7 +270,7 @@ __pthread_mutex_trylock (mutex)
oldval = mutex->__data.__lock;
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -337,7 +337,7 @@ __pthread_mutex_trylock (mutex)
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 8fe5b67f09..95ae9337c8 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -60,7 +60,7 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
return 0;
}
- else if (__builtin_expect (type == PTHREAD_MUTEX_TIMED_ELISION_NP, 1))
+ else if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_ELISION_NP))
{
/* Don't reset the owner/users fields for elision. */
return lll_unlock_elision (mutex->__data.__lock,
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index a06c3f2d8b..3773f7db2a 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -45,7 +45,7 @@ __pthread_rwlock_rdlock (rwlock)
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
/* Increment the reader counter. Avoid overflow. */
- if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers == 0))
{
/* Overflow on number of readers. */
--rwlock->__data.__nr_readers;
@@ -67,7 +67,7 @@ __pthread_rwlock_rdlock (rwlock)
}
/* Remember that we are a reader. */
- if (__builtin_expect (++rwlock->__data.__nr_readers_queued == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers_queued == 0))
{
/* Overflow on number of queued readers. */
--rwlock->__data.__nr_readers_queued;
diff --git a/nptl/pthread_rwlock_timedrdlock.c b/nptl/pthread_rwlock_timedrdlock.c
index 770cc343cf..81b2ee4096 100644
--- a/nptl/pthread_rwlock_timedrdlock.c
+++ b/nptl/pthread_rwlock_timedrdlock.c
@@ -78,7 +78,7 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
{
result = ETIMEDOUT;
break;
diff --git a/nptl/pthread_rwlock_timedwrlock.c b/nptl/pthread_rwlock_timedwrlock.c
index 2e1390b34f..26f2139c9f 100644
--- a/nptl/pthread_rwlock_timedwrlock.c
+++ b/nptl/pthread_rwlock_timedwrlock.c
@@ -69,7 +69,7 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
{
result = ETIMEDOUT;
break;
diff --git a/nptl/pthread_rwlock_tryrdlock.c b/nptl/pthread_rwlock_tryrdlock.c
index 697aa80c70..f7b1e6b8ac 100644
--- a/nptl/pthread_rwlock_tryrdlock.c
+++ b/nptl/pthread_rwlock_tryrdlock.c
@@ -32,7 +32,7 @@ __pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
&& (rwlock->__data.__nr_writers_queued == 0
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
- if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers == 0))
{
--rwlock->__data.__nr_readers;
result = EAGAIN;
diff --git a/nptl/pthread_setcancelstate.c b/nptl/pthread_setcancelstate.c
index 3bb05030ed..5c3ca866bf 100644
--- a/nptl/pthread_setcancelstate.c
+++ b/nptl/pthread_setcancelstate.c
@@ -55,7 +55,7 @@ __pthread_setcancelstate (state, oldstate)
atomically since other bits could be modified as well. */
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
__do_cancel ();
diff --git a/nptl/pthread_setcanceltype.c b/nptl/pthread_setcanceltype.c
index 0a7691f5b6..fb1631f0ab 100644
--- a/nptl/pthread_setcanceltype.c
+++ b/nptl/pthread_setcanceltype.c
@@ -55,7 +55,7 @@ __pthread_setcanceltype (type, oldtype)
atomically since other bits could be modified as well. */
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
diff --git a/nptl/pthread_setschedprio.c b/nptl/pthread_setschedprio.c
index 033bfecf62..c58ba94719 100644
--- a/nptl/pthread_setschedprio.c
+++ b/nptl/pthread_setschedprio.c
@@ -48,7 +48,7 @@ pthread_setschedprio (threadid, prio)
param.sched_priority = pd->tpp->priomax;
/* Try to set the scheduler information. */
- if (__builtin_expect (sched_setparam (pd->tid, &param) == -1, 0))
+ if (__glibc_unlikely (sched_setparam (pd->tid, &param) == -1))
result = errno;
else
{
diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c
index 877fb02200..0ace86168f 100644
--- a/nptl/pthread_setspecific.c
+++ b/nptl/pthread_setspecific.c
@@ -36,7 +36,7 @@ __pthread_setspecific (key, value)
/* Special case access to the first 2nd-level block. This is the
usual case. */
- if (__builtin_expect (key < PTHREAD_KEY_2NDLEVEL_SIZE, 1))
+ if (__glibc_likely (key < PTHREAD_KEY_2NDLEVEL_SIZE))
{
/* Verify the key is sane. */
if (KEY_UNUSED ((seq = __pthread_keys[key].seq)))
diff --git a/nptl/sem_init.c b/nptl/sem_init.c
index 8bfb9c1f0c..7af2775113 100644
--- a/nptl/sem_init.c
+++ b/nptl/sem_init.c
@@ -31,7 +31,7 @@ __new_sem_init (sem, pshared, value)
unsigned int value;
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
@@ -66,7 +66,7 @@ __old_sem_init (sem, pshared, value)
unsigned int value;
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index b57e6b7573..cf91859dab 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -74,10 +74,10 @@ __where_is_shmfs (void)
/* OK, do it the hard way. Look through the /proc/mounts file and if
this does not exist through /etc/fstab to find the mount point. */
fp = __setmntent ("/proc/mounts", "r");
- if (__builtin_expect (fp == NULL, 0))
+ if (__glibc_unlikely (fp == NULL))
{
fp = __setmntent (_PATH_MNTTAB, "r");
- if (__builtin_expect (fp == NULL, 0))
+ if (__glibc_unlikely (fp == NULL))
/* There is nothing we can do. Blind guesses are not helpful. */
return;
}
diff --git a/nptl/sigaction.c b/nptl/sigaction.c
index 33cf9ade41..7b01bfcd9c 100644
--- a/nptl/sigaction.c
+++ b/nptl/sigaction.c
@@ -34,7 +34,7 @@ __sigaction (sig, act, oact)
const struct sigaction *act;
struct sigaction *oact;
{
- if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0))
+ if (__glibc_unlikely (sig == SIGCANCEL || sig == SIGSETXID))
{
__set_errno (EINVAL);
return -1;
diff --git a/nptl/sockperf.c b/nptl/sockperf.c
index d29a6ee26a..740fb883f0 100644
--- a/nptl/sockperf.c
+++ b/nptl/sockperf.c
@@ -479,7 +479,7 @@ get_clockfreq (void)
return result;
fd = open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
to a size of 4096 bytes. */
@@ -491,7 +491,7 @@ get_clockfreq (void)
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
int seen_decpoint = 0;
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index 2a9a723ddb..93f93eebd4 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -56,7 +56,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
PREPARE_CREATE;
#endif
- if (__builtin_expect (stopped != 0, 0))
+ if (__glibc_unlikely (stopped != 0))
/* We make sure the thread does not run far by forcing it to get a
lock. We lock it here too so that the new thread cannot continue
until we tell it to. */
@@ -75,7 +75,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
int rc = ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags,
pd, &pd->tid, TLS_VALUE, &pd->tid);
- if (__builtin_expect (rc == -1, 0))
+ if (__glibc_unlikely (rc == -1))
{
atomic_decrement (&__nptl_nthreads); /* Oops, we lied for a second. */
@@ -93,7 +93,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
}
/* Now we have the possibility to set scheduling parameters etc. */
- if (__builtin_expect (stopped != 0, 0))
+ if (__glibc_unlikely (stopped != 0))
{
INTERNAL_SYSCALL_DECL (err);
int res = 0;
@@ -104,7 +104,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid,
attr->cpusetsize, attr->cpuset);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
/* The operation failed. We have to kill the thread. First
send it the cancellation signal. */
@@ -129,7 +129,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid,
pd->schedpolicy, &pd->schedparam);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
goto err_out;
}
}
@@ -183,7 +183,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
| CLONE_CHILD_CLEARTID | CLONE_SYSVSEM
| 0);
- if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
+ if (__glibc_unlikely (THREAD_GETMEM (THREAD_SELF, report_events)))
{
/* The parent thread is supposed to report events. Check whether
the TD_CREATE event is needed, too. */
diff --git a/nptl/sysdeps/pthread/setxid.h b/nptl/sysdeps/pthread/setxid.h
index 65a1ce7bf9..76c88e0feb 100644
--- a/nptl/sysdeps/pthread/setxid.h
+++ b/nptl/sysdeps/pthread/setxid.h
@@ -48,7 +48,7 @@
({ \
extern __typeof (__nptl_setxid) __nptl_setxid __attribute__((weak));\
int __result; \
- if (__builtin_expect (__nptl_setxid != NULL, 0)) \
+ if (__glibc_unlikely (__nptl_setxid != NULL)) \
{ \
struct xid_command __cmd; \
__cmd.syscall_no = __NR_##name; \
diff --git a/nptl/sysdeps/pthread/timer_create.c b/nptl/sysdeps/pthread/timer_create.c
index 359a770c05..461d28e353 100644
--- a/nptl/sysdeps/pthread/timer_create.c
+++ b/nptl/sysdeps/pthread/timer_create.c
@@ -68,7 +68,7 @@ timer_create (clock_id, evp, timerid)
pthread_mutex_lock (&__timer_mutex);
newtimer = __timer_alloc ();
- if (__builtin_expect (newtimer == NULL, 0))
+ if (__glibc_unlikely (newtimer == NULL))
{
__set_errno (EAGAIN);
goto unlock_bail;
@@ -123,7 +123,7 @@ timer_create (clock_id, evp, timerid)
thread = __timer_thread_alloc (&newtimer->attr, clock_id);
/* Out of luck; no threads are available. */
- if (__builtin_expect (thread == NULL, 0))
+ if (__glibc_unlikely (thread == NULL))
{
__set_errno (EAGAIN);
goto unlock_bail;
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index cb94ea6c21..9d7bdc5b90 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -42,7 +42,7 @@ pthread_cancel_init (void)
void *getcfa;
void *handle;
- if (__builtin_expect (libgcc_s_handle != NULL, 1))
+ if (__glibc_likely (libgcc_s_handle != NULL))
{
/* Force gcc to reload all values. */
asm volatile ("" ::: "memory");
@@ -93,7 +93,7 @@ __unwind_freeres (void)
void
_Unwind_Resume (struct _Unwind_Exception *exc)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -109,7 +109,7 @@ __gcc_personality_v0 (int version, _Unwind_Action actions,
struct _Unwind_Exception *ue_header,
struct _Unwind_Context *context)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -125,7 +125,7 @@ _Unwind_Reason_Code
_Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
void *stop_argument)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -140,7 +140,7 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
_Unwind_Word
_Unwind_GetCFA (struct _Unwind_Context *context)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
diff --git a/nptl/sysdeps/unix/sysv/linux/getpid.c b/nptl/sysdeps/unix/sysv/linux/getpid.c
index f806f2ff87..937b1d4e11 100644
--- a/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -27,10 +27,10 @@ static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval);
static inline __attribute__((always_inline)) pid_t
really_getpid (pid_t oldval)
{
- if (__builtin_expect (oldval == 0, 1))
+ if (__glibc_likely (oldval == 0))
{
pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid);
- if (__builtin_expect (selftid != 0, 1))
+ if (__glibc_likely (selftid != 0))
return selftid;
}
@@ -53,7 +53,7 @@ __getpid (void)
pid_t result = INTERNAL_SYSCALL (getpid, err, 0);
#else
pid_t result = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (result <= 0, 0))
+ if (__glibc_unlikely (result <= 0))
result = really_getpid (result);
#endif
return result;
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
index 5c9ada18a0..c894b1ecda 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
@@ -35,7 +35,7 @@ __lll_robust_lock_wait (int *futex, int private)
do
{
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
return oldval;
int newval = oldval | FUTEX_WAITERS;
@@ -72,7 +72,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
return ETIMEDOUT;
do
@@ -100,7 +100,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
#endif
/* Wait. */
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
return oldval;
int newval = oldval | FUTEX_WAITERS;
diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
index 0d20919667..3138ad2c3c 100644
--- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
@@ -266,7 +266,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
/* If we cannot create the netlink socket we cannot provide
SIGEV_THREAD support. */
- if (__builtin_expect (netlink_socket == -1, 0))
+ if (__glibc_unlikely (netlink_socket == -1))
{
__set_errno (ENOSYS);
return -1;
@@ -299,7 +299,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se);
/* If it failed, free the allocated memory. */
- if (__builtin_expect (retval != 0, 0))
+ if (__glibc_unlikely (retval != 0))
free (data.attr);
return retval;
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index fe856708a4..ab92c3fc8f 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -306,7 +306,7 @@ extern int __lll_robust_timedlock_wait
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_rel (__futex, 0); \
- if (__builtin_expect (__val > 1, 0)) \
+ if (__glibc_unlikely (__val > 1)) \
lll_futex_wake (__futex, 1, private); \
}))
@@ -314,7 +314,7 @@ extern int __lll_robust_timedlock_wait
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_rel (__futex, 0); \
- if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
+ if (__glibc_unlikely (__val & FUTEX_WAITERS)) \
lll_futex_wake (__futex, 1, private); \
}))
diff --git a/nptl/sysdeps/unix/sysv/linux/pt-raise.c b/nptl/sysdeps/unix/sysv/linux/pt-raise.c
index 68059db8db..74762b749b 100644
--- a/nptl/sysdeps/unix/sysv/linux/pt-raise.c
+++ b/nptl/sysdeps/unix/sysv/linux/pt-raise.c
@@ -31,7 +31,7 @@ raise (sig)
fork function temporarily invalidated the PID field. Adjust for
that. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
+ if (__glibc_unlikely (pid < 0))
pid = -pid;
return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index 43e5c02b37..f8957ae17c 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -40,7 +40,7 @@ __pthread_kill (threadid, signo)
if a thread exits between ESRCH test and tgkill, we might return
EINVAL, because pd->tid would be cleared by the kernel. */
pid_t tid = atomic_forced_read (pd->tid);
- if (__builtin_expect (tid <= 0, 0))
+ if (__glibc_unlikely (tid <= 0))
/* Not a valid thread handle. */
return ESRCH;
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
index 288d73f8c8..874cf4b578 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
@@ -61,7 +61,7 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
INTERNAL_SYSCALL_DECL (err);
int res;
- if (__builtin_expect (__kernel_cpumask_size == 0, 0))
+ if (__glibc_unlikely (__kernel_cpumask_size == 0))
{
res = __determine_cpumask_size (pd->tid);
if (res != 0)
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
index 9c3e73cdea..8dee3a69d2 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
@@ -44,7 +44,7 @@ pthread_sigqueue (threadid, signo, value)
if a thread exits between ESRCH test and tgkill, we might return
EINVAL, because pd->tid would be cleared by the kernel. */
pid_t tid = atomic_forced_read (pd->tid);
- if (__builtin_expect (tid <= 0, 0))
+ if (__glibc_unlikely (tid <= 0))
/* Not a valid thread handle. */
return ESRCH;
diff --git a/nptl/sysdeps/unix/sysv/linux/raise.c b/nptl/sysdeps/unix/sysv/linux/raise.c
index 321d9c3543..67c9b1f23e 100644
--- a/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -50,7 +50,7 @@ raise (sig)
/* raise is an async-safe function. It could be called while the
fork/vfork function temporarily invalidated the PID field. Adjust for
that. */
- if (__builtin_expect (pid <= 0, 0))
+ if (__glibc_unlikely (pid <= 0))
pid = (pid & INT_MAX) == 0 ? selftid : -pid;
return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 80dc90543b..864dcbccc0 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -233,7 +233,7 @@ static inline void
__attribute__ ((always_inline))
__lll_lock (int *futex, int private)
{
- if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 1, 0), 0))
+ if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 1, 0)))
{
if (__builtin_constant_p (private) && private == LLL_PRIVATE)
__lll_lock_wait_private (futex);
@@ -260,7 +260,7 @@ static inline void
__attribute__ ((always_inline))
__lll_cond_lock (int *futex, int private)
{
- if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 2, 0), 0))
+ if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 2, 0)))
__lll_lock_wait (futex, private);
}
#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
@@ -278,7 +278,7 @@ __attribute__ ((always_inline))
__lll_timedlock (int *futex, const struct timespec *abstime, int private)
{
int result = 0;
- if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 1, 0), 0))
+ if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 1, 0)))
result = __lll_timedlock_wait (futex, abstime, private);
return result;
}
@@ -307,7 +307,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
int *__futexp = (futex); \
\
lll_compare_and_swap (__futexp, __oldval, __newval, "slr %2,%2"); \
- if (__builtin_expect (__oldval > 1, 0)) \
+ if (__glibc_unlikely (__oldval > 1)) \
lll_futex_wake (__futexp, 1, private); \
})
#define lll_unlock(futex, private) __lll_unlock(&(futex), private)
@@ -320,7 +320,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
int *__futexp = (futex); \
\
lll_compare_and_swap (__futexp, __oldval, __newval, "slr %2,%2"); \
- if (__builtin_expect (__oldval & FUTEX_WAITERS, 0)) \
+ if (__glibc_unlikely (__oldval & FUTEX_WAITERS)) \
lll_futex_wake (__futexp, 1, private); \
})
#define lll_robust_unlock(futex, private) \
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index d851d74542..d4ed7a9bd7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -223,7 +223,7 @@ __lll_lock (int *futex, int private)
{
int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
- if (__builtin_expect (val != 0, 0))
+ if (__glibc_unlikely (val != 0))
{
if (__builtin_constant_p (private) && private == LLL_PRIVATE)
__lll_lock_wait_private (futex);
@@ -251,7 +251,7 @@ __lll_cond_lock (int *futex, int private)
{
int val = atomic_compare_and_exchange_val_24_acq (futex, 2, 0);
- if (__builtin_expect (val != 0, 0))
+ if (__glibc_unlikely (val != 0))
__lll_lock_wait (futex, private);
}
#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
@@ -272,7 +272,7 @@ __lll_timedlock (int *futex, const struct timespec *abstime, int private)
int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
int result = 0;
- if (__builtin_expect (val != 0, 0))
+ if (__glibc_unlikely (val != 0))
result = __lll_timedlock_wait (futex, abstime, private);
return result;
}
@@ -296,7 +296,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_24_rel (__futex, 0); \
- if (__builtin_expect (__val > 1, 0)) \
+ if (__glibc_unlikely (__val > 1)) \
lll_futex_wake (__futex, 1, private); \
}))
@@ -304,7 +304,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_rel (__futex, 0); \
- if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
+ if (__glibc_unlikely (__val & FUTEX_WAITERS)) \
lll_futex_wake (__futex, 1, private); \
}))
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
index 4ce7871fbd..2221a27e22 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
@@ -33,7 +33,7 @@ pthread_barrier_destroy (barrier)
lll_lock (ibarrier->b.lock, private);
- if (__builtin_expect (ibarrier->b.left == ibarrier->b.init_count, 1))
+ if (__glibc_likely (ibarrier->b.left == ibarrier->b.init_count))
/* The barrier is not used anymore. */
result = 0;
else
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
index 9bc7a05333..6af686361d 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
@@ -28,7 +28,7 @@ pthread_barrier_init (barrier, attr, count)
{
union sparc_pthread_barrier *ibarrier;
- if (__builtin_expect (count == 0, 0))
+ if (__glibc_unlikely (count == 0))
return EINVAL;
struct pthread_barrierattr *iattr = (struct pthread_barrierattr *) attr;
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
index d415366f4c..cbefdc4823 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
@@ -32,7 +32,7 @@ __new_sem_init (sem, pshared, value)
unsigned int value;
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
@@ -66,7 +66,7 @@ __old_sem_init (sem, pshared, value)
unsigned int value;
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
index e46eef426c..7624f2cdb2 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
@@ -50,7 +50,7 @@ __timer_create_old (clockid_t clock_id, struct sigevent *evp, int *timerid)
break;
}
- if (__builtin_expect (i == OLD_TIMER_MAX, 0))
+ if (__glibc_unlikely (i == OLD_TIMER_MAX))
{
/* No free slot. */
(void) __timer_delete_new (newp);
diff --git a/nptl/unwind.c b/nptl/unwind.c
index fb2489cd96..a71015a2f1 100644
--- a/nptl/unwind.c
+++ b/nptl/unwind.c
@@ -62,7 +62,7 @@ unwind_stop (int version, _Unwind_Action actions,
adj))
do_longjump = 1;
- if (__builtin_expect (curp != NULL, 0))
+ if (__glibc_unlikely (curp != NULL))
{
/* Handle the compatibility stuff. Execute all handlers
registered with the old method which would be unwound by this
diff --git a/nscd/aicache.c b/nscd/aicache.c
index d6b928cf2d..98d40a1c55 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -77,7 +77,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
char strdata[0];
} *dataset = NULL;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in hosts cache!"), (char *) key);
@@ -434,7 +434,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
struct dataset *newp
= (struct dataset *) mempool_alloc (db, total + req->key_len,
1);
- if (__builtin_expect (newp != NULL, 1))
+ if (__glibc_likely (newp != NULL))
{
/* Adjust pointer into the memory block. */
key_copy = (char *) newp + (key_copy - (char *) dataset);
diff --git a/nscd/cache.c b/nscd/cache.c
index 2c35a34943..5e8a42f596 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -138,7 +138,7 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet,
bool first, struct database_dyn *table,
uid_t owner, bool prune_wakeup)
{
- if (__builtin_expect (debug_level >= 2, 0))
+ if (__glibc_unlikely (debug_level >= 2))
{
const char *str;
char buf[INET6_ADDRSTRLEN + 1];
@@ -311,7 +311,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
bool *mark;
size_t memory_needed = cnt * sizeof (bool);
bool mark_use_alloca;
- if (__builtin_expect (memory_needed <= MAX_STACK_USE, 1))
+ if (__glibc_likely (memory_needed <= MAX_STACK_USE))
{
mark = alloca (cnt * sizeof (bool));
memset (mark, '\0', memory_needed);
@@ -327,7 +327,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
char *const data = table->data;
bool any = false;
- if (__builtin_expect (debug_level > 2, 0))
+ if (__glibc_unlikely (debug_level > 2))
dbg_log (_("pruning %s cache; time %ld"),
dbnames[table - dbs], (long int) now);
@@ -343,7 +343,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
struct datahead *dh = (struct datahead *) (data + runp->packet);
/* Some debug support. */
- if (__builtin_expect (debug_level > 2, 0))
+ if (__glibc_unlikely (debug_level > 2))
{
char buf[INET6_ADDRSTRLEN];
const char *str;
@@ -422,7 +422,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
}
while (cnt > 0);
- if (__builtin_expect (fd != -1, 0))
+ if (__glibc_unlikely (fd != -1))
{
/* Reply to the INVALIDATE initiator that the cache has been
invalidated. */
@@ -436,7 +436,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
/* Now we have to get the write lock since we are about to modify
the table. */
- if (__builtin_expect (pthread_rwlock_trywrlock (&table->lock) != 0, 0))
+ if (__glibc_unlikely (pthread_rwlock_trywrlock (&table->lock) != 0))
{
++table->head->wrlockdelayed;
pthread_rwlock_wrlock (&table->lock);
@@ -492,7 +492,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
MS_ASYNC);
/* One extra pass if we do debugging. */
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
struct hashentry *runp = head;
@@ -517,7 +517,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
}
}
- if (__builtin_expect (! mark_use_alloca, 0))
+ if (__glibc_unlikely (! mark_use_alloca))
free (mark);
/* Run garbage collection if any entry has been removed or replaced. */
diff --git a/nscd/connections.c b/nscd/connections.c
index f3732f5ef4..f463f45b86 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -999,7 +999,7 @@ register_traced_file (size_t dbidx, struct traced_file *finfo)
if (! dbs[dbidx].enabled || ! dbs[dbidx].check_file)
return;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
dbg_log (_("register trace file %s for database %s"),
finfo->fname, dbnames[dbidx]);
@@ -1129,7 +1129,7 @@ send_ro_fd (struct database_dyn *db, char *key, int fd)
#endif
(void) TEMP_FAILURE_RETRY (sendmsg (fd, &msg, MSG_NOSIGNAL));
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
dbg_log (_("provide access to FD %d, for %s"), db->ro_fd, key);
}
#endif /* SCM_RIGHTS */
@@ -1201,7 +1201,7 @@ request from '%s' [%ld] not handled due to missing permission"),
}
/* Is this service enabled? */
- if (__builtin_expect (!db->enabled, 0))
+ if (__glibc_unlikely (!db->enabled))
{
/* No, sent the prepared record. */
if (TEMP_FAILURE_RETRY (send (fd, db->disabled_iov->iov_base,
@@ -1220,7 +1220,7 @@ request from '%s' [%ld] not handled due to missing permission"),
}
/* Be sure we can read the data. */
- if (__builtin_expect (pthread_rwlock_tryrdlock (&db->lock) != 0, 0))
+ if (__glibc_unlikely (pthread_rwlock_tryrdlock (&db->lock) != 0))
{
++db->head->rdlockdelayed;
pthread_rwlock_rdlock (&db->lock);
@@ -1236,7 +1236,7 @@ request from '%s' [%ld] not handled due to missing permission"),
ssize_t nwritten;
#ifdef HAVE_SENDFILE
- if (__builtin_expect (db->mmap_used, 1))
+ if (__glibc_likely (db->mmap_used))
{
assert (db->wr_fd != -1);
assert ((char *) cached->data > (char *) db->data);
@@ -1603,7 +1603,7 @@ nscd_run_prune (void *p)
dbs[my_number].head->timestamp = now;
struct timespec prune_ts;
- if (__builtin_expect (clock_gettime (timeout_clock, &prune_ts) == -1, 0))
+ if (__glibc_unlikely (clock_gettime (timeout_clock, &prune_ts) == -1))
/* Should never happen. */
abort ();
@@ -1656,7 +1656,7 @@ nscd_run_prune (void *p)
we need to wake up occasionally to update the timestamp.
Wait 90% of the update period. */
#define UPDATE_MAPPING_TIMEOUT (MAPPING_TIMEOUT * 9 / 10)
- if (__builtin_expect (! dont_need_update, 0))
+ if (__glibc_unlikely (! dont_need_update))
{
next_wait = MIN (UPDATE_MAPPING_TIMEOUT, next_wait);
dbs[my_number].head->timestamp = now;
@@ -1756,7 +1756,7 @@ nscd_run_worker (void *p)
#ifdef SO_PEERCRED
pid_t pid = 0;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
struct ucred caller;
socklen_t optlen = sizeof (caller);
@@ -1849,7 +1849,7 @@ fd_ready (int fd)
}
bool do_signal = true;
- if (__builtin_expect (nready == 0, 0))
+ if (__glibc_unlikely (nready == 0))
{
++client_queued;
do_signal = false;
@@ -2264,7 +2264,7 @@ main_loop_epoll (int efd)
sizeof (inev)));
if (nb < (ssize_t) sizeof (struct inotify_event))
{
- if (__builtin_expect (nb == -1 && errno != EAGAIN, 0))
+ if (__glibc_unlikely (nb == -1 && errno != EAGAIN))
{
/* Something went wrong when reading the inotify
data. Better disable inotify. */
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 8f5d39b138..b5a33eb347 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -452,7 +452,7 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
bool use_malloc = false;
int errval = 0;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in group cache!"), keystr);
@@ -465,7 +465,7 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
{
errno = 0;
- if (__builtin_expect (buflen > 32768, 0))
+ if (__glibc_unlikely (buflen > 32768))
{
char *old_buffer = buffer;
buflen *= 2;
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index abedf9a63e..a79b67aa7e 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -480,7 +480,7 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
int errval = 0;
int32_t ttl = INT32_MAX;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
const char *str;
char buf[INET6_ADDRSTRLEN + 1];
@@ -502,7 +502,7 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
{
errno = 0;
- if (__builtin_expect (buflen > 32768, 0))
+ if (__glibc_unlikely (buflen > 32768))
{
char *old_buffer = buffer;
buflen *= 2;
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index a727fa9c8b..1bf9f0d7f4 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -71,7 +71,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
char strdata[0];
} *dataset = NULL;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in group cache!"), (char *) key);
@@ -112,7 +112,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
mempool_alloc. */
// XXX This really should use alloca. need to change the backends.
gid_t *groups = (gid_t *) malloc (size * sizeof (gid_t));
- if (__builtin_expect (groups == NULL, 0))
+ if (__glibc_unlikely (groups == NULL))
/* No more memory. */
goto out;
diff --git a/nscd/mem.c b/nscd/mem.c
index 0d09e21d5e..b4090fb6a5 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -124,11 +124,11 @@ gc (struct database_dyn *db)
/* In prune_cache we are also using a dynamically allocated array.
If the array in the caller is too large we have malloc'ed it. */
size_t stack_used = sizeof (bool) * db->head->module;
- if (__builtin_expect (stack_used > MAX_STACK_USE, 0))
+ if (__glibc_unlikely (stack_used > MAX_STACK_USE))
stack_used = 0;
size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS;
size_t memory_needed = nmark * sizeof (BITMAP_T);
- if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1))
+ if (__glibc_likely (stack_used + memory_needed <= MAX_STACK_USE))
{
mark = (BITMAP_T *) alloca_account (memory_needed, stack_used);
mark_use_malloc = false;
@@ -146,7 +146,7 @@ gc (struct database_dyn *db)
struct hashentry **he;
struct hashentry **he_data;
bool he_use_malloc;
- if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1))
+ if (__glibc_likely (stack_used + memory_needed <= MAX_STACK_USE))
{
he = alloca_account (memory_needed, stack_used);
he_use_malloc = false;
@@ -421,7 +421,7 @@ gc (struct database_dyn *db)
}
while (runp != moves->next);
- if (__builtin_expect (debug_level >= 3, 0))
+ if (__glibc_unlikely (debug_level >= 3))
dbg_log (_("freed %zu bytes in %s cache"),
db->head->first_free
- ((char *) moves->to + moves->size - db->data),
@@ -432,7 +432,7 @@ gc (struct database_dyn *db)
db->head->first_free = (char *) moves->to + moves->size - db->data;
/* Consistency check. */
- if (__builtin_expect (debug_level >= 3, 0))
+ if (__glibc_unlikely (debug_level >= 3))
{
for (size_t idx = 0; idx < db->head->module; ++idx)
{
@@ -527,7 +527,7 @@ mempool_alloc (struct database_dyn *db, size_t len, int data_alloc)
retry:
res = db->data + db->head->first_free;
- if (__builtin_expect (db->head->first_free + len > db->head->data_size, 0))
+ if (__glibc_unlikely (db->head->first_free + len > db->head->data_size))
{
if (! tried_resize)
{
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index be01fe8670..426d3c5e39 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -120,7 +120,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
const char *key, uid_t uid, struct hashentry *he,
struct datahead *dh, struct dataset **resultp)
{
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in netgroup cache!"), key);
@@ -398,7 +398,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
{
struct dataset *newp
= (struct dataset *) mempool_alloc (db, total + req->key_len, 1);
- if (__builtin_expect (newp != NULL, 1))
+ if (__glibc_likely (newp != NULL))
{
/* Adjust pointer into the memory block. */
key_copy = (char *) newp + (key_copy - buffer);
@@ -494,7 +494,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
key = (char *) rawmemchr (key, '\0') + 1;
const char *domain = *key++ ? key : NULL;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s (%s,%s,%s)\" in netgroup cache!"),
@@ -531,7 +531,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
1);
struct indataset dataset_mem;
bool cacheable = true;
- if (__builtin_expect (dataset == NULL, 0))
+ if (__glibc_unlikely (dataset == NULL))
{
cacheable = false;
dataset = &dataset_mem;
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index b5c9f871a7..98f77e7901 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -331,7 +331,7 @@ __nscd_acquire_maplock (volatile struct locked_map_ptr *mapptr)
1, 0) != 0, 0))
{
// XXX Best number of rounds?
- if (__builtin_expect (++cnt > 5, 0))
+ if (__glibc_unlikely (++cnt > 5))
return false;
atomic_delay ();
@@ -369,7 +369,7 @@ __nscd_drop_map_ref (struct mapped_database *map, int *gc_cycle)
if (map != NO_MAPPING)
{
int now_cycle = map->head->gc_cycle;
- if (__builtin_expect (now_cycle != *gc_cycle, 0))
+ if (__glibc_unlikely (now_cycle != *gc_cycle))
{
/* We might have read inconsistent data. */
*gc_cycle = now_cycle;
diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c
index 155cfef2eb..328c2617da 100644
--- a/nscd/nscd_getai.c
+++ b/nscd/nscd_getai.c
@@ -42,7 +42,7 @@ extern int __nss_have_localdomain attribute_hidden;
int
__nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
{
- if (__builtin_expect (__nss_have_localdomain >= 0, 0))
+ if (__glibc_unlikely (__nss_have_localdomain >= 0))
{
if (__nss_have_localdomain == 0)
__nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1;
@@ -171,7 +171,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
}
else
{
- if (__builtin_expect (ai_resp.found == -1, 0))
+ if (__glibc_unlikely (ai_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_hosts = 1;
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index ed5dc11159..d9b91a470f 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -143,7 +143,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
/* No value found so far. */
*result = NULL;
- if (__builtin_expect (gr_resp.found == -1, 0))
+ if (__glibc_unlikely (gr_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_group = 1;
@@ -164,7 +164,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
& (__alignof__ (char *) - 1));
total_len = (align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)
+ gr_resp.gr_name_len + gr_resp.gr_passwd_len);
- if (__builtin_expect (buflen < total_len, 0))
+ if (__glibc_unlikely (buflen < total_len))
{
no_room:
__set_errno (ERANGE);
@@ -190,7 +190,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
if (gr_name == NULL)
{
/* Handle a simple, usual case: no group members. */
- if (__builtin_expect (gr_resp.gr_mem_cnt == 0, 1))
+ if (__glibc_likely (gr_resp.gr_mem_cnt == 0))
{
size_t n = gr_resp.gr_name_len + gr_resp.gr_passwd_len;
if (__builtin_expect (__readall (sock, resultbuf->gr_name, n)
@@ -217,7 +217,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
/* Get this data. */
size_t n = __readvall (sock, vec, 2);
- if (__builtin_expect (n != total_len, 0))
+ if (__glibc_unlikely (n != total_len))
goto out_close;
}
}
@@ -239,7 +239,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
p += len[cnt];
}
- if (__builtin_expect (gr_name + gr_name_len + total_len > recend, 0))
+ if (__glibc_unlikely (gr_name + gr_name_len + total_len > recend))
{
/* len array might contain garbage during nscd GC cycle,
retry rather than fail in that case. */
@@ -247,7 +247,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
retval = -2;
goto out_close;
}
- if (__builtin_expect (total_len > buflen, 0))
+ if (__glibc_unlikely (total_len > buflen))
{
/* len array might contain garbage during nscd GC cycle,
retry rather than fail in that case. */
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index 3368fc4482..fe885ee320 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -140,7 +140,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
struct hostent *resultbuf, char *buffer, size_t buflen,
struct hostent **result, int *h_errnop)
{
- if (__builtin_expect (__nss_have_localdomain >= 0, 0))
+ if (__glibc_unlikely (__nss_have_localdomain >= 0))
{
if (__nss_have_localdomain == 0)
__nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1;
@@ -232,7 +232,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
/* No value found so far. */
*result = NULL;
- if (__builtin_expect (hst_resp.found == -1, 0))
+ if (__glibc_unlikely (hst_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_hosts = 1;
@@ -377,7 +377,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
goto out_close;
}
/* See whether this would exceed the buffer capacity. */
- if (__builtin_expect (cp > buffer + buflen, 0))
+ if (__glibc_unlikely (cp > buffer + buflen))
{
/* aliases_len array might contain garbage during nscd GC cycle,
retry rather than fail in that case. */
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index 5454ab62ad..278b9db8ff 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -134,7 +134,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
/* No value found so far. */
*result = NULL;
- if (__builtin_expect (pw_resp.found == -1, 0))
+ if (__glibc_unlikely (pw_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_passwd = 1;
@@ -165,9 +165,9 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
p += pw_resp.pw_shell_len;
ssize_t total = p - buffer;
- if (__builtin_expect (pw_name + total > recend, 0))
+ if (__glibc_unlikely (pw_name + total > recend))
goto out_close;
- if (__builtin_expect (buflen < total, 0))
+ if (__glibc_unlikely (buflen < total))
{
__set_errno (ERANGE);
retval = ERANGE;
@@ -179,7 +179,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
{
ssize_t nbytes = __readall (sock, buffer, total);
- if (__builtin_expect (nbytes != total, 0))
+ if (__glibc_unlikely (nbytes != total))
{
/* The `errno' to some value != ERANGE. */
__set_errno (ENOENT);
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
index 38f159eecf..4e3f702b84 100644
--- a/nscd/nscd_getserv_r.c
+++ b/nscd/nscd_getserv_r.c
@@ -189,7 +189,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
/* No value found so far. */
*result = NULL;
- if (__builtin_expect (serv_resp.found == -1, 0))
+ if (__glibc_unlikely (serv_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_services = 1;
@@ -300,7 +300,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
}
/* See whether this would exceed the buffer capacity. */
- if (__builtin_expect (cp > buf + buflen, 0))
+ if (__glibc_unlikely (cp > buf + buflen))
{
/* aliases_len array might contain garbage during nscd GC cycle,
retry rather than fail in that case. */
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index e4fb2e59f8..0d61643f10 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -110,7 +110,7 @@ __readvall (int fd, const struct iovec *iov, int iovcnt)
ssize_t ret = TEMP_FAILURE_RETRY (__readv (fd, iov, iovcnt));
if (ret <= 0)
{
- if (__builtin_expect (ret == 0 || errno != EAGAIN, 1))
+ if (__glibc_likely (ret == 0 || errno != EAGAIN))
/* A genuine error or no data to read. */
return ret;
@@ -226,7 +226,7 @@ open_socket (request_type type, const char *key, size_t keylen)
ssize_t wres = TEMP_FAILURE_RETRY (__send (sock, &reqdata,
real_sizeof_reqdata,
MSG_NOSIGNAL));
- if (__builtin_expect (wres == (ssize_t) real_sizeof_reqdata, 1))
+ if (__glibc_likely (wres == (ssize_t) real_sizeof_reqdata))
/* We managed to send the request. */
return sock;
@@ -339,13 +339,13 @@ __nscd_get_mapping (request_type type, const char *key,
int *ip = (void *) CMSG_DATA (cmsg);
mapfd = *ip;
- if (__builtin_expect (n != keylen && n != keylen + sizeof (mapsize), 0))
+ if (__glibc_unlikely (n != keylen && n != keylen + sizeof (mapsize)))
goto out_close;
- if (__builtin_expect (strcmp (resdata, key) != 0, 0))
+ if (__glibc_unlikely (strcmp (resdata, key) != 0))
goto out_close;
- if (__builtin_expect (n == keylen, 0))
+ if (__glibc_unlikely (n == keylen))
{
struct stat64 st;
if (__builtin_expect (fstat64 (mapfd, &st) != 0, 0)
@@ -358,7 +358,7 @@ __nscd_get_mapping (request_type type, const char *key,
/* The file is large enough, map it now. */
void *mapping = __mmap (NULL, mapsize, PROT_READ, MAP_SHARED, mapfd, 0);
- if (__builtin_expect (mapping != MAP_FAILED, 1))
+ if (__glibc_likely (mapping != MAP_FAILED))
{
/* Check whether the database is correct and up-to-date. */
struct database_pers_head *head = mapping;
@@ -383,7 +383,7 @@ __nscd_get_mapping (request_type type, const char *key,
ALIGN)
+ head->data_size);
- if (__builtin_expect (mapsize < size, 0))
+ if (__glibc_unlikely (mapsize < size))
goto out_unmap;
/* Allocate a record for the mapping. */
@@ -433,7 +433,7 @@ __nscd_get_map_ref (request_type type, const char *name,
cur = mapptr->mapped;
- if (__builtin_expect (cur != NO_MAPPING, 1))
+ if (__glibc_likely (cur != NO_MAPPING))
{
/* If not mapped or timestamp not updated, request new map. */
if (cur == NULL
@@ -443,7 +443,7 @@ __nscd_get_map_ref (request_type type, const char *name,
cur = __nscd_get_mapping (type, name,
(struct mapped_database **) &mapptr->mapped);
- if (__builtin_expect (cur != NO_MAPPING, 1))
+ if (__glibc_likely (cur != NO_MAPPING))
{
if (__builtin_expect (((*gc_cyclep = cur->head->gc_cycle) & 1) != 0,
0))
diff --git a/nscd/nscd_initgroups.c b/nscd/nscd_initgroups.c
index 8bc3e6ce3d..a11ef061fd 100644
--- a/nscd/nscd_initgroups.c
+++ b/nscd/nscd_initgroups.c
@@ -130,7 +130,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
}
else
{
- if (__builtin_expect (initgr_resp.found == -1, 0))
+ if (__glibc_unlikely (initgr_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_group = 1;
diff --git a/nscd/nscd_netgroup.c b/nscd/nscd_netgroup.c
index 4acb0be412..104bf21c30 100644
--- a/nscd/nscd_netgroup.c
+++ b/nscd/nscd_netgroup.c
@@ -124,7 +124,7 @@ __nscd_setnetgrent (const char *group, struct __netgrent *datap)
}
else
{
- if (__builtin_expect (netgroup_resp.found == -1, 0))
+ if (__glibc_unlikely (netgroup_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_netgroup = 1;
@@ -248,7 +248,7 @@ __nscd_innetgr (const char *netgroup, const char *host, const char *user,
retval = innetgroup_resp.result;
else
{
- if (__builtin_expect (innetgroup_resp.found == -1, 0))
+ if (__glibc_unlikely (innetgroup_resp.found == -1))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_netgroup = 1;
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 5adb8ad8e3..fa355c3891 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -430,7 +430,7 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
bool use_malloc = false;
int errval = 0;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in password cache!"), keystr);
@@ -443,7 +443,7 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
{
errno = 0;
- if (__builtin_expect (buflen > 32768, 0))
+ if (__glibc_unlikely (buflen > 32768))
{
char *old_buffer = buffer;
buflen *= 2;
diff --git a/nscd/selinux.c b/nscd/selinux.c
index c0c8e22f5c..e477254251 100644
--- a/nscd/selinux.c
+++ b/nscd/selinux.c
@@ -212,7 +212,7 @@ preserve_capabilities (void)
cap_free (tmp_caps);
- if (__builtin_expect (res != 0, 0))
+ if (__glibc_unlikely (res != 0))
{
cap_free (new_caps);
dbg_log (_("Failed to drop capabilities"));
diff --git a/nscd/servicescache.c b/nscd/servicescache.c
index 52058a6e02..12ce9b2ca4 100644
--- a/nscd/servicescache.c
+++ b/nscd/servicescache.c
@@ -389,7 +389,7 @@ addservbyX (struct database_dyn *db, int fd, request_header *req,
bool use_malloc = false;
int errval = 0;
- if (__builtin_expect (debug_level > 0, 0))
+ if (__glibc_unlikely (debug_level > 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in services cache!"), key);
@@ -402,7 +402,7 @@ addservbyX (struct database_dyn *db, int fd, request_header *req,
{
errno = 0;
- if (__builtin_expect (buflen > 32768, 0))
+ if (__glibc_unlikely (buflen > 32768))
{
char *old_buffer = buffer;
buflen *= 2;
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 36242f9d44..00b2ecf612 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -272,7 +272,7 @@ internal_getent (struct STRUCTURE *result,
|| ! (parse_result = parse_line (p, result, data, buflen, errnop
EXTRA_ARGS)));
- if (__builtin_expect (parse_result == -1, 0))
+ if (__glibc_unlikely (parse_result == -1))
{
H_ERRNO_SET (NETDB_INTERNAL);
return NSS_STATUS_TRYAGAIN;
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index f748d3df46..4f14a8b839 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -348,12 +348,12 @@ fnmatch (pattern, string, flags)
#else
n = strlen (pattern);
#endif
- if (__builtin_expect (n < 1024, 1))
+ if (__glibc_likely (n < 1024))
{
wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
alloca_used);
n = mbsrtowcs (wpattern, &p, n + 1, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
@@ -368,12 +368,12 @@ fnmatch (pattern, string, flags)
{
prepare_wpattern:
n = mbsrtowcs (NULL, &pattern, 0, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
return -1;
- if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
{
__set_errno (ENOMEM);
return -2;
@@ -393,12 +393,12 @@ fnmatch (pattern, string, flags)
n = strlen (string);
#endif
p = string;
- if (__builtin_expect (n < 1024, 1))
+ if (__glibc_likely (n < 1024))
{
wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
alloca_used);
n = mbsrtowcs (wstring, &p, n + 1, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
{
/* Something wrong.
XXX Do we have to set `errno' to something which
@@ -417,12 +417,12 @@ fnmatch (pattern, string, flags)
{
prepare_wstring:
n = mbsrtowcs (NULL, &string, 0, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
goto free_return;
- if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
{
free (wpattern_malloc);
__set_errno (ENOMEM);
diff --git a/posix/getopt.c b/posix/getopt.c
index 2d481f1c7f..a859acb67a 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -601,7 +601,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
fputc_unlocked ('\n', fp);
- if (__builtin_expect (fclose (fp) != EOF, 1))
+ if (__glibc_likely (fclose (fp) != EOF))
{
_IO_flockfile (stderr);
diff --git a/posix/glob.c b/posix/glob.c
index f1431088a2..aa4bb92f82 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -354,7 +354,7 @@ glob (pattern, flags, errfunc, pglob)
/* It is an illegal expression. */
illegal_brace:
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
@@ -404,7 +404,7 @@ glob (pattern, flags, errfunc, pglob)
if (result && result != GLOB_NOMATCH)
{
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
if (!(flags & GLOB_APPEND))
@@ -425,7 +425,7 @@ glob (pattern, flags, errfunc, pglob)
}
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
@@ -488,7 +488,7 @@ glob (pattern, flags, errfunc, pglob)
}
else
{
- if (__builtin_expect (pattern[0] == '\0', 0))
+ if (__glibc_unlikely (pattern[0] == '\0'))
{
dirs.gl_pathv = NULL;
goto no_matches;
@@ -671,7 +671,7 @@ glob (pattern, flags, errfunc, pglob)
2 * pwbuflen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
retval = GLOB_NOSPACE;
goto out;
@@ -717,7 +717,7 @@ glob (pattern, flags, errfunc, pglob)
{
if (flags & GLOB_TILDE_CHECK)
{
- if (__builtin_expect (malloc_home_dir, 0))
+ if (__glibc_unlikely (malloc_home_dir))
free (home_dir);
retval = GLOB_NOMATCH;
goto out;
@@ -730,7 +730,7 @@ glob (pattern, flags, errfunc, pglob)
/* Now construct the full directory. */
if (dirname[1] == '\0')
{
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
dirname = home_dir;
@@ -750,7 +750,7 @@ glob (pattern, flags, errfunc, pglob)
newp = malloc (home_len + dirlen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_home_dir, 0))
+ if (__glibc_unlikely (malloc_home_dir))
free (home_dir);
retval = GLOB_NOSPACE;
goto out;
@@ -760,7 +760,7 @@ glob (pattern, flags, errfunc, pglob)
mempcpy (mempcpy (newp, home_dir, home_len),
&dirname[1], dirlen);
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
dirname = newp;
@@ -859,7 +859,7 @@ glob (pattern, flags, errfunc, pglob)
if (pwtmpbuf == NULL)
{
nomem_getpw:
- if (__builtin_expect (malloc_user_name, 0))
+ if (__glibc_unlikely (malloc_user_name))
free (user_name);
retval = GLOB_NOSPACE;
goto out;
@@ -884,7 +884,7 @@ glob (pattern, flags, errfunc, pglob)
2 * buflen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
goto nomem_getpw;
}
@@ -897,7 +897,7 @@ glob (pattern, flags, errfunc, pglob)
p = getpwnam (user_name);
# endif
- if (__builtin_expect (malloc_user_name, 0))
+ if (__glibc_unlikely (malloc_user_name))
free (user_name);
/* If we found a home directory use this. */
@@ -906,7 +906,7 @@ glob (pattern, flags, errfunc, pglob)
size_t home_len = strlen (p->pw_dir);
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
malloc_dirname = 0;
@@ -918,7 +918,7 @@ glob (pattern, flags, errfunc, pglob)
dirname = malloc (home_len + rest_len + 1);
if (dirname == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
retval = GLOB_NOSPACE;
goto out;
@@ -931,12 +931,12 @@ glob (pattern, flags, errfunc, pglob)
dirlen = home_len + rest_len;
dirname_modified = 1;
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
}
else
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
if (flags & GLOB_TILDE_CHECK)
@@ -1035,7 +1035,7 @@ glob (pattern, flags, errfunc, pglob)
*(char *) &dirname[--dirlen] = '\0';
}
- if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) != 0, 0))
+ if (__glibc_unlikely ((flags & GLOB_ALTDIRFUNC) != 0))
{
/* Use the alternative access functions also in the recursive
call. */
@@ -1253,7 +1253,7 @@ glob (pattern, flags, errfunc, pglob)
}
out:
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
return retval;
@@ -1530,7 +1530,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
of the function to copy this name into the result. */
flags |= GLOB_NOCHECK;
- if (__builtin_expect (!alloca_fullname, 0))
+ if (__glibc_unlikely (!alloca_fullname))
free (fullname);
}
else
@@ -1573,7 +1573,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
}
d64buf;
- if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ if (__glibc_unlikely (flags & GLOB_ALTDIRFUNC))
{
struct dirent *d32 = (*pglob->gl_readdir) (stream);
if (d32 != NULL)
@@ -1732,7 +1732,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
if (stream != NULL)
{
save = errno;
- if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ if (__glibc_unlikely (flags & GLOB_ALTDIRFUNC))
(*pglob->gl_closedir) (stream);
else
closedir (stream);
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 366ec18aeb..b6b65dd993 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -823,7 +823,7 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
args[1] = "-nc";
/* Redirect output. */
- if (__builtin_expect (fildes[1] != STDOUT_FILENO, 1))
+ if (__glibc_likely (fildes[1] != STDOUT_FILENO))
{
__dup2 (fildes[1], STDOUT_FILENO);
__close (fildes[1]);
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index f8f192e5af..541c25a348 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -398,7 +398,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct host_data), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -452,7 +452,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
break;
case AF_INET6:
/* Only lookup with the byte string format if the user wants it. */
- if (__builtin_expect (_res.options & RES_USEBSTRING, 0))
+ if (__glibc_unlikely (_res.options & RES_USEBSTRING))
{
qp = stpcpy (qbuf, "\\[x");
for (n = 0; n < IN6ADDRSZ; ++n)
@@ -613,7 +613,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
int have_to_map = 0;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
buffer += pad;
- if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
{
/* The buffer is too small. */
too_small:
@@ -727,14 +727,14 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (__builtin_expect (n < 0 || (*name_ok) (bp) == 0, 0))
+ if (__glibc_unlikely (n < 0 || (*name_ok) (bp) == 0))
{
++had_error;
continue;
}
cp += n; /* name */
- if (__builtin_expect (cp + 10 > end_of_message, 0))
+ if (__glibc_unlikely (cp + 10 > end_of_message))
{
++had_error;
continue;
@@ -748,7 +748,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += INT32SZ; /* TTL */
n = __ns_get16 (cp);
cp += INT16SZ; /* len */
- if (__builtin_expect (class != C_IN, 0))
+ if (__glibc_unlikely (class != C_IN))
{
/* XXX - debug? syslog? */
cp += n;
@@ -764,7 +764,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
continue;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || (*name_ok) (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || (*name_ok) (tbuf) == 0))
{
++had_error;
continue;
@@ -782,7 +782,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
linebuflen -= n;
/* Get canonical name. */
n = strlen (tbuf) + 1; /* For the \0. */
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
{
@@ -798,7 +798,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qtype == T_PTR && type == T_CNAME)
{
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_dnok (tbuf) == 0))
{
++had_error;
continue;
@@ -806,7 +806,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += n;
/* Get canonical name. */
n = strlen (tbuf) + 1; /* For the \0. */
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
{
@@ -833,7 +833,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (type == T_A && qtype == T_AAAA && map)
have_to_map = 1;
- else if (__builtin_expect (type != qtype, 0))
+ else if (__glibc_unlikely (type != qtype))
{
syslog (LOG_NOTICE | LOG_AUTH,
"gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
@@ -845,7 +845,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
switch (type)
{
case T_PTR:
- if (__builtin_expect (strcasecmp (tname, bp) != 0, 0))
+ if (__glibc_unlikely (strcasecmp (tname, bp) != 0))
{
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
cp += n;
@@ -862,7 +862,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (__builtin_expect (n < 0 || res_hnok (bp) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (bp) == 0))
{
++had_error;
break;
@@ -892,7 +892,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (have_to_map)
{
n = strlen (bp) + 1; /* for the \0 */
- if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
break;
@@ -938,7 +938,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
linebuflen -= sizeof (align) - ((u_long) bp % sizeof (align));
bp += sizeof (align) - ((u_long) bp % sizeof (align));
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
bp = __mempcpy (*hap++ = bp, cp, n);
cp += n;
@@ -1009,7 +1009,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
int qdcount = ntohs (hp->qdcount);
const u_char *cp = answer->buf + HFIXEDSZ;
const u_char *end_of_message = answer->buf + anslen;
- if (__builtin_expect (qdcount != 1, 0))
+ if (__glibc_unlikely (qdcount != 1))
{
*h_errnop = NO_RECOVERY;
return NSS_STATUS_UNAVAIL;
@@ -1063,7 +1063,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = -1;
}
- if (__builtin_expect (n < 0 || res_hnok (buffer) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (buffer) == 0))
{
++had_error;
continue;
@@ -1077,7 +1077,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
cp += n; /* name */
- if (__builtin_expect (cp + 10 > end_of_message, 0))
+ if (__glibc_unlikely (cp + 10 > end_of_message))
{
++had_error;
continue;
@@ -1107,7 +1107,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
*ttlp = ttl;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (tbuf) == 0))
{
++had_error;
continue;
@@ -1124,9 +1124,9 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
n = strlen (tbuf) + 1;
- if (__builtin_expect (n > buflen, 0))
+ if (__glibc_unlikely (n > buflen))
goto too_small;
- if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
continue;
@@ -1143,7 +1143,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
// We should not see any types other than those explicitly listed
// below. Some types sent by server seem missing, though. Just
// collect the data for now.
- if (__builtin_expect (type != T_A && type != T_AAAA, 0))
+ if (__glibc_unlikely (type != T_A && type != T_AAAA))
#else
if (__builtin_expect (type == T_SIG, 0)
|| __builtin_expect (type == T_KEY, 0)
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 8e80a6010e..b8aee218e1 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -268,7 +268,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct net_data);
buffer += pad;
- if (__builtin_expect (buflen < sizeof (*net_data) + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof (*net_data) + pad))
{
/* The buffer is too small. */
too_small:
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 5e1a747a4a..ea133f8d82 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -334,7 +334,7 @@ __res_vinit(res_state statp, int preinit) {
sa6->sin6_flowinfo = 0;
sa6->sin6_addr = a6;
- if (__builtin_expect (el == NULL, 1))
+ if (__glibc_likely (el == NULL))
sa6->sin6_scope_id = 0;
else {
int try_numericscope = 1;
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 6170763fa3..1635e6a035 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -180,7 +180,7 @@ res_nmkquery(res_state statp,
n = ns_name_compress((char *)data, cp, buflen,
(const u_char **) dnptrs,
(const u_char **) lastdnptr);
- if (__builtin_expect (n < 0, 0))
+ if (__glibc_unlikely (n < 0))
return (-1);
cp += n;
buflen -= n;
@@ -195,7 +195,7 @@ res_nmkquery(res_state statp,
/*
* Initialize answer section
*/
- if (__builtin_expect (buflen < 1 + RRFIXEDSZ + datalen, 0))
+ if (__glibc_unlikely (buflen < 1 + RRFIXEDSZ + datalen))
return (-1);
*cp++ = '\0'; /* no domain name */
NS_PUT16 (type, cp);
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 1325f9772d..88230f43eb 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -202,7 +202,7 @@ __libc_res_nquery(res_state statp,
goto again;
}
}
- if (__builtin_expect (n <= 0, 0)) {
+ if (__glibc_unlikely (n <= 0)) {
/* If the query choked with EDNS0, retry without EDNS0. */
if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0
&& ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 7f2e85f324..f46630d30f 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -358,7 +358,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
}
#ifdef USE_HOOKS
- if (__builtin_expect (statp->qhook || statp->rhook, 0)) {
+ if (__glibc_unlikely (statp->qhook || statp->rhook)) {
if (anssiz < MAXPACKET && ansp) {
u_char *buf = malloc (MAXPACKET);
if (buf == NULL)
@@ -499,7 +499,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
goto next_ns;
same_ns:
#ifdef USE_HOOKS
- if (__builtin_expect (statp->qhook != NULL, 0)) {
+ if (__glibc_unlikely (statp->qhook != NULL)) {
int done = 0, loops = 0;
do {
@@ -541,7 +541,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
: &((struct sockaddr_in *) nsap)->sin_addr),
tmpbuf, sizeof (tmpbuf))));
- if (__builtin_expect (v_circuit, 0)) {
+ if (__glibc_unlikely (v_circuit)) {
/* Use VC; at most one attempt per server. */
try = statp->retry;
n = send_vc(statp, buf, buflen, buf2, buflen2,
@@ -595,7 +595,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
__res_iclose(statp, false);
}
#ifdef USE_HOOKS
- if (__builtin_expect (statp->rhook, 0)) {
+ if (__glibc_unlikely (statp->rhook)) {
int done = 0, loops = 0;
do {
@@ -814,7 +814,7 @@ send_vc(res_state statp,
if (rlen > *thisanssizp) {
/* Yes, we test ANSCP here. If we have two buffers
both will be allocatable. */
- if (__builtin_expect (anscp != NULL, 1)) {
+ if (__glibc_likely (anscp != NULL)) {
u_char *newp = malloc (MAXPACKET);
if (newp == NULL) {
*terrno = ENOMEM;
@@ -835,7 +835,7 @@ send_vc(res_state statp,
} else
len = rlen;
- if (__builtin_expect (len < HFIXEDSZ, 0)) {
+ if (__glibc_unlikely (len < HFIXEDSZ)) {
/*
* Undersized message.
*/
@@ -851,13 +851,13 @@ send_vc(res_state statp,
cp += n;
len -= n;
}
- if (__builtin_expect (n <= 0, 0)) {
+ if (__glibc_unlikely (n <= 0)) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
__res_iclose(statp, false);
return (0);
}
- if (__builtin_expect (truncating, 0)) {
+ if (__glibc_unlikely (truncating)) {
/*
* Flush rest of answer so connection stays in synch.
*/
@@ -917,7 +917,7 @@ reopen (res_state statp, int *terrno, int ns)
/* only try IPv6 if IPv6 NS and if not failed before */
if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
- if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
+ if (__glibc_likely (__have_o_nonblock >= 0)) {
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
0);
@@ -928,14 +928,14 @@ reopen (res_state statp, int *terrno, int ns)
&& errno == EINVAL ? -1 : 1);
#endif
}
- if (__builtin_expect (__have_o_nonblock < 0, 0))
+ if (__glibc_unlikely (__have_o_nonblock < 0))
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM, 0);
if (EXT(statp).nssocks[ns] < 0)
statp->ipv6_unavail = errno == EAFNOSUPPORT;
slen = sizeof (struct sockaddr_in6);
} else if (nsap->sa_family == AF_INET) {
- if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
+ if (__glibc_likely (__have_o_nonblock >= 0)) {
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
0);
@@ -946,7 +946,7 @@ reopen (res_state statp, int *terrno, int ns)
&& errno == EINVAL ? -1 : 1);
#endif
}
- if (__builtin_expect (__have_o_nonblock < 0, 0))
+ if (__glibc_unlikely (__have_o_nonblock < 0))
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM, 0);
slen = sizeof (struct sockaddr_in);
@@ -973,7 +973,7 @@ reopen (res_state statp, int *terrno, int ns)
__res_iclose(statp, false);
return (0);
}
- if (__builtin_expect (__have_o_nonblock < 0, 0)) {
+ if (__glibc_unlikely (__have_o_nonblock < 0)) {
/* Make socket non-blocking. */
int fl = __fcntl (EXT(statp).nssocks[ns], F_GETFL);
if (fl != -1)
@@ -1055,7 +1055,7 @@ send_dg(res_state statp,
n = 0;
if (nwritten == 0)
n = __poll (pfd, 1, 0);
- if (__builtin_expect (n == 0, 0)) {
+ if (__glibc_unlikely (n == 0)) {
n = __poll (pfd, 1, ptimeout);
need_recompute = 1;
}
@@ -1130,7 +1130,7 @@ send_dg(res_state statp,
reqs[1].msg_hdr.msg_controllen = 0;
int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
- if (__builtin_expect (ndg == 2, 1))
+ if (__glibc_likely (ndg == 2))
{
if (reqs[0].msg_len != buflen
|| reqs[1].msg_len != buflen2)
@@ -1146,7 +1146,7 @@ send_dg(res_state statp,
else
{
#ifndef __ASSUME_SENDMMSG
- if (__builtin_expect (have_sendmmsg == 0, 0))
+ if (__glibc_unlikely (have_sendmmsg == 0))
{
if (ndg < 0 && errno == ENOSYS)
{
@@ -1246,7 +1246,7 @@ send_dg(res_state statp,
*thisresplenp = recvfrom(pfd[0].fd, (char*)*thisansp,
*thisanssizp, 0,
(struct sockaddr *)&from, &fromlen);
- if (__builtin_expect (*thisresplenp <= 0, 0)) {
+ if (__glibc_unlikely (*thisresplenp <= 0)) {
if (errno == EINTR || errno == EAGAIN) {
need_recompute = 1;
goto wait;
@@ -1255,7 +1255,7 @@ send_dg(res_state statp,
goto err_out;
}
*gotsomewhere = 1;
- if (__builtin_expect (*thisresplenp < HFIXEDSZ, 0)) {
+ if (__glibc_unlikely (*thisresplenp < HFIXEDSZ)) {
/*
* Undersized message.
*/
diff --git a/stdio-common/_i18n_number.h b/stdio-common/_i18n_number.h
index 061c4d47f8..299c3e083f 100644
--- a/stdio-common/_i18n_number.h
+++ b/stdio-common/_i18n_number.h
@@ -42,7 +42,7 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
wint_t wthousands = __towctrans (L',', map);
#ifndef COMPILE_WPRINTF
- if (__builtin_expect (map != NULL, 0))
+ if (__glibc_unlikely (map != NULL))
{
mbstate_t state;
memset (&state, '\0', sizeof (state));
diff --git a/stdio-common/perror.c b/stdio-common/perror.c
index acd97d2f7d..4b470156a6 100644
--- a/stdio-common/perror.c
+++ b/stdio-common/perror.c
@@ -60,7 +60,7 @@ perror (const char *s)
|| (fd = __dup (fd)) == -1
|| (fp = fdopen (fd, "w+")) == NULL)
{
- if (__builtin_expect (fd != -1, 0))
+ if (__glibc_unlikely (fd != -1))
__close (fd);
/* Use standard error as is. */
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 7a3292cf97..9cd4b4b00c 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -1094,7 +1094,7 @@ ___printf_fp (FILE *fp,
/* Write the exponent if it is needed. */
if (type != 'f')
{
- if (__builtin_expect (expsign != 0 && exponent == 4 && spec == 'g', 0))
+ if (__glibc_unlikely (expsign != 0 && exponent == 4 && spec == 'g'))
{
/* This is another special case. The exponent of the number is
really smaller than -4, which requires the 'e'/'E' format.
@@ -1180,7 +1180,7 @@ ___printf_fp (FILE *fp,
size_t nbuffer = (2 + chars_needed * factor + decimal_len
+ ngroups * thousands_sep_len);
- if (__builtin_expect (buffer_malloced, 0))
+ if (__glibc_unlikely (buffer_malloced))
{
buffer = (char *) malloc (nbuffer);
if (buffer == NULL)
@@ -1208,7 +1208,7 @@ ___printf_fp (FILE *fp,
}
tmpptr = buffer;
- if (__builtin_expect (info->i18n, 0))
+ if (__glibc_unlikely (info->i18n))
{
#ifdef COMPILE_WPRINTF
wstartp = _i18n_number_rewrite (wstartp, wcp,
@@ -1228,7 +1228,7 @@ ___printf_fp (FILE *fp,
PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr);
/* Free the memory if necessary. */
- if (__builtin_expect (buffer_malloced, 0))
+ if (__glibc_unlikely (buffer_malloced))
{
free (buffer);
free (wbuffer);
diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c
index 3d0386269e..d8cd50907f 100644
--- a/stdio-common/tmpnam.c
+++ b/stdio-common/tmpnam.c
@@ -38,7 +38,7 @@ tmpnam (char *s)
0))
return NULL;
- if (__builtin_expect (__gen_tempname (tmpbuf, 0, 0, __GT_NOCREATE), 0))
+ if (__glibc_unlikely (__gen_tempname (tmpbuf, 0, 0, __GT_NOCREATE)))
return NULL;
if (s == NULL)
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 2e1e91af78..e0d224530c 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -269,7 +269,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
#define ADDW(Ch) \
do \
{ \
- if (__builtin_expect (wpsize == wpmax, 0)) \
+ if (__glibc_unlikely (wpsize == wpmax)) \
{ \
CHAR_T *old = wp; \
size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \
@@ -392,7 +392,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
do
{
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
else if (c != (unsigned char) *f++)
{
@@ -420,7 +420,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
c = inchar ();
/* Characters other than format specs must just match. */
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
/* We saw white space char as the last character in the format
@@ -428,12 +428,12 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (skip_space)
{
while (ISSPACE (c))
- if (__builtin_expect (inchar () == EOF, 0))
+ if (__glibc_unlikely (inchar () == EOF))
input_error ();
skip_space = 0;
}
- if (__builtin_expect (c != fc, 0))
+ if (__glibc_unlikely (c != fc))
{
ungetc (c, s);
conv_error ();
@@ -581,7 +581,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
/* End of the format string? */
- if (__builtin_expect (*f == L_('\0'), 0))
+ if (__glibc_unlikely (*f == L_('\0')))
conv_error ();
/* Find the conversion specifier. */
@@ -610,9 +610,9 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
case L_('%'): /* Must match a literal '%'. */
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
- if (__builtin_expect (c != fc, 0))
+ if (__glibc_unlikely (c != fc))
{
ungetc_not_eof (c, s);
conv_error ();
@@ -710,7 +710,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
#endif
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
#ifdef COMPILE_WSCANF
@@ -758,7 +758,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* No valid wide character. */
input_error ();
@@ -836,7 +836,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
STRING_ARG (wstr, wchar_t, (width > 1024 ? 1024 : width));
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
#ifdef COMPILE_WSCANF
@@ -946,14 +946,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Possibly correct character, just not enough
input. */
- if (__builtin_expect (inchar () == EOF, 0))
+ if (__glibc_unlikely (inchar () == EOF))
encode_error ();
buf[0] = c;
continue;
}
- if (__builtin_expect (n != 1, 0))
+ if (__glibc_unlikely (n != 1))
encode_error ();
/* We have a match. */
@@ -991,7 +991,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
STRING_ARG (str, char, 100);
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
#ifdef COMPILE_WSCANF
@@ -1060,7 +1060,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c,
&state);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
encode_error ();
assert (n <= MB_CUR_MAX);
@@ -1262,14 +1262,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Possibly correct character, just not enough
input. */
- if (__builtin_expect (inchar () == EOF, 0))
+ if (__glibc_unlikely (inchar () == EOF))
encode_error ();
buf[0] = c;
continue;
}
- if (__builtin_expect (n != 1, 0))
+ if (__glibc_unlikely (n != 1))
encode_error ();
/* We have a match. */
@@ -1368,7 +1368,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
number:
c = inchar ();
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
/* Check for a sign. */
@@ -1434,7 +1434,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
#endif
/* Get the alternative digit forms if there are any. */
- if (__builtin_expect (map != NULL, 0))
+ if (__glibc_unlikely (map != NULL))
{
/* Adding new level for extra digits set in locale file. */
++to_level;
@@ -1502,7 +1502,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Get the string for the digits with value N. */
#ifdef COMPILE_WSCANF
- if (__builtin_expect (map != NULL, 0))
+ if (__glibc_unlikely (map != NULL))
wcdigits[n] = wcdigits_extended[n];
else
wcdigits[n] = (const wchar_t *)
@@ -1521,7 +1521,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
const char *cmpp;
int avail = width > 0 ? width : INT_MAX;
- if (__builtin_expect (map != NULL, 0))
+ if (__glibc_unlikely (map != NULL))
mbdigits[n] = mbdigits_extended[n];
else
mbdigits[n]
@@ -1795,7 +1795,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
else
num.ul = __strtoul_internal (wp, &tw, base, flags & GROUP);
}
- if (__builtin_expect (wp == tw, 0))
+ if (__glibc_unlikely (wp == tw))
conv_error ();
if (!(flags & SUPPRESS))
@@ -1842,7 +1842,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
c = inchar ();
if (width > 0)
--width;
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
input_error ();
got_digit = got_dot = got_e = 0;
@@ -1851,7 +1851,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (c == L_('-') || c == L_('+'))
{
negative = c == L_('-');
- if (__builtin_expect (width == 0 || inchar () == EOF, 0))
+ if (__glibc_unlikely (width == 0 || inchar () == EOF))
/* EOF is only an input error before we read any chars. */
conv_error ();
if (width > 0)
@@ -2334,7 +2334,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
*ARG (float *) = negative ? -d : d;
}
- if (__builtin_expect (tw == wp, 0))
+ if (__glibc_unlikely (tw == wp))
conv_error ();
if (!(flags & SUPPRESS))
@@ -2374,7 +2374,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
while ((fc = *f++) != L'\0' && fc != L']');
- if (__builtin_expect (fc == L'\0', 0))
+ if (__glibc_unlikely (fc == L'\0'))
conv_error ();
wchar_t *twend = (wchar_t *) f - 1;
#else
@@ -2410,7 +2410,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
/* Add the character to the flag map. */
wp[fc] = 1;
- if (__builtin_expect (fc == '\0', 0))
+ if (__glibc_unlikely (fc == '\0'))
conv_error();
#endif
@@ -2418,7 +2418,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
size_t now = read_in;
#ifdef COMPILE_WSCANF
- if (__builtin_expect (inchar () == WEOF, 0))
+ if (__glibc_unlikely (inchar () == WEOF))
input_error ();
do
@@ -2530,7 +2530,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
size_t cnt = 0;
mbstate_t cstate;
- if (__builtin_expect (inchar () == EOF, 0))
+ if (__glibc_unlikely (inchar () == EOF))
input_error ();
memset (&cstate, '\0', sizeof (cstate));
@@ -2613,13 +2613,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
while (inchar () != EOF);
- if (__builtin_expect (cnt != 0, 0))
+ if (__glibc_unlikely (cnt != 0))
/* We stopped in the middle of recognizing another
character. That's a problem. */
encode_error ();
#endif
- if (__builtin_expect (now == read_in, 0))
+ if (__glibc_unlikely (now == read_in))
/* We haven't succesfully read any character. */
conv_error ();
@@ -2645,7 +2645,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
size_t now = read_in;
- if (__builtin_expect (inchar () == EOF, 0))
+ if (__glibc_unlikely (inchar () == EOF))
input_error ();
#ifdef COMPILE_WSCANF
@@ -2754,7 +2754,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
encode_error ();
assert (n <= MB_CUR_MAX);
@@ -2817,7 +2817,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
while (--width > 0 && inchar () != EOF);
#endif
- if (__builtin_expect (now == read_in, 0))
+ if (__glibc_unlikely (now == read_in))
/* We haven't succesfully read any character. */
conv_error ();
@@ -2911,9 +2911,9 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (errp != NULL)
*errp |= errval;
- if (__builtin_expect (done == EOF, 0))
+ if (__glibc_unlikely (done == EOF))
{
- if (__builtin_expect (ptrs_to_free != NULL, 0))
+ if (__glibc_unlikely (ptrs_to_free != NULL))
{
struct ptrs_to_free *p = ptrs_to_free;
while (p != NULL)
@@ -2928,7 +2928,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
}
}
- else if (__builtin_expect (strptr != NULL, 0))
+ else if (__glibc_unlikely (strptr != NULL))
{
free (*strptr);
*strptr = NULL;
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index 299a9c0fc8..04f8e9a5d9 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -57,7 +57,7 @@ __cxa_finalize (void *d)
/* It is possible that that last exit function registered
more exit functions. Start the loop over. */
- if (__builtin_expect (check != __new_exitfn_called, 0))
+ if (__glibc_unlikely (check != __new_exitfn_called))
goto restart;
}
}
diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
index d2f88d3ed8..1a6d9864f6 100644
--- a/stdlib/cxa_thread_atexit_impl.c
+++ b/stdlib/cxa_thread_atexit_impl.c
@@ -52,7 +52,7 @@ __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
/* See if we already encountered the DSO. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
- if (__builtin_expect (dso_symbol_cache != dso_symbol, 0))
+ if (__glibc_unlikely (dso_symbol_cache != dso_symbol))
{
ElfW(Addr) caller = (ElfW(Addr)) dso_symbol;
diff --git a/stdlib/drand48-iter.c b/stdlib/drand48-iter.c
index 10d2969df0..82e58873a4 100644
--- a/stdlib/drand48-iter.c
+++ b/stdlib/drand48-iter.c
@@ -35,7 +35,7 @@ __drand48_iterate (xsubi, buffer)
uint64_t result;
/* Initialize buffer, if not yet done. */
- if (__builtin_expect (!buffer->__init, 0))
+ if (__glibc_unlikely (!buffer->__init))
{
buffer->__a = 0x5deece66dull;
buffer->__c = 0xb;
diff --git a/stdlib/putenv.c b/stdlib/putenv.c
index 9bc16872b4..e6ad267afe 100644
--- a/stdlib/putenv.c
+++ b/stdlib/putenv.c
@@ -77,7 +77,7 @@ putenv (string)
#endif
int result = __add_to_environ (name, NULL, string, 1);
- if (__builtin_expect (use_malloc, 0))
+ if (__glibc_unlikely (use_malloc))
free (name);
return result;
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 6b5f9be8d5..e244e18331 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -191,17 +191,17 @@ __add_to_environ (name, value, combined, replace)
# endif
np = KNOWN_VALUE (new_value);
- if (__builtin_expect (np == NULL, 1))
+ if (__glibc_likely (np == NULL))
#endif
{
#ifdef USE_TSEARCH
- if (__builtin_expect (! use_alloca, 0))
+ if (__glibc_unlikely (! use_alloca))
np = new_value;
else
#endif
{
np = malloc (varlen);
- if (__builtin_expect (np == NULL, 0))
+ if (__glibc_unlikely (np == NULL))
{
UNLOCK;
return -1;
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index c80306deef..6707e482a4 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -545,7 +545,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
struct __locale_data *current = loc->__locales[LC_NUMERIC];
- if (__builtin_expect (group, 0))
+ if (__glibc_unlikely (group))
{
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
if (*grouping <= 0 || *grouping == CHAR_MAX)
@@ -709,7 +709,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands))
c = *++cp;
#else
- if (__builtin_expect (thousands == NULL, 1))
+ if (__glibc_likely (thousands == NULL))
while (c == '0')
c = *++cp;
else
@@ -789,7 +789,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Not a digit or separator: end of the integer part. */
break;
#else
- if (__builtin_expect (thousands == NULL, 1))
+ if (__glibc_likely (thousands == NULL))
break;
else
{
@@ -1181,10 +1181,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
exponent -= incr;
}
- if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
+ if (__glibc_unlikely (exponent > MAX_10_EXP + 1 - (intmax_t) int_no))
return overflow_value (negative);
- if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
+ if (__glibc_unlikely (exponent < MIN_10_EXP - (DIG + 1)))
return underflow_value (negative);
if (int_no > 0)
@@ -1245,7 +1245,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Now we know the exponent of the number in base two.
Check it against the maximum possible exponent. */
- if (__builtin_expect (bits > MAX_EXP, 0))
+ if (__glibc_unlikely (bits > MAX_EXP))
return overflow_value (negative);
/* We have already the first BITS bits of the result. Together with
diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c
index 95c2df398a..c77b43dc0c 100644
--- a/stdlib/strtol_l.c
+++ b/stdlib/strtol_l.c
@@ -255,7 +255,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
in the format described in <locale.h>. */
const char *grouping;
- if (__builtin_expect (group, 0))
+ if (__glibc_unlikely (group))
{
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
if (*grouping <= 0 || *grouping == CHAR_MAX)
@@ -297,7 +297,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
/* Skip white space. */
while (ISSPACE (*s))
++s;
- if (__builtin_expect (*s == L_('\0'), 0))
+ if (__glibc_unlikely (*s == L_('\0')))
goto noconv;
/* Check for a sign. */
@@ -331,7 +331,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
if (base != 10)
grouping = NULL;
- if (__builtin_expect (grouping != NULL, 0))
+ if (__glibc_unlikely (grouping != NULL))
{
# ifndef USE_WIDE_CHAR
thousands_len = strlen (thousands);
@@ -499,7 +499,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
overflow = 1;
#endif
- if (__builtin_expect (overflow, 0))
+ if (__glibc_unlikely (overflow))
{
__set_errno (ERANGE);
#if UNSIGNED
diff --git a/string/memmem.c b/string/memmem.c
index 93e5e18c66..b2842fe57f 100644
--- a/string/memmem.c
+++ b/string/memmem.c
@@ -53,7 +53,7 @@ memmem (const void *haystack_start, size_t haystack_len,
/* Sanity check, otherwise the loop might search through the whole
memory. */
- if (__builtin_expect (haystack_len < needle_len, 0))
+ if (__glibc_unlikely (haystack_len < needle_len))
return NULL;
/* Use optimizations in memchr when possible, to reduce the search
diff --git a/string/strerror.c b/string/strerror.c
index 5eed633e2b..3d732a2d28 100644
--- a/string/strerror.c
+++ b/string/strerror.c
@@ -32,7 +32,7 @@ strerror (errnum)
char *ret = __strerror_r (errnum, NULL, 0);
int saved_errno;
- if (__builtin_expect (ret != NULL, 1))
+ if (__glibc_likely (ret != NULL))
return ret;
saved_errno = errno;
if (buf == NULL)
diff --git a/string/strnlen.c b/string/strnlen.c
index 8d53afbaf0..b3ab7ae44a 100644
--- a/string/strnlen.c
+++ b/string/strnlen.c
@@ -40,7 +40,7 @@ __strnlen (const char *str, size_t maxlen)
if (maxlen == 0)
return 0;
- if (__builtin_expect (end_ptr < str, 0))
+ if (__glibc_unlikely (end_ptr < str))
end_ptr = (const char *) ~0UL;
/* Handle the first few characters by reading one character at a time.
diff --git a/string/test-memmem.c b/string/test-memmem.c
index 1b4e4b7ea0..caaa191d28 100644
--- a/string/test-memmem.c
+++ b/string/test-memmem.c
@@ -44,7 +44,7 @@ simple_memmem (const void *haystack, size_t haystack_len, const void *needle,
/* Sanity check, otherwise the loop might search through the whole
memory. */
- if (__builtin_expect (haystack_len < needle_len, 0))
+ if (__glibc_unlikely (haystack_len < needle_len))
return NULL;
for (begin = (const char *) haystack; begin <= last_possible; ++begin)
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 1b6a20b826..6ffa5f2590 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -196,7 +196,7 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program,
# endif
}
#endif
- if (__builtin_expect (*sockp < 0, 0))
+ if (__glibc_unlikely (*sockp < 0))
{
struct rpc_createerr *ce = &get_rpc_createerr ();
ce->cf_stat = RPC_SYSTEMERROR;
diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c
index f10f87250d..d9df0cc35b 100644
--- a/sunrpc/pm_getport.c
+++ b/sunrpc/pm_getport.c
@@ -59,7 +59,7 @@ __get_socket (struct sockaddr_in *saddr)
laddr.sin_addr.s_addr = htonl (INADDR_ANY);
int cc = __bind (so, (struct sockaddr *) &laddr, namelen);
- if (__builtin_expect (cc < 0, 0))
+ if (__glibc_unlikely (cc < 0))
{
fail:
__close (so);
@@ -67,7 +67,7 @@ __get_socket (struct sockaddr_in *saddr)
}
cc = __connect (so, (struct sockaddr *) saddr, namelen);
- if (__builtin_expect (cc < 0, 0))
+ if (__glibc_unlikely (cc < 0))
goto fail;
return so;
diff --git a/sysdeps/gnu/unwind-resume.c b/sysdeps/gnu/unwind-resume.c
index 8963bf6deb..c7d6870731 100644
--- a/sysdeps/gnu/unwind-resume.c
+++ b/sysdeps/gnu/unwind-resume.c
@@ -46,7 +46,7 @@ init (void)
void
_Unwind_Resume (struct _Unwind_Exception *exc)
{
- if (__builtin_expect (libgcc_s_resume == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_resume == NULL))
init ();
libgcc_s_resume (exc);
}
@@ -57,7 +57,7 @@ __gcc_personality_v0 (int version, _Unwind_Action actions,
struct _Unwind_Exception *ue_header,
struct _Unwind_Context *context)
{
- if (__builtin_expect (libgcc_s_personality == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_personality == NULL))
init ();
return libgcc_s_personality (version, actions, exception_class,
ue_header, context);
diff --git a/sysdeps/i386/dl-irel.h b/sysdeps/i386/dl-irel.h
index 6eb3495f88..4cf81ee207 100644
--- a/sysdeps/i386/dl-irel.h
+++ b/sysdeps/i386/dl-irel.h
@@ -39,7 +39,7 @@ elf_irel (const Elf32_Rel *reloc)
Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_386_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_386_IRELATIVE))
{
Elf32_Addr value = elf_ifunc_invoke(*reloc_addr);
*reloc_addr = value;
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 917550c64f..368bee2164 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -123,7 +123,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
to intercept the calls to collect information. In this case we
don't store the address in the GOT so that all future calls also
end in this function. */
- if (__builtin_expect (profile, 0))
+ if (__glibc_unlikely (profile))
{
got[2] = (Elf32_Addr) &_dl_runtime_profile;
@@ -308,7 +308,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
# if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_386_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_386_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -325,7 +325,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
*reloc_addr += map->l_addr;
}
# ifndef RTLD_BOOTSTRAP
- else if (__builtin_expect (r_type == R_386_NONE, 0))
+ else if (__glibc_unlikely (r_type == R_386_NONE))
return;
# endif
else
@@ -660,7 +660,7 @@ elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
/* Check for unexpected PLT reloc type. */
- if (__builtin_expect (r_type == R_386_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_386_JMP_SLOT))
{
if (__builtin_expect (map->l_mach.plt, 0) == 0)
*reloc_addr += l_addr;
@@ -668,7 +668,7 @@ elf_machine_lazy_rel (struct link_map *map,
*reloc_addr = (map->l_mach.plt
+ (((Elf32_Addr) reloc_addr) - map->l_mach.gotplt) * 4);
}
- else if (__builtin_expect (r_type == R_386_TLS_DESC, 1))
+ else if (__glibc_likely (r_type == R_386_TLS_DESC))
{
struct tlsdesc volatile * __attribute__((__unused__)) td =
(struct tlsdesc volatile *)reloc_addr;
@@ -715,10 +715,10 @@ elf_machine_lazy_rel (struct link_map *map,
# endif
}
}
- else if (__builtin_expect (r_type == R_386_IRELATIVE, 0))
+ else if (__glibc_unlikely (r_type == R_386_IRELATIVE))
{
Elf32_Addr value = map->l_addr + *reloc_addr;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = ((Elf32_Addr (*) (void)) value) ();
*reloc_addr = value;
}
@@ -736,9 +736,9 @@ elf_machine_lazy_rela (struct link_map *map,
{
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_386_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_386_JMP_SLOT))
;
- else if (__builtin_expect (r_type == R_386_TLS_DESC, 1))
+ else if (__glibc_likely (r_type == R_386_TLS_DESC))
{
struct tlsdesc volatile * __attribute__((__unused__)) td =
(struct tlsdesc volatile *)reloc_addr;
@@ -746,10 +746,10 @@ elf_machine_lazy_rela (struct link_map *map,
td->arg = (void*)reloc;
td->entry = _dl_tlsdesc_resolve_rela;
}
- else if (__builtin_expect (r_type == R_386_IRELATIVE, 0))
+ else if (__glibc_unlikely (r_type == R_386_IRELATIVE))
{
Elf32_Addr value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = ((Elf32_Addr (*) (void)) value) ();
*reloc_addr = value;
}
diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c
index 21bb9908d1..0f96743390 100644
--- a/sysdeps/ieee754/dbl-64/e_atanh.c
+++ b/sysdeps/ieee754/dbl-64/e_atanh.c
@@ -48,7 +48,7 @@ __ieee754_atanh (double x)
double t;
if (isless (xa, 0.5))
{
- if (__builtin_expect (xa < 0x1.0p-28, 0))
+ if (__glibc_unlikely (xa < 0x1.0p-28))
{
math_force_eval (huge + x);
return x;
@@ -57,7 +57,7 @@ __ieee754_atanh (double x)
t = xa + xa;
t = 0.5 * __log1p (t + t * xa / (1.0 - xa));
}
- else if (__builtin_expect (isless (xa, 1.0), 1))
+ else if (__glibc_likely (isless (xa, 1.0)))
t = 0.5 * __log1p ((xa + xa) / (1.0 - xa));
else
{
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index 10e23e2218..588fbfdee8 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -43,10 +43,10 @@ __ieee754_exp2 (double x)
static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
/* Check for usual case. */
- if (__builtin_expect (isless (x, himark), 1))
+ if (__glibc_likely (isless (x, himark)))
{
/* Exceptional cases: */
- if (__builtin_expect (!isgreaterequal (x, lomark), 0))
+ if (__glibc_unlikely (!isgreaterequal (x, lomark)))
{
if (__isinf (x))
/* e^-inf == 0, with no error. */
diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c
index c83c2aedb2..e82b302200 100644
--- a/sysdeps/ieee754/dbl-64/e_fmod.c
+++ b/sysdeps/ieee754/dbl-64/e_fmod.c
@@ -45,7 +45,7 @@ __ieee754_fmod (double x, double y)
}
/* determine ix = ilogb(x) */
- if (__builtin_expect (hx < 0x00100000, 0)) /* subnormal x */
+ if (__glibc_unlikely (hx < 0x00100000)) /* subnormal x */
{
if (hx == 0)
{
@@ -62,7 +62,7 @@ __ieee754_fmod (double x, double y)
ix = (hx >> 20) - 1023;
/* determine iy = ilogb(y) */
- if (__builtin_expect (hy < 0x00100000, 0)) /* subnormal y */
+ if (__glibc_unlikely (hy < 0x00100000)) /* subnormal y */
{
if (hy == 0)
{
@@ -79,7 +79,7 @@ __ieee754_fmod (double x, double y)
iy = (hy >> 20) - 1023;
/* set up {hx,lx}, {hy,ly} and align y to x */
- if (__builtin_expect (ix >= -1022, 1))
+ if (__glibc_likely (ix >= -1022))
hx = 0x00100000 | (0x000fffff & hx);
else /* subnormal x, shift x to normal */
{
@@ -95,7 +95,7 @@ __ieee754_fmod (double x, double y)
lx = 0;
}
}
- if (__builtin_expect (iy >= -1022, 1))
+ if (__glibc_likely (iy >= -1022))
hy = 0x00100000 | (0x000fffff & hy);
else /* subnormal y, shift y to normal */
{
@@ -144,7 +144,7 @@ __ieee754_fmod (double x, double y)
hx = hx + hx + (lx >> 31); lx = lx + lx;
iy -= 1;
}
- if (__builtin_expect (iy >= -1022, 1)) /* normalize output */
+ if (__glibc_likely (iy >= -1022)) /* normalize output */
{
hx = ((hx - 0x00100000) | ((iy + 1023) << 20));
INSERT_WORDS (x, hx | sx, lx);
diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c
index 1c427556bc..a35a9e5608 100644
--- a/sysdeps/ieee754/dbl-64/e_gamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c
@@ -122,7 +122,7 @@ __ieee754_gamma_r (double x, int *signgamp)
EXTRACT_WORDS (hx, lx, x);
- if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
+ if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
@@ -135,13 +135,13 @@ __ieee754_gamma_r (double x, int *signgamp)
*signgamp = 0;
return (x - x) / (x - x);
}
- if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx == 0, 0))
+ if (__glibc_unlikely ((unsigned int) hx == 0xfff00000 && lx == 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
return x - x;
}
- if (__builtin_expect ((hx & 0x7ff00000) == 0x7ff00000, 0))
+ if (__glibc_unlikely ((hx & 0x7ff00000) == 0x7ff00000))
{
/* Positive infinity (return positive infinity) or NaN (return
NaN). */
diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c
index 88242bc4f6..5cbfcbeb48 100644
--- a/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -70,7 +70,7 @@ __ieee754_hypot (double x, double y)
return a + b;
} /* x/y > 2**60 */
k = 0;
- if (__builtin_expect (ha > 0x5f300000, 0)) /* a>2**500 */
+ if (__glibc_unlikely (ha > 0x5f300000)) /* a>2**500 */
{
if (ha >= 0x7ff00000) /* Inf or NaN */
{
diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c
index ab754c6ee0..bc7ca0609f 100644
--- a/sysdeps/ieee754/dbl-64/e_j1.c
+++ b/sysdeps/ieee754/dbl-64/e_j1.c
@@ -89,7 +89,7 @@ __ieee754_j1 (double x)
GET_HIGH_WORD (hx, x);
ix = hx & 0x7fffffff;
- if (__builtin_expect (ix >= 0x7ff00000, 0))
+ if (__glibc_unlikely (ix >= 0x7ff00000))
return one / x;
y = fabs (x);
if (ix >= 0x40000000) /* |x| >= 2.0 */
@@ -121,7 +121,7 @@ __ieee754_j1 (double x)
else
return z;
}
- if (__builtin_expect (ix < 0x3e400000, 0)) /* |x|<2**-27 */
+ if (__glibc_unlikely (ix < 0x3e400000)) /* |x|<2**-27 */
{
if (huge + x > one)
return 0.5 * x; /* inexact if x!=0 necessary */
@@ -163,12 +163,12 @@ __ieee754_y1 (double x)
EXTRACT_WORDS (hx, lx, x);
ix = 0x7fffffff & hx;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if (__builtin_expect (ix >= 0x7ff00000, 0))
+ if (__glibc_unlikely (ix >= 0x7ff00000))
return one / (x + x * x);
- if (__builtin_expect ((ix | lx) == 0, 0))
+ if (__glibc_unlikely ((ix | lx) == 0))
return -HUGE_VAL + x;
/* -inf and overflow exception. */;
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return zero / (zero * x);
if (ix >= 0x40000000) /* |x| >= 2.0 */
{
@@ -203,7 +203,7 @@ __ieee754_y1 (double x)
}
return z;
}
- if (__builtin_expect (ix <= 0x3c900000, 0)) /* x < 2**-54 */
+ if (__glibc_unlikely (ix <= 0x3c900000)) /* x < 2**-54 */
{
return (-tpi / x);
}
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index f48e43a0d9..236878ba1d 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -60,7 +60,7 @@ __ieee754_jn (int n, double x)
EXTRACT_WORDS (hx, lx, x);
ix = 0x7fffffff & hx;
/* if J(n,NaN) is NaN */
- if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0))
+ if (__glibc_unlikely ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000))
return x + x;
if (n < 0)
{
@@ -74,7 +74,7 @@ __ieee754_jn (int n, double x)
return (__ieee754_j1 (x));
sgn = (n & 1) & (hx >> 31); /* even n -- 0, odd n -- sign(x) */
x = fabs (x);
- if (__builtin_expect ((ix | lx) == 0 || ix >= 0x7ff00000, 0))
+ if (__glibc_unlikely ((ix | lx) == 0 || ix >= 0x7ff00000))
/* if x is 0 or inf */
b = zero;
else if ((double) n <= x)
@@ -253,12 +253,12 @@ __ieee754_yn (int n, double x)
EXTRACT_WORDS (hx, lx, x);
ix = 0x7fffffff & hx;
/* if Y(n,NaN) is NaN */
- if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0))
+ if (__glibc_unlikely ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000))
return x + x;
- if (__builtin_expect ((ix | lx) == 0, 0))
+ if (__glibc_unlikely ((ix | lx) == 0))
return -HUGE_VAL + x;
/* -inf and overflow exception. */;
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return zero / (zero * x);
sign = 1;
if (n < 0)
@@ -270,7 +270,7 @@ __ieee754_yn (int n, double x)
return (__ieee754_y0 (x));
if (n == 1)
return (sign * __ieee754_y1 (x));
- if (__builtin_expect (ix == 0x7ff00000, 0))
+ if (__glibc_unlikely (ix == 0x7ff00000))
return zero;
if (ix >= 0x52D00000) /* x > 2**302 */
{ /* (x >> n**2)
diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c
index 0b2889cb3b..05d318b786 100644
--- a/sysdeps/ieee754/dbl-64/e_log.c
+++ b/sysdeps/ieee754/dbl-64/e_log.c
@@ -77,23 +77,23 @@ __ieee754_log (double x)
ux = num.i[HIGH_HALF];
dx = num.i[LOW_HALF];
n = 0;
- if (__builtin_expect (ux < 0x00100000, 0))
+ if (__glibc_unlikely (ux < 0x00100000))
{
- if (__builtin_expect (((ux & 0x7fffffff) | dx) == 0, 0))
+ if (__glibc_unlikely (((ux & 0x7fffffff) | dx) == 0))
return MHALF / 0.0; /* return -INF */
- if (__builtin_expect (ux < 0, 0))
+ if (__glibc_unlikely (ux < 0))
return (x - x) / 0.0; /* return NaN */
n -= 54;
x *= two54.d; /* scale x */
num.d = x;
}
- if (__builtin_expect (ux >= 0x7ff00000, 0))
+ if (__glibc_unlikely (ux >= 0x7ff00000))
return x + x; /* INF or NaN */
/* Regular values of x */
w = x - 1;
- if (__builtin_expect (ABS (w) > U03, 1))
+ if (__glibc_likely (ABS (w) > U03))
goto case_03;
/*--- Stage I, the case abs(x-1) < 0.03 */
diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c
index c3d465a4a9..8548ee3942 100644
--- a/sysdeps/ieee754/dbl-64/e_log10.c
+++ b/sysdeps/ieee754/dbl-64/e_log10.c
@@ -63,15 +63,15 @@ __ieee754_log10 (double x)
k = 0;
if (hx < 0x00100000)
{ /* x < 2**-1022 */
- if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
+ if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
return -two54 / (x - x); /* log(+-0)=-inf */
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD (hx, x);
}
- if (__builtin_expect (hx >= 0x7ff00000, 0))
+ if (__glibc_unlikely (hx >= 0x7ff00000))
return x + x;
k += (hx >> 20) - 1023;
i = ((u_int32_t) k & 0x80000000) >> 31;
diff --git a/sysdeps/ieee754/dbl-64/e_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c
index 890a4a2bd0..997d7cefc8 100644
--- a/sysdeps/ieee754/dbl-64/e_log2.c
+++ b/sysdeps/ieee754/dbl-64/e_log2.c
@@ -81,15 +81,15 @@ __ieee754_log2 (double x)
k = 0;
if (hx < 0x00100000)
{ /* x < 2**-1022 */
- if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
+ if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
return -two54 / (x - x); /* log(+-0)=-inf */
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD (hx, x);
}
- if (__builtin_expect (hx >= 0x7ff00000, 0))
+ if (__glibc_unlikely (hx >= 0x7ff00000))
return x + x;
k += (hx >> 20) - 1023;
hx &= 0x000fffff;
diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c
index 851b510aaa..4ff28bf85d 100644
--- a/sysdeps/ieee754/dbl-64/e_sinh.c
+++ b/sysdeps/ieee754/dbl-64/e_sinh.c
@@ -49,7 +49,7 @@ __ieee754_sinh (double x)
ix = jx & 0x7fffffff;
/* x is INF or NaN */
- if (__builtin_expect (ix >= 0x7ff00000, 0))
+ if (__glibc_unlikely (ix >= 0x7ff00000))
return x + x;
h = 0.5;
@@ -58,7 +58,7 @@ __ieee754_sinh (double x)
/* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x40360000) /* |x|<22 */
{
- if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */
+ if (__glibc_unlikely (ix < 0x3e300000)) /* |x|<2**-28 */
if (shuge + x > one)
return x;
/* sinh(tiny) = tiny with inexact */
diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c
index 5500746848..a33758d3c9 100644
--- a/sysdeps/ieee754/dbl-64/s_asinh.c
+++ b/sysdeps/ieee754/dbl-64/s_asinh.c
@@ -36,12 +36,12 @@ __asinh (double x)
int32_t hx, ix;
GET_HIGH_WORD (hx, x);
ix = hx & 0x7fffffff;
- if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */
+ if (__glibc_unlikely (ix < 0x3e300000)) /* |x|<2**-28 */
{
if (huge + x > one)
return x; /* return x inexact except 0 */
}
- if (__builtin_expect (ix > 0x41b00000, 0)) /* |x| > 2**28 */
+ if (__glibc_unlikely (ix > 0x41b00000)) /* |x| > 2**28 */
{
if (ix >= 0x7ff00000)
return x + x; /* x is inf or NaN */
diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c
index cfaa22d184..389acd4cde 100644
--- a/sysdeps/ieee754/dbl-64/s_fma.c
+++ b/sysdeps/ieee754/dbl-64/s_fma.c
@@ -174,7 +174,7 @@ __fma (double x, double y, double z)
}
/* Ensure correct sign of exact 0 + 0. */
- if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0))
+ if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
fenv_t env;
@@ -216,7 +216,7 @@ __fma (double x, double y, double z)
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
- if (__builtin_expect (adjust < 0, 0))
+ if (__glibc_unlikely (adjust < 0))
{
if ((u.ieee.mantissa1 & 1) == 0)
u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0;
@@ -228,14 +228,14 @@ __fma (double x, double y, double z)
/* Reset rounding mode and test for inexact simultaneously. */
int j = libc_feupdateenv_test (&env, FE_INEXACT) != 0;
- if (__builtin_expect (adjust == 0, 1))
+ if (__glibc_likely (adjust == 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff)
u.ieee.mantissa1 |= j;
/* Result is a1 + u.d. */
return a1 + u.d;
}
- else if (__builtin_expect (adjust > 0, 1))
+ else if (__glibc_likely (adjust > 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff)
u.ieee.mantissa1 |= j;
diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c
index ea1dc6ca76..fd4dce5f23 100644
--- a/sysdeps/ieee754/dbl-64/s_log1p.c
+++ b/sysdeps/ieee754/dbl-64/s_log1p.c
@@ -107,14 +107,14 @@ __log1p (double x)
k = 1;
if (hx < 0x3FDA827A) /* x < 0.41422 */
{
- if (__builtin_expect (ax >= 0x3ff00000, 0)) /* x <= -1.0 */
+ if (__glibc_unlikely (ax >= 0x3ff00000)) /* x <= -1.0 */
{
if (x == -1.0)
return -two54 / (x - x); /* log1p(-1)=+inf */
else
return (x - x) / (x - x); /* log1p(x<-1)=NaN */
}
- if (__builtin_expect (ax < 0x3e200000, 0)) /* |x| < 2**-29 */
+ if (__glibc_unlikely (ax < 0x3e200000)) /* |x| < 2**-29 */
{
math_force_eval (two54 + x); /* raise inexact */
if (ax < 0x3c900000) /* |x| < 2**-54 */
@@ -127,7 +127,7 @@ __log1p (double x)
k = 0; f = x; hu = 1;
} /* -0.2929<x<0.41422 */
}
- else if (__builtin_expect (hx >= 0x7ff00000, 0))
+ else if (__glibc_unlikely (hx >= 0x7ff00000))
return x + x;
if (k != 0)
{
diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c
index c065826dd2..7a6c49abf5 100644
--- a/sysdeps/ieee754/dbl-64/s_logb.c
+++ b/sysdeps/ieee754/dbl-64/s_logb.c
@@ -30,7 +30,7 @@ __logb (double x)
return -1.0 / fabs (x);
if (ix >= 0x7ff00000)
return x * x;
- if (__builtin_expect ((rix = ix >> 20) == 0, 0))
+ if (__glibc_unlikely ((rix = ix >> 20) == 0))
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c
index 1dce6381ae..0a1e13008f 100644
--- a/sysdeps/ieee754/dbl-64/s_modf.c
+++ b/sysdeps/ieee754/dbl-64/s_modf.c
@@ -54,7 +54,7 @@ __modf (double x, double *iptr)
}
}
}
- else if (__builtin_expect (j0 > 51, 0)) /* no fraction part */
+ else if (__glibc_unlikely (j0 > 51)) /* no fraction part */
{
*iptr = x * one;
/* We must handle NaNs separately. */
diff --git a/sysdeps/ieee754/dbl-64/s_scalbln.c b/sysdeps/ieee754/dbl-64/s_scalbln.c
index 6402927d23..874b98e4cf 100644
--- a/sysdeps/ieee754/dbl-64/s_scalbln.c
+++ b/sysdeps/ieee754/dbl-64/s_scalbln.c
@@ -31,7 +31,7 @@ __scalbln (double x, long int n)
int32_t k, hx, lx;
EXTRACT_WORDS (hx, lx, x);
k = (hx & 0x7ff00000) >> 20; /* extract exponent */
- if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */
+ if (__glibc_unlikely (k == 0)) /* 0 or subnormal x */
{
if ((lx | (hx & 0x7fffffff)) == 0)
return x; /* +-0 */
@@ -39,16 +39,16 @@ __scalbln (double x, long int n)
GET_HIGH_WORD (hx, x);
k = ((hx & 0x7ff00000) >> 20) - 54;
}
- if (__builtin_expect (k == 0x7ff, 0))
+ if (__glibc_unlikely (k == 0x7ff))
return x + x; /* NaN or Inf */
- if (__builtin_expect (n < -50000, 0))
+ if (__glibc_unlikely (n < -50000))
return tiny * __copysign (tiny, x); /*underflow*/
- if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0))
+ if (__glibc_unlikely (n > 50000 || k + n > 0x7fe))
return huge * __copysign (huge, x); /* overflow */
/* Now k and n are bounded we know that k = k+n does not
overflow. */
k = k + n;
- if (__builtin_expect (k > 0, 1)) /* normal result */
+ if (__glibc_likely (k > 0)) /* normal result */
{
SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x;
}
diff --git a/sysdeps/ieee754/dbl-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/s_scalbn.c
index 6e7d5ad217..0f58034df5 100644
--- a/sysdeps/ieee754/dbl-64/s_scalbn.c
+++ b/sysdeps/ieee754/dbl-64/s_scalbn.c
@@ -31,7 +31,7 @@ __scalbn (double x, int n)
int32_t k, hx, lx;
EXTRACT_WORDS (hx, lx, x);
k = (hx & 0x7ff00000) >> 20; /* extract exponent */
- if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */
+ if (__glibc_unlikely (k == 0)) /* 0 or subnormal x */
{
if ((lx | (hx & 0x7fffffff)) == 0)
return x; /* +-0 */
@@ -39,16 +39,16 @@ __scalbn (double x, int n)
GET_HIGH_WORD (hx, x);
k = ((hx & 0x7ff00000) >> 20) - 54;
}
- if (__builtin_expect (k == 0x7ff, 0))
+ if (__glibc_unlikely (k == 0x7ff))
return x + x; /* NaN or Inf */
- if (__builtin_expect (n < -50000, 0))
+ if (__glibc_unlikely (n < -50000))
return tiny * __copysign (tiny, x); /*underflow*/
- if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0))
+ if (__glibc_unlikely (n > 50000 || k + n > 0x7fe))
return huge * __copysign (huge, x); /* overflow */
/* Now k and n are bounded we know that k = k+n does not
overflow. */
k = k + n;
- if (__builtin_expect (k > 0, 1)) /* normal result */
+ if (__glibc_likely (k > 0)) /* normal result */
{
SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x;
}
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
index 26268f2498..ccccdaf106 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
@@ -39,7 +39,7 @@ __ieee754_acosh (double x)
if (hx > INT64_C (0x4000000000000000))
{
- if (__builtin_expect (hx >= INT64_C (0x41b0000000000000), 0))
+ if (__glibc_unlikely (hx >= INT64_C (0x41b0000000000000)))
{
/* x > 2**28 */
if (hx >= INT64_C (0x7ff0000000000000))
@@ -53,13 +53,13 @@ __ieee754_acosh (double x)
double t = x * x;
return __ieee754_log (2.0 * x - one / (x + __ieee754_sqrt (t - one)));
}
- else if (__builtin_expect (hx > INT64_C (0x3ff0000000000000), 1))
+ else if (__glibc_likely (hx > INT64_C (0x3ff0000000000000)))
{
/* 1<x<2 */
double t = x - one;
return __log1p (t + __ieee754_sqrt (2.0 * t + t * t));
}
- else if (__builtin_expect (hx == INT64_C (0x3ff0000000000000), 1))
+ else if (__glibc_likely (hx == INT64_C (0x3ff0000000000000)))
return 0.0; /* acosh(1) = 0 */
else /* x < 1 */
return (x - x) / (x - x);
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
index dcb7b58a1b..4f5a81669e 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
@@ -64,16 +64,16 @@ __ieee754_log10 (double x)
k = 0;
if (hx < INT64_C(0x0010000000000000))
{ /* x < 2**-1022 */
- if (__builtin_expect ((hx & UINT64_C(0x7fffffffffffffff)) == 0, 0))
+ if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0))
return -two54 / (x - x); /* log(+-0)=-inf */
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
x *= two54; /* subnormal number, scale up x */
EXTRACT_WORDS64 (hx, x);
}
/* scale up resulted in a NaN number */
- if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000), 0))
+ if (__glibc_unlikely (hx >= UINT64_C(0x7ff0000000000000)))
return x + x;
k += (hx >> 52) - 1023;
i = ((uint64_t) k & UINT64_C(0x8000000000000000)) >> 63;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
index 6dc7b7d217..5ccb78cf03 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
@@ -80,15 +80,15 @@ __ieee754_log2 (double x)
k = 0;
if (hx < INT64_C(0x0010000000000000))
{ /* x < 2**-1022 */
- if (__builtin_expect ((hx & UINT64_C(0x7fffffffffffffff)) == 0, 0))
+ if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0))
return -two54 / (x - x); /* log(+-0)=-inf */
- if (__builtin_expect (hx < 0, 0))
+ if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
x *= two54; /* subnormal number, scale up x */
EXTRACT_WORDS64 (hx, x);
}
- if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000), 0))
+ if (__glibc_unlikely (hx >= UINT64_C(0x7ff0000000000000)))
return x + x;
k += (hx >> 52) - 1023;
hx &= UINT64_C(0x000fffffffffffff);
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
index d03e33ee1f..f2d980d9e0 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
@@ -39,11 +39,11 @@ __frexp (double x, int *eptr)
int32_t ex = 0x7ff & (ix >> 52);
int e = 0;
- if (__builtin_expect (ex != 0x7ff && x != 0.0, 1))
+ if (__glibc_likely (ex != 0x7ff && x != 0.0))
{
/* Not zero and finite. */
e = ex - 1022;
- if (__builtin_expect (ex == 0, 0))
+ if (__glibc_unlikely (ex == 0))
{
/* Subnormal. */
x *= 0x1p54;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
index e51c849592..1970ce922e 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
@@ -34,7 +34,7 @@ __logb (double x)
ex = ix >> 52;
if (ex == 0x7ff)
return x * x;
- if (__builtin_expect (ex == 0, 0))
+ if (__glibc_unlikely (ex == 0))
{
int m = __builtin_clzll (ix);
ex -= m - 12;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
index b22503f5c7..06b9242a86 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
@@ -40,7 +40,7 @@ __remquo (double x, double y, int *quo)
hx &= UINT64_C(0x7fffffffffffffff);
/* Purge off exception values. */
- if (__builtin_expect (hy == 0, 0))
+ if (__glibc_unlikely (hy == 0))
return (x * y) / (x * y); /* y = 0 */
if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000) /* x not finite */
|| hy > UINT64_C(0x7ff0000000000000), 0))/* y is NaN */
@@ -49,7 +49,7 @@ __remquo (double x, double y, int *quo)
if (hy <= UINT64_C(0x7fbfffffffffffff))
x = __ieee754_fmod (x, 8 * y); /* now x < 8y */
- if (__builtin_expect (hx == hy, 0))
+ if (__glibc_unlikely (hx == hy))
{
*quo = qs ? -1 : 1;
return zero * x;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
index 684858c065..8b86b81b00 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
@@ -32,7 +32,7 @@ __round (double x)
EXTRACT_WORDS64 (i0, x);
j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
- if (__builtin_expect (j0 < 52, 1))
+ if (__glibc_likely (j0 < 52))
{
if (j0 < 0)
{
diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c
index dbd3fe4be2..da4fa4dc0b 100644
--- a/sysdeps/ieee754/flt-32/e_atanhf.c
+++ b/sysdeps/ieee754/flt-32/e_atanhf.c
@@ -48,7 +48,7 @@ __ieee754_atanhf (float x)
float t;
if (isless (xa, 0.5f))
{
- if (__builtin_expect (xa < 0x1.0p-28f, 0))
+ if (__glibc_unlikely (xa < 0x1.0p-28f))
{
math_force_eval (huge + x);
return x;
@@ -57,7 +57,7 @@ __ieee754_atanhf (float x)
t = xa + xa;
t = 0.5f * __log1pf (t + t * xa / (1.0f - xa));
}
- else if (__builtin_expect (isless (xa, 1.0f), 1))
+ else if (__glibc_likely (isless (xa, 1.0f)))
t = 0.5f * __log1pf ((xa + xa) / (1.0f - xa));
else
{
diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c
index e8da51a42c..7b72587e9d 100644
--- a/sysdeps/ieee754/flt-32/e_gammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c
@@ -114,7 +114,7 @@ __ieee754_gammaf_r (float x, int *signgamp)
GET_FLOAT_WORD (hx, x);
- if (__builtin_expect ((hx & 0x7fffffff) == 0, 0))
+ if (__glibc_unlikely ((hx & 0x7fffffff) == 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
@@ -127,13 +127,13 @@ __ieee754_gammaf_r (float x, int *signgamp)
*signgamp = 0;
return (x - x) / (x - x);
}
- if (__builtin_expect (hx == 0xff800000, 0))
+ if (__glibc_unlikely (hx == 0xff800000))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
return x - x;
}
- if (__builtin_expect ((hx & 0x7f800000) == 0x7f800000, 0))
+ if (__glibc_unlikely ((hx & 0x7f800000) == 0x7f800000))
{
/* Positive infinity (return positive infinity) or NaN (return
NaN). */
diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c
index 011adbb2b7..ba0267ebcb 100644
--- a/sysdeps/ieee754/flt-32/s_logbf.c
+++ b/sysdeps/ieee754/flt-32/s_logbf.c
@@ -27,7 +27,7 @@ __logbf (float x)
return (float) -1.0 / fabsf (x);
if (ix >= 0x7f800000)
return x * x;
- if (__builtin_expect ((rix = ix >> 23) == 0, 0))
+ if (__glibc_unlikely ((rix = ix >> 23) == 0))
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index 48b63ab51d..1d5f27b7b6 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -178,7 +178,7 @@ __fmal (long double x, long double y, long double z)
}
/* Ensure correct sign of exact 0 + 0. */
- if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0))
+ if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
fenv_t env;
@@ -220,7 +220,7 @@ __fmal (long double x, long double y, long double z)
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
- if (__builtin_expect (adjust == 0, 1))
+ if (__glibc_likely (adjust == 0))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
@@ -228,7 +228,7 @@ __fmal (long double x, long double y, long double z)
/* Result is a1 + u.d. */
return a1 + u.d;
}
- else if (__builtin_expect (adjust > 0, 1))
+ else if (__glibc_likely (adjust > 0))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
index a140fb322d..205097d38f 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -48,7 +48,7 @@ __ieee754_fmodl (long double x, long double y)
(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
(hy>0x7ff0000000000000LL),0)) /* or y is NaN */
return (x*y)/(x*y);
- if (__builtin_expect (hx <= hy, 0))
+ if (__glibc_unlikely (hx <= hy))
{
/* If |x| < |y| return x. */
if (hx < hy)
@@ -83,7 +83,7 @@ __ieee754_fmodl (long double x, long double y)
ldbl_extract_mantissa(&hx, &lx, &ix, x);
ldbl_extract_mantissa(&hy, &ly, &iy, y);
- if (__builtin_expect (ix == -IEEE754_DOUBLE_BIAS, 0))
+ if (__glibc_unlikely (ix == -IEEE754_DOUBLE_BIAS))
{
/* subnormal x, shift x to normal. */
while ((hx & (1LL << 48)) == 0)
@@ -94,7 +94,7 @@ __ieee754_fmodl (long double x, long double y)
}
}
- if (__builtin_expect (iy == -IEEE754_DOUBLE_BIAS, 0))
+ if (__glibc_unlikely (iy == -IEEE754_DOUBLE_BIAS))
{
/* subnormal y, shift y to normal. */
while ((hy & (1LL << 48)) == 0)
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
index 1b6e27a9ff..051352f9f7 100644
--- a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -215,14 +215,14 @@ ldbl_nearbyint (double a)
{
double two52 = 0x1p52;
- if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
+ if (__glibc_likely ((__builtin_fabs (a) < two52)))
{
- if (__builtin_expect ((a > 0.0), 1))
+ if (__glibc_likely ((a > 0.0)))
{
a += two52;
a -= two52;
}
- else if (__builtin_expect ((a < 0.0), 1))
+ else if (__glibc_likely ((a < 0.0)))
{
a = two52 - a;
a = -(a - two52);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
index 345f3905d6..86996bff3d 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -45,7 +45,7 @@ __llrintl (long double x)
{
save_round = __fegetround ();
- if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+ if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1))))
{
/* When XH is 9223372036854775808.0, converting to long long will
overflow, resulting in an invalid operation. However, XL might
@@ -72,7 +72,7 @@ __llrintl (long double x)
res = hi + lo;
/* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
- if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
goto overflow;
xh -= lo;
@@ -114,7 +114,7 @@ __llrintl (long double x)
break;
}
- if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
goto overflow;
return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
index 4a6e2d5f83..dd84074cf7 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -41,7 +41,7 @@ __llroundl (long double x)
#endif
)
{
- if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+ if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1))))
{
/* When XH is 9223372036854775808.0, converting to long long will
overflow, resulting in an invalid operation. However, XL might
@@ -68,7 +68,7 @@ __llroundl (long double x)
res = hi + lo;
/* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
- if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
goto overflow;
xh -= lo;
@@ -94,7 +94,7 @@ __llroundl (long double x)
res -= 1;
}
- if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
goto overflow;
return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
index da8d71bdec..dbd3478e63 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -36,7 +36,7 @@ __logbl (long double x)
return -1.0 / fabs (x);
if (hx >= 0x7ff0000000000000LL)
return x * x;
- if (__builtin_expect ((rhx = hx >> 52) == 0, 0))
+ if (__glibc_unlikely ((rhx = hx >> 52) == 0))
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
index 56c3a81cd3..2b47c52a06 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -59,7 +59,7 @@ __lrintl (long double x)
hi = llhi;
xh -= hi;
#else
- if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+ if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1))))
{
/* When XH is 9223372036854775808.0, converting to long long will
overflow, resulting in an invalid operation. However, XL might
@@ -87,7 +87,7 @@ __lrintl (long double x)
res = hi + lo;
/* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
- if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
goto overflow;
xh -= lo;
@@ -129,7 +129,7 @@ __lrintl (long double x)
break;
}
- if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
goto overflow;
return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
index 107778df3e..27b72e2ad1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -55,7 +55,7 @@ __lroundl (long double x)
hi = llhi;
xh -= hi;
#else
- if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+ if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1))))
{
/* When XH is 9223372036854775808.0, converting to long long will
overflow, resulting in an invalid operation. However, XL might
@@ -83,7 +83,7 @@ __lroundl (long double x)
res = hi + lo;
/* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
- if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
goto overflow;
xh -= lo;
@@ -109,7 +109,7 @@ __lroundl (long double x)
res -= 1;
}
- if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
goto overflow;
return res;
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index 477c3a61d3..2832f417c9 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -119,19 +119,19 @@ __ieee754_gammal_r (long double x, int *signgamp)
GET_LDOUBLE_WORDS (es, hx, lx, x);
- if (__builtin_expect (((es & 0x7fff) | hx | lx) == 0, 0))
+ if (__glibc_unlikely (((es & 0x7fff) | hx | lx) == 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
return 1.0 / x;
}
- if (__builtin_expect (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0, 0))
+ if (__glibc_unlikely (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
return x - x;
}
- if (__builtin_expect ((es & 0x7fff) == 0x7fff, 0))
+ if (__glibc_unlikely ((es & 0x7fff) == 0x7fff))
{
/* Positive infinity (return positive infinity) or NaN (return
NaN). */
diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c
index 3939259d81..56f48f1ab9 100644
--- a/sysdeps/ieee754/ldbl-96/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j0l.c
@@ -112,7 +112,7 @@ __ieee754_j0l (long double x)
GET_LDOUBLE_EXP (se, x);
ix = se & 0x7fff;
- if (__builtin_expect (ix >= 0x7fff, 0))
+ if (__glibc_unlikely (ix >= 0x7fff))
return one / (x * x);
x = fabsl (x);
if (ix >= 0x4000) /* |x| >= 2.0 */
@@ -132,7 +132,7 @@ __ieee754_j0l (long double x)
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if (__builtin_expect (ix > 0x4080, 0)) /* 2^129 */
+ if (__glibc_unlikely (ix > 0x4080)) /* 2^129 */
z = (invsqrtpi * cc) / __ieee754_sqrtl (x);
else
{
@@ -142,7 +142,7 @@ __ieee754_j0l (long double x)
}
return z;
}
- if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */
+ if (__glibc_unlikely (ix < 0x3fef)) /* |x| < 2**-16 */
{
/* raise inexact if x != 0 */
math_force_eval (huge + x);
@@ -199,11 +199,11 @@ __ieee754_y0l (long double x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */
- if (__builtin_expect (se & 0x8000, 0))
+ if (__glibc_unlikely (se & 0x8000))
return zero / (zero * x);
- if (__builtin_expect (ix >= 0x7fff, 0))
+ if (__glibc_unlikely (ix >= 0x7fff))
return one / (x + x * x);
- if (__builtin_expect ((i0 | i1) == 0, 0))
+ if (__glibc_unlikely ((i0 | i1) == 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -234,7 +234,7 @@ __ieee754_y0l (long double x)
else
ss = z / cc;
}
- if (__builtin_expect (ix > 0x4080, 0)) /* 1e39 */
+ if (__glibc_unlikely (ix > 0x4080)) /* 1e39 */
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -244,7 +244,7 @@ __ieee754_y0l (long double x)
}
return z;
}
- if (__builtin_expect (ix <= 0x3fde, 0)) /* x < 2^-33 */
+ if (__glibc_unlikely (ix <= 0x3fde)) /* x < 2^-33 */
{
z = -7.380429510868722527629822444004602747322E-2L
+ tpi * __ieee754_logl (x);
diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c
index 4c13018aea..5c0a2e1992 100644
--- a/sysdeps/ieee754/ldbl-96/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j1l.c
@@ -114,7 +114,7 @@ __ieee754_j1l (long double x)
GET_LDOUBLE_EXP (se, x);
ix = se & 0x7fff;
- if (__builtin_expect (ix >= 0x7fff, 0))
+ if (__glibc_unlikely (ix >= 0x7fff))
return one / x;
y = fabsl (x);
if (ix >= 0x4000)
@@ -134,7 +134,7 @@ __ieee754_j1l (long double x)
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
* y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
*/
- if (__builtin_expect (ix > 0x4080, 0))
+ if (__glibc_unlikely (ix > 0x4080))
z = (invsqrtpi * cc) / __ieee754_sqrtl (y);
else
{
@@ -147,7 +147,7 @@ __ieee754_j1l (long double x)
else
return z;
}
- if (__builtin_expect (ix < 0x3fde, 0)) /* |x| < 2^-33 */
+ if (__glibc_unlikely (ix < 0x3fde)) /* |x| < 2^-33 */
{
if (huge + x > one)
return 0.5 * x; /* inexact if x!=0 necessary */
@@ -192,11 +192,11 @@ __ieee754_y1l (long double x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if (__builtin_expect (se & 0x8000, 0))
+ if (__glibc_unlikely (se & 0x8000))
return zero / (zero * x);
- if (__builtin_expect (ix >= 0x7fff, 0))
+ if (__glibc_unlikely (ix >= 0x7fff))
return one / (x + x * x);
- if (__builtin_expect ((i0 | i1) == 0, 0))
+ if (__glibc_unlikely ((i0 | i1) == 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -222,7 +222,7 @@ __ieee754_y1l (long double x)
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
- if (__builtin_expect (ix > 0x4080, 0))
+ if (__glibc_unlikely (ix > 0x4080))
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -232,7 +232,7 @@ __ieee754_y1l (long double x)
}
return z;
}
- if (__builtin_expect (ix <= 0x3fbe, 0))
+ if (__glibc_unlikely (ix <= 0x3fbe))
{ /* x < 2**-65 */
return (-tpi / x);
}
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index fa8e27efec..11d097c271 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -81,7 +81,7 @@ __ieee754_jnl (int n, long double x)
ix = se & 0x7fff;
/* if J(n,NaN) is NaN */
- if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
+ if (__glibc_unlikely ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0)))
return x + x;
if (n < 0)
{
@@ -95,7 +95,7 @@ __ieee754_jnl (int n, long double x)
return (__ieee754_j1l (x));
sgn = (n & 1) & (se >> 15); /* even n -- 0, odd n -- sign(x) */
x = fabsl (x);
- if (__builtin_expect ((ix | i0 | i1) == 0 || ix >= 0x7fff, 0))
+ if (__glibc_unlikely ((ix | i0 | i1) == 0 || ix >= 0x7fff))
/* if x is 0 or inf */
b = zero;
else if ((long double) n <= x)
@@ -316,7 +316,7 @@ __ieee754_ynl (int n, long double x)
return (__ieee754_y0l (x));
if (n == 1)
return (sign * __ieee754_y1l (x));
- if (__builtin_expect (ix == 0x7fff, 0))
+ if (__glibc_unlikely (ix == 0x7fff))
return zero;
if (ix >= 0x412D)
{ /* x > 2**302 */
diff --git a/sysdeps/ieee754/ldbl-96/s_fma.c b/sysdeps/ieee754/ldbl-96/s_fma.c
index fde2811040..354be4eae9 100644
--- a/sysdeps/ieee754/ldbl-96/s_fma.c
+++ b/sysdeps/ieee754/ldbl-96/s_fma.c
@@ -29,7 +29,7 @@
double
__fma (double x, double y, double z)
{
- if (__builtin_expect (isinf (z), 0))
+ if (__glibc_unlikely (isinf (z)))
{
/* If z is Inf, but x and y are finite, the result should be
z rather than NaN. */
@@ -39,7 +39,7 @@ __fma (double x, double y, double z)
}
/* Ensure correct sign of exact 0 + 0. */
- if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0))
+ if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
fenv_t env;
diff --git a/sysdeps/ieee754/ldbl-96/s_fmal.c b/sysdeps/ieee754/ldbl-96/s_fmal.c
index 0564321354..4983eda9c6 100644
--- a/sysdeps/ieee754/ldbl-96/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-96/s_fmal.c
@@ -176,7 +176,7 @@ __fmal (long double x, long double y, long double z)
}
/* Ensure correct sign of exact 0 + 0. */
- if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0))
+ if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
fenv_t env;
@@ -218,7 +218,7 @@ __fmal (long double x, long double y, long double z)
/* Perform m2 + a2 addition with round to odd. */
u.d = a2 + m2;
- if (__builtin_expect (adjust == 0, 1))
+ if (__glibc_likely (adjust == 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
@@ -226,7 +226,7 @@ __fmal (long double x, long double y, long double z)
/* Result is a1 + u.d. */
return a1 + u.d;
}
- else if (__builtin_expect (adjust > 0, 1))
+ else if (__glibc_likely (adjust > 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 27f264bb16..0bb1399e97 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -30,7 +30,7 @@ static long int nsec; /* Clock frequency of the processor. */
static int
hp_timing_getres (struct timespec *res)
{
- if (__builtin_expect (nsec == 0, 0))
+ if (__glibc_unlikely (nsec == 0))
{
hp_timing_t freq;
@@ -39,7 +39,7 @@ hp_timing_getres (struct timespec *res)
code against multiple execution since all of them should
lead to the same result. */
freq = __get_clockfreq ();
- if (__builtin_expect (freq == 0, 0))
+ if (__glibc_unlikely (freq == 0))
/* Something went wrong. */
return -1;
@@ -60,7 +60,7 @@ realtime_getres (struct timespec *res)
{
long int clk_tck = sysconf (_SC_CLK_TCK);
- if (__builtin_expect (clk_tck != -1, 1))
+ if (__glibc_likely (clk_tck != -1))
{
/* This implementation assumes that the realtime clock has a
resolution higher than 1 second. This is the case for any
diff --git a/sysdeps/posix/fdopendir.c b/sysdeps/posix/fdopendir.c
index d8c6ec0513..4071996dcd 100644
--- a/sysdeps/posix/fdopendir.c
+++ b/sysdeps/posix/fdopendir.c
@@ -31,7 +31,7 @@ __fdopendir (int fd)
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
return NULL;
- if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+ if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
{
__set_errno (ENOTDIR);
return NULL;
@@ -39,9 +39,9 @@ __fdopendir (int fd)
/* Make sure the descriptor allows for reading. */
int flags = __fcntl (fd, F_GETFL);
- if (__builtin_expect (flags == -1, 0))
+ if (__glibc_unlikely (flags == -1))
return NULL;
- if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
+ if (__glibc_unlikely ((flags & O_ACCMODE) == O_WRONLY))
{
__set_errno (EINVAL);
return NULL;
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 8218237af2..e1a399b3ca 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -471,7 +471,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
bool malloc_namebuf = false;
char *namebuf = (char *) name;
- if (__builtin_expect (scope_delim != NULL, 0))
+ if (__glibc_unlikely (scope_delim != NULL))
{
if (malloc_name)
*scope_delim = '\0';
@@ -2608,7 +2608,7 @@ getaddrinfo (const char *name, const char *service,
the information. */
struct sort_result_combo src
= { .results = results, .nresults = nresults };
- if (__builtin_expect (gaiconf_reload_flag_ever_set, 0))
+ if (__glibc_unlikely (gaiconf_reload_flag_ever_set))
{
__libc_lock_define_initialized (static, lock);
diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
index e366701bd4..2740b3ac29 100644
--- a/sysdeps/posix/opendir.c
+++ b/sysdeps/posix/opendir.c
@@ -110,7 +110,7 @@ __opendirat (int dfd, const char *name)
performed on, say, a tape device might have undesirable effects. */
if (__builtin_expect (__xstat64 (_STAT_VER, name, &statbuf), 0) < 0)
return NULL;
- if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+ if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
{
__set_errno (ENOTDIR);
return NULL;
@@ -139,7 +139,7 @@ __opendirat (int dfd, const char *name)
the `stat' call. */
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
goto lose;
- if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+ if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode)))
{
__set_errno (ENOTDIR);
lose:
diff --git a/sysdeps/posix/sleep.c b/sysdeps/posix/sleep.c
index 4a72c275b3..d8b19099fd 100644
--- a/sysdeps/posix/sleep.c
+++ b/sysdeps/posix/sleep.c
@@ -33,7 +33,7 @@ unsigned int
__sleep (unsigned int seconds)
{
/* This is not necessary but some buggy programs depend on it. */
- if (__builtin_expect (seconds == 0, 0))
+ if (__glibc_unlikely (seconds == 0))
{
#ifdef CANCELLATION_P
CANCELLATION_P (THREAD_SELF);
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 1f86549df3..d21c0ccf00 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -113,7 +113,7 @@
# include <hp-timing.h>
# if HP_TIMING_AVAIL
# define RANDOM_BITS(Var) \
- if (__builtin_expect (value == UINT64_C (0), 0)) \
+ if (__glibc_unlikely (value == UINT64_C (0))) \
{ \
/* If this is the first time this function is used initialize \
the variable we accumulate the value in to some somewhat \
diff --git a/sysdeps/powerpc/powerpc32/dl-irel.h b/sysdeps/powerpc/powerpc32/dl-irel.h
index 16b786b72f..9d6f56a37c 100644
--- a/sysdeps/powerpc/powerpc32/dl-irel.h
+++ b/sysdeps/powerpc/powerpc32/dl-irel.h
@@ -39,7 +39,7 @@ elf_irela (const Elf32_Rela *reloc)
{
unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_PPC_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_PPC_IRELATIVE))
{
Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend);
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 4b77966e77..7ef1e3b4a6 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -442,19 +442,19 @@ __process_machine_rela (struct link_map *map,
break;
case R_PPC_ADDR24:
- if (__builtin_expect (finaladdr > 0x01fffffc && finaladdr < 0xfe000000, 0))
+ if (__glibc_unlikely (finaladdr > 0x01fffffc && finaladdr < 0xfe000000))
_dl_reloc_overflow (map, "R_PPC_ADDR24", reloc_addr, refsym);
*reloc_addr = (*reloc_addr & 0xfc000003) | (finaladdr & 0x3fffffc);
break;
case R_PPC_ADDR16:
- if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
+ if (__glibc_unlikely (finaladdr > 0x7fff && finaladdr < 0xffff8000))
_dl_reloc_overflow (map, "R_PPC_ADDR16", reloc_addr, refsym);
*(Elf32_Half*) reloc_addr = finaladdr;
break;
case R_PPC_UADDR16:
- if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
+ if (__glibc_unlikely (finaladdr > 0x7fff && finaladdr < 0xffff8000))
_dl_reloc_overflow (map, "R_PPC_UADDR16", reloc_addr, refsym);
((union unaligned *) reloc_addr)->u2 = finaladdr;
break;
@@ -474,7 +474,7 @@ __process_machine_rela (struct link_map *map,
case R_PPC_ADDR14:
case R_PPC_ADDR14_BRTAKEN:
case R_PPC_ADDR14_BRNTAKEN:
- if (__builtin_expect (finaladdr > 0x7fff && finaladdr < 0xffff8000, 0))
+ if (__glibc_unlikely (finaladdr > 0x7fff && finaladdr < 0xffff8000))
_dl_reloc_overflow (map, "R_PPC_ADDR14", reloc_addr, refsym);
*reloc_addr = (*reloc_addr & 0xffff0003) | (finaladdr & 0xfffc);
if (rinfo != R_PPC_ADDR14)
@@ -578,7 +578,7 @@ __process_machine_rela (struct link_map *map,
inline void do_reloc16 (const char *r_name, Elf32_Addr value)
{
- if (__builtin_expect (value > 0x7fff && value < 0xffff8000, 0))
+ if (__glibc_unlikely (value > 0x7fff && value < 0xffff8000))
_dl_reloc_overflow (map, r_name, reloc_addr, refsym);
*(Elf32_Half *) reloc_addr = value;
}
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index 96d08c5d36..23b610fbf1 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -177,7 +177,7 @@ elf_machine_runtime_setup (struct link_map *map,
extern void _dl_runtime_resolve (void);
extern void _dl_prof_resolve (void);
- if (__builtin_expect (!profile, 1))
+ if (__glibc_likely (!profile))
dlrr = _dl_runtime_resolve;
else
{
@@ -287,7 +287,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
return;
}
- if (__builtin_expect (r_type == R_PPC_NONE, 0))
+ if (__glibc_unlikely (r_type == R_PPC_NONE))
return;
/* binutils on ppc32 includes st_value in r_addend for relocations
diff --git a/sysdeps/powerpc/powerpc64/dl-irel.h b/sysdeps/powerpc/powerpc64/dl-irel.h
index 8f834ce63b..ae9e1b696c 100644
--- a/sysdeps/powerpc/powerpc64/dl-irel.h
+++ b/sysdeps/powerpc/powerpc64/dl-irel.h
@@ -40,13 +40,13 @@ elf_irela (const Elf64_Rela *reloc)
{
unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_PPC64_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_PPC64_IRELATIVE))
{
Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
}
- else if (__builtin_expect (r_type == R_PPC64_JMP_IREL, 1))
+ else if (__glibc_likely (r_type == R_PPC64_JMP_IREL))
{
Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index dd44df5fa6..bc99183570 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -655,7 +655,7 @@ elf_machine_rela (struct link_map *map,
return;
}
- if (__builtin_expect (r_type == R_PPC64_NONE, 0))
+ if (__glibc_unlikely (r_type == R_PPC64_NONE))
return;
/* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt
@@ -680,13 +680,13 @@ elf_machine_rela (struct link_map *map,
return;
case R_PPC64_IRELATIVE:
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = resolve_ifunc (value, map, sym_map);
*reloc_addr = value;
return;
case R_PPC64_JMP_IREL:
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = resolve_ifunc (value, map, sym_map);
/* Fall thru */
case R_PPC64_JMP_SLOT:
diff --git a/sysdeps/pthread/aio_notify.c b/sysdeps/pthread/aio_notify.c
index 302f1a785b..2202572973 100644
--- a/sysdeps/pthread/aio_notify.c
+++ b/sysdeps/pthread/aio_notify.c
@@ -57,7 +57,7 @@ __aio_notify_only (struct sigevent *sigev)
int result = 0;
/* Send the signal to notify about finished processing of the request. */
- if (__builtin_expect (sigev->sigev_notify == SIGEV_THREAD, 0))
+ if (__glibc_unlikely (sigev->sigev_notify == SIGEV_THREAD))
{
/* We have to start a thread. */
pthread_t tid;
diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c
index b8f8a5b22a..e7b43ba5ac 100644
--- a/sysdeps/pthread/aio_suspend.c
+++ b/sysdeps/pthread/aio_suspend.c
@@ -110,7 +110,7 @@ aio_suspend (list, nent, timeout)
int nent;
const struct timespec *timeout;
{
- if (__builtin_expect (nent < 0, 0))
+ if (__glibc_unlikely (nent < 0))
{
__set_errno (EINVAL);
return -1;
@@ -229,7 +229,7 @@ aio_suspend (list, nent, timeout)
#ifndef DONT_NEED_AIO_MISC_COND
/* Release the conditional variable. */
- if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0))
+ if (__glibc_unlikely (pthread_cond_destroy (&cond) != 0))
/* This must never happen. */
abort ();
#endif
diff --git a/sysdeps/s390/dl-irel.h b/sysdeps/s390/dl-irel.h
index 82d5e4c4a1..401ee1c0c2 100644
--- a/sysdeps/s390/dl-irel.h
+++ b/sysdeps/s390/dl-irel.h
@@ -40,7 +40,7 @@ elf_irela (const ElfW(Rela) *reloc)
ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
- if (__builtin_expect (r_type == R_390_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_390_IRELATIVE))
{
ElfW(Addr) value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 928581ed49..4fd2745801 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -114,7 +114,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
to intercept the calls to collect information. In this case we
don't store the address in the GOT so that all future calls also
end in this function. */
- if (__builtin_expect (profile, 0))
+ if (__glibc_unlikely (profile))
{
got[2] = (Elf32_Addr) &_dl_runtime_profile;
@@ -277,7 +277,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_390_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_390_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -295,7 +295,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
else
#endif
- if (__builtin_expect (r_type == R_390_NONE, 0))
+ if (__glibc_unlikely (r_type == R_390_NONE))
return;
else
{
@@ -316,7 +316,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
{
case R_390_IRELATIVE:
value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = elf_ifunc_invoke (value);
*reloc_addr = value;
break;
@@ -448,7 +448,7 @@ elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
/* Check for unexpected PLT reloc type. */
- if (__builtin_expect (r_type == R_390_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_390_JMP_SLOT))
{
if (__builtin_expect (map->l_mach.plt, 0) == 0)
*reloc_addr += l_addr;
@@ -457,10 +457,10 @@ elf_machine_lazy_rel (struct link_map *map,
map->l_mach.plt
+ (((Elf32_Addr) reloc_addr) - map->l_mach.gotplt) * 8;
}
- else if (__builtin_expect (r_type == R_390_IRELATIVE, 1))
+ else if (__glibc_likely (r_type == R_390_IRELATIVE))
{
Elf32_Addr value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = elf_ifunc_invoke (value);
*reloc_addr = value;
}
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index e919223c6a..2f3716987c 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -103,7 +103,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
to intercept the calls to collect information. In this case we
don't store the address in the GOT so that all future calls also
end in this function. */
- if (__builtin_expect (profile, 0))
+ if (__glibc_unlikely (profile))
{
got[2] = (Elf64_Addr) &_dl_runtime_profile;
@@ -255,7 +255,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_390_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_390_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -273,7 +273,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
}
else
#endif
- if (__builtin_expect (r_type == R_390_NONE, 0))
+ if (__glibc_unlikely (r_type == R_390_NONE))
return;
else
{
@@ -294,7 +294,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
{
case R_390_IRELATIVE:
value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = elf_ifunc_invoke (value);
*reloc_addr = value;
break;
@@ -432,7 +432,7 @@ elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
/* Check for unexpected PLT reloc type. */
- if (__builtin_expect (r_type == R_390_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_390_JMP_SLOT))
{
if (__builtin_expect (map->l_mach.plt, 0) == 0)
*reloc_addr += l_addr;
@@ -441,10 +441,10 @@ elf_machine_lazy_rel (struct link_map *map,
map->l_mach.plt
+ (((Elf64_Addr) reloc_addr) - map->l_mach.gotplt) * 4;
}
- else if (__builtin_expect (r_type == R_390_IRELATIVE, 1))
+ else if (__glibc_likely (r_type == R_390_IRELATIVE))
{
Elf64_Addr value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = elf_ifunc_invoke (value);
*reloc_addr = value;
}
diff --git a/sysdeps/s390/s390-64/utf16-utf32-z9.c b/sysdeps/s390/s390-64/utf16-utf32-z9.c
index f7d9e07957..11a098fa99 100644
--- a/sysdeps/s390/s390-64/utf16-utf32-z9.c
+++ b/sysdeps/s390/s390-64/utf16-utf32-z9.c
@@ -54,7 +54,7 @@
if (dir == to_utf16) \
{ \
/* Emit the UTF-16 Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 2 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 2 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put16u (outbuf, BOM_UTF16); \
@@ -63,7 +63,7 @@
else \
{ \
/* Emit the UTF-32 Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 4 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 4 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put32u (outbuf, BOM_UTF32); \
@@ -236,13 +236,13 @@ gconv_end (struct __gconv_step *data)
{ \
/* An isolated low-surrogate was found. This has to be \
considered ill-formed. */ \
- if (__builtin_expect (u1 >= 0xdc00, 0)) \
+ if (__glibc_unlikely (u1 >= 0xdc00)) \
{ \
STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
/* It's a surrogate character. At least the first word says \
it is. */ \
- if (__builtin_expect (inptr + 4 > inend, 0)) \
+ if (__glibc_unlikely (inptr + 4 > inend)) \
{ \
/* We don't have enough input for another complete input \
character. */ \
@@ -306,7 +306,7 @@ gconv_end (struct __gconv_step *data)
uint16_t out; \
\
/* Generate a surrogate character. */ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/sysdeps/s390/s390-64/utf8-utf16-z9.c b/sysdeps/s390/s390-64/utf8-utf16-z9.c
index 863677455c..74754211c1 100644
--- a/sysdeps/s390/s390-64/utf8-utf16-z9.c
+++ b/sysdeps/s390/s390-64/utf8-utf16-z9.c
@@ -50,7 +50,7 @@
&& data->__invocation_counter == 0) \
{ \
/* Emit the UTF-16 Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 2 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 2 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put16u (outbuf, BOM_UTF16); \
@@ -197,7 +197,7 @@ gconv_end (struct __gconv_step *data)
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -210,7 +210,7 @@ gconv_end (struct __gconv_step *data)
/* Next input byte. */ \
uint16_t ch = *inptr; \
\
- if (__builtin_expect (ch < 0x80, 1)) \
+ if (__glibc_likely (ch < 0x80)) \
{ \
/* One byte sequence. */ \
++inptr; \
@@ -228,13 +228,13 @@ gconv_end (struct __gconv_step *data)
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
@@ -255,7 +255,7 @@ gconv_end (struct __gconv_step *data)
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
- if (__builtin_expect (inptr + cnt > inend, 0)) \
+ if (__glibc_unlikely (inptr + cnt > inend)) \
{ \
/* We don't have enough input. But before we report \
that check that all the bytes are correct. */ \
@@ -263,7 +263,7 @@ gconv_end (struct __gconv_step *data)
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -278,7 +278,7 @@ gconv_end (struct __gconv_step *data)
low) are needed. */ \
uint16_t zabcd, high, low; \
\
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -368,7 +368,7 @@ gconv_end (struct __gconv_step *data)
\
uint16_t c = get16 (inptr); \
\
- if (__builtin_expect (c <= 0x007f, 1)) \
+ if (__glibc_likely (c <= 0x007f)) \
{ \
/* Single byte UTF-8 char. */ \
*outptr = c & 0xff; \
@@ -378,7 +378,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* Two byte UTF-8 char. */ \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -397,7 +397,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* Three byte UTF-8 char. */ \
\
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -419,14 +419,14 @@ gconv_end (struct __gconv_step *data)
/* Four byte UTF-8 char. */ \
uint16_t low, uvwxy; \
\
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
inptr += 2; \
- if (__builtin_expect (inptr + 2 > inend, 0)) \
+ if (__glibc_unlikely (inptr + 2 > inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
diff --git a/sysdeps/s390/s390-64/utf8-utf32-z9.c b/sysdeps/s390/s390-64/utf8-utf32-z9.c
index 5120837037..cb74f34075 100644
--- a/sysdeps/s390/s390-64/utf8-utf32-z9.c
+++ b/sysdeps/s390/s390-64/utf8-utf32-z9.c
@@ -52,7 +52,7 @@
&& data->__invocation_counter == 0) \
{ \
/* Emit the Byte Order Mark. */ \
- if (__builtin_expect (outbuf + 4 > outend, 0)) \
+ if (__glibc_unlikely (outbuf + 4 > outend)) \
return __GCONV_FULL_OUTPUT; \
\
put32u (outbuf, BOM); \
@@ -201,7 +201,7 @@ gconv_end (struct __gconv_step *data)
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -214,7 +214,7 @@ gconv_end (struct __gconv_step *data)
/* Next input byte. */ \
uint32_t ch = *inptr; \
\
- if (__builtin_expect (ch < 0x80, 1)) \
+ if (__glibc_likely (ch < 0x80)) \
{ \
/* One byte sequence. */ \
++inptr; \
@@ -232,25 +232,25 @@ gconv_end (struct __gconv_step *data)
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
ch &= 0x03; \
} \
- else if (__builtin_expect ((ch & 0xfe) == 0xfc, 1)) \
+ else if (__glibc_likely ((ch & 0xfe) == 0xfc)) \
{ \
/* We expect six bytes. */ \
cnt = 6; \
@@ -271,7 +271,7 @@ gconv_end (struct __gconv_step *data)
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
- if (__builtin_expect (inptr + cnt > inend, 0)) \
+ if (__glibc_unlikely (inptr + cnt > inend)) \
{ \
/* We don't have enough input. But before we report \
that check that all the bytes are correct. */ \
@@ -279,7 +279,7 @@ gconv_end (struct __gconv_step *data)
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -338,19 +338,19 @@ gconv_end (struct __gconv_step *data)
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
@@ -431,7 +431,7 @@ gconv_end (struct __gconv_step *data)
\
uint32_t wc = *((const uint32_t *) inptr); \
\
- if (__builtin_expect (wc <= 0x7f, 1)) \
+ if (__glibc_likely (wc <= 0x7f)) \
{ \
/* Single UTF-8 char. */ \
*outptr = (uint8_t)wc; \
@@ -440,7 +440,7 @@ gconv_end (struct __gconv_step *data)
else if (wc <= 0x7ff) \
{ \
/* Two UTF-8 chars. */ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -458,7 +458,7 @@ gconv_end (struct __gconv_step *data)
else if (wc <= 0xffff) \
{ \
/* Three UTF-8 chars. */ \
- if (__builtin_expect (outptr + 3 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 3 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -478,7 +478,7 @@ gconv_end (struct __gconv_step *data)
else if (wc <= 0x10ffff) \
{ \
/* Four UTF-8 chars. */ \
- if (__builtin_expect (outptr + 4 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 4 > outend)) \
{ \
/* Overflow in the output buffer. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 5e5fd6cc79..4f3db89ed3 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -291,7 +291,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
} \
}
- if (__builtin_expect (r_type == R_SH_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_SH_RELATIVE))
{
#ifndef RTLD_BOOTSTRAP
if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
@@ -310,7 +310,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
}
#ifndef RTLD_BOOTSTRAP
- else if (__builtin_expect (r_type == R_SH_NONE, 0))
+ else if (__glibc_unlikely (r_type == R_SH_NONE))
return;
#endif
else
diff --git a/sysdeps/sparc/sparc32/dl-irel.h b/sysdeps/sparc/sparc32/dl-irel.h
index 03441ec4a5..5b61e0a24e 100644
--- a/sysdeps/sparc/sparc32/dl-irel.h
+++ b/sysdeps/sparc/sparc32/dl-irel.h
@@ -40,13 +40,13 @@ elf_irela (const Elf32_Rela *reloc)
{
unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_SPARC_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_SPARC_IRELATIVE))
{
Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
}
- else if (__builtin_expect (r_type == R_SPARC_JMP_IREL, 1))
+ else if (__glibc_likely (r_type == R_SPARC_JMP_IREL))
{
Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend);
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 91b125dd7a..e7d31b40b6 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -350,17 +350,17 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
weak_extern (_dl_rtld_map);
#endif
- if (__builtin_expect (r_type == R_SPARC_NONE, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_NONE))
return;
- if (__builtin_expect (r_type == R_SPARC_SIZE32, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_SIZE32))
{
*reloc_addr = sym->st_size + reloc->r_addend;
return;
}
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
if (map != &_dl_rtld_map) /* Already done in rtld itself. */
@@ -549,12 +549,12 @@ elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_SPARC_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_SPARC_JMP_SLOT))
;
else if (r_type == R_SPARC_JMP_IREL)
{
Elf32_Addr value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap));
sparc_fixup_plt (reloc, reloc_addr, value, 1, 1);
}
diff --git a/sysdeps/sparc/sparc64/dl-irel.h b/sysdeps/sparc/sparc64/dl-irel.h
index 85b36cd066..9aae20a40d 100644
--- a/sysdeps/sparc/sparc64/dl-irel.h
+++ b/sysdeps/sparc/sparc64/dl-irel.h
@@ -40,13 +40,13 @@ elf_irela (const Elf64_Rela *reloc)
{
unsigned int r_type = (reloc->r_info & 0xff);
- if (__builtin_expect (r_type == R_SPARC_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_SPARC_IRELATIVE))
{
Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
}
- else if (__builtin_expect (r_type == R_SPARC_JMP_IREL, 1))
+ else if (__glibc_likely (r_type == R_SPARC_JMP_IREL))
{
Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index b285402257..ef4ad4ce9e 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -377,17 +377,17 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
weak_extern (_dl_rtld_map);
#endif
- if (__builtin_expect (r_type == R_SPARC_NONE, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_NONE))
return;
- if (__builtin_expect (r_type == R_SPARC_SIZE64, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_SIZE64))
{
*reloc_addr = sym->st_size + reloc->r_addend;
return;
}
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_SPARC_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
if (map != &_dl_rtld_map) /* Already done in rtld itself. */
@@ -652,13 +652,13 @@ elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
- if (__builtin_expect (r_type == R_SPARC_JMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_SPARC_JMP_SLOT))
;
else if (r_type == R_SPARC_JMP_IREL
|| r_type == R_SPARC_IRELATIVE)
{
Elf64_Addr value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = ((Elf64_Addr (*) (int)) value) (GLRO(dl_hwcap));
if (r_type == R_SPARC_JMP_IREL)
{
diff --git a/sysdeps/sparc/sparc64/dl-plt.h b/sysdeps/sparc/sparc64/dl-plt.h
index be1927b303..82bc18601d 100644
--- a/sysdeps/sparc/sparc64/dl-plt.h
+++ b/sysdeps/sparc/sparc64/dl-plt.h
@@ -115,7 +115,7 @@ sparc64_fixup_plt (struct link_map *map, const Elf64_Rela *reloc,
/* ??? Some tricks can be stolen from the sparc64 egcs backend
constant formation code I wrote. -DaveM */
- if (__builtin_expect (high32 & 0x3ff, 0))
+ if (__glibc_unlikely (high32 & 0x3ff))
{
/* sethi %hh(value), %g1
sethi %lm(value), %g5
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 4a1e5b61c6..d4ca697444 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -41,14 +41,14 @@ hp_timing_gettime (clockid_t clock_id, struct timespec *tp)
{
hp_timing_t tsc;
- if (__builtin_expect (freq == 0, 0))
+ if (__glibc_unlikely (freq == 0))
{
/* This can only happen if we haven't initialized the `freq'
variable yet. Do this now. We don't have to protect this
code against multiple execution since all of them should
lead to the same result. */
freq = __get_clockfreq ();
- if (__builtin_expect (freq == 0, 0))
+ if (__glibc_unlikely (freq == 0))
/* Something went wrong. */
return -1;
}
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index f3c67ef8c9..7ce6dfc1f2 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -43,14 +43,14 @@ hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
/* First thing is to get the current time. */
HP_TIMING_NOW (tsc);
- if (__builtin_expect (freq == 0, 0))
+ if (__glibc_unlikely (freq == 0))
{
/* This can only happen if we haven't initialized the `freq'
variable yet. Do this now. We don't have to protect this
code against multiple execution since all of them should lead
to the same result. */
freq = __get_clockfreq ();
- if (__builtin_expect (freq == 0, 0))
+ if (__glibc_unlikely (freq == 0))
/* Something went wrong. */
return -1;
}
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 602dfb623a..c4f067f036 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -108,7 +108,7 @@ grantpt (int fd)
char *buf = _buf;
struct stat64 st;
- if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf), &st), 0))
+ if (__glibc_unlikely (pts_name (fd, &buf, sizeof (_buf), &st)))
{
int save_errno = errno;
@@ -136,7 +136,7 @@ grantpt (int fd)
}
static int tty_gid = -1;
- if (__builtin_expect (tty_gid == -1, 0))
+ if (__glibc_unlikely (tty_gid == -1))
{
char *grtmpbuf;
struct group grbuf;
diff --git a/sysdeps/unix/sysv/linux/accept4.c b/sysdeps/unix/sysv/linux/accept4.c
index 0e2113434a..019e96b677 100644
--- a/sysdeps/unix/sysv/linux/accept4.c
+++ b/sysdeps/unix/sysv/linux/accept4.c
@@ -52,7 +52,7 @@ static int have_accept4;
int
accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
{
- if (__builtin_expect (have_accept4 >= 0, 1))
+ if (__glibc_likely (have_accept4 >= 0))
{
int ret = __internal_accept4 (fd, addr, addr_len, flags);
/* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
index 45d4680645..be49911eeb 100644
--- a/sysdeps/unix/sysv/linux/adjtime.c
+++ b/sysdeps/unix/sysv/linux/adjtime.c
@@ -83,7 +83,7 @@ ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv)
#if defined ADJ_OFFSET_SS_READ && !defined __ASSUME_ADJ_OFFSET_SS_READ
again:
#endif
- if (__builtin_expect (ADJTIMEX (&tntx) < 0, 0))
+ if (__glibc_unlikely (ADJTIMEX (&tntx) < 0))
{
#if defined ADJ_OFFSET_SS_READ && !defined __ASSUME_ADJ_OFFSET_SS_READ
if (itv && errno == EINVAL && tntx.modes == ADJ_OFFSET_SS_READ)
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index dd333b4a94..5c8e75affc 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -331,7 +331,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
{
int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
- if (__builtin_expect (fd >= 0, 1))
+ if (__glibc_likely (fd >= 0))
{
struct sockaddr_nl nladdr;
memset (&nladdr, '\0', sizeof (nladdr));
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 6608e6adb3..af1343822f 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -33,7 +33,7 @@
if the library is not compiled to run on all kernels. */ \
\
int version = _dl_discover_osversion (); \
- if (__builtin_expect (version >= 0, 1)) \
+ if (__glibc_likely (version >= 0)) \
{ \
if (__builtin_expect (GLRO(dl_osversion) == 0, 1) \
|| GLRO(dl_osversion) > version) \
@@ -58,7 +58,7 @@ _dl_setup_stack_chk_guard (void *dl_random)
} ret;
#ifndef __ASSUME_AT_RANDOM
- if (__builtin_expect (dl_random == NULL, 0))
+ if (__glibc_unlikely (dl_random == NULL))
{
const size_t filllen = sizeof (ret.bytes) - 1;
ret.num = 0;
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 06abac278d..c00f431a45 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -71,7 +71,7 @@ faccessat (fd, file, mode, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -102,7 +102,7 @@ faccessat (fd, file, mode, flag)
# endif
result = INTERNAL_SYSCALL (access, err, 2, file, mode);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index 803988d88c..4d3e43e371 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -70,7 +70,7 @@ fchmodat (fd, file, mode, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -100,7 +100,7 @@ fchmodat (fd, file, mode, flag)
# endif
result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index b0329cd2c2..196b8005c3 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -65,7 +65,7 @@ fchownat (fd, file, owner, group, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -93,7 +93,7 @@ fchownat (fd, file, owner, group, flag)
else
result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index ce7290e0f3..89ea20b121 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -75,7 +75,7 @@ futimesat (fd, file, tvp)
else if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -100,7 +100,7 @@ futimesat (fd, file, tvp)
# ifdef __NR_utimes
result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
return result;
# ifndef __ASSUME_UTIMES
@@ -126,7 +126,7 @@ futimesat (fd, file, tvp)
times = NULL;
result = INTERNAL_SYSCALL (utime, err, 2, file, times);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
return result;
fail:
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 9acbf36a9b..1ec0922350 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -84,7 +84,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -114,7 +114,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
result = INTERNAL_SYSCALL (stat, err, 2, file,
(struct kernel_stat *) st);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
return result;
}
#ifdef STAT_IS_KERNEL_STAT
@@ -129,7 +129,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
else
result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
return __xstat_conv (vers, &kst, st);
#endif
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index b6195c877a..24bd51bf46 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -33,7 +33,7 @@
int
__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
{
- if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
+ if (__glibc_unlikely (vers != _STAT_VER_LINUX))
{
__set_errno (EINVAL);
return -1;
@@ -76,7 +76,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -101,7 +101,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
else
result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
{
# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
if (st->__st_ino != (__ino_t) st->st_ino)
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c
index 00fc6f3b76..3a4299ee29 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate.c
@@ -40,7 +40,7 @@ fallocate (int fd, int mode, __off_t offset, __off_t len)
LIBC_CANCEL_RESET (oldtype);
}
- if (__builtin_expect (err, 0))
+ if (__glibc_unlikely (err))
{
__set_errno (err);
err = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index 14c304877d..d69021b633 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -40,7 +40,7 @@ fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
LIBC_CANCEL_RESET (oldtype);
}
- if (__builtin_expect (err, 0))
+ if (__glibc_unlikely (err))
{
__set_errno (err);
err = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
index 7726bb6f72..5c2359c8b5 100644
--- a/sysdeps/unix/sysv/linux/i386/fchownat.c
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.c
@@ -61,7 +61,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -89,7 +89,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
else
result = INTERNAL_SYSCALL (chown32, err, 3, file, owner, group);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index 4180947dca..8fdbbb81f5 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -66,7 +66,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
#endif
#ifndef __ASSUME_ATFCTS
- if (__builtin_expect (flag & ~AT_SYMLINK_NOFOLLOW, 0))
+ if (__glibc_unlikely (flag & ~AT_SYMLINK_NOFOLLOW))
{
__set_errno (EINVAL);
return -1;
@@ -77,7 +77,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -113,11 +113,11 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
result = INTERNAL_SYSCALL (lstat64, err, 2, file, &st64);
else
result = INTERNAL_SYSCALL (stat64, err, 2, file, &st64);
- if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
return __xstat32_conv (vers, &st64, st);
out:
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
index 9555c26580..024d4d0108 100644
--- a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
+++ b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
@@ -40,7 +40,7 @@ __get_clockfreq (void)
return result;
fd = __open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
to a size of 4096 bytes. */
@@ -52,7 +52,7 @@ __get_clockfreq (void)
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
int seen_decpoint = 0;
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fallocate.c b/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
index bcadf8ddfb..f532898e5b 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
@@ -36,7 +36,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (__have_fallocate >= 0, 1))
+ if (__glibc_likely (__have_fallocate >= 0))
# endif
{
int res = __call_fallocate (fd, 0, offset, len);
@@ -44,7 +44,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
return 0;
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (res == ENOSYS, 0))
+ if (__glibc_unlikely (res == ENOSYS))
__have_fallocate = -1;
else
# endif
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c b/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
index 4fa61e8110..1aa1fcf316 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
@@ -38,7 +38,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (__have_fallocate >= 0, 1))
+ if (__glibc_likely (__have_fallocate >= 0))
# endif
{
int res = __call_fallocate (fd, 0, offset, len);
@@ -47,7 +47,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
return 0;
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (res == ENOSYS, 0))
+ if (__glibc_unlikely (res == ENOSYS))
__have_fallocate = -1;
else
# endif
diff --git a/sysdeps/unix/sysv/linux/i386/scandir64.c b/sysdeps/unix/sysv/linux/i386/scandir64.c
index 90abe32a2b..2782eeb04e 100644
--- a/sysdeps/unix/sysv/linux/i386/scandir64.c
+++ b/sysdeps/unix/sysv/linux/i386/scandir64.c
@@ -85,7 +85,7 @@ __old_scandir64 (dir, namelist, select, cmp)
/* Ignore errors from select or readdir */
__set_errno (0);
- if (__builtin_expect (c.cnt == vsize, 0))
+ if (__glibc_unlikely (c.cnt == vsize))
{
struct __old_dirent64 **new;
if (vsize == 0)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 01888e9ce4..54f87c9f71 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -310,7 +310,7 @@ asm (".L__X'%ebx = 1\n\t"
#define INLINE_SYSCALL(name, nr, args...) \
({ \
unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
resultvar = 0xffffffff; \
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 7b8867100f..d83e8f8e84 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -175,7 +175,7 @@ __netlink_request (struct netlink_handle *h, int type)
if (nladdr.nl_pid != 0)
continue;
- if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+ if (__glibc_unlikely (msg.msg_flags & MSG_TRUNC))
goto out_fail;
size_t count = 0;
@@ -459,7 +459,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
kernel. */
ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
map_newlink_data, newlink);
- if (__builtin_expect (ifa_index == -1, 0))
+ if (__glibc_unlikely (ifa_index == -1))
{
try_again:
result = -EAGAIN;
@@ -552,7 +552,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
ifa_index = newlink + newaddr_idx;
int idx = map_newlink (ifam->ifa_index - 1, ifas,
map_newlink_data, newlink);
- if (__builtin_expect (idx == -1, 0))
+ if (__glibc_unlikely (idx == -1))
goto try_again;
ifas[ifa_index].ifa.ifa_flags = ifas[idx].ifa.ifa_flags;
if (ifa_index > 0)
@@ -737,7 +737,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
{
int idx = map_newlink (ifam->ifa_index - 1, ifas,
map_newlink_data, newlink);
- if (__builtin_expect (idx == -1, 0))
+ if (__glibc_unlikely (idx == -1))
goto try_again;
ifas[ifa_index].ifa.ifa_name = ifas[idx].ifa.ifa_name;
}
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index ad09be64b3..29cefb8192 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -65,7 +65,7 @@ linkat (fromfd, from, tofd, to, flags)
if (fromfd != AT_FDCWD && from[0] != '/')
{
size_t filelen = strlen (from);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -108,7 +108,7 @@ linkat (fromfd, from, tofd, to, flags)
result = INTERNAL_SYSCALL (link, err, 2, from, to);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), tofd, bufto,
fromfd, buffrom);
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 72d69c58f3..77099f3533 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -56,7 +56,7 @@ mkdirat (fd, file, mode)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -80,7 +80,7 @@ mkdirat (fd, file, mode)
INTERNAL_SYSCALL_DECL (err);
res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
res = -1;
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index e16e4184fd..c5f12d8a7b 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -36,7 +36,7 @@ mq_unlink (const char *name)
/* While unlink can return either EPERM or EACCES, mq_unlink should
return just EACCES. */
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (ret, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err)))
{
ret = INTERNAL_SYSCALL_ERRNO (ret, err);
if (ret == EPERM)
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 9bb8acec1f..2cf233b8de 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -108,7 +108,7 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -132,7 +132,7 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
res = -1;
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c
index 477f9f8574..cb75ffc1fa 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate.c
@@ -34,7 +34,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (__have_fallocate >= 0, 1))
+ if (__glibc_likely (__have_fallocate >= 0))
# endif
{
INTERNAL_SYSCALL_DECL (err);
@@ -46,7 +46,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
return 0;
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
__have_fallocate = -1;
else
# endif
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c
index 73983aed5b..4f5881b96c 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate64.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c
@@ -36,7 +36,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (__have_fallocate >= 0, 1))
+ if (__glibc_likely (__have_fallocate >= 0))
# endif
{
INTERNAL_SYSCALL_DECL (err);
@@ -50,7 +50,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
return 0;
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
__have_fallocate = -1;
else
# endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
index 61e0a4dc56..4e3767a6a0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/fchownat.c
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
@@ -65,7 +65,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -93,7 +93,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
else
result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
return -1;
diff --git a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
index 0a6aa81fb0..8b37943863 100644
--- a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
+++ b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -49,7 +49,7 @@ __get_clockfreq (void)
{
int fd = __open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* The timebase will be in the 1st 1024 bytes for systems with up
to 8 processors. If the first read returns less then 1024
@@ -87,7 +87,7 @@ __get_clockfreq (void)
{
char *mhz = memmem (buf, n, "timebase", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 8fbbd414ac..7d096d3c36 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -58,7 +58,7 @@ readlinkat (fd, path, buf, len)
if (fd != AT_FDCWD && path[0] != '/')
{
size_t pathlen = strlen (path);
- if (__builtin_expect (pathlen == 0, 0))
+ if (__glibc_unlikely (pathlen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -83,7 +83,7 @@ readlinkat (fd, path, buf, len)
result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c
index bcb9a6cf5c..04ff42ee72 100644
--- a/sysdeps/unix/sysv/linux/recvmmsg.c
+++ b/sysdeps/unix/sysv/linux/recvmmsg.c
@@ -53,7 +53,7 @@ int
recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
const struct timespec *tmo)
{
- if (__builtin_expect (have_recvmmsg >= 0, 1))
+ if (__glibc_likely (have_recvmmsg >= 0))
{
int ret = __internal_recvmmsg (fd, vmessages, vlen, flags, tmo);
/* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 8addae2d57..dbc4c75c01 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -134,7 +134,7 @@ renameat (oldfd, old, newfd, new)
if (oldfd != AT_FDCWD && old[0] != '/')
{
size_t filelen = strlen (old);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -159,7 +159,7 @@ renameat (oldfd, old, newfd, new)
if (newfd != AT_FDCWD && new[0] != '/')
{
size_t filelen = strlen (new);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -183,7 +183,7 @@ renameat (oldfd, old, newfd, new)
result = INTERNAL_SYSCALL (rename, err, 2, old, new);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), newfd, bufnew,
oldfd, bufold);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index fa7c8c50e5..1c6191b261 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -182,7 +182,7 @@
#define INLINE_SYSCALL(name, nr, args...) \
({ \
unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
_ret = 0xffffffff; \
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 020cd9ad45..91fc275585 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -188,7 +188,7 @@
#define INLINE_SYSCALL(name, nr, args...) \
({ \
long _ret = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
_ret = -1; \
diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
index 77345338ef..1f8ebba9fc 100644
--- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
@@ -32,7 +32,7 @@ static size_t __kernel_cpumask_size;
int
__sched_setaffinity_new (pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
{
- if (__builtin_expect (__kernel_cpumask_size == 0, 0))
+ if (__glibc_unlikely (__kernel_cpumask_size == 0))
{
INTERNAL_SYSCALL_DECL (err);
int res;
diff --git a/sysdeps/unix/sysv/linux/sendmmsg.c b/sysdeps/unix/sysv/linux/sendmmsg.c
index 598ff40d75..f8494be044 100644
--- a/sysdeps/unix/sysv/linux/sendmmsg.c
+++ b/sysdeps/unix/sysv/linux/sendmmsg.c
@@ -52,7 +52,7 @@ static int have_sendmmsg;
int
__sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
{
- if (__builtin_expect (have_sendmmsg >= 0, 1))
+ if (__glibc_likely (have_sendmmsg >= 0))
{
int ret = __internal_sendmmsg (fd, vmessages, vlen, flags);
/* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index fef8fd531a..cec6fdbd0c 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -75,10 +75,10 @@ where_is_shmfs (void)
/* OK, do it the hard way. Look through the /proc/mounts file and if
this does not exist through /etc/fstab to find the mount point. */
fp = __setmntent ("/proc/mounts", "r");
- if (__builtin_expect (fp == NULL, 0))
+ if (__glibc_unlikely (fp == NULL))
{
fp = __setmntent (_PATH_MNTTAB, "r");
- if (__builtin_expect (fp == NULL, 0))
+ if (__glibc_unlikely (fp == NULL))
/* There is nothing we can do. Blind guesses are not helpful. */
return;
}
@@ -208,7 +208,7 @@ shm_open (const char *name, int oflag, mode_t mode)
}
#endif
}
- else if (__builtin_expect (errno == EISDIR, 0))
+ else if (__glibc_unlikely (errno == EISDIR))
/* It might be better to fold this error with EINVAL since
directory names are just another example for unsuitable shared
object names and the standard does not mention EISDIR. */
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index 46b731e0a7..3b352c68bc 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -47,7 +47,7 @@ __sleep (unsigned int seconds)
unsigned int result;
/* This is not necessary but some buggy programs depend on this. */
- if (__builtin_expect (seconds == 0, 0))
+ if (__glibc_unlikely (seconds == 0))
{
#ifdef CANCELLATION_P
CANCELLATION_P (THREAD_SELF);
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index ae9bb359ad..0c5ed3f5f9 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -56,7 +56,7 @@ symlinkat (from, tofd, to)
if (tofd != AT_FDCWD && to[0] != '/')
{
size_t tolen = strlen (to);
- if (__builtin_expect (tolen == 0, 0))
+ if (__glibc_unlikely (tolen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -81,7 +81,7 @@ symlinkat (from, tofd, to)
result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), tofd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index a739100e37..d759f7a417 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -39,7 +39,7 @@ __tcgetattr (fd, termios_p)
retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
- if (__builtin_expect (retval == 0, 1))
+ if (__glibc_likely (retval == 0))
{
termios_p->c_iflag = k_termios.c_iflag;
termios_p->c_oflag = k_termios.c_oflag;
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 8d808ce373..d257d25977 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -127,7 +127,7 @@ ttyname (int fd)
/* isatty check, tcgetattr is used because it sets the correct
errno (EBADF resp. ENOTTY) on error. */
- if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+ if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
return NULL;
if (__fxstat64 (_STAT_VER, fd, &st) < 0)
@@ -148,7 +148,7 @@ ttyname (int fd)
}
ssize_t len = __readlink (procname, ttyname_buf, buflen);
- if (__builtin_expect (len != -1, 1))
+ if (__glibc_likely (len != -1))
{
if ((size_t) len >= buflen)
return NULL;
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index a03d012f8d..6ce85db33b 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
/* isatty check, tcgetattr is used because it sets the correct
errno (EBADF resp. ENOTTY) on error. */
struct termios term;
- if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+ if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
return errno;
if (__fxstat64 (_STAT_VER, fd, &st) < 0)
@@ -128,13 +128,13 @@ __ttyname_r (int fd, char *buf, size_t buflen)
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
ssize_t ret = __readlink (procname, buf, buflen - 1);
- if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
+ if (__glibc_unlikely (ret == -1 && errno == ENAMETOOLONG))
{
__set_errno (ERANGE);
return ERANGE;
}
- if (__builtin_expect (ret != -1, 1))
+ if (__glibc_likely (ret != -1))
{
#define UNREACHABLE_LEN strlen ("(unreachable)")
if (ret > UNREACHABLE_LEN
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 0925d85800..6366c867e1 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -63,7 +63,7 @@ unlinkat (fd, file, flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -91,7 +91,7 @@ unlinkat (fd, file, flag)
else
result = INTERNAL_SYSCALL (unlink, err, 1, file);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
result = -1;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index 29f0e540d1..5aec8af39c 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -70,7 +70,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
@@ -98,7 +98,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
else
res = INTERNAL_SYSCALL (stat, err, 2, file, st);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
res = -1;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
index 8f3b521ed7..84e42a1f0a 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
@@ -34,7 +34,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (__have_fallocate >= 0, 1))
+ if (__glibc_likely (__have_fallocate >= 0))
# endif
{
INTERNAL_SYSCALL_DECL (err);
@@ -50,7 +50,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
return 0;
# ifndef __ASSUME_FALLOCATE
- if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
__have_fallocate = -1;
else
# endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 4a9a9d90bc..f52690feeb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -193,7 +193,7 @@
# define INLINE_SYSCALL(name, nr, args...) \
({ \
unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
resultvar = (unsigned long int) -1; \
@@ -207,7 +207,7 @@
# define INLINE_SYSCALL_TYPES(name, nr, args...) \
({ \
unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
resultvar = (unsigned long int) -1; \
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index 62e47e1eed..9e3643f71b 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -70,7 +70,7 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
- if (__builtin_expect (filelen == 0, 0))
+ if (__glibc_unlikely (filelen == 0))
{
__set_errno (ENOENT);
return -1;
diff --git a/sysdeps/x86_64/dl-irel.h b/sysdeps/x86_64/dl-irel.h
index 1249fe823f..f0f2f4b4e8 100644
--- a/sysdeps/x86_64/dl-irel.h
+++ b/sysdeps/x86_64/dl-irel.h
@@ -39,7 +39,7 @@ elf_irela (const ElfW(Rela) *reloc)
ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
- if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1))
+ if (__glibc_likely (r_type == R_X86_64_IRELATIVE))
{
ElfW(Addr) value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 504c95f320..8df04a96ca 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -92,7 +92,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
to intercept the calls to collect information. In this case we
don't store the address in the GOT so that all future calls also
end in this function. */
- if (__builtin_expect (profile, 0))
+ if (__glibc_unlikely (profile))
{
*(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
@@ -241,7 +241,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
# if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
- if (__builtin_expect (r_type == R_X86_64_RELATIVE, 0))
+ if (__glibc_unlikely (r_type == R_X86_64_RELATIVE))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -262,11 +262,11 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
# if !defined RTLD_BOOTSTRAP
/* l_addr + r_addend may be > 0xffffffff and R_X86_64_RELATIVE64
relocation updates the whole 64-bit entry. */
- if (__builtin_expect (r_type == R_X86_64_RELATIVE64, 0))
+ if (__glibc_unlikely (r_type == R_X86_64_RELATIVE64))
*(Elf64_Addr *) reloc_addr = (Elf64_Addr) map->l_addr + reloc->r_addend;
else
# endif
- if (__builtin_expect (r_type == R_X86_64_NONE, 0))
+ if (__glibc_unlikely (r_type == R_X86_64_NONE))
return;
else
{
@@ -419,7 +419,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
*(unsigned int *) reloc_addr = value;
const char *fmt;
- if (__builtin_expect (value > UINT_MAX, 0))
+ if (__glibc_unlikely (value > UINT_MAX))
{
const char *strtab;
@@ -438,7 +438,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
case R_X86_64_PC32:
value += reloc->r_addend - (ElfW(Addr)) reloc_addr;
*(unsigned int *) reloc_addr = value;
- if (__builtin_expect (value != (int) value, 0))
+ if (__glibc_unlikely (value != (int) value))
{
fmt = "\
%s: Symbol `%s' causes overflow in R_X86_64_PC32 relocation\n";
@@ -484,7 +484,7 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
#if !defined RTLD_BOOTSTRAP
/* l_addr + r_addend may be > 0xffffffff and R_X86_64_RELATIVE64
relocation updates the whole 64-bit entry. */
- if (__builtin_expect (ELFW(R_TYPE) (reloc->r_info) == R_X86_64_RELATIVE64, 0))
+ if (__glibc_unlikely (ELFW(R_TYPE) (reloc->r_info) == R_X86_64_RELATIVE64))
*(Elf64_Addr *) reloc_addr = (Elf64_Addr) l_addr + reloc->r_addend;
else
#endif
@@ -504,7 +504,7 @@ elf_machine_lazy_rel (struct link_map *map,
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
/* Check for unexpected PLT reloc type. */
- if (__builtin_expect (r_type == R_X86_64_JUMP_SLOT, 1))
+ if (__glibc_likely (r_type == R_X86_64_JUMP_SLOT))
{
if (__builtin_expect (map->l_mach.plt, 0) == 0)
*reloc_addr += l_addr;
@@ -513,7 +513,7 @@ elf_machine_lazy_rel (struct link_map *map,
map->l_mach.plt
+ (((ElfW(Addr)) reloc_addr) - map->l_mach.gotplt) * 2;
}
- else if (__builtin_expect (r_type == R_X86_64_TLSDESC, 1))
+ else if (__glibc_likely (r_type == R_X86_64_TLSDESC))
{
struct tlsdesc volatile * __attribute__((__unused__)) td =
(struct tlsdesc volatile *)reloc_addr;
@@ -522,10 +522,10 @@ elf_machine_lazy_rel (struct link_map *map,
td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+ map->l_addr);
}
- else if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 0))
+ else if (__glibc_unlikely (r_type == R_X86_64_IRELATIVE))
{
ElfW(Addr) value = map->l_addr + reloc->r_addend;
- if (__builtin_expect (!skip_ifunc, 1))
+ if (__glibc_likely (!skip_ifunc))
value = ((ElfW(Addr) (*) (void)) value) ();
*reloc_addr = value;
}
diff --git a/time/asctime.c b/time/asctime.c
index dfbafbff09..073cf84461 100644
--- a/time/asctime.c
+++ b/time/asctime.c
@@ -46,7 +46,7 @@ asctime_internal (const struct tm *tp, char *buf, size_t buflen)
this would mean the output needs more space. This would not be a
problem if the 'asctime_r' interface would be defined sanely and
a buffer size would be passed. */
- if (__builtin_expect (tp->tm_year > INT_MAX - 1900, 0))
+ if (__glibc_unlikely (tp->tm_year > INT_MAX - 1900))
{
eoverflow:
__set_errno (EOVERFLOW);
diff --git a/time/tzfile.c b/time/tzfile.c
index deef58ef34..52f0994815 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -232,7 +232,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
> (SIZE_MAX - total_size) / sizeof (struct ttinfo), 0))
goto lose;
total_size += num_types * sizeof (struct ttinfo);
- if (__builtin_expect (chars > SIZE_MAX - total_size, 0))
+ if (__glibc_unlikely (chars > SIZE_MAX - total_size))
goto lose;
total_size += chars;
if (__builtin_expect (__alignof__ (struct leap) - 1
@@ -261,16 +261,16 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|| tzspec_len < num_leaps * 12, 0))
goto lose;
tzspec_len -= num_leaps * 12;
- if (__builtin_expect (tzspec_len < num_isstd, 0))
+ if (__glibc_unlikely (tzspec_len < num_isstd))
goto lose;
tzspec_len -= num_isstd;
- if (__builtin_expect (tzspec_len == 0 || tzspec_len - 1 < num_isgmt, 0))
+ if (__glibc_unlikely (tzspec_len == 0 || tzspec_len - 1 < num_isgmt))
goto lose;
tzspec_len -= num_isgmt + 1;
- if (__builtin_expect (SIZE_MAX - total_size < tzspec_len, 0))
+ if (__glibc_unlikely (SIZE_MAX - total_size < tzspec_len))
goto lose;
}
- if (__builtin_expect (SIZE_MAX - total_size - tzspec_len < extra, 0))
+ if (__glibc_unlikely (SIZE_MAX - total_size - tzspec_len < extra))
goto lose;
/* Allocate enough memory including the extra block requested by the
@@ -310,7 +310,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
/* Check for bogus indices in the data file, so we can hereafter
safely use type_idxs[T] as indices into `types' and never crash. */
for (i = 0; i < num_transitions; ++i)
- if (__builtin_expect (type_idxs[i] >= num_types, 0))
+ if (__glibc_unlikely (type_idxs[i] >= num_types))
goto lose;
if ((BYTE_ORDER != BIG_ENDIAN && (sizeof (time_t) == 4 || trans_width == 4))
@@ -341,18 +341,18 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
0))
goto lose;
c = getc_unlocked (f);
- if (__builtin_expect ((unsigned int) c > 1u, 0))
+ if (__glibc_unlikely ((unsigned int) c > 1u))
goto lose;
types[i].isdst = c;
c = getc_unlocked (f);
- if (__builtin_expect ((size_t) c > chars, 0))
+ if (__glibc_unlikely ((size_t) c > chars))
/* Bogus index in data file. */
goto lose;
types[i].idx = c;
types[i].offset = (long int) decode (x);
}
- if (__builtin_expect (fread_unlocked (zone_names, 1, chars, f) != chars, 0))
+ if (__glibc_unlikely (fread_unlocked (zone_names, 1, chars, f) != chars))
goto lose;
for (i = 0; i < num_leaps; ++i)
@@ -366,7 +366,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
else
leaps[i].transition = (time_t) decode64 (x);
- if (__builtin_expect (fread_unlocked (x, 1, 4, f) != 4, 0))
+ if (__glibc_unlikely (fread_unlocked (x, 1, 4, f) != 4))
goto lose;
leaps[i].change = (long int) decode (x);
}
@@ -374,7 +374,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
for (i = 0; i < num_isstd; ++i)
{
int c = getc_unlocked (f);
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
goto lose;
types[i].isstd = c != 0;
}
@@ -384,7 +384,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
for (i = 0; i < num_isgmt; ++i)
{
int c = getc_unlocked (f);
- if (__builtin_expect (c == EOF, 0))
+ if (__glibc_unlikely (c == EOF))
goto lose;
types[i].isgmt = c != 0;
}
@@ -627,7 +627,7 @@ __tzfile_compute (time_t timer, int use_localtime,
__tzname[0] = NULL;
__tzname[1] = NULL;
- if (__builtin_expect (num_transitions == 0 || timer < transitions[0], 0))
+ if (__glibc_unlikely (num_transitions == 0 || timer < transitions[0]))
{
/* TIMER is before any transition (or there are no transitions).
Choose the first non-DST type
@@ -657,9 +657,9 @@ __tzfile_compute (time_t timer, int use_localtime,
++j;
}
}
- else if (__builtin_expect (timer >= transitions[num_transitions - 1], 0))
+ else if (__glibc_unlikely (timer >= transitions[num_transitions - 1]))
{
- if (__builtin_expect (tzspec == NULL, 0))
+ if (__glibc_unlikely (tzspec == NULL))
{
use_last:
i = num_transitions;
@@ -671,7 +671,7 @@ __tzfile_compute (time_t timer, int use_localtime,
/* Convert to broken down structure. If this fails do not
use the string. */
- if (__builtin_expect (! __offtime (&timer, 0, tp), 0))
+ if (__glibc_unlikely (! __offtime (&timer, 0, tp)))
goto use_last;
/* Use the rules from the TZ string to compute the change. */
@@ -680,7 +680,7 @@ __tzfile_compute (time_t timer, int use_localtime,
/* If tzspec comes from posixrules loaded by __tzfile_default,
override the STD and DST zone names with the ones user
requested in TZ envvar. */
- if (__builtin_expect (zone_names == (char *) &leaps[num_leaps], 0))
+ if (__glibc_unlikely (zone_names == (char *) &leaps[num_leaps]))
{
assert (num_types == 2);
__tzname[0] = __tzstring (zone_names);
@@ -762,7 +762,7 @@ __tzfile_compute (time_t timer, int use_localtime,
++j;
}
- if (__builtin_expect (__tzname[0] == NULL, 0))
+ if (__glibc_unlikely (__tzname[0] == NULL))
__tzname[0] = __tzname[1];
i = type_idxs[i - 1];
diff --git a/time/tzset.c b/time/tzset.c
index bfcd943436..77bfde9fb1 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -184,16 +184,16 @@ __tzset_parse_tz (tz)
{
/* Check for the quoted version. */
char *wp = tzbuf;
- if (__builtin_expect (*tz++ != '<', 0))
+ if (__glibc_unlikely (*tz++ != '<'))
goto out;
while (isalnum (*tz) || *tz == '+' || *tz == '-')
*wp++ = *tz++;
- if (__builtin_expect (*tz++ != '>' || wp - tzbuf < 3, 0))
+ if (__glibc_unlikely (*tz++ != '>' || wp - tzbuf < 3))
goto out;
*wp = '\0';
}
- else if (__builtin_expect (consumed < 3, 0))
+ else if (__glibc_unlikely (consumed < 3))
goto out;
else
tz += consumed;
@@ -232,19 +232,19 @@ __tzset_parse_tz (tz)
/* Check for the quoted version. */
char *wp = tzbuf;
const char *rp = tz;
- if (__builtin_expect (*rp++ != '<', 0))
+ if (__glibc_unlikely (*rp++ != '<'))
/* Punt on name, set up the offsets. */
goto done_names;
while (isalnum (*rp) || *rp == '+' || *rp == '-')
*wp++ = *rp++;
- if (__builtin_expect (*rp++ != '>' || wp - tzbuf < 3, 0))
+ if (__glibc_unlikely (*rp++ != '>' || wp - tzbuf < 3))
/* Punt on name, set up the offsets. */
goto done_names;
*wp = '\0';
tz = rp;
}
- else if (__builtin_expect (consumed < 3, 0))
+ else if (__glibc_unlikely (consumed < 3))
/* Punt on name, set up the offsets. */
goto done_names;
else
diff --git a/wcsmbs/mbrtoc16.c b/wcsmbs/mbrtoc16.c
index 9fa31bc568..643aaf585c 100644
--- a/wcsmbs/mbrtoc16.c
+++ b/wcsmbs/mbrtoc16.c
@@ -88,7 +88,7 @@ mbrtoc16 (char16_t *pc16, const char *s, size_t n, mbstate_t *ps)
/* Do a normal conversion. */
inbuf = (const unsigned char *) s;
endbuf = inbuf + n;
- if (__builtin_expect (endbuf < inbuf, 0))
+ if (__glibc_unlikely (endbuf < inbuf))
{
endbuf = (const unsigned char *) ~(uintptr_t) 0;
if (endbuf == inbuf)
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 6eeaa55be6..c57217add5 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -70,7 +70,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
/* Do a normal conversion. */
inbuf = (const unsigned char *) s;
endbuf = inbuf + n;
- if (__builtin_expect (endbuf < inbuf, 0))
+ if (__glibc_unlikely (endbuf < inbuf))
{
endbuf = (const unsigned char *) ~(uintptr_t) 0;
if (endbuf == inbuf)
diff --git a/wcsmbs/wcsmbsload.c b/wcsmbs/wcsmbsload.c
index 8267faf9c4..84733b35fe 100644
--- a/wcsmbs/wcsmbsload.c
+++ b/wcsmbs/wcsmbsload.c
@@ -156,7 +156,7 @@ __wcsmbs_load_conv (struct __locale_data *new_category)
/* We should repeat the test since while we waited some other thread
might have run this function. */
- if (__builtin_expect (new_category->private.ctype == NULL, 1))
+ if (__glibc_likely (new_category->private.ctype == NULL))
{
/* We must find the real functions. */
const char *charset_name;
diff --git a/wcsmbs/wcsmbsload.h b/wcsmbs/wcsmbsload.h
index a709428631..7636da7b65 100644
--- a/wcsmbs/wcsmbsload.h
+++ b/wcsmbs/wcsmbsload.h
@@ -68,9 +68,9 @@ extern const struct __locale_data _nl_C_LC_CTYPE attribute_hidden;
static inline const struct gconv_fcts *
get_gconv_fcts (struct __locale_data *data)
{
- if (__builtin_expect (data->private.ctype == NULL, 0))
+ if (__glibc_unlikely (data->private.ctype == NULL))
{
- if (__builtin_expect (data == &_nl_C_LC_CTYPE, 0))
+ if (__glibc_unlikely (data == &_nl_C_LC_CTYPE))
return &__wcsmbs_gconv_fcts_c;
__wcsmbs_load_conv (data);
}