diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-26 17:34:17 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-26 17:34:17 +0400 |
commit | b61abd4fe0da70ce52acf29c065df2af68e2eabe (patch) | |
tree | 67eb2668ca92240580a62f4358f7bc464c938b2e /source/blender/blenlib/BLI_math_base.h | |
parent | 43bb431548436b6b1699f795acd107de0f6b86a8 (diff) | |
parent | 25a925ceabb9987c0204df32200b664dcc1aaf44 (diff) |
Merge from trunk r49908-r50219smoke2
Diffstat (limited to 'source/blender/blenlib/BLI_math_base.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index b0e0d3cbf19..4a89776a52e 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -137,8 +137,30 @@ # endif #endif +/* Causes warning: + * incompatible types when assigning to type 'Foo' from type 'Bar' + * ... the compiler optimizes away the temp var */ +#ifndef CHECK_TYPE +#ifdef __GNUC__ +#define CHECK_TYPE(var, type) { \ + __typeof(var) *__tmp; \ + __tmp = (type *)NULL; \ + (void)__tmp; \ +} (void)0 +#else +#define CHECK_TYPE(var, type) +#endif +#endif + #ifndef SWAP -# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0 +# define SWAP(type, a, b) { \ + type sw_ap; \ + CHECK_TYPE(a, type); \ + CHECK_TYPE(b, type); \ + sw_ap = (a); \ + (a) = (b); \ + (b) = sw_ap; \ +} (void)0 #endif #ifndef CLAMP |