diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-01 15:59:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-01 16:03:03 +0400 |
commit | 7f32cf46054ceb924afcfef4ebf7c26822aa524d (patch) | |
tree | acb49bfe2dcf6cac95fbac2e39f657d1f7255248 /source/blender/editors/include/BIF_gl.h | |
parent | c9366a29693082555c1388717d7a99c08da5477c (diff) |
Prevent macros hiding casts from `const` pointers
Diffstat (limited to 'source/blender/editors/include/BIF_gl.h')
-rw-r--r-- | source/blender/editors/include/BIF_gl.h | 20 |
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 |