@@ -29,7 +29,7 @@ namespace {
2929SpinMutex GlobalMutex;
3030struct ThreadTrie {
3131 tid_t TId;
32- typename std::aligned_storage< sizeof (FunctionCallTrie)>::type TrieStorage ;
32+ alignas (FunctionCallTrie) std::byte TrieStorage[ sizeof (FunctionCallTrie)] ;
3333};
3434
3535struct ProfileBuffer {
@@ -71,16 +71,13 @@ using ThreadDataAllocator = ThreadDataArray::AllocatorType;
7171// by the ThreadData array. This lets us host the buffers, allocators, and tries
7272// associated with a thread by moving the data into the array instead of
7373// attempting to copy the data to a separately backed set of tries.
74- static typename std::aligned_storage<
75- sizeof (BufferQueue), alignof (BufferQueue)>::type BufferQueueStorage;
74+ alignas (BufferQueue) static std::byte BufferQueueStorage[sizeof (BufferQueue)];
7675static BufferQueue *BQ = nullptr ;
7776static BufferQueue::Buffer Buffer;
78- static typename std::aligned_storage<sizeof (ThreadDataAllocator),
79- alignof (ThreadDataAllocator)>::type
80- ThreadDataAllocatorStorage;
81- static typename std::aligned_storage<sizeof (ThreadDataArray),
82- alignof (ThreadDataArray)>::type
83- ThreadDataArrayStorage;
77+ alignas (ThreadDataAllocator) static std::byte
78+ ThreadDataAllocatorStorage[sizeof (ThreadDataAllocator)];
79+ alignas (ThreadDataArray) static std::byte
80+ ThreadDataArrayStorage[sizeof (ThreadDataArray)];
8481
8582static ThreadDataAllocator *TDAllocator = nullptr ;
8683static ThreadDataArray *TDArray = nullptr ;
@@ -91,10 +88,10 @@ using ProfileBufferArrayAllocator = typename ProfileBufferArray::AllocatorType;
9188// These need to be global aligned storage to avoid dynamic initialization. We
9289// need these to be aligned to allow us to placement new objects into the
9390// storage, and have pointers to those objects be appropriately aligned.
94- static typename std::aligned_storage< sizeof (ProfileBufferArray)>::type
95- ProfileBuffersStorage;
96- static typename std::aligned_storage< sizeof (ProfileBufferArrayAllocator)>::type
97- ProfileBufferArrayAllocatorStorage;
91+ alignas (ProfileBufferArray) static std::byte
92+ ProfileBuffersStorage[ sizeof (ProfileBufferArray)] ;
93+ alignas (ProfileBufferArrayAllocator) static std::byte
94+ ProfileBufferArrayAllocatorStorage[ sizeof (ProfileBufferArrayAllocator)] ;
9895
9996static ProfileBufferArrayAllocator *ProfileBuffersAllocator = nullptr ;
10097static ProfileBufferArray *ProfileBuffers = nullptr ;
@@ -382,8 +379,8 @@ XRayBuffer nextBuffer(XRayBuffer B) XRAY_NEVER_INSTRUMENT {
382379 return {nullptr , 0 };
383380
384381 static pthread_once_t Once = PTHREAD_ONCE_INIT;
385- static typename std::aligned_storage< sizeof (XRayProfilingFileHeader)>::type
386- FileHeaderStorage;
382+ alignas (XRayProfilingFileHeader) static std::byte
383+ FileHeaderStorage[ sizeof (XRayProfilingFileHeader)] ;
387384 pthread_once (
388385 &Once, +[]() XRAY_NEVER_INSTRUMENT {
389386 new (&FileHeaderStorage) XRayProfilingFileHeader{};
0 commit comments