Brian Silverman | aa9183a | 2013-12-08 10:33:47 -0800 | [diff] [blame] | 1 | #ifndef CAPE_UTIL_H_ |
| 2 | #define CAPE_UTIL_H_ |
| 3 | |
| 4 | #define ALIAS_WEAK(f) __attribute__ ((weak, alias (#f))) |
| 5 | |
Brian Silverman | 2df8441 | 2013-12-10 14:00:40 -0800 | [diff] [blame^] | 6 | // MSG has to be separated_with_spaces. |
| 7 | #define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(!!(COND))*2-1] |
| 8 | |
Brian Silverman | aa9183a | 2013-12-08 10:33:47 -0800 | [diff] [blame] | 9 | // Prevents the compiler from reordering memory operations around this. |
| 10 | static inline void compiler_memory_barrier(void) { |
| 11 | __asm__ __volatile__("" ::: "memory"); |
| 12 | } |
| 13 | |
| 14 | #endif // CAPE_UTIL_H_ |