From: Kefu Chai Date: Thu, 19 Jun 2025 10:04:05 +0000 (+0800) Subject: rgw: avoid using std::aligned_storage_t X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4ecf0a8d1fc045f779a7319307f3118e06dfea82;p=ceph.git rgw: avoid using std::aligned_storage_t std::aligned_storage_t was deprecated in C++23, to be prepared for it, let's use alignas for the same behavior. because the 3 * 8 (with LP64 data model) is not power-of-2, while `alignas()` requires an alignment of power of 2. so we use `std::bit_ceil()` to calculate the minimum alignment greater or equal to this number. Signed-off-by: Kefu Chai --- diff --git a/src/rgw/rgw_aio.h b/src/rgw/rgw_aio.h index 0b4ce71ca3f66..4f6301c8f84f9 100644 --- a/src/rgw/rgw_aio.h +++ b/src/rgw/rgw_aio.h @@ -15,9 +15,9 @@ #pragma once +#include #include #include -#include #include #include "include/rados/librados_fwd.hpp" @@ -40,7 +40,10 @@ struct AioResult { uint64_t id = 0; // id allows caller to associate a result with its request bufferlist data; // result buffer for reads int result = 0; - std::aligned_storage_t<3 * sizeof(void*)> user_data; + static constexpr size_t user_data_alignment = std::bit_ceil(3 * sizeof(void*)); + struct alignas(user_data_alignment) { + unsigned char data[user_data_alignment]; + } user_data; AioResult() = default; AioResult(const AioResult&) = delete;