diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-25 08:44:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-25 08:44:46 +0400 |
commit | 9e6d27bbf0afed29f3b31800d75c17ee68472a9c (patch) | |
tree | 84082a76c5c017b1c678d4af50f808ee1d277189 /source/blender/blenlib/BLI_utildefines.h | |
parent | 69fa77d279f602641c965919a3071713cb4addb7 (diff) |
add BLI_STATIC_ASSERT macro.
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 801cff089d7..22312a52e87 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -348,6 +348,13 @@ # define BLI_assert(a) (void)0 #endif +#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ +# define BLI_STATIC_ASSERT(a, msg) _Static_assert(a, msg); +#else + /* TODO msvc, clang */ +# define BLI_STATIC_ASSERT(a, msg) (void)0 +#endif + /* hints for branch pradiction, only use in code that runs a _lot_ where */ #ifdef __GNUC__ # define LIKELY(x) __builtin_expect(!!(x), 1) |