Release Cosmopolitan v3.6.0

This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
Justine Tunney 2024-07-23 03:16:17 -07:00
parent 62ace3623a
commit 5660ec4741
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1585 changed files with 117353 additions and 271644 deletions

View file

@ -10,6 +10,7 @@
#define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H
#include <__config>
#include <__fwd/memory_resource.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -24,15 +25,14 @@ namespace pmr {
// [mem.res.class]
class _LIBCPP_TYPE_VIS memory_resource {
class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource {
static const size_t __max_align = alignof(max_align_t);
public:
virtual ~memory_resource();
_LIBCPP_NODISCARD_AFTER_CXX17
[[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void*
allocate(size_t __bytes, size_t __align = __max_align) {
[[nodiscard]] [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]]
_LIBCPP_HIDE_FROM_ABI void* allocate(size_t __bytes, size_t __align = __max_align) {
return do_allocate(__bytes, __align);
}
@ -51,20 +51,33 @@ private:
// [mem.res.eq]
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool
operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
return &__lhs == &__rhs || __lhs.is_equal(__rhs);
}
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
# if _LIBCPP_STD_VER <= 17
inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool
operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
return !(__lhs == __rhs);
}
# endif
// [mem.res.global]
[[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* get_default_resource() noexcept;
[[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* set_default_resource(memory_resource*) noexcept;
[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* new_delete_resource() noexcept;
[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* null_memory_resource() noexcept;
[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
get_default_resource() noexcept;
[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
set_default_resource(memory_resource*) noexcept;
[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
new_delete_resource() noexcept;
[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
null_memory_resource() noexcept;
} // namespace pmr

View file

@ -26,7 +26,7 @@ namespace pmr {
// [mem.res.monotonic.buffer]
class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource {
class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI monotonic_buffer_resource : public memory_resource {
static const size_t __default_buffer_capacity = 1024;
static const size_t __default_buffer_alignment = 16;

View file

@ -11,12 +11,12 @@
#include <__assert>
#include <__config>
#include <__fwd/pair.h>
#include <__memory_resource/memory_resource.h>
#include <__utility/exception_guard.h>
#include <cstddef>
#include <limits>
#include <new>
#include <stdexcept>
#include <tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -39,7 +39,7 @@ template <class _ValueType
= byte
# endif
>
class _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
public:
using value_type = _ValueType;
@ -60,7 +60,7 @@ public:
// [mem.poly.allocator.mem]
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) {
if (__n > __max_size()) {
__throw_bad_array_new_length();
}
@ -68,7 +68,10 @@ public:
}
_LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) {
_LIBCPP_ASSERT(__n <= __max_size(), "deallocate called for size which exceeds max_size()");
_LIBCPP_ASSERT_VALID_DEALLOCATION(
__n <= __max_size(),
"deallocate() called for a size which exceeds max_size(), leading to a memory leak "
"(the argument will overflow and result in too few objects being deleted)");
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
}
@ -207,12 +210,16 @@ operator==(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<
return *__lhs.resource() == *__rhs.resource();
}
# if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Up>
inline _LIBCPP_HIDE_FROM_ABI bool
operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept {
return !(__lhs == __rhs);
}
# endif
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

View file

@ -24,7 +24,7 @@ namespace pmr {
// [mem.res.pool.options]
struct _LIBCPP_TYPE_VIS pool_options {
struct _LIBCPP_EXPORTED_FROM_ABI pool_options {
size_t max_blocks_per_chunk = 0;
size_t largest_required_pool_block = 0;
};

View file

@ -14,9 +14,7 @@
#include <__memory_resource/pool_options.h>
#include <__memory_resource/unsynchronized_pool_resource.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <mutex>
#endif
#include <mutex>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -30,7 +28,7 @@ namespace pmr {
// [mem.res.pool.overview]
class _LIBCPP_TYPE_VIS synchronized_pool_resource : public memory_resource {
class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resource : public memory_resource {
public:
_LIBCPP_HIDE_FROM_ABI synchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream)
: __unsync_(__opts, __upstream) {}

View file

@ -27,7 +27,7 @@ namespace pmr {
// [mem.res.pool.overview]
class _LIBCPP_TYPE_VIS unsynchronized_pool_resource : public memory_resource {
class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI unsynchronized_pool_resource : public memory_resource {
class __fixed_pool;
class __adhoc_pool {