[Bf-blender-cvs] [6a523da6cf1] asset-browser-poselib: Fix C-linkage warning on Clang
Julian Eisel
noreply at git.blender.org
Fri Apr 16 02:09:10 CEST 2021
Commit: 6a523da6cf1f1b5bf4e8f7e9f66cd3428fd1d3ac
Author: Julian Eisel
Date: Thu Apr 15 23:45:13 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rB6a523da6cf1f1b5bf4e8f7e9f66cd3428fd1d3ac
Fix C-linkage warning on Clang
After macro expansion, there would be C++ code in code with C linkage
(`extern "C"`). Clang warned about this.
Make sure the expanded C++ code always uses C++ linkage. Will commit this to
master soon.
===================================================================
M source/blender/blenlib/BLI_utildefines.h
===================================================================
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 1c6e6ffe578..0bf117df43b 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -785,6 +785,7 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
* To use after the enum declaration. */
/* If any enumerator `C` is set to say `A|B`, then `C` would be the max enum value. */
# define ENUM_OPERATORS(_enum_type, _max_enum_value) \
+ extern "C++" { \
inline constexpr _enum_type operator|(_enum_type a, _enum_type b) \
{ \
return static_cast<_enum_type>(static_cast<int>(a) | b); \
@@ -804,7 +805,8 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
inline _enum_type &operator&=(_enum_type &a, _enum_type b) \
{ \
return a = static_cast<_enum_type>(static_cast<int>(a) & b); \
- }
+ } \
+ } /* extern "C++" */
#else
/* Output nothing. */
More information about the Bf-blender-cvs
mailing list