diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-02 17:30:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-02 17:30:51 +0300 |
commit | 459daf16487485533ca9cdfb347fc8767fbf887a (patch) | |
tree | 1fc7a99741bc1c0264aa6d9a2d7409743ab6cf5f /source/blender/blenlib/BLI_assert.h | |
parent | 95a9a3e6c0b606d622550d4b192052c865917dbf (diff) |
Fix Linux build error after recent changes.
Diffstat (limited to 'source/blender/blenlib/BLI_assert.h')
-rw-r--r-- | source/blender/blenlib/BLI_assert.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index 3454b236fca..52d4858548a 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -79,10 +79,15 @@ extern "C" { #elif defined(_MSC_VER) # define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a); #else /* older gcc, clang... */ - /* 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. */ + /* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */ + /* Note we need the two concats below because arguments to ## are not expanded, so we need to + * expand __LINE__ with one indirection before doing the actual concatenation. */ +# define _BLI_ASSERT_CONCAT_(a, b) a##b +# define _BLI_ASSERT_CONCAT(a, b) _BLI_ASSERT_CONCAT_(a, b) + /* 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 BLI_STATIC_ASSERT(a, msg) \ ; enum { _BLI_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) }; #endif |