William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 1 | #include <stdplus/exception.hpp> |
| 2 | |
William A. Kennington III | 9a70f4e | 2021-05-01 17:16:57 -0700 | [diff] [blame] | 3 | // These will only be used if the compiler doesn't support them |
Patrick Williams | 5e3b13f | 2021-08-28 14:43:46 -0500 | [diff] [blame] | 4 | #if !__has_builtin(__builtin_LINE) |
William A. Kennington III | 9a70f4e | 2021-05-01 17:16:57 -0700 | [diff] [blame] | 5 | int __builtin_LINE() |
| 6 | { |
| 7 | return -1; |
| 8 | } |
| 9 | const char* __builtin_FILE() |
| 10 | { |
| 11 | return "<unknown>"; |
| 12 | } |
| 13 | const char* __builtin_FUNCTION() |
| 14 | { |
| 15 | return "<unknown>"; |
| 16 | } |
Patrick Williams | 5e3b13f | 2021-08-28 14:43:46 -0500 | [diff] [blame] | 17 | #endif |
William A. Kennington III | 9a70f4e | 2021-05-01 17:16:57 -0700 | [diff] [blame] | 18 | |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 19 | namespace stdplus |
| 20 | { |
| 21 | namespace exception |
| 22 | { |
| 23 | |
William A. Kennington III | 95aab6d | 2023-12-22 16:39:49 -0800 | [diff] [blame^] | 24 | Incomplete::Incomplete(const char* what) : |
| 25 | std::system_error(std::make_error_code(std::errc::illegal_byte_sequence), |
| 26 | what) |
| 27 | {} |
| 28 | |
| 29 | Incomplete::Incomplete(const std::string& what) : |
| 30 | std::system_error(std::make_error_code(std::errc::illegal_byte_sequence), |
| 31 | what) |
| 32 | {} |
| 33 | |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 34 | WouldBlock::WouldBlock(const char* what) : |
| 35 | std::system_error(std::make_error_code(std::errc::operation_would_block), |
| 36 | what) |
Patrick Williams | d1984dd | 2023-05-10 16:12:44 -0500 | [diff] [blame] | 37 | {} |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 38 | |
| 39 | WouldBlock::WouldBlock(const std::string& what) : |
| 40 | std::system_error(std::make_error_code(std::errc::operation_would_block), |
| 41 | what) |
Patrick Williams | d1984dd | 2023-05-10 16:12:44 -0500 | [diff] [blame] | 42 | {} |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 43 | |
| 44 | Eof::Eof(const char* what) : |
| 45 | std::system_error(std::make_error_code(std::errc::no_message_available), |
| 46 | what) |
Patrick Williams | d1984dd | 2023-05-10 16:12:44 -0500 | [diff] [blame] | 47 | {} |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 48 | |
| 49 | Eof::Eof(const std::string& what) : |
| 50 | std::system_error(std::make_error_code(std::errc::no_message_available), |
| 51 | what) |
Patrick Williams | d1984dd | 2023-05-10 16:12:44 -0500 | [diff] [blame] | 52 | {} |
William A. Kennington III | 2f21073 | 2020-08-02 16:12:36 -0700 | [diff] [blame] | 53 | |
| 54 | } // namespace exception |
| 55 | } // namespace stdplus |