Make minor improvements

This commit is contained in:
Justine Tunney 2020-12-23 23:42:56 -08:00
parent 04caf6f9ad
commit 95b142e4e5
95 changed files with 3818 additions and 2760 deletions

View file

@ -806,36 +806,6 @@ typedef uint64_t uintmax_t;
do { \
} while (0)
#ifndef likely
#define likely(expr) __builtin_expect(!!(expr), 1)
#endif
#ifndef unlikely
#define unlikely(expr) __builtin_expect(!!(expr), 0)
#endif
/**
* Evaluates ternary expression without type promotion.
*/
#ifndef chooseexpr
#define chooseexpr(pred, a, b) __builtin_choose_expr(pred, a, b)
#endif
/**
* Returns true if expression can be evaluated at compile-time.
*/
#ifndef isconstant
#define isconstant(expr) __builtin_constant_p(expr)
#endif
#ifndef static_assert
#define static_assert(expr) _Static_assert(expr, #expr)
#endif
#ifndef typescompatible
#define typescompatible(a, b) __builtin_types_compatible_p(a, b)
#endif
#ifndef __STRICT_ANSI__
#define testonly noinline _Section(".test")
#define textstartup _Section(".text.startup") noinstrument
@ -873,10 +843,6 @@ typedef uint64_t uintmax_t;
#define offsetof(type, member) __builtin_offsetof(type, member)
#endif
#ifndef alignas
#define alignas(x) _Alignas(x)
#endif
#ifndef _Section
#ifndef __STRICT_ANSI__
#define _Section(s) __attribute__((__section__(s)))
@ -1029,15 +995,15 @@ typedef uint64_t uintmax_t;
* Pulls another module, by symbol, into linkage.
* @note nop is discarded by ape/ape.lds
*/
#define YOINK(SYMBOL) \
do { \
_Static_assert(!typescompatible(typeof(SYMBOL), char[]), \
"Please YOINK(symbol), not YOINK(\"symbol\")"); \
asm(".pushsection .yoink\n\t" \
"nop\t%a0\n\t" \
".popsection" \
: /* no outputs */ \
: "X"(SYMBOL)); \
#define YOINK(SYMBOL) \
do { \
_Static_assert(!__builtin_types_compatible_p(typeof(SYMBOL), char[]), \
"Please YOINK(symbol), not YOINK(\"symbol\")"); \
asm(".pushsection .yoink\n\t" \
"nop\t%a0\n\t" \
".popsection" \
: /* no outputs */ \
: "X"(SYMBOL)); \
} while (0)
/**