From: Mark de Wever Date: Sat, 8 Apr 2023 15:29:31 +0000 (+0200) Subject: [libc++] Granularize system_error. X-Git-Tag: upstream/17.0.6~12218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8cfbfd05a951b85f80156dffc8eeecb34c7271c;p=platform%2Fupstream%2Fllvm.git [libc++] Granularize system_error. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D147853 --- diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst index 1e2d52c..100c3b4 100644 --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -63,8 +63,8 @@ Deprecations and Removals includes are removed based on the language version used. Incidental transitive inclusions of the following headers have been removed: - - C++2b: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``new``, ``stdexcept``, - ``type_traits``, ``typeinfo`` + - C++2b: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``limits``, ``new``, + ``stdexcept``, ``system_error``, ``type_traits``, ``typeinfo`` - The headers ```` and ```` have been removed, since all the contents have been implemented in namespace ``std`` for at least two releases. diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 8232784..e9b1eb5 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -589,6 +589,10 @@ set(files __support/xlocale/__nop_locale_mgmt.h __support/xlocale/__posix_l_fallback.h __support/xlocale/__strtonum_fallback.h + __system_error/error_category.h + __system_error/error_code.h + __system_error/error_condition.h + __system_error/system_error.h __thread/poll_with_backoff.h __thread/timed_backoff_policy.h __threading_support diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h index 926effb..10b0662 100644 --- a/libcxx/include/__condition_variable/condition_variable.h +++ b/libcxx/include/__condition_variable/condition_variable.h @@ -15,12 +15,12 @@ #include <__config> #include <__mutex/mutex.h> #include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> #include <__threading_support> #include <__type_traits/enable_if.h> #include <__type_traits/is_floating_point.h> #include <__utility/move.h> #include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h index 77aaa74..bb5088c 100644 --- a/libcxx/include/__filesystem/directory_entry.h +++ b/libcxx/include/__filesystem/directory_entry.h @@ -12,6 +12,7 @@ #include <__availability> #include <__chrono/time_point.h> +#include <__compare/ordering.h> #include <__config> #include <__errc> #include <__filesystem/file_status.h> @@ -21,10 +22,11 @@ #include <__filesystem/operations.h> #include <__filesystem/path.h> #include <__filesystem/perms.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include <__utility/unreachable.h> #include #include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h index e45ea85..d74c8be 100644 --- a/libcxx/include/__filesystem/directory_iterator.h +++ b/libcxx/include/__filesystem/directory_iterator.h @@ -20,8 +20,9 @@ #include <__memory/shared_ptr.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__filesystem/filesystem_error.h b/libcxx/include/__filesystem/filesystem_error.h index def7e3f..7860fc4 100644 --- a/libcxx/include/__filesystem/filesystem_error.h +++ b/libcxx/include/__filesystem/filesystem_error.h @@ -14,11 +14,13 @@ #include <__config> #include <__filesystem/path.h> #include <__memory/shared_ptr.h> +#include <__system_error/error_code.h> +#include <__system_error/system_error.h> #include <__utility/forward.h> #include <__verbose_abort> #include #include -#include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__filesystem/operations.h b/libcxx/include/__filesystem/operations.h index f48d301..6bf58d8 100644 --- a/libcxx/include/__filesystem/operations.h +++ b/libcxx/include/__filesystem/operations.h @@ -21,8 +21,8 @@ #include <__filesystem/perm_options.h> #include <__filesystem/perms.h> #include <__filesystem/space_info.h> +#include <__system_error/error_code.h> #include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h index 847b404..ac40dc8 100644 --- a/libcxx/include/__filesystem/recursive_directory_iterator.h +++ b/libcxx/include/__filesystem/recursive_directory_iterator.h @@ -19,8 +19,9 @@ #include <__memory/shared_ptr.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__mutex/unique_lock.h b/libcxx/include/__mutex/unique_lock.h index a057d1c..c27ce4b 100644 --- a/libcxx/include/__mutex/unique_lock.h +++ b/libcxx/include/__mutex/unique_lock.h @@ -14,8 +14,9 @@ #include <__config> #include <__memory/addressof.h> #include <__mutex/tag_types.h> +#include <__system_error/system_error.h> #include <__utility/swap.h> -#include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__system_error/error_category.h b/libcxx/include/__system_error/error_category.h new file mode 100644 index 0000000..9f1abd0 --- /dev/null +++ b/libcxx/include/__system_error/error_category.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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___SYSTEM_ERROR_ERROR_CATEGORY_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H + +#include <__compare/ordering.h> +#include <__config> +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_TYPE_VIS error_condition; +class _LIBCPP_TYPE_VIS error_code; + +class _LIBCPP_HIDDEN __do_message; + +class _LIBCPP_TYPE_VIS error_category +{ +public: + virtual ~error_category() _NOEXCEPT; + +#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) + error_category() noexcept; +#else + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; +#endif + error_category(const error_category&) = delete; + error_category& operator=(const error_category&) = delete; + + virtual const char* name() const _NOEXCEPT = 0; + virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; + virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; + virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; + virtual string message(int __ev) const = 0; + + _LIBCPP_INLINE_VISIBILITY + bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} + +#if _LIBCPP_STD_VER >= 20 + + _LIBCPP_HIDE_FROM_ABI + strong_ordering operator<=>(const error_category& __rhs) const noexcept {return compare_three_way()(this, std::addressof(__rhs));} + +#else // _LIBCPP_STD_VER >= 20 + + _LIBCPP_INLINE_VISIBILITY + bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} + + _LIBCPP_INLINE_VISIBILITY + bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} + +#endif // _LIBCPP_STD_VER >= 20 + + friend class _LIBCPP_HIDDEN __do_message; +}; + +class _LIBCPP_HIDDEN __do_message + : public error_category +{ +public: + string message(int __ev) const override; +}; + +_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; +_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H diff --git a/libcxx/include/__system_error/error_code.h b/libcxx/include/__system_error/error_code.h new file mode 100644 index 0000000..b14c742 --- /dev/null +++ b/libcxx/include/__system_error/error_code.h @@ -0,0 +1,191 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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___SYSTEM_ERROR_ERROR_CODE_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H + +#include <__compare/ordering.h> +#include <__config> +#include <__errc> +#include <__functional/hash.h> +#include <__functional/unary_function.h> +#include <__system_error/error_category.h> +#include <__system_error/error_condition.h> +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template +struct _LIBCPP_TEMPLATE_VIS is_error_code_enum + : public false_type {}; + +#if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; +#endif + +namespace __adl_only { + // Those cause ADL to trigger but they are not viable candidates, + // so they are never actually selected. + void make_error_code() = delete; +} // namespace __adl_only + +class _LIBCPP_TYPE_VIS error_code +{ + int __val_; + const error_category* __cat_; +public: + _LIBCPP_INLINE_VISIBILITY + error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} + + _LIBCPP_INLINE_VISIBILITY + error_code(int __val, const error_category& __cat) _NOEXCEPT + : __val_(__val), __cat_(&__cat) {} + + template + _LIBCPP_INLINE_VISIBILITY + error_code(_Ep __e, + typename enable_if::value>::type* = nullptr + ) _NOEXCEPT + { + using __adl_only::make_error_code; + *this = make_error_code(__e); + } + + _LIBCPP_INLINE_VISIBILITY + void assign(int __val, const error_category& __cat) _NOEXCEPT + { + __val_ = __val; + __cat_ = &__cat; + } + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + is_error_code_enum<_Ep>::value, + error_code& + >::type + operator=(_Ep __e) _NOEXCEPT + { + using __adl_only::make_error_code; + *this = make_error_code(__e); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT + { + __val_ = 0; + __cat_ = &system_category(); + } + + _LIBCPP_INLINE_VISIBILITY + int value() const _NOEXCEPT {return __val_;} + + _LIBCPP_INLINE_VISIBILITY + const error_category& category() const _NOEXCEPT {return *__cat_;} + + _LIBCPP_INLINE_VISIBILITY + error_condition default_error_condition() const _NOEXCEPT + {return __cat_->default_error_condition(__val_);} + + string message() const; + + _LIBCPP_INLINE_VISIBILITY + explicit operator bool() const _NOEXCEPT {return __val_ != 0;} +}; + +inline _LIBCPP_INLINE_VISIBILITY +error_code +make_error_code(errc __e) _NOEXCEPT +{ + return error_code(static_cast(__e), generic_category()); +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const error_code& __x, const error_code& __y) _NOEXCEPT +{ + return __x.category() == __y.category() && __x.value() == __y.value(); +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT +{ + return __x.category().equivalent(__x.value(), __y) + || __y.category().equivalent(__x, __y.value()); +} + +#if _LIBCPP_STD_VER <= 17 +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT +{ + return __y == __x; +} +#endif + +#if _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT +{return !(__x == __y);} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT +{return !(__x == __y);} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT +{return !(__x == __y);} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(const error_code& __x, const error_code& __y) _NOEXCEPT +{ + return __x.category() < __y.category() + || (__x.category() == __y.category() && __x.value() < __y.value()); +} + +#else // _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI strong_ordering +operator<=>(const error_code& __x, const error_code& __y) noexcept +{ + if (auto __c = __x.category() <=> __y.category(); __c != 0) + return __c; + return __x.value() <=> __y.value(); +} + +#endif // _LIBCPP_STD_VER <= 17 + +template <> +struct _LIBCPP_TEMPLATE_VIS hash + : public __unary_function +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const error_code& __ec) const _NOEXCEPT + { + return static_cast(__ec.value()); + } +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H diff --git a/libcxx/include/__system_error/error_condition.h b/libcxx/include/__system_error/error_condition.h new file mode 100644 index 0000000..2f57a7c --- /dev/null +++ b/libcxx/include/__system_error/error_condition.h @@ -0,0 +1,168 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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___SYSTEM_ERROR_ERROR_CONDITION_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H + +#include <__compare/ordering.h> +#include <__config> +#include <__errc> +#include <__functional/unary_function.h> +#include <__system_error/error_category.h> +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum + : public false_type {}; + +#if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; +#endif + +template <> +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum + : true_type { }; + +#ifdef _LIBCPP_CXX03_LANG +template <> +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum + : true_type { }; +#endif + +namespace __adl_only { + // Those cause ADL to trigger but they are not viable candidates, + // so they are never actually selected. + void make_error_condition() = delete; +} // namespace __adl_only + +class _LIBCPP_TYPE_VIS error_condition +{ + int __val_; + const error_category* __cat_; +public: + _LIBCPP_INLINE_VISIBILITY + error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} + + _LIBCPP_INLINE_VISIBILITY + error_condition(int __val, const error_category& __cat) _NOEXCEPT + : __val_(__val), __cat_(&__cat) {} + + template + _LIBCPP_INLINE_VISIBILITY + error_condition(_Ep __e, + typename enable_if::value>::type* = nullptr + ) _NOEXCEPT + { + using __adl_only::make_error_condition; + *this = make_error_condition(__e); + } + + _LIBCPP_INLINE_VISIBILITY + void assign(int __val, const error_category& __cat) _NOEXCEPT + { + __val_ = __val; + __cat_ = &__cat; + } + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + is_error_condition_enum<_Ep>::value, + error_condition& + >::type + operator=(_Ep __e) _NOEXCEPT + { + using __adl_only::make_error_condition; + *this = make_error_condition(__e); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT + { + __val_ = 0; + __cat_ = &generic_category(); + } + + _LIBCPP_INLINE_VISIBILITY + int value() const _NOEXCEPT {return __val_;} + + _LIBCPP_INLINE_VISIBILITY + const error_category& category() const _NOEXCEPT {return *__cat_;} + string message() const; + + _LIBCPP_INLINE_VISIBILITY + explicit operator bool() const _NOEXCEPT {return __val_ != 0;} +}; + +inline _LIBCPP_INLINE_VISIBILITY +error_condition +make_error_condition(errc __e) _NOEXCEPT +{ + return error_condition(static_cast(__e), generic_category()); +} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT +{ + return __x.category() == __y.category() && __x.value() == __y.value(); +} + +#if _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT +{return !(__x == __y);} + +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT +{ + return __x.category() < __y.category() + || (__x.category() == __y.category() && __x.value() < __y.value()); +} + + +#else // _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI strong_ordering +operator<=>(const error_condition& __x, const error_condition& __y) noexcept +{ + if (auto __c = __x.category() <=> __y.category(); __c != 0) + return __c; + return __x.value() <=> __y.value(); +} + +#endif // _LIBCPP_STD_VER <= 17 + +template <> +struct _LIBCPP_TEMPLATE_VIS hash + : public __unary_function +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const error_condition& __ec) const _NOEXCEPT + { + return static_cast(__ec.value()); + } +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H diff --git a/libcxx/include/__system_error/system_error.h b/libcxx/include/__system_error/system_error.h new file mode 100644 index 0000000..701dd54 --- /dev/null +++ b/libcxx/include/__system_error/system_error.h @@ -0,0 +1,51 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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___SYSTEM_ERROR_SYSTEM_ERROR_H +#define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H + +#include <__config> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_TYPE_VIS system_error + : public runtime_error +{ + error_code __ec_; +public: + system_error(error_code __ec, const string& __what_arg); + system_error(error_code __ec, const char* __what_arg); + system_error(error_code __ec); + system_error(int __ev, const error_category& __ecat, const string& __what_arg); + system_error(int __ev, const error_category& __ecat, const char* __what_arg); + system_error(int __ev, const error_category& __ecat); + system_error(const system_error&) _NOEXCEPT = default; + ~system_error() _NOEXCEPT override; + + _LIBCPP_INLINE_VISIBILITY + const error_code& code() const _NOEXCEPT {return __ec_;} + +private: + static string __init(const error_code&, string); +}; + +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS +void __throw_system_error(int __ev, const char* __what_arg); + + +_LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable index e1eec60..4135a20 100644 --- a/libcxx/include/condition_variable +++ b/libcxx/include/condition_variable @@ -285,6 +285,7 @@ _LIBCPP_END_NAMESPACE_STD # include # include # include +# include # include # include #endif diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem index d7678e1..b10555d 100644 --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -468,6 +468,7 @@ inline constexpr bool std::ranges::enable_view # include +# include #endif #endif // _LIBCPP_FILESYSTEM diff --git a/libcxx/include/future b/libcxx/include/future index ab554f2..22fc585 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -367,11 +367,18 @@ template struct uses_allocator, Alloc>; #include <__chrono/time_point.h> #include <__config> #include <__exception/exception_ptr.h> +#include <__memory/allocator.h> #include <__memory/allocator_arg_t.h> #include <__memory/allocator_destructor.h> +#include <__memory/allocator_traits.h> +#include <__memory/compressed_pair.h> +#include <__memory/pointer_traits.h> #include <__memory/shared_ptr.h> #include <__memory/unique_ptr.h> #include <__memory/uses_allocator.h> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> #include <__type_traits/aligned_storage.h> #include <__type_traits/alignment_of.h> #include <__type_traits/strip_signature.h> @@ -380,7 +387,7 @@ template struct uses_allocator, Alloc>; #include <__utility/move.h> #include #include -#include +#include #include #include @@ -2462,6 +2469,7 @@ _LIBCPP_END_NAMESPACE_STD # include # include # include +# include #endif #endif // _LIBCPP_FUTURE diff --git a/libcxx/include/ios b/libcxx/include/ios index afe42a6..d972a22 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -219,9 +219,12 @@ storage-class-specifier const error_category& iostream_category() noexcept; #include <__assert> // all public C++ headers provide the assertion handler #include <__ios/fpos.h> #include <__locale> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> +#include <__system_error/system_error.h> #include <__utility/swap.h> #include <__verbose_abort> -#include #include // standard-mandated includes @@ -1048,6 +1051,7 @@ _LIBCPP_END_NAMESPACE_STD # include # include # include +# include # include # include #endif diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp index b9a670c..dd25640 100644 --- a/libcxx/include/libcxx.imp +++ b/libcxx/include/libcxx.imp @@ -41,6 +41,7 @@ { include: [ "@<__ranges/.*>", "private", "", "public" ] }, { include: [ "@<__string/.*>", "private", "", "public" ] }, { include: [ "@<__support/.*>", "private", "", "public" ] }, + { include: [ "@<__system_error/.*>", "private", "", "public" ] }, { include: [ "@<__thread/.*>", "private", "", "public" ] }, { include: [ "@<__tuple_dir/.*>", "private", "", "public" ] }, { include: [ "@<__type_traits/.*>", "private", "", "public" ] }, diff --git a/libcxx/include/locale b/libcxx/include/locale index 0f862b1..4b7e865 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -203,6 +203,7 @@ template class messages_byname; #include <__locale> #include <__memory/unique_ptr.h> #include <__type_traits/make_unsigned.h> +#include #include #include #include diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index 7bae70f..970039a 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -904,6 +904,7 @@ module std [system] { private header "__format/format_context.h" export optional export locale + export __locale } module format_error { private header "__format/format_error.h" } module format_functions { @@ -1433,7 +1434,22 @@ module std [system] { } module system_error { header "system_error" + export __errc export * + module __system_error { + module error_category { private header "__system_error/error_category.h" } + module error_code { + private header "__system_error/error_code.h" + export functional.__functional.hash + export functional.__functional.unary_function + } + module error_condition { + private header "__system_error/error_condition.h" + export functional.__functional.hash + export functional.__functional.unary_function + } + module system_error { private header "__system_error/system_error.h" } + } } module thread { @requires_LIBCXX_ENABLE_THREADS@ diff --git a/libcxx/include/mutex b/libcxx/include/mutex index 3e89aaa..ed9b43d 100644 --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -719,6 +719,7 @@ _LIBCPP_POP_MACROS # include # include # include +# include # include # include #endif diff --git a/libcxx/include/ostream b/libcxx/include/ostream index 753bec1..610a283 100644 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -168,6 +168,7 @@ basic_ostream& operator<<(basic_ostream&, cons #include <__exception/operations.h> #include <__memory/shared_ptr.h> #include <__memory/unique_ptr.h> +#include <__system_error/error_code.h> #include <__type_traits/conjunction.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_base_of.h> diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex index dd142f4..db35514 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -133,9 +133,9 @@ template #include <__mutex/mutex.h> #include <__mutex/tag_types.h> #include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> #include <__utility/swap.h> #include -#include #include _LIBCPP_PUSH_MACROS @@ -515,4 +515,8 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include +#endif + #endif // _LIBCPP_SHARED_MUTEX diff --git a/libcxx/include/system_error b/libcxx/include/system_error index 8142aac..3d1722f 100644 --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -146,12 +146,10 @@ template <> struct hash; #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__errc> -#include <__functional/hash.h> -#include <__functional/unary_function.h> -#include <__memory/addressof.h> -#include -#include +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> +#include <__system_error/system_error.h> #include // standard-mandated includes @@ -163,388 +161,10 @@ template <> struct hash; # pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -// is_error_code_enum - -template -struct _LIBCPP_TEMPLATE_VIS is_error_code_enum - : public false_type {}; - -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; -#endif - -// is_error_condition_enum - -template -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum - : public false_type {}; - -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; -#endif - -template <> -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum - : true_type { }; - -#ifdef _LIBCPP_CXX03_LANG -template <> -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum - : true_type { }; -#endif - -class _LIBCPP_TYPE_VIS error_condition; -class _LIBCPP_TYPE_VIS error_code; - -// class error_category - -class _LIBCPP_HIDDEN __do_message; - -class _LIBCPP_TYPE_VIS error_category -{ -public: - virtual ~error_category() _NOEXCEPT; - -#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) - error_category() noexcept; -#else - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; -#endif - error_category(const error_category&) = delete; - error_category& operator=(const error_category&) = delete; - - virtual const char* name() const _NOEXCEPT = 0; - virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; - virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; - virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; - virtual string message(int __ev) const = 0; - - _LIBCPP_INLINE_VISIBILITY - bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} - -#if _LIBCPP_STD_VER >= 20 - - _LIBCPP_HIDE_FROM_ABI - strong_ordering operator<=>(const error_category& __rhs) const noexcept {return compare_three_way()(this, std::addressof(__rhs));} - -#else // _LIBCPP_STD_VER >= 20 - - _LIBCPP_INLINE_VISIBILITY - bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} - - _LIBCPP_INLINE_VISIBILITY - bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} - -#endif // _LIBCPP_STD_VER >= 20 - - friend class _LIBCPP_HIDDEN __do_message; -}; - -class _LIBCPP_HIDDEN __do_message - : public error_category -{ -public: - string message(int __ev) const override; -}; - -_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; -_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT; - -namespace __adl_only { - // Those cause ADL to trigger but they are not viable candidates, - // so they are never actually selected. - void make_error_condition() = delete; - void make_error_code() = delete; -} // namespace __adl_only - -class _LIBCPP_TYPE_VIS error_condition -{ - int __val_; - const error_category* __cat_; -public: - _LIBCPP_INLINE_VISIBILITY - error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} - - _LIBCPP_INLINE_VISIBILITY - error_condition(int __val, const error_category& __cat) _NOEXCEPT - : __val_(__val), __cat_(&__cat) {} - - template - _LIBCPP_INLINE_VISIBILITY - error_condition(_Ep __e, - typename enable_if::value>::type* = nullptr - ) _NOEXCEPT - { - using __adl_only::make_error_condition; - *this = make_error_condition(__e); - } - - _LIBCPP_INLINE_VISIBILITY - void assign(int __val, const error_category& __cat) _NOEXCEPT - { - __val_ = __val; - __cat_ = &__cat; - } - - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_error_condition_enum<_Ep>::value, - error_condition& - >::type - operator=(_Ep __e) _NOEXCEPT - { - using __adl_only::make_error_condition; - *this = make_error_condition(__e); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __val_ = 0; - __cat_ = &generic_category(); - } - - _LIBCPP_INLINE_VISIBILITY - int value() const _NOEXCEPT {return __val_;} - - _LIBCPP_INLINE_VISIBILITY - const error_category& category() const _NOEXCEPT {return *__cat_;} - string message() const; - - _LIBCPP_INLINE_VISIBILITY - explicit operator bool() const _NOEXCEPT {return __val_ != 0;} -}; - -inline _LIBCPP_INLINE_VISIBILITY -error_condition -make_error_condition(errc __e) _NOEXCEPT -{ - return error_condition(static_cast(__e), generic_category()); -} - -// error_code - -class _LIBCPP_TYPE_VIS error_code -{ - int __val_; - const error_category* __cat_; -public: - _LIBCPP_INLINE_VISIBILITY - error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} - - _LIBCPP_INLINE_VISIBILITY - error_code(int __val, const error_category& __cat) _NOEXCEPT - : __val_(__val), __cat_(&__cat) {} - - template - _LIBCPP_INLINE_VISIBILITY - error_code(_Ep __e, - typename enable_if::value>::type* = nullptr - ) _NOEXCEPT - { - using __adl_only::make_error_code; - *this = make_error_code(__e); - } - - _LIBCPP_INLINE_VISIBILITY - void assign(int __val, const error_category& __cat) _NOEXCEPT - { - __val_ = __val; - __cat_ = &__cat; - } - - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_error_code_enum<_Ep>::value, - error_code& - >::type - operator=(_Ep __e) _NOEXCEPT - { - using __adl_only::make_error_code; - *this = make_error_code(__e); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __val_ = 0; - __cat_ = &system_category(); - } - - _LIBCPP_INLINE_VISIBILITY - int value() const _NOEXCEPT {return __val_;} - - _LIBCPP_INLINE_VISIBILITY - const error_category& category() const _NOEXCEPT {return *__cat_;} - - _LIBCPP_INLINE_VISIBILITY - error_condition default_error_condition() const _NOEXCEPT - {return __cat_->default_error_condition(__val_);} - - string message() const; - - _LIBCPP_INLINE_VISIBILITY - explicit operator bool() const _NOEXCEPT {return __val_ != 0;} -}; - -inline _LIBCPP_INLINE_VISIBILITY -error_code -make_error_code(errc __e) _NOEXCEPT -{ - return error_code(static_cast(__e), generic_category()); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_code& __x, const error_code& __y) _NOEXCEPT -{ - return __x.category() == __y.category() && __x.value() == __y.value(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category().equivalent(__x.value(), __y) - || __y.category().equivalent(__x, __y.value()); -} - -#if _LIBCPP_STD_VER <= 17 -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT -{ - return __y == __x; -} -#endif - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category() == __y.category() && __x.value() == __y.value(); -} - -#if _LIBCPP_STD_VER <= 17 - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category() < __y.category() - || (__x.category() == __y.category() && __x.value() < __y.value()); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<(const error_code& __x, const error_code& __y) _NOEXCEPT -{ - return __x.category() < __y.category() - || (__x.category() == __y.category() && __x.value() < __y.value()); -} - -#else // _LIBCPP_STD_VER <= 17 - -inline _LIBCPP_HIDE_FROM_ABI strong_ordering -operator<=>(const error_code& __x, const error_code& __y) noexcept -{ - if (auto __c = __x.category() <=> __y.category(); __c != 0) - return __c; - return __x.value() <=> __y.value(); -} - -inline _LIBCPP_HIDE_FROM_ABI strong_ordering -operator<=>(const error_condition& __x, const error_condition& __y) noexcept -{ - if (auto __c = __x.category() <=> __y.category(); __c != 0) - return __c; - return __x.value() <=> __y.value(); -} - -#endif // _LIBCPP_STD_VER <= 17 - -template <> -struct _LIBCPP_TEMPLATE_VIS hash - : public __unary_function -{ - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const error_code& __ec) const _NOEXCEPT - { - return static_cast(__ec.value()); - } -}; - -template <> -struct _LIBCPP_TEMPLATE_VIS hash - : public __unary_function -{ - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const error_condition& __ec) const _NOEXCEPT - { - return static_cast(__ec.value()); - } -}; - -// system_error - -class _LIBCPP_TYPE_VIS system_error - : public runtime_error -{ - error_code __ec_; -public: - system_error(error_code __ec, const string& __what_arg); - system_error(error_code __ec, const char* __what_arg); - system_error(error_code __ec); - system_error(int __ev, const error_category& __ecat, const string& __what_arg); - system_error(int __ev, const error_category& __ecat, const char* __what_arg); - system_error(int __ev, const error_category& __ecat); - system_error(const system_error&) _NOEXCEPT = default; - ~system_error() _NOEXCEPT override; - - _LIBCPP_INLINE_VISIBILITY - const error_code& code() const _NOEXCEPT {return __ec_;} - -private: - static string __init(const error_code&, string); -}; - -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS -void __throw_system_error(int __ev, const char* __what_arg); - -_LIBCPP_END_NAMESPACE_STD - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include +# include +# include # include #endif diff --git a/libcxx/include/thread b/libcxx/include/thread index d2e67fa..e071476 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -100,17 +100,19 @@ void sleep_for(const chrono::duration& rel_time); #include <__format/formatter_integral.h> #include <__format/parser_std_format_spec.h> #include <__functional/hash.h> +#include <__functional/unary_function.h> #include <__memory/addressof.h> #include <__memory/unique_ptr.h> #include <__mutex/mutex.h> #include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> #include <__thread/poll_with_backoff.h> #include <__thread/timed_backoff_policy.h> #include <__threading_support> #include <__utility/forward.h> #include +#include #include -#include #include #include @@ -469,10 +471,10 @@ _LIBCPP_POP_MACROS #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 -# include # include # include # include +# include #endif #endif // _LIBCPP_THREAD diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp index 8c85d96..213f888 100644 --- a/libcxx/src/chrono.cpp +++ b/libcxx/src/chrono.cpp @@ -12,9 +12,9 @@ #define _LARGE_TIME_API #endif -#include // errno +#include <__system_error/system_error.h> +#include // errno #include -#include // __throw_system_error #if defined(__MVS__) #include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp index b17c4cf..85f334e 100644 --- a/libcxx/src/condition_variable.cpp +++ b/libcxx/src/condition_variable.cpp @@ -12,7 +12,6 @@ #include #include -#include #if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) # pragma comment(lib, "pthread") diff --git a/libcxx/src/filesystem/filesystem_common.h b/libcxx/src/filesystem/filesystem_common.h index 0d52426..a9ca34d 100644 --- a/libcxx/src/filesystem/filesystem_common.h +++ b/libcxx/src/filesystem/filesystem_common.h @@ -18,8 +18,8 @@ #include #include #include -#include #include +#include #if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp index c09c064..90e615f 100644 --- a/libcxx/src/mutex.cpp +++ b/libcxx/src/mutex.cpp @@ -9,7 +9,6 @@ #include <__assert> #include #include -#include #include "include/atomic_support.h" diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp index 3873246..c120d6a 100644 --- a/libcxx/src/random.cpp +++ b/libcxx/src/random.cpp @@ -13,9 +13,9 @@ # define _CRT_RAND_S #endif // defined(_LIBCPP_USING_WIN32_RANDOM) +#include <__system_error/system_error.h> #include #include -#include #if defined(__sun__) # define rename solaris_headers_are_broken diff --git a/libcxx/src/ryu/d2fixed.cpp b/libcxx/src/ryu/d2fixed.cpp index 305fbb4..e03f1a7 100644 --- a/libcxx/src/ryu/d2fixed.cpp +++ b/libcxx/src/ryu/d2fixed.cpp @@ -43,7 +43,6 @@ #include <__config> #include #include -#include #include "include/ryu/common.h" #include "include/ryu/d2fixed.h" diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp index d08b674..d5c9173 100644 --- a/libcxx/src/stdexcept.cpp +++ b/libcxx/src/stdexcept.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #ifdef _LIBCPP_ABI_VCRUNTIME #include "support/runtime/stdexcept_vcruntime.ipp" diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp index 263c05a..501a3e1 100644 --- a/libcxx/test/libcxx/private_headers.verify.cpp +++ b/libcxx/test/libcxx/private_headers.verify.cpp @@ -604,6 +604,10 @@ END-SCRIPT #include <__string/char_traits.h> // expected-error@*:* {{use of private header from outside its module: '__string/char_traits.h'}} #include <__string/constexpr_c_functions.h> // expected-error@*:* {{use of private header from outside its module: '__string/constexpr_c_functions.h'}} #include <__string/extern_template_lists.h> // expected-error@*:* {{use of private header from outside its module: '__string/extern_template_lists.h'}} +#include <__system_error/error_category.h> // expected-error@*:* {{use of private header from outside its module: '__system_error/error_category.h'}} +#include <__system_error/error_code.h> // expected-error@*:* {{use of private header from outside its module: '__system_error/error_code.h'}} +#include <__system_error/error_condition.h> // expected-error@*:* {{use of private header from outside its module: '__system_error/error_condition.h'}} +#include <__system_error/system_error.h> // expected-error@*:* {{use of private header from outside its module: '__system_error/system_error.h'}} #include <__thread/poll_with_backoff.h> // expected-error@*:* {{use of private header from outside its module: '__thread/poll_with_backoff.h'}} #include <__thread/timed_backoff_policy.h> // expected-error@*:* {{use of private header from outside its module: '__thread/timed_backoff_policy.h'}} #include <__tuple_dir/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__tuple_dir/apply_cv.h'}} diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv index 3223ab4..4d87ed2 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx03.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv @@ -158,6 +158,7 @@ concepts cstddef concepts type_traits concepts version condition_variable atomic +condition_variable cerrno condition_variable concepts condition_variable cstddef condition_variable cstdint @@ -170,6 +171,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept +condition_variable string condition_variable system_error condition_variable type_traits condition_variable typeinfo @@ -394,6 +396,7 @@ functional utility functional vector functional version future atomic +future cerrno future chrono future cstddef future cstdint @@ -407,6 +410,7 @@ future mutex future new future ratio future stdexcept +future string future system_error future thread future type_traits @@ -492,6 +496,7 @@ list typeinfo list version locale atomic locale cctype +locale cerrno locale concepts locale cstdarg locale cstddef @@ -555,6 +560,7 @@ memory_resource stdexcept memory_resource tuple memory_resource version mutex atomic +mutex cerrno mutex concepts mutex cstddef mutex cstdint @@ -568,6 +574,7 @@ mutex limits mutex new mutex ratio mutex stdexcept +mutex string mutex system_error mutex type_traits mutex typeinfo @@ -611,6 +618,7 @@ optional variant optional version ostream atomic ostream bitset +ostream cerrno ostream concepts ostream cstddef ostream cstdint @@ -625,6 +633,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream type_traits ostream typeinfo ostream version @@ -739,6 +748,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio +shared_mutex stdexcept +shared_mutex string shared_mutex system_error shared_mutex type_traits shared_mutex version @@ -829,6 +840,7 @@ system_error string system_error type_traits system_error version thread array +thread cerrno thread chrono thread compare thread cstddef @@ -841,6 +853,7 @@ thread limits thread locale thread new thread ratio +thread stdexcept thread string thread string_view thread system_error diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv index 1cc6e3a..4a3fab5 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx11.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv @@ -158,6 +158,7 @@ concepts cstddef concepts type_traits concepts version condition_variable atomic +condition_variable cerrno condition_variable concepts condition_variable cstddef condition_variable cstdint @@ -170,6 +171,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept +condition_variable string condition_variable system_error condition_variable type_traits condition_variable typeinfo @@ -394,6 +396,7 @@ functional utility functional vector functional version future atomic +future cerrno future chrono future cstddef future cstdint @@ -407,6 +410,7 @@ future mutex future new future ratio future stdexcept +future string future system_error future thread future type_traits @@ -492,6 +496,7 @@ list typeinfo list version locale atomic locale cctype +locale cerrno locale concepts locale cstdarg locale cstddef @@ -555,6 +560,7 @@ memory_resource stdexcept memory_resource tuple memory_resource version mutex atomic +mutex cerrno mutex concepts mutex cstddef mutex cstdint @@ -568,6 +574,7 @@ mutex limits mutex new mutex ratio mutex stdexcept +mutex string mutex system_error mutex tuple mutex type_traits @@ -612,6 +619,7 @@ optional variant optional version ostream atomic ostream bitset +ostream cerrno ostream concepts ostream cstddef ostream cstdint @@ -626,6 +634,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream type_traits ostream typeinfo ostream version @@ -740,6 +749,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio +shared_mutex stdexcept +shared_mutex string shared_mutex system_error shared_mutex type_traits shared_mutex version @@ -830,6 +841,7 @@ system_error string system_error type_traits system_error version thread array +thread cerrno thread chrono thread compare thread cstddef @@ -842,6 +854,7 @@ thread limits thread locale thread new thread ratio +thread stdexcept thread string thread string_view thread system_error diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv index d749918..53db202 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx14.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv @@ -158,6 +158,7 @@ concepts cstddef concepts type_traits concepts version condition_variable atomic +condition_variable cerrno condition_variable concepts condition_variable cstddef condition_variable cstdint @@ -170,6 +171,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept +condition_variable string condition_variable system_error condition_variable type_traits condition_variable typeinfo @@ -396,6 +398,7 @@ functional utility functional vector functional version future atomic +future cerrno future chrono future cstddef future cstdint @@ -409,6 +412,7 @@ future mutex future new future ratio future stdexcept +future string future system_error future thread future type_traits @@ -494,6 +498,7 @@ list typeinfo list version locale atomic locale cctype +locale cerrno locale concepts locale cstdarg locale cstddef @@ -557,6 +562,7 @@ memory_resource stdexcept memory_resource tuple memory_resource version mutex atomic +mutex cerrno mutex concepts mutex cstddef mutex cstdint @@ -570,6 +576,7 @@ mutex limits mutex new mutex ratio mutex stdexcept +mutex string mutex system_error mutex tuple mutex type_traits @@ -614,6 +621,7 @@ optional variant optional version ostream atomic ostream bitset +ostream cerrno ostream concepts ostream cstddef ostream cstdint @@ -628,6 +636,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream type_traits ostream typeinfo ostream version @@ -742,6 +751,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio +shared_mutex stdexcept +shared_mutex string shared_mutex system_error shared_mutex type_traits shared_mutex version @@ -832,6 +843,7 @@ system_error string system_error type_traits system_error version thread array +thread cerrno thread chrono thread compare thread cstddef @@ -844,6 +856,7 @@ thread limits thread locale thread new thread ratio +thread stdexcept thread string thread string_view thread system_error diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv index d749918..53db202 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx17.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv @@ -158,6 +158,7 @@ concepts cstddef concepts type_traits concepts version condition_variable atomic +condition_variable cerrno condition_variable concepts condition_variable cstddef condition_variable cstdint @@ -170,6 +171,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept +condition_variable string condition_variable system_error condition_variable type_traits condition_variable typeinfo @@ -396,6 +398,7 @@ functional utility functional vector functional version future atomic +future cerrno future chrono future cstddef future cstdint @@ -409,6 +412,7 @@ future mutex future new future ratio future stdexcept +future string future system_error future thread future type_traits @@ -494,6 +498,7 @@ list typeinfo list version locale atomic locale cctype +locale cerrno locale concepts locale cstdarg locale cstddef @@ -557,6 +562,7 @@ memory_resource stdexcept memory_resource tuple memory_resource version mutex atomic +mutex cerrno mutex concepts mutex cstddef mutex cstdint @@ -570,6 +576,7 @@ mutex limits mutex new mutex ratio mutex stdexcept +mutex string mutex system_error mutex tuple mutex type_traits @@ -614,6 +621,7 @@ optional variant optional version ostream atomic ostream bitset +ostream cerrno ostream concepts ostream cstddef ostream cstdint @@ -628,6 +636,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream type_traits ostream typeinfo ostream version @@ -742,6 +751,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio +shared_mutex stdexcept +shared_mutex string shared_mutex system_error shared_mutex type_traits shared_mutex version @@ -832,6 +843,7 @@ system_error string system_error type_traits system_error version thread array +thread cerrno thread chrono thread compare thread cstddef @@ -844,6 +856,7 @@ thread limits thread locale thread new thread ratio +thread stdexcept thread string thread string_view thread system_error diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv index 8926711..255d4f6 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx20.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv @@ -165,6 +165,7 @@ concepts cstddef concepts type_traits concepts version condition_variable atomic +condition_variable cerrno condition_variable concepts condition_variable cstddef condition_variable cstdint @@ -177,6 +178,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept +condition_variable string condition_variable system_error condition_variable type_traits condition_variable typeinfo @@ -403,6 +405,7 @@ functional utility functional vector functional version future atomic +future cerrno future cstddef future cstdint future cstdlib @@ -415,6 +418,7 @@ future mutex future new future ratio future stdexcept +future string future system_error future thread future type_traits @@ -500,6 +504,7 @@ list typeinfo list version locale atomic locale cctype +locale cerrno locale concepts locale cstdarg locale cstddef @@ -563,6 +568,7 @@ memory_resource stdexcept memory_resource tuple memory_resource version mutex atomic +mutex cerrno mutex concepts mutex cstddef mutex cstdint @@ -576,6 +582,7 @@ mutex limits mutex new mutex ratio mutex stdexcept +mutex string mutex system_error mutex tuple mutex type_traits @@ -620,6 +627,7 @@ optional variant optional version ostream atomic ostream bitset +ostream cerrno ostream concepts ostream cstddef ostream cstdint @@ -634,6 +642,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream type_traits ostream typeinfo ostream version @@ -748,6 +757,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio +shared_mutex stdexcept +shared_mutex string shared_mutex system_error shared_mutex type_traits shared_mutex version @@ -838,6 +849,7 @@ system_error string system_error type_traits system_error version thread array +thread cerrno thread compare thread cstddef thread cstdint diff --git a/libcxx/test/libcxx/transitive_includes/cxx2b.csv b/libcxx/test/libcxx/transitive_includes/cxx2b.csv index efac40b..ac566e7 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx2b.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx2b.csv @@ -103,6 +103,7 @@ complex stdexcept complex version concepts cstddef concepts version +condition_variable cerrno condition_variable cstddef condition_variable ctime condition_variable iosfwd @@ -110,7 +111,7 @@ condition_variable limits condition_variable new condition_variable ratio condition_variable stdexcept -condition_variable system_error +condition_variable string condition_variable typeinfo condition_variable version coroutine compare @@ -213,7 +214,6 @@ filesystem new filesystem ratio filesystem string filesystem string_view -filesystem system_error filesystem version format array format cmath @@ -271,6 +271,7 @@ functional typeinfo functional unordered_map functional vector functional version +future cerrno future cstddef future cstdint future cstdlib @@ -282,7 +283,7 @@ future mutex future new future ratio future stdexcept -future system_error +future string future thread future typeinfo future version @@ -297,7 +298,6 @@ ios cstring ios iosfwd ios mutex ios string -ios system_error ios version iosfwd version iostream ios @@ -337,6 +337,7 @@ list stdexcept list tuple list version locale cctype +locale cerrno locale cstddef locale cstdint locale cstdio @@ -381,6 +382,7 @@ memory_resource new memory_resource stdexcept memory_resource tuple memory_resource version +mutex cerrno mutex cstddef mutex cstdint mutex ctime @@ -389,7 +391,7 @@ mutex limits mutex new mutex ratio mutex stdexcept -mutex system_error +mutex string mutex tuple mutex typeinfo mutex version @@ -411,6 +413,7 @@ optional new optional stdexcept optional version ostream bitset +ostream cerrno ostream cstddef ostream cstdint ostream cstring @@ -422,6 +425,7 @@ ostream locale ostream new ostream stdexcept ostream streambuf +ostream string ostream typeinfo ostream version queue compare @@ -498,7 +502,8 @@ shared_mutex ctime shared_mutex iosfwd shared_mutex limits shared_mutex ratio -shared_mutex system_error +shared_mutex stdexcept +shared_mutex string shared_mutex version source_location cstdint source_location version @@ -554,13 +559,11 @@ strstream version system_error cerrno system_error compare system_error cstddef -system_error cstdint -system_error cstring -system_error limits system_error stdexcept system_error string system_error version thread array +thread cerrno thread compare thread cstddef thread cstdint @@ -573,7 +576,6 @@ thread ratio thread stdexcept thread string thread string_view -thread system_error thread tuple thread vector thread version diff --git a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp index 2f766e6..b4a6566 100644 --- a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp +++ b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp @@ -12,6 +12,7 @@ // template constexpr bool is_error_condition_enum_v; +#include #include #include #include "test_macros.h" diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp index bfd6fd6..0559778 100644 --- a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp +++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "test_macros.h" diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp index 0f5aa8b..2c98c89 100644 --- a/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp +++ b/libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "test_macros.h" diff --git a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp index ac16721..a2d46ab 100644 --- a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp @@ -29,6 +29,7 @@ // throw. #include +#include #include #include diff --git a/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp index 3339a54..9c385b3 100644 --- a/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include "test_macros.h" diff --git a/libcxx/test/std/thread/futures/futures.errors/default_error_condition.pass.cpp b/libcxx/test/std/thread/futures/futures.errors/default_error_condition.pass.cpp index ea25027..5871861 100644 --- a/libcxx/test/std/thread/futures/futures.errors/default_error_condition.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.errors/default_error_condition.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "test_macros.h" diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp index ce97d3f..e7d2462 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp index 210824e..b49a492 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "test_macros.h" diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp index 4aa6660..920baa7 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "make_test_thread.h" diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt index 62f997e..a69f75b 100644 --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -611,7 +611,10 @@ libcxx/include/__support/newlib/xlocale.h libcxx/include/__support/solaris/xlocale.h libcxx/include/__support/win32/locale_win32.h libcxx/include/__support/xlocale/__nop_locale_mgmt.h -libcxx/include/system_error +libcxx/include/__system_error/error_category.h +libcxx/include/__system_error/error_code.h +libcxx/include/__system_error/error_condition.h +libcxx/include/__system_error/system_error.h libcxx/include/thread libcxx/include/__threading_support libcxx/include/__thread/poll_with_backoff.h