Anoncoin  0.9.4
P2P Digital Currency
glibcxx_compat.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include <cstddef>
7 #include <istream>
8 #include <stdexcept>
9 #include <typeinfo>
10 
11 #ifndef _GLIBCXX_USE_NOEXCEPT
12 #define _GLIBCXX_USE_NOEXCEPT throw()
13 #endif
14 
15 namespace std
16 {
17 const char* bad_exception::what() const throw()
18 {
19  return "std::bad_exception";
20 }
21 
22 const char* bad_cast::what() const throw()
23 {
24  return "std::bad_cast";
25 }
26 
27 const char* bad_alloc::what() const throw()
28 {
29  return "std::bad_alloc";
30 }
31 
32 namespace __detail
33 {
35  void _M_hook(std::__detail::_List_node_base* const __position) throw() __attribute__((used))
36  {
37  _M_next = __position;
38  _M_prev = __position->_M_prev;
39  __position->_M_prev->_M_next = this;
40  __position->_M_prev = this;
41  }
42 
43  void _M_unhook() __attribute__((used))
44  {
45  _List_node_base* const __next_node = _M_next;
46  _List_node_base* const __prev_node = _M_prev;
47  __prev_node->_M_next = __next_node;
48  __next_node->_M_prev = __prev_node;
49  }
50 
53 };
54 } // namespace detail
55 
56 template ostream& ostream::_M_insert(bool);
57 template ostream& ostream::_M_insert(long);
58 template ostream& ostream::_M_insert(double);
59 template ostream& ostream::_M_insert(unsigned long);
60 template ostream& ostream::_M_insert(const void*);
61 template ostream& __ostream_insert(ostream&, const char*, streamsize);
62 template istream& istream::_M_extract(long&);
63 template istream& istream::_M_extract(unsigned short&);
64 
65 out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {}
66 
67 length_error::~length_error() _GLIBCXX_USE_NOEXCEPT {}
68 
69 // Used with permission.
70 // See: https://github.com/madlib/madlib/commit/c3db418c0d34d6813608f2137fef1012ce03043d
71 
72 void ctype<char>::_M_widen_init() const
73 {
74  char __tmp[sizeof(_M_widen)];
75  for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i)
76  __tmp[__i] = __i;
77  do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
78 
79  _M_widen_ok = 1;
80  // Set _M_widen_ok to 2 if memcpy can't be used.
81  for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i)
82  if (__tmp[__i] != _M_widen[__i]) {
83  _M_widen_ok = 2;
84  break;
85  }
86 }
87 
88 void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__));
89 void __throw_out_of_range_fmt(const char* err, ...)
90 {
91  // Safe and over-simplified version. Ignore the format and print it as-is.
92  __throw_out_of_range(err);
93 }
94 
95 } // namespace std
void _M_unhook() __attribute__((used))
void _M_hook(std::__detail::_List_node_base *const __position) __attribute__((used))
#define _GLIBCXX_USE_NOEXCEPT
template ostream & __ostream_insert(ostream &, const char *, streamsize)
void __throw_out_of_range_fmt(const char *,...) __attribute__((__noreturn__))