Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-08-01 15:59:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-08-01 16:03:03 +0400
commit7f32cf46054ceb924afcfef4ebf7c26822aa524d (patch)
treeacb49bfe2dcf6cac95fbac2e39f657d1f7255248 /source/blender/editors
parentc9366a29693082555c1388717d7a99c08da5477c (diff)
Prevent macros hiding casts from `const` pointers
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/BIF_gl.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 477a7c0ce17..4258bbcd359 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -58,8 +58,24 @@
* */
void cpack(unsigned int x);
-#define glMultMatrixf(x) glMultMatrixf( (float *)(x))
-#define glLoadMatrixf(x) glLoadMatrixf( (float *)(x))
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+# define glMultMatrixf(x) \
+ glMultMatrixf(_Generic(x, \
+ float *: (float *)(x), \
+ float (*)[4]: (float *)(x), \
+ const float *: (float *)(x), \
+ const float (*)[4]: (float *)(x)) \
+)
+# define glLoadMatrixf(x) \
+ glLoadMatrixf(_Generic(x, \
+ float *: (float *)(x), \
+ float (*)[4]: (float *)(x)) \
+)
+#else
+# define glMultMatrixf(x) glMultMatrixf((float *)(x))
+# define glLoadMatrixf(x) glLoadMatrixf((float *)(x))
+#endif
#define GLA_PIXEL_OFS 0.375f