[PATCH] make kmod compatible with GCC < 4.6 --- kmod-15.org/libkmod/macro.h +++ kmod-15/libkmod/macro.h @@ -21,8 +21,25 @@ #include +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ +0 >= 201112L) || \ + (defined(__GNUC__) && (__GNUC__ +0) * 10 + (__GNUC_MINOR__ +0) >= 46) + #define assert_cc(expr) \ _Static_assert((expr), #expr) + +#elif defined(__LINE__) + +#define PASTE2__(A, B) A ## B +#define PASTE__(A, B) PASTE2__(A, B) +#define STATIC_ASSERT__(COND) typedef char PASTE__(static_assertion, __LINE__) [(COND)?1:-1] +#define assert_cc(expr) \ + STATIC_ASSERT__((expr)) + +#else +#warning "compiler has no support for static assertions" +#define assert_cc(expr) do {} while(0) + +#endif #if HAVE_TYPEOF #define check_types_match(expr1, expr2) \