6 #include "compiler-gcc4.h"
8 #include "compiler-gcc3.h"
10 #error Compiler too old, need gcc at least gcc 3.x
18 * Mark unused variables passed to ops functions as unused, to silence gcc
20 #define fio_unused __attribute__((__unused__))
21 #define fio_init __attribute__((constructor))
22 #define fio_exit __attribute__((destructor))
24 #define fio_unlikely(x) __builtin_expect(!!(x), 0)
27 * Check at compile time that something is of a particular type.
28 * Always evaluates to 1 so you may use it easily in comparisons.
30 #define typecheck(type,x) \
33 (void)(&__dummy == &__dummy2); \
38 #if defined(CONFIG_STATIC_ASSERT)
39 #define compiletime_assert(condition, msg) _Static_assert(condition, msg)
41 #elif !defined(CONFIG_DISABLE_OPTIMIZATIONS)
43 #ifndef __compiletime_error
44 #define __compiletime_error(message)
47 #ifndef __compiletime_error_fallback
48 #define __compiletime_error_fallback(condition) do { } while (0)
51 #define __compiletime_assert(condition, msg, prefix, suffix) \
53 int __cond = !(condition); \
54 extern void prefix ## suffix(void) __compiletime_error(msg); \
57 __compiletime_error_fallback(__cond); \
60 #define _compiletime_assert(condition, msg, prefix, suffix) \
61 __compiletime_assert(condition, msg, prefix, suffix)
63 #define compiletime_assert(condition, msg) \
64 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
68 #define compiletime_assert(condition, msg) do { } while (0)