[Bf-blender-cvs] [e3dfe29110f] master: Fix T65334: use _Static_assert on clang as well, to avoid macOS build error

Brecht Van Lommel noreply at git.blender.org
Fri May 31 10:51:02 CEST 2019


Commit: e3dfe29110fd85ea9f20259a502e40133829067e
Author: Brecht Van Lommel
Date:   Thu May 30 17:03:08 2019 +0200
Branches: master
https://developer.blender.org/rBe3dfe29110fd85ea9f20259a502e40133829067e

Fix T65334: use _Static_assert on clang as well, to avoid macOS build error

Still needs a proper solution for older compilers with custom static assert.
macro that can conflict when there is an assert on the same line in multiple
files.

===================================================================

M	source/blender/blenlib/BLI_assert.h

===================================================================

diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h
index 3d3c84d6370..366ed86c022 100644
--- a/source/blender/blenlib/BLI_assert.h
+++ b/source/blender/blenlib/BLI_assert.h
@@ -87,7 +87,8 @@ extern "C" {
 /* C++ can't use _Static_assert, expects static_assert() but c++0x only,
  * Coverity also errors out. */
 #if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && \
-    (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */
+    ((defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) || \
+     (defined(__clang__) && __has_feature(c_static_assert))) /* GCC 4.6+ and clang */
 #  define BLI_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg);
 #elif defined(_MSC_VER)
 #  define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a);



More information about the Bf-blender-cvs mailing list