2 Permission is granted to use, modify, and / or redistribute at will.
4 This includes removing authorship notices, re-use of code parts in
5 other software (with or without giving credit), and / or creating a
6 commercial product based on it.
8 This permission is not revocable by the author.
10 This software is provided as-is. Use it at your own risk. There is
11 no warranty whatsoever, neither expressed nor implied, and by using
12 this software you accept that the author(s) shall not be held liable
13 for any loss of data, loss of service, or other damages, be they
14 incidental or consequential. Your only option other than accepting
15 this is not to use the software at all.
18 #include <cstdlib> // std::abort()
23 * file-local functions
25 static void default_unexpected_handler()
30 static void default_terminate_handler()
38 * file-local variables
40 static std::unexpected_handler cur_unexpected_handler
= &default_unexpected_handler
;
41 static std::terminate_handler cur_terminate_handler
= &default_terminate_handler
;
45 #ifndef _LIGHTLIBCPP_NO_EXCEPTIONS
48 * Class std::exception
51 std::exception::~exception() throw()
55 const char* std::exception::what() const throw()
57 return "std::exception";
63 * Class std::bad_exception
66 const char* std::bad_exception::what() const throw()
68 return "std::bad_exception";
71 std::bad_exception::~bad_exception() throw()
83 std::unexpected_handler
std::set_unexpected(unexpected_handler f
) throw()
85 unexpected_handler tmp
= cur_unexpected_handler
;
86 cur_unexpected_handler
= f
;
90 std::unexpected_handler
std::__get_unexpected()
92 return cur_unexpected_handler
;
95 void std::unexpected()
97 cur_unexpected_handler();
100 std::terminate_handler
std::set_terminate(terminate_handler f
) throw()
102 terminate_handler tmp
= cur_terminate_handler
;
103 cur_terminate_handler
= f
;
107 std::terminate_handler
std::__get_terminate()
109 return cur_terminate_handler
;
112 void std::terminate()
114 cur_terminate_handler();