Warning: This file is not a C or C++ file. It does not have highlighting.
1 | // -*- C++ -*- |
---|---|
2 | //===----------------------------------------------------------------------===// |
3 | // |
4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | // See https://llvm.org/LICENSE.txt for license information. |
6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | |
10 | #ifndef _LIBCPP___CXX03___SYSTEM_ERROR_SYSTEM_ERROR_H |
11 | #define _LIBCPP___CXX03___SYSTEM_ERROR_SYSTEM_ERROR_H |
12 | |
13 | #include <__cxx03/__config> |
14 | #include <__cxx03/__system_error/error_category.h> |
15 | #include <__cxx03/__system_error/error_code.h> |
16 | #include <__cxx03/__verbose_abort> |
17 | #include <__cxx03/stdexcept> |
18 | #include <__cxx03/string> |
19 | |
20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
21 | # pragma GCC system_header |
22 | #endif |
23 | |
24 | _LIBCPP_BEGIN_NAMESPACE_STD |
25 | |
26 | class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error { |
27 | error_code __ec_; |
28 | |
29 | public: |
30 | system_error(error_code __ec, const string& __what_arg); |
31 | system_error(error_code __ec, const char* __what_arg); |
32 | system_error(error_code __ec); |
33 | system_error(int __ev, const error_category& __ecat, const string& __what_arg); |
34 | system_error(int __ev, const error_category& __ecat, const char* __what_arg); |
35 | system_error(int __ev, const error_category& __ecat); |
36 | _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default; |
37 | ~system_error() _NOEXCEPT override; |
38 | |
39 | _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; } |
40 | }; |
41 | |
42 | _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg); |
43 | _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) { |
44 | #ifndef _LIBCPP_HAS_NO_EXCEPTIONS |
45 | throw system_error(__ec, __what_arg); |
46 | #else |
47 | _LIBCPP_VERBOSE_ABORT( |
48 | "system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", __ec.value(), __what_arg); |
49 | #endif |
50 | } |
51 | |
52 | _LIBCPP_END_NAMESPACE_STD |
53 | |
54 | #endif // _LIBCPP___CXX03___SYSTEM_ERROR_SYSTEM_ERROR_H |
55 |
Warning: This file is not a C or C++ file. It does not have highlighting.