Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give basic_memory_buffer allocator [[no_unique_address]] #3485

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@
# endif
#endif

#ifndef FMT_NO_UNIQUE_ADDRESS
# if FMT_CPLUSPLUS >= 202002L
# if FMT_HAS_CPP_ATTRIBUTE(no_unique_address)
# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]]
# elif FMT_MSC_VERSION >= 1929 // VS2019 v16.10 and later
# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
# endif
# else
# define FMT_NO_UNIQUE_ADDRESS
# endif
#endif

#if FMT_GCC_VERSION || defined(__clang__)
# define FMT_VISIBILITY(value) __attribute__((visibility(value)))
#else
Expand Down Expand Up @@ -920,7 +932,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
T store_[SIZE];

// Don't inherit from Allocator avoid generating type_info for it.
Allocator alloc_;
FMT_NO_UNIQUE_ADDRESS Allocator alloc_;

// Deallocate memory allocated by the buffer.
FMT_CONSTEXPR20 void deallocate() {
Expand Down