diff options
Diffstat (limited to 'include/my_global.h')
-rw-r--r-- | include/my_global.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h index 71a2d087a43..b78c7120565 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -465,6 +465,18 @@ C_MODE_END */ #include <assert.h> +/* an assert that works at compile-time. only for constant expression */ +#ifndef __GNUC__ +#define compile_time_assert(X) do { } while(0) +#else +#define compile_time_assert(X) \ + do \ + { \ + char compile_time_assert[(X) ? 1 : -1] \ + __attribute__ ((unused)); \ + } while(0) +#endif + /* Go around some bugs in different OS and compilers */ #if defined (HPUX11) && defined(_LARGEFILE_SOURCE) #define _LARGEFILE64_SOURCE |