See http://www.pixelbeat.org/programming/gcc/static_assert.html

#define ASSERT\_CONCAT\_(a, b) a##b
#define ASSERT\_CONCAT(a, b) ASSERT\_CONCAT_(a, b)
/* These can't be used after statements in c89. */
#ifdef \_\_COUNTER\_\_
  #define STATIC_ASSERT(e,m) \
    { enum { ASSERT_CONCAT(static\_assert\_, \_\_COUNTER\_\_) = 1/(!!(e)) }; }
#else
  /* This can't be used twice on the same line so ensure if using in headers
   * that the headers are not included twice (by wrapping in #ifndef...#endif)
   * Note it doesn't cause an issue when used on same line of separate modules
   * compiled with gcc -combine -fwhole-program.  */
  #define STATIC_ASSERT(e,m) \
    { enum { ASSERT_CONCAT(assert\_line\_, \_\_LINE\_\_) = 1/(!!(e)) }; }
#endif