diff options
author | Jacques Lucke <jacques@blender.org> | 2022-05-25 17:28:07 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-05-25 17:28:07 +0300 |
commit | a337e7738fbf2ec1eaec4c1deb46d28840885758 (patch) | |
tree | b7b3d436363d8ab07c9fbfa0067233c1c604b652 /CMakeLists.txt | |
parent | f381c31ac69cb8a6175a54dc31863e13e9b199d6 (diff) |
BLI: use no_unique_address attribute
Even though the `no_unique_address` attribute has only been standardized
in C++20, compilers seem to support it with C++17 already. This attribute
allows reducing the memory footprint of structs which have empty types as
data members (usually that is an allocator or inline buffer in Blender).
Previously, one had to use the empty base optimization to achieve the same
effect, which requires a lot of boilerplate code.
The types that benefit from this the most are `Vector` and `Array`, which
usually become 8 bytes smaller. All types which use these core data structures
get smaller as well of course.
Differential Revision: https://developer.blender.org/D14993
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 85827e01af5..3e97e393f17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1756,6 +1756,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") "/wd4828" # The file contains a character that is illegal "/wd4996" # identifier was declared deprecated "/wd4661" # no suitable definition provided for explicit template instantiation request + "/wd4848" # 'no_unique_address' is a vendor extension in C++17 # errors: "/we4013" # 'function' undefined; assuming extern returning int "/we4133" # incompatible pointer types |