[Bf-blender-cvs] [b0351bd3bda] blender2.8: Gawain: define feature macros in a more compatible way

Mike Erwin noreply at git.blender.org
Tue Apr 18 18:11:19 CEST 2017


Commit: b0351bd3bdaa16f7dec75fe90bcd66569564608a
Author: Mike Erwin
Date:   Tue Apr 18 11:35:56 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBb0351bd3bdaa16f7dec75fe90bcd66569564608a

Gawain: define feature macros in a more compatible way

Thanks to @sergey for proactively testing clang 4.0, which does not accept defined(FOO) as part of macro definitions.

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

M	intern/gawain/gawain/common.h
M	intern/gawain/gawain/vertex_format.h

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

diff --git a/intern/gawain/gawain/common.h b/intern/gawain/gawain/common.h
index b734da41681..80f434cb178 100644
--- a/intern/gawain/gawain/common.h
+++ b/intern/gawain/gawain/common.h
@@ -11,8 +11,12 @@
 
 #pragma once
 
-#define TRUST_NO_ONE !defined(NDEBUG)
-// strict error checking, enabled for debug builds during early development
+#if defined(NDEBUG)
+  #define TRUST_NO_ONE 1
+  // strict error checking, enabled for debug builds during early development
+#else
+  #define TRUST_NO_ONE 0
+#endif
 
 #include <GL/glew.h>
 #include <stdbool.h>
@@ -22,7 +26,11 @@
   #include <assert.h>
 #endif
 
-#define APPLE_LEGACY (defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT))
+#if defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT)
+  #define APPLE_LEGACY 1
+#else
+  #define APPLE_LEGACY 1
+#endif
 
 #if APPLE_LEGACY
   #undef glGenVertexArrays
diff --git a/intern/gawain/gawain/vertex_format.h b/intern/gawain/gawain/vertex_format.h
index 6fe92681909..f8a79b84707 100644
--- a/intern/gawain/gawain/vertex_format.h
+++ b/intern/gawain/gawain/vertex_format.h
@@ -17,9 +17,13 @@
 #define AVG_VERTEX_ATTRIB_NAME_LEN 5
 #define VERTEX_ATTRIB_NAMES_BUFFER_LEN ((AVG_VERTEX_ATTRIB_NAME_LEN + 1) * MAX_VERTEX_ATTRIBS)
 
-#define USE_10_10_10 defined(_WIN32)
-// (GLEW_VERSION_3_3 || GLEW_ARB_vertex_type_2_10_10_10_rev)
-//   ^-- this is only guaranteed on Windows right now, will be true on all platforms soon
+#if defined(_WIN32)
+  // (GLEW_VERSION_3_3 || GLEW_ARB_vertex_type_2_10_10_10_rev)
+  //   ^-- this is only guaranteed on Windows right now, will be true on all platforms soon
+  #define USE_10_10_10 1
+#else
+  #define USE_10_10_10 0
+#endif
 
 typedef enum {
 	COMP_I8,




More information about the Bf-blender-cvs mailing list