1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <__config>
10
11// This has technically been removed in LLVM 3.4
12#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \
13 _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 4
14# define _LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS
15#endif
16
17#include <system_error>
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
21
22// class error_category
23
24#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS)
25error_category::error_category() noexcept {}
26#endif
27
28error_category::~error_category() noexcept {}
29
30error_condition error_category::default_error_condition(int ev) const noexcept { return error_condition(ev, *this); }
31
32bool error_category::equivalent(int code, const error_condition& condition) const noexcept {
33 return default_error_condition(ev: code) == condition;
34}
35
36bool error_category::equivalent(const error_code& code, int condition) const noexcept {
37 return *this == code.category() && code.value() == condition;
38}
39
40_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
41_LIBCPP_END_NAMESPACE_STD
42