summaryrefslogtreecommitdiff
path: root/src/first.h
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-11-21 10:37:29 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-11-27 08:12:21 -0500
commit647222b35c38a1b60da9e7a4dd7248975a4cb870 (patch)
tree760e93723b0893f5a64529ebbef8f795392a5e8a /src/first.h
parent730c932e3c32ea43dbbb2fad51c2ebfc9219b856 (diff)
downloadlighttpd-git-647222b35c38a1b60da9e7a4dd7248975a4cb870.tar.gz
[core] check for __builtin_expect() availability
Diffstat (limited to 'src/first.h')
-rw-r--r--src/first.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/first.h b/src/first.h
index d011f227..dd095f8a 100644
--- a/src/first.h
+++ b/src/first.h
@@ -60,6 +60,10 @@
#define __has_attribute(x) 0
#endif
+#ifndef __has_builtin /* clang */
+#define __has_builtin(x) 0
+#endif
+
#ifdef __GNUC__
#ifndef __GNUC_PREREQ
# ifdef __GNUC_PREREQ__
@@ -75,6 +79,13 @@
#define __GNUC_PREREQ(maj,min) 0
#endif
+#ifndef __builtin_expect
+#if !__has_builtin(__builtin_expect) \
+ && !__GNUC_PREREQ(2,96)
+#define __builtin_expect(x,y) (x)
+#endif
+#endif
+
#ifndef __attribute_noinline__
#if __has_attribute(noinline) \
|| __GNUC_PREREQ(3,1)