mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-02 18:52:29 +00:00
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:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
9
third_party/libcxx/__exception/exception.h
vendored
9
third_party/libcxx/__exception/exception.h
vendored
|
@ -69,18 +69,21 @@ public:
|
|||
// On all other platforms, we define our own std::exception and std::bad_exception types
|
||||
// regardless of whether exceptions are turned on as a language feature.
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI exception {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI exception {
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI exception() _NOEXCEPT {}
|
||||
_LIBCPP_HIDE_FROM_ABI exception(const exception&) _NOEXCEPT = default;
|
||||
_LIBCPP_HIDE_FROM_ABI exception(const exception&) _NOEXCEPT = default;
|
||||
_LIBCPP_HIDE_FROM_ABI exception& operator=(const exception&) _NOEXCEPT = default;
|
||||
|
||||
virtual ~exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_exception : public exception {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI bad_exception : public exception {
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI bad_exception() _NOEXCEPT {}
|
||||
_LIBCPP_HIDE_FROM_ABI bad_exception(const bad_exception&) _NOEXCEPT = default;
|
||||
_LIBCPP_HIDE_FROM_ABI bad_exception& operator=(const bad_exception&) _NOEXCEPT = default;
|
||||
~bad_exception() _NOEXCEPT override;
|
||||
const char* what() const _NOEXCEPT override;
|
||||
};
|
||||
|
|
86
third_party/libcxx/__exception/exception_ptr.h
vendored
86
third_party/libcxx/__exception/exception_ptr.h
vendored
|
@ -12,21 +12,63 @@
|
|||
#include <__config>
|
||||
#include <__exception/operations.h>
|
||||
#include <__memory/addressof.h>
|
||||
#include <__memory/construct_at.h>
|
||||
#include <__type_traits/decay.h>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <typeinfo>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ABI_MICROSOFT
|
||||
|
||||
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
|
||||
|
||||
namespace __cxxabiv1 {
|
||||
|
||||
extern "C" {
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw();
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw();
|
||||
|
||||
struct __cxa_exception;
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception(
|
||||
void*,
|
||||
std::type_info*,
|
||||
# if defined(_WIN32)
|
||||
void(__thiscall*)(void*)) throw();
|
||||
# elif defined(__wasm__)
|
||||
// In Wasm, a destructor returns its argument
|
||||
void* (*)(void*)) throw();
|
||||
# else
|
||||
void (*)(void*)) throw();
|
||||
# endif
|
||||
}
|
||||
|
||||
} // namespace __cxxabiv1
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace std { // purposefully not using versioning namespace
|
||||
|
||||
#ifndef _LIBCPP_ABI_MICROSOFT
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
|
||||
void* __ptr_;
|
||||
|
||||
static exception_ptr __from_native_exception_pointer(void*) _NOEXCEPT;
|
||||
|
||||
template <class _Ep>
|
||||
friend _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT;
|
||||
|
||||
public:
|
||||
// exception_ptr is basically a COW string.
|
||||
using __trivially_relocatable = exception_ptr;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
|
||||
|
@ -44,18 +86,44 @@ public:
|
|||
return !(__x == __y);
|
||||
}
|
||||
|
||||
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
friend _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
|
||||
friend _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template <class _Ep>
|
||||
_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
|
||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L
|
||||
using _Ep2 = __decay_t<_Ep>;
|
||||
|
||||
void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep));
|
||||
# ifdef __wasm__
|
||||
// In Wasm, a destructor returns its argument
|
||||
(void)__cxxabiv1::__cxa_init_primary_exception(
|
||||
__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* {
|
||||
# else
|
||||
(void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) {
|
||||
# endif
|
||||
std::__destroy_at(static_cast<_Ep2*>(__p));
|
||||
# ifdef __wasm__
|
||||
return __p;
|
||||
# endif
|
||||
});
|
||||
|
||||
try {
|
||||
::new (__ex) _Ep2(__e);
|
||||
return exception_ptr::__from_native_exception_pointer(__ex);
|
||||
} catch (...) {
|
||||
__cxxabiv1::__cxa_free_exception(__ex);
|
||||
return current_exception();
|
||||
}
|
||||
# else
|
||||
try {
|
||||
throw __e;
|
||||
} catch (...) {
|
||||
return current_exception();
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
((void)__e);
|
||||
std::abort();
|
||||
|
@ -64,7 +132,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
|
|||
|
||||
#else // _LIBCPP_ABI_MICROSOFT
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
|
||||
_LIBCPP_DIAGNOSTIC_PUSH
|
||||
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
|
||||
void* __ptr1_;
|
||||
|
@ -81,17 +149,17 @@ public:
|
|||
explicit operator bool() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_FUNC_VIS bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT;
|
||||
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void* __except, const void* __ptr);
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
|
||||
|
||||
// This is a built-in template function which automagically extracts the required
|
||||
// information.
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include <__type_traits/decay.h>
|
||||
#include <__type_traits/is_base_of.h>
|
||||
#include <__type_traits/is_class.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_convertible.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__type_traits/is_final.h>
|
||||
#include <__type_traits/is_polymorphic.h>
|
||||
#include <__utility/forward.h>
|
||||
|
@ -28,13 +28,13 @@
|
|||
|
||||
namespace std { // purposefully not using versioning namespace
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI nested_exception {
|
||||
class _LIBCPP_EXPORTED_FROM_ABI nested_exception {
|
||||
exception_ptr __ptr_;
|
||||
|
||||
public:
|
||||
nested_exception() _NOEXCEPT;
|
||||
// nested_exception(const nested_exception&) noexcept = default;
|
||||
// nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI nested_exception(const nested_exception&) _NOEXCEPT = default;
|
||||
_LIBCPP_HIDE_FROM_ABI nested_exception& operator=(const nested_exception&) _NOEXCEPT = default;
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
|
@ -53,14 +53,14 @@ struct __throw_with_nested;
|
|||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, true> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void __do_throw(_Tp&& __t) {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) {
|
||||
throw __nested<_Up>(std::forward<_Tp>(__t));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, false> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -84,17 +84,15 @@ struct __can_dynamic_cast
|
|||
: _BoolConstant< is_polymorphic<_From>::value &&
|
||||
(!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value)> {};
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void
|
||||
rethrow_if_nested(const _Ep& __e, __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value>* = 0) {
|
||||
template <class _Ep, __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep& __e) {
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::addressof(__e));
|
||||
if (__nep)
|
||||
__nep->rethrow_nested();
|
||||
}
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void
|
||||
rethrow_if_nested(const _Ep&, __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value>* = 0) {}
|
||||
template <class _Ep, __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep&) {}
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
|
21
third_party/libcxx/__exception/operations.h
vendored
21
third_party/libcxx/__exception/operations.h
vendored
|
@ -9,7 +9,6 @@
|
|||
#ifndef _LIBCPP___EXCEPTION_OPERATIONS_H
|
||||
#define _LIBCPP___EXCEPTION_OPERATIONS_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -21,22 +20,22 @@ namespace std { // purposefully not using versioning namespace
|
|||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \
|
||||
defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
using unexpected_handler = void (*)();
|
||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected();
|
||||
#endif
|
||||
|
||||
using terminate_handler = void (*)();
|
||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool uncaught_exception() _NOEXCEPT;
|
||||
_LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
|
||||
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
|
||||
} // namespace std
|
||||
|
||||
#endif // _LIBCPP___EXCEPTION_OPERATIONS_H
|
||||
|
|
2
third_party/libcxx/__exception/terminate.h
vendored
2
third_party/libcxx/__exception/terminate.h
vendored
|
@ -16,7 +16,7 @@
|
|||
#endif
|
||||
|
||||
namespace std { // purposefully not using versioning namespace
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
|
||||
} // namespace std
|
||||
|
||||
#endif // _LIBCPP___EXCEPTION_TERMINATE_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue