Browse Source

[core] check for __builtin_expect() availability

master
Glenn Strauss 7 months ago
parent
commit
647222b35c
  1. 11
      src/first.h

11
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)

Loading…
Cancel
Save