diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-08-11 23:43:48 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-08-11 23:43:48 +0200 |
commit | 5ed12dc1583e4abd91410a53c4a49b7ab194a3f2 (patch) | |
tree | 53e4b8dc0a17afe12b4d7e6ff9f61911d9f90dc7 /libshouldbeinlibc | |
parent | 7e07503bbc4d85a238c8167b7a2dd536642964b8 (diff) | |
download | hurd-5ed12dc1583e4abd91410a53c4a49b7ab194a3f2.tar.gz hurd-5ed12dc1583e4abd91410a53c4a49b7ab194a3f2.tar.bz2 hurd-5ed12dc1583e4abd91410a53c4a49b7ab194a3f2.zip |
assert_*_backtrace: Tell the compiler that failures are unlikely
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r-- | libshouldbeinlibc/assert-backtrace.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libshouldbeinlibc/assert-backtrace.h b/libshouldbeinlibc/assert-backtrace.h index f49a537e..c1e51594 100644 --- a/libshouldbeinlibc/assert-backtrace.h +++ b/libshouldbeinlibc/assert-backtrace.h @@ -45,16 +45,16 @@ void __assert_perror_fail_backtrace (int errnum, __attribute__ ((noreturn, unused)); #define assert_backtrace(expr) \ - ((expr) \ + (__builtin_expect(!!(expr), 1) \ ? (void) 0 \ : __assert_fail_backtrace (__STRING(expr), \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__)) #define assert_perror_backtrace(expr) \ - ((expr == 0) \ + (__builtin_expect(((expr) == 0), 1) \ ? (void) 0 \ - : __assert_perror_fail_backtrace (expr, \ + : __assert_perror_fail_backtrace ((expr), \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__)) |