aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2023-11-05 08:40:51 -0500
committerGitHub <noreply@github.com>2023-11-05 08:40:51 -0500
commit8a7846fe86f95e82c6bd5f4f45b8dd311320e903 (patch)
treed1962a9f38e9f0fd449df717f4302f52e29b5b4a /libcxx/src
parenta9070f22a29e28f7d6f83c24a8dd88f3a94969ae (diff)
downloadllvm-8a7846fe86f95e82c6bd5f4f45b8dd311320e903.zip
llvm-8a7846fe86f95e82c6bd5f4f45b8dd311320e903.tar.gz
llvm-8a7846fe86f95e82c6bd5f4f45b8dd311320e903.tar.bz2
[libc++] Bump the C++ Standard used to compile the dylib to C++23 (#66824)
This is necessary in order to implement some papers like P2467R1, which require using C++23 declarations in the dylib. It is a good habit to keep building the dylib with a recent standard version regardless. With this patch, we also stop strictly enforcing that the targets are built with C++23. Concretely, C++23 will soon be required in order to build the dylib, but not enforcing it strictly works around some issues like the documentation bots using an old and unsupported compiler. Since these bots do not actually build the library, not strictly enforcing the C++ Standard makes our CMake build more resilient to these kinds of situation. This is just a workaround though, the better way of going about would be to update the compiler on the documentation bot but we don't seem to have control over that.
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/include/sso_allocator.h3
-rw-r--r--libcxx/src/locale.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/libcxx/src/include/sso_allocator.h b/libcxx/src/include/sso_allocator.h
index 6a682fc..0cc8738 100644
--- a/libcxx/src/include/sso_allocator.h
+++ b/libcxx/src/include/sso_allocator.h
@@ -11,6 +11,7 @@
#define _LIBCPP_SSO_ALLOCATOR_H
#include <__config>
+#include <cstddef>
#include <memory>
#include <new>
#include <type_traits>
@@ -34,7 +35,7 @@ public:
template <class _Tp, size_t _Np>
class _LIBCPP_HIDDEN __sso_allocator
{
- typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
+ alignas(_Tp) std::byte buf_[sizeof(_Tp) * _Np];
bool __allocated_;
public:
typedef size_t size_type;
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 317b4de..c37e091 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -10,6 +10,7 @@
#include <algorithm>
#include <clocale>
#include <codecvt>
+#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -87,7 +88,7 @@ struct release
template <class T, class ...Args>
T& make(Args ...args)
{
- static typename aligned_storage<sizeof(T)>::type buf;
+ alignas(T) static std::byte buf[sizeof(T)];
auto *obj = ::new (&buf) T(args...);
return *obj;
}
@@ -541,7 +542,7 @@ const locale&
locale::__imp::make_classic()
{
// only one thread can get in here and it only gets in once
- static aligned_storage<sizeof(locale)>::type buf;
+ alignas(locale) static std::byte buf[sizeof(locale)];
locale* c = reinterpret_cast<locale*>(&buf);
c->__locale_ = &make<__imp>(1u);
return *c;
@@ -558,7 +559,7 @@ locale&
locale::__imp::make_global()
{
// only one thread can get in here and it only gets in once
- static aligned_storage<sizeof(locale)>::type buf;
+ alignas(locale) static std::byte buf[sizeof(locale)];
auto *obj = ::new (&buf) locale(locale::classic());
return *obj;
}