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

@ -23,8 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Iterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
# ifdef _LIBCPP_CXX03_LANG
# error Support for unspecified stability is only for C++11 and higher

View file

@ -0,0 +1,104 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___LIBCXX_DEBUG_UTILS_SANITIZERS_H
#define _LIBCPP___LIBCXX_DEBUG_UTILS_SANITIZERS_H
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_constant_evaluated.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" {
_LIBCPP_EXPORTED_FROM_ABI void
__sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
_LIBCPP_EXPORTED_FROM_ABI void __sanitizer_annotate_double_ended_contiguous_container(
const void*, const void*, const void*, const void*, const void*, const void*);
_LIBCPP_EXPORTED_FROM_ABI int
__sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*);
}
#endif // _LIBCPP_HAS_NO_ASAN
_LIBCPP_BEGIN_NAMESPACE_STD
// ASan choices
#ifndef _LIBCPP_HAS_NO_ASAN
# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
#endif
#ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS
// __asan_annotate_container_with_allocator determines whether containers with custom allocators are annotated. This is
// a public customization point to disable annotations if the custom allocator assumes that the memory isn't poisoned.
// See the https://libcxx.llvm.org/UsingLibcxx.html#turning-off-asan-annotation-in-containers for more information.
template <class _Alloc>
struct __asan_annotate_container_with_allocator : true_type {};
#endif
// Annotate a double-ended contiguous range.
// - [__first_storage, __last_storage) is the allocated memory region,
// - [__first_old_contained, __last_old_contained) is the previously allowed (unpoisoned) range, and
// - [__first_new_contained, __last_new_contained) is the new allowed (unpoisoned) range.
template <class _Allocator>
_LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
const void* __first_storage,
const void* __last_storage,
const void* __first_old_contained,
const void* __last_old_contained,
const void* __first_new_contained,
const void* __last_new_contained) {
#ifdef _LIBCPP_HAS_NO_ASAN
(void)__first_storage;
(void)__last_storage;
(void)__first_old_contained;
(void)__last_old_contained;
(void)__first_new_contained;
(void)__last_new_contained;
#else
if (__asan_annotate_container_with_allocator<_Allocator>::value && __first_storage != nullptr)
__sanitizer_annotate_double_ended_contiguous_container(
__first_storage,
__last_storage,
__first_old_contained,
__last_old_contained,
__first_new_contained,
__last_new_contained);
#endif
}
// Annotate a contiguous range.
// [__first_storage, __last_storage) is the allocated memory region,
// __old_last_contained is the previously last allowed (unpoisoned) element, and
// __new_last_contained is the new last allowed (unpoisoned) element.
template <class _Allocator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_container(
const void* __first_storage,
const void* __last_storage,
const void* __old_last_contained,
const void* __new_last_contained) {
#ifdef _LIBCPP_HAS_NO_ASAN
(void)__first_storage;
(void)__last_storage;
(void)__old_last_contained;
(void)__new_last_contained;
#else
if (!__libcpp_is_constant_evaluated() && __asan_annotate_container_with_allocator<_Allocator>::value &&
__first_storage != nullptr)
__sanitizer_annotate_contiguous_container(
__first_storage, __last_storage, __old_last_contained, __new_last_contained);
#endif
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___LIBCXX_DEBUG_UTILS_SANITIZERS_H

View file

@ -0,0 +1,77 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___LIBCXX_DEBUG_STRICT_WEAK_ORDERING_CHECK
#define _LIBCPP___LIBCXX_DEBUG_STRICT_WEAK_ORDERING_CHECK
#include <__config>
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/is_sorted.h>
#include <__assert>
#include <__iterator/iterator_traits.h>
#include <__type_traits/is_constant_evaluated.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _RandomAccessIterator, class _Comp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
__check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
using __diff_t = __iter_diff_t<_RandomAccessIterator>;
using _Comp_ref = __comp_ref_type<_Comp>;
if (!__libcpp_is_constant_evaluated()) {
// Check if the range is actually sorted.
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
(std::is_sorted<_RandomAccessIterator, _Comp_ref>(__first, __last, _Comp_ref(__comp))),
"The range is not sorted after the sort, your comparator is not a valid strict-weak ordering");
// Limit the number of elements we need to check.
__diff_t __size = __last - __first > __diff_t(100) ? __diff_t(100) : __last - __first;
__diff_t __p = 0;
while (__p < __size) {
__diff_t __q = __p + __diff_t(1);
// Find first element that is greater than *(__first+__p).
while (__q < __size && !__comp(*(__first + __p), *(__first + __q))) {
++__q;
}
// Check that the elements from __p to __q are equal between each other.
for (__diff_t __b = __p; __b < __q; ++__b) {
for (__diff_t __a = __p; __a <= __b; ++__a) {
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering");
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering");
}
}
// Check that elements between __p and __q are less than between __q and __size.
for (__diff_t __a = __p; __a < __q; ++__a) {
for (__diff_t __b = __q; __b < __size; ++__b) {
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering");
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering");
}
}
// Skip these equal elements.
__p = __q;
}
}
#else
(void)__first;
(void)__last;
(void)__comp;
#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___LIBCXX_DEBUG_STRICT_WEAK_ORDERING_CHECK