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:
authorRay Molenkamp <github@lazydodo.com>2019-09-14 18:59:42 +0300
committerRay Molenkamp <github@lazydodo.com>2019-09-14 18:59:42 +0300
commitea70bd2abf7c178076a403dd071fcf593b79c20c (patch)
tree6ecd4a9aec38cffe7ee91187a1d9e5295f332cdf /source/blender/blenlib
parent5fe14f32cf004039eee17b5a4a692a058d50c8ba (diff)
MSVC: Fix macro collision with MSVC Headers
Picked up while investigating a build error on the functions branch which seems to use this specific header in a way master doesn't. The problem: The MSVC headers define a `_CONCAT` macro, so does BLI_kdtree_imp.h however at the end `BLI_kdtree_imp.h` undefines the macro making the MS headers that still rely on it "unhappy". Who's fault is this: Ours, C99 Spec says ``` 7.1.3 Reserved identifiers - All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. ... if the program removes (with #undef) any macro definition of an identifier in the first group listed above, the behavior is undefined. ``` So we should not have defined it, and we definitely should not have undefined it. We have *tons* of these violations, although fixing them would be great at one point lots of them are in /extern or in the 3rd party deps, I'd rather deal with them on a case by case basis when it actually causes issues. Differential Revision: https://developer.blender.org/D5790 Reviewers: campbellbarton, JacquesLucke
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_kdtree_impl.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_kdtree_impl.h b/source/blender/blenlib/BLI_kdtree_impl.h
index e442bd7a99d..c028266ef64 100644
--- a/source/blender/blenlib/BLI_kdtree_impl.h
+++ b/source/blender/blenlib/BLI_kdtree_impl.h
@@ -21,9 +21,9 @@
#include "BLI_compiler_attrs.h"
-#define _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
-#define _CONCAT(MACRO_ARG1, MACRO_ARG2) _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
-#define BLI_kdtree_nd_(id) _CONCAT(KDTREE_PREFIX_ID, _##id)
+#define _BLI_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
+#define _BLI_CONCAT(MACRO_ARG1, MACRO_ARG2) _BLI_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
+#define BLI_kdtree_nd_(id) _BLI_CONCAT(KDTREE_PREFIX_ID, _##id)
struct KDTree;
typedef struct KDTree KDTree;
@@ -93,6 +93,6 @@ int BLI_kdtree_nd_(range_search_with_len_squared_cb)(
const void *user_data),
const void *user_data) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
-#undef _CONCAT_AUX
-#undef _CONCAT
+#undef _BLI_CONCAT_AUX
+#undef _BLI_CONCAT
#undef BLI_kdtree_nd_