|
| 1 | +#include <cstddef> |
| 2 | +#include <istream> |
| 3 | +#include <stdexcept> |
| 4 | +#include <typeinfo> |
| 5 | + |
| 6 | +#ifndef _GLIBCXX_USE_NOEXCEPT |
| 7 | + #define _GLIBCXX_USE_NOEXCEPT throw() |
| 8 | +#endif |
| 9 | + |
| 10 | +namespace std { |
| 11 | + |
| 12 | +const char* bad_exception::what() const throw() |
| 13 | +{ |
| 14 | + return "std::bad_exception"; |
| 15 | +} |
| 16 | + |
| 17 | +const char* bad_cast::what() const throw() |
| 18 | +{ |
| 19 | + return "std::bad_cast"; |
| 20 | +} |
| 21 | + |
| 22 | +const char* bad_alloc::what() const throw() |
| 23 | +{ |
| 24 | + return "std::bad_alloc"; |
| 25 | +} |
| 26 | + |
| 27 | +namespace __detail |
| 28 | +{ |
| 29 | +struct _List_node_base |
| 30 | +{ |
| 31 | + void _M_hook(std::__detail::_List_node_base* const __position) throw () __attribute__((used)) |
| 32 | + { |
| 33 | + _M_next = __position; |
| 34 | + _M_prev = __position->_M_prev; |
| 35 | + __position->_M_prev->_M_next = this; |
| 36 | + __position->_M_prev = this; |
| 37 | + } |
| 38 | + void _M_unhook() __attribute__((used)) |
| 39 | + { |
| 40 | + _List_node_base* const __next_node = _M_next; |
| 41 | + _List_node_base* const __prev_node = _M_prev; |
| 42 | + __prev_node->_M_next = __next_node; |
| 43 | + __next_node->_M_prev = __prev_node; |
| 44 | + } |
| 45 | + _List_node_base* _M_next; |
| 46 | + _List_node_base* _M_prev; |
| 47 | +}; |
| 48 | +} // namespace detail |
| 49 | + |
| 50 | +template ostream& ostream::_M_insert(bool); |
| 51 | +template ostream& ostream::_M_insert(long); |
| 52 | +template ostream& ostream::_M_insert(double); |
| 53 | +template ostream& ostream::_M_insert(unsigned long); |
| 54 | +template ostream& ostream::_M_insert(const void*); |
| 55 | +template ostream& __ostream_insert(ostream&, const char*, streamsize); |
| 56 | +template istream& istream::_M_extract(long&); |
| 57 | +template istream& istream::_M_extract(unsigned short&); |
| 58 | + |
| 59 | +out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT { } |
| 60 | + |
| 61 | +// Used with permission. |
| 62 | +// See: https://github.com/madlib/madlib/commit/c3db418c0d34d6813608f2137fef1012ce03043d |
| 63 | + |
| 64 | +void |
| 65 | +ctype<char>::_M_widen_init() const { |
| 66 | + char __tmp[sizeof(_M_widen)]; |
| 67 | + for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) |
| 68 | + __tmp[__i] = __i; |
| 69 | + do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen); |
| 70 | + |
| 71 | + _M_widen_ok = 1; |
| 72 | + // Set _M_widen_ok to 2 if memcpy can't be used. |
| 73 | + for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) |
| 74 | + if (__tmp[__i] != _M_widen[__i]) { |
| 75 | + _M_widen_ok = 2; |
| 76 | + break; |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +}// namespace std |
0 commit comments