blob: dac30d5badac0de3c986d8e7893da86fd2abd373 [file] [log] [blame]
Brian Silvermanaa9183a2013-12-08 10:33:47 -08001#ifndef CAPE_UTIL_H_
2#define CAPE_UTIL_H_
3
4#define ALIAS_WEAK(f) __attribute__ ((weak, alias (#f)))
5
Brian Silverman2df84412013-12-10 14:00:40 -08006// MSG has to be separated_with_spaces.
7#define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(!!(COND))*2-1]
8
Brian Silvermanaa9183a2013-12-08 10:33:47 -08009// Prevents the compiler from reordering memory operations around this.
10static inline void compiler_memory_barrier(void) {
11 __asm__ __volatile__("" ::: "memory");
12}
13
14#endif // CAPE_UTIL_H_