5 #include "compiler-gcc4.h"
7 #include "compiler-gcc3.h"
9 #error Compiler too old, need gcc at least gcc 3.x
17 * Mark unused variables passed to ops functions as unused, to silence gcc
19 #define fio_unused __attribute__((__unused__))
20 #define fio_init __attribute__((constructor))
21 #define fio_exit __attribute__((destructor))
23 #define fio_unlikely(x) __builtin_expect(!!(x), 0)
26 * Check at compile time that something is of a particular type.
27 * Always evaluates to 1 so you may use it easily in comparisons.
29 #define typecheck(type,x) \
32 (void)(&__dummy == &__dummy2); \
36 #ifndef __compiletime_error
37 #define __compiletime_error(message)
39 #ifndef __compiletime_error_fallback
40 #define __compiletime_error_fallback(condition) do { } while (0)
43 #define __compiletime_assert(condition, msg, prefix, suffix) \
45 int __cond = !(condition); \
46 extern void prefix ## suffix(void) __compiletime_error(msg); \
49 __compiletime_error_fallback(__cond); \
52 #define _compiletime_assert(condition, msg, prefix, suffix) \
53 __compiletime_assert(condition, msg, prefix, suffix)
55 #define compiletime_assert(condition, msg) \
56 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)