From: John Hodge Date: Mon, 26 May 2014 09:43:28 +0000 (+0800) Subject: Usermode/libc++ - Debug in cxa code, list emplace and iterators, general STL fixes X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=1a4752fe23a96f47fb83c57861aa991681fa98b0;p=tpg%2Facess2.git Usermode/libc++ - Debug in cxa code, list emplace and iterators, general STL fixes --- diff --git a/Usermode/Libraries/libc++.so_src/cxxabi.cc b/Usermode/Libraries/libc++.so_src/cxxabi.cc index 84cedf2c..ad8adbde 100644 --- a/Usermode/Libraries/libc++.so_src/cxxabi.cc +++ b/Usermode/Libraries/libc++.so_src/cxxabi.cc @@ -10,6 +10,7 @@ * http://libcxxabi.llvm.org/spec.html */ #include +#include namespace __cxxabiv1 { @@ -34,3 +35,17 @@ __vmi_class_type_info::~__vmi_class_type_info() }; // namespace __cxxabiv1 +extern "C" void __cxa_bad_cast () +{ + _SysDebug("__cxa_bad_cast"); + for(;;); + //throw ::std::bad_cast; +} + +extern "C" void __cxa_bad_typeid () +{ + _SysDebug("__cxa_bad_typeid"); + for(;;); + //throw ::std::bad_typeid; +} + diff --git a/Usermode/Libraries/libc++.so_src/exception_handling.cc b/Usermode/Libraries/libc++.so_src/exception_handling.cc index 44d029ba..1bb26daf 100644 --- a/Usermode/Libraries/libc++.so_src/exception_handling.cc +++ b/Usermode/Libraries/libc++.so_src/exception_handling.cc @@ -8,9 +8,12 @@ #include #include "exception_handling.h" +#include - int uncaught_exception_count; -__cxa_exception *uncaught_exception_top; +/*__thread*/ struct __cxa_eh_globals { + __cxa_exception *caughtExceptions; + unsigned int uncaughtExceptions; +} eh_globals; /*__thread*/ struct { __cxa_exception info; @@ -25,14 +28,24 @@ static bool TEST_AND_SET(bool& flag) { } // === CODE === +extern "C" __cxa_eh_globals *__cxa_get_globals(void) +{ + return &eh_globals; +} +extern "C" __cxa_eh_globals *__cxa_get_globals_fast(void) +{ + return &eh_globals; +} extern "C" void __cxa_call_unexpected(void *) { // An unexpected exception was thrown from a function that lists its possible exceptions + _SysDebug("__cxa_call_unexpected - TODO"); for(;;); } extern "C" void *__cxa_allocate_exception(size_t thrown_size) { + ::_SysDebug("__cxa_allocate_exception(%i)", thrown_size); __cxa_exception *ret = static_cast<__cxa_exception*>( malloc( sizeof(__cxa_exception) + thrown_size ) ); if( !ret ) { if( thrown_size <= sizeof(emergency_exception.buf) && TEST_AND_SET(emergency_exception_used) ) @@ -41,13 +54,16 @@ extern "C" void *__cxa_allocate_exception(size_t thrown_size) } } if( !ret ) { + _SysDebug("__cxa_allocate_exception - No free space"); ::std::terminate(); } - return ret; + ::_SysDebug("__cxa_allocate_exception: return %p", ret+1); + return ret + 1; } extern "C" void __cxa_free_exception(void *thrown_exception) { + ::_SysDebug("__cxa_free_exception(%p)", thrown_exception); if(thrown_exception == &emergency_exception.buf) { //assert(emergency_exception_used); emergency_exception_used = false; @@ -60,37 +76,49 @@ extern "C" void __cxa_free_exception(void *thrown_exception) extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void*)) { + ::_SysDebug("__cxa_throw(%p,%p,%p) '%s'", thrown_exception, tinfo, dest, tinfo->name()); + { + const ::std::exception* e = reinterpret_cast(thrown_exception); + ::_SysDebug("- e.what() = '%s'", e->what()); + } + ::_SysDebug("- typeid(*tinfo) = %p", &typeid(*tinfo)); + __cxa_exception *except = static_cast<__cxa_exception*>( thrown_exception ) - 1; + except->unexpectedHandler = 0; + except->terminateHandler = 0; except->exceptionType = tinfo; except->exceptionDestructor = dest; memcpy(&except->unwindHeader.exception_class, "Ac20C++\0", 8); - uncaught_exception_top ++; + __cxa_get_globals()->uncaughtExceptions ++; _Unwind_RaiseException(thrown_exception); + ::_SysDebug("__cxa_throw(%p,%s) :: UNCAUGHT", thrown_exception, tinfo->name()); ::std::terminate(); } extern "C" void *__cxa_begin_catch(void *exceptionObject) { + ::_SysDebug("__cxa_begin_catch(%p)", exceptionObject); __cxa_exception *except = static_cast<__cxa_exception*>( exceptionObject ) - 1; except->handlerCount ++; - except->nextException = uncaught_exception_top; - uncaught_exception_top = except; + except->nextException = __cxa_get_globals()->caughtExceptions; + __cxa_get_globals()->caughtExceptions = except; - uncaught_exception_count --; + __cxa_get_globals_fast()->uncaughtExceptions --; return except; } extern "C" void __cxa_end_catch() { - struct __cxa_exception *except = uncaught_exception_top; + struct __cxa_exception *except = __cxa_get_globals()->caughtExceptions; + ::_SysDebug("__cxa_end_catch - %p", except); except->handlerCount --; - uncaught_exception_top = except->nextException; + __cxa_get_globals()->caughtExceptions = except->nextException; if( except->handlerCount == 0 ) { __cxa_free_exception(except+1); diff --git a/Usermode/Libraries/libc++.so_src/exception_handling.h b/Usermode/Libraries/libc++.so_src/exception_handling.h index b1feae55..eb65fd1d 100644 --- a/Usermode/Libraries/libc++.so_src/exception_handling.h +++ b/Usermode/Libraries/libc++.so_src/exception_handling.h @@ -34,8 +34,8 @@ struct __cxa_exception { std::type_info* exceptionType; void (*exceptionDestructor)(void *); - unexpected_handler unexpectedHandler; - terminate_handler terminateHandler; + unexpected_handler* unexpectedHandler; + terminate_handler* terminateHandler; __cxa_exception* nextException; int handlerCount; diff --git a/Usermode/Libraries/libc++.so_src/exceptions.cc b/Usermode/Libraries/libc++.so_src/exceptions.cc index 593ce3ad..f570f341 100644 --- a/Usermode/Libraries/libc++.so_src/exceptions.cc +++ b/Usermode/Libraries/libc++.so_src/exceptions.cc @@ -38,6 +38,7 @@ const char* ::std::exception::what() const throw() void ::std::terminate() { + _SysDebug("::std::terminate()"); _exit(0); } @@ -51,3 +52,8 @@ void ::std::terminate() logic_error(what_str) { } + +::std::length_error::length_error(const ::std::string& what_str): + logic_error(what_str) +{ +} diff --git a/Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h b/Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h new file mode 100644 index 00000000..e131c42a --- /dev/null +++ b/Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h @@ -0,0 +1,12 @@ + +#ifndef _LIBCXX__LIBCXX_HELEPRS_H_ +#define _LIBCXX__LIBCXX_HELEPRS_H_ + +#if __cplusplus > 199711L // C++11 check +# define _CXX11_AVAIL 1 +#else +# define _CXX11_AVAIL 0 +#endif + +#endif + diff --git a/Usermode/Libraries/libc++.so_src/include_exp/allocator b/Usermode/Libraries/libc++.so_src/include_exp/allocator index 656507f6..6057eb3d 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/allocator +++ b/Usermode/Libraries/libc++.so_src/include_exp/allocator @@ -8,8 +8,11 @@ #ifndef _LIBCXX_ALLOCATOR_ #define _LIBCXX_ALLOCATOR_ +#include "_libcxx_helpers.h" + #include "new" #include "cstddef" +#include "utility" namespace std { @@ -61,10 +64,12 @@ public: new ((void*)p) value_type (val); } // C++11 - //template - //void construct( U* p, Args&&... args ) { - // ::new ((void*)p) U (forward(args)); - //} + #if _CXX11_AVAIL + template + void construct( U* p, Args&&... args ) { + ::new ((void*)p) U (::std::forward(args)...); + } + #endif void destroy(pointer p) { p->~value_type(); } diff --git a/Usermode/Libraries/libc++.so_src/include_exp/iterator b/Usermode/Libraries/libc++.so_src/include_exp/iterator new file mode 100644 index 00000000..d96082a0 --- /dev/null +++ b/Usermode/Libraries/libc++.so_src/include_exp/iterator @@ -0,0 +1,35 @@ +/* + */ +#ifndef _LIBCXX_ITERATOR_ +#define _LIBCXX_ITERATOR_ + +namespace std { + +struct input_iterator_tag {}; +struct output_iterator_tag {}; +struct forward_iterator_tag {}; +struct bidrectional_iterator_tag {}; +struct random_access_iterator_tag {}; + +template +class iterator +{ +public: + typedef T value_type; + typedef Distance difference_type; + typedef Pointer pointer_type; + typedef Reference reference; + typedef Category iterator_category; +}; + +template class iterator_traits; +template class iterator_traits; +template class iterator_traits; + + +}; // namespace std + +#endif + +// vim: ft=cpp + diff --git a/Usermode/Libraries/libc++.so_src/include_exp/list b/Usermode/Libraries/libc++.so_src/include_exp/list index ff826141..f63e31de 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/list +++ b/Usermode/Libraries/libc++.so_src/include_exp/list @@ -10,11 +10,13 @@ #include #include "allocator" +#include "stdexcept" +#include "utility" namespace std { namespace _bits { -template class list_iterator; +template class list_iterator; template class list_item; } @@ -23,7 +25,7 @@ class list { typedef ::std::_bits::list_item item_type; typedef ::std::_bits::list_item const_item_type; - friend class ::std::_bits::list_iterator; + friend class ::std::_bits::list_iterator; typedef typename Alloc::template rebind::other item_allocator; public: @@ -33,8 +35,8 @@ public: typedef typename allocator_type::const_reference const_reference; typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; - typedef _bits::list_iterator iterator; - typedef _bits::list_iterator const_iterator; + typedef _bits::list_iterator iterator; + typedef _bits::list_iterator const_iterator; typedef int difference_type; typedef size_t size_type; @@ -43,6 +45,7 @@ private: allocator_type m_allocator; item_type *m_start; item_type *m_end; + size_type m_item_count; public: list(const allocator_type& alloc = allocator_type()): @@ -64,29 +67,41 @@ public: list& operator =(const list& x); iterator begin() { - return iterator(m_start); + return iterator(*this, m_start); } const_iterator begin() const { - return const_iterator(m_start); + return const_iterator(*this, m_start); } iterator end() { - return iterator(0); + return iterator(*this, 0); } const_iterator end() const { - return const_iterator(0); + return const_iterator(*this, 0); } bool empty() const { return !m_start; } - size_t size() const; - size_t max_size() const; + size_t size() const { + return m_item_count; + } + size_t max_size() const { + return (size_type)-1 / sizeof(item_type); + } - T& front(); - const T& front() const; - T& back(); - const T& back() const; + T& front() { + return m_start->value; + } + const T& front() const { + return m_start->value; + } + T& back() { + return m_end->value; + } + const T& back() const { + return m_end->value; + } void assign(size_type n, const value_type& val) { clear(); @@ -109,28 +124,17 @@ public: erase(end()); } + template + iterator emplace(iterator position, Args&&... args) { + item_type *newi = m_item_allocator.allocate(1); + m_allocator.construct(&newi->value, ::std::forward(args)...); + return insert_item(position, newi); + } + iterator insert(iterator position, const value_type& val) { item_type *newi = m_item_allocator.allocate(1); m_allocator.construct(&newi->value, val); - if( position == end() ) { - newi->next = 0; - newi->prev = m_end; - m_end->next = newi; - m_end = newi; - } - else if( position == begin() ) { - newi->next = m_start; - newi->prev = 0; - m_start->prev = newi; - m_start = newi; - } - else { - newi->prev = position.cur->prev; - newi->next = position.cur; - position.cur->prev->next = newi; - position.cur->prev = newi; - } - return ++position; + return insert_item(position, newi); } void insert(iterator position, size_type n, const value_type& val) { for( size_type i = 0; i < n; i ++ ) @@ -142,8 +146,8 @@ public: if( position == end() ) { } else { - item_type *oldi = position.cur; - position ++; + item_type *oldi = position.m_cur; + ++ position; if(oldi->prev) oldi->prev->next = oldi->next; @@ -153,7 +157,8 @@ public: oldi->next->prev = oldi->prev; else m_end = oldi->prev; - + + m_item_count --; m_allocator.destroy(&oldi->value); m_item_allocator.deallocate(oldi, 1); } @@ -166,6 +171,39 @@ public: m_start = m_start->next; delete item; } + m_item_count = 0; + } +private: + iterator insert_item(iterator position, item_type *newi) { + m_item_count ++; + if( m_start == 0 ) { + newi->next = 0; + newi->prev = m_end; + m_start = newi; + m_end = newi; + return end(); + } + if( position == end() ) { + newi->next = 0; + newi->prev = m_end; + //assert(m_end); + m_end->next = newi; + m_end = newi; + } + else if( position == begin() ) { + newi->next = m_start; + newi->prev = 0; + //assert(m_start); + m_start->prev = newi; + m_start = newi; + } + else { + newi->prev = position.m_cur->prev; + newi->next = position.m_cur; + position.m_cur->prev->next = newi; + position.m_cur->prev = newi; + } + return ++position; } }; @@ -181,38 +219,57 @@ struct list_item value_type value; }; -template +template class list_iterator//: //public bidirectional_iterator_tag; { - list_item *cur; - friend class ::std::list; + const ListType* m_list; + list_item *m_cur; + friend ListType; public: + list_iterator(const list_iterator& x): + m_list(x.m_list), + m_cur (x.m_cur) + { + } + list_iterator& operator=(const list_iterator& x) { + m_list = x.m_list; + m_cur = x.m_cur; + } + bool operator == (const list_iterator& other) const { - return cur == other.cur; + return m_cur == other.m_cur; } bool operator != (const list_iterator& other) const { - return cur != other.cur; + return !(*this == other); } T& operator * () { - return cur->value; + return m_cur->value; } T& operator -> () { - return cur->value; + return m_cur->value; } list_iterator& operator ++ () { - cur = cur->next; + if(!m_cur) + throw ::std::logic_error("list iterator ++ on end"); + m_cur = m_cur->next; return *this; } list_iterator& operator -- () { - cur = cur->prev; + if( m_cur == m_list->m_start ) + throw ::std::logic_error("list iterator -- on start"); + if(!m_cur) + m_cur = m_list->m_end; + else + m_cur = m_cur->prev; return *this; } - + private: - list_iterator(list_item *item): - cur(item) + list_iterator(const ListType& list, list_item *item): + m_list(&list), + m_cur(item) { } }; diff --git a/Usermode/Libraries/libc++.so_src/include_exp/stdexcept b/Usermode/Libraries/libc++.so_src/include_exp/stdexcept index aea1afd3..aa7072bb 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/stdexcept +++ b/Usermode/Libraries/libc++.so_src/include_exp/stdexcept @@ -33,6 +33,13 @@ public: explicit out_of_range(const string& what_arg); }; +class length_error: + public logic_error +{ +public: + explicit length_error(const string& what_arg); +}; + }; // namespace std #endif diff --git a/Usermode/Libraries/libc++.so_src/include_exp/system_error b/Usermode/Libraries/libc++.so_src/include_exp/system_error index ec08bee1..e9a88472 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/system_error +++ b/Usermode/Libraries/libc++.so_src/include_exp/system_error @@ -8,7 +8,9 @@ #ifndef _LIBCXX_SYSTEM_ERROR_ #define _LIBCXX_SYSTEM_ERROR_ -#if __cplusplus <= 199711L // C++11 check +#include "_libcxx_helpers.h" + +#if !_CXX11_AVAIL # error "This header requires C++11 support enabled" #endif @@ -20,13 +22,13 @@ class error_category; class error_condition; class error_code; -bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept; -bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; -bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept; -bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; -bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; -bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; -bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; +static bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept; +static bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; +static bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept; +static bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; +static bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; +static bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; +static bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; extern const error_category& generic_category() noexcept; extern const error_category& system_category() noexcept; @@ -154,25 +156,25 @@ public: const char* what() const noexcept; }; -bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept { +static inline bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept { return lhs.category() == rhs.category() && lhs.value() == rhs.value(); } -bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept { +static inline bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept { return !(lhs == rhs); } -bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept { +static inline bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept { return lhs.category() < rhs.category() || lhs.value() < rhs.value(); } -bool operator==(const error_condition& lhs, const error_code& rhs) noexcept { +static inline bool operator==(const error_condition& lhs, const error_code& rhs) noexcept { return lhs.category().equivalent(rhs, lhs.value()) || rhs.category().equivalent(rhs.value(), lhs); } -bool operator==(const error_code& lhs, const error_condition& rhs) noexcept { +static inline bool operator==(const error_code& lhs, const error_condition& rhs) noexcept { return lhs.category().equivalent(lhs.value(),rhs) || rhs.category().equivalent(lhs,rhs.value()); } -bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept { +static inline bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept { return !(lhs == rhs); } -bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept { +static inline bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept { return !(lhs == rhs); } diff --git a/Usermode/Libraries/libc++.so_src/include_exp/type_traits b/Usermode/Libraries/libc++.so_src/include_exp/type_traits new file mode 100644 index 00000000..62103ac2 --- /dev/null +++ b/Usermode/Libraries/libc++.so_src/include_exp/type_traits @@ -0,0 +1,24 @@ +/* + * Acess2 C++ Library + * - By John Hodge (thePowersGang) + * + * type_traits (header) + * - C++11 type traits + */ +#ifndef _LIBCXX_TYPE_TRAITS_ +#define _LIBCXX_TYPE_TRAITS_ + +#include "_libcxx_helpers.h" + +#if !_CXX11_AVAIL +# error "This header requires C++11 support enabled" +#endif + +template struct remove_reference { typedef T type; }; +template struct remove_reference { typedef T type; }; +template struct remove_reference { typedef T type; }; + +#endif + +// vim: ft=cpp + diff --git a/Usermode/Libraries/libc++.so_src/include_exp/utility b/Usermode/Libraries/libc++.so_src/include_exp/utility index 6f057443..9b7957c5 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/utility +++ b/Usermode/Libraries/libc++.so_src/include_exp/utility @@ -8,6 +8,9 @@ #ifndef _LIBCXX_UTILITY_ #define _LIBCXX_UTILITY_ +#include "_libcxx_helpers.h" +#include "type_traits" + namespace std { template @@ -46,6 +49,17 @@ bool operator!= (const pair& lhs, const pair& rhs) { return !(lhs == rhs); } +#if _CXX11_AVAIL +template +T&& forward(typename remove_reference::type& arg) noexcept { + return static_cast(arg); +} +template +T&& forward(typename remove_reference::type&& arg) noexcept { + return static_cast(arg); +} +#endif + }; // namespace std #endif diff --git a/Usermode/Libraries/libc++.so_src/include_exp/vector b/Usermode/Libraries/libc++.so_src/include_exp/vector index 870c49b8..30bd207c 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/vector +++ b/Usermode/Libraries/libc++.so_src/include_exp/vector @@ -9,6 +9,9 @@ #define _LIBCXX_VECTOR_ #include +#include + +extern "C" void _SysDebug(const char *, ...); namespace std { @@ -44,7 +47,7 @@ public: return *this; } bool operator==(const vector_iterator& other) const { - return m_array == other.m_array && m_pos == other.m_pos; + return m_pos == other.m_pos; } bool operator!=(const vector_iterator& other) const { return !(*this == other); @@ -102,7 +105,7 @@ public: vector(size_type n, const value_type& val = value_type(), const allocator_type& alloc = allocator_type()): vector(alloc) { - + resize(n, val); } vector(const vector& x): vector(x.m_alloc) @@ -159,8 +162,19 @@ public: return m_size == 0; } void reserve(size_type n) { - //if( n > max_size() ) - // throw ::std::length_error(); + if( n > max_size() ) + throw ::std::length_error("::std::vector::reserve"); + if( n > m_capacity ) + { + size_type size = (n + 0x1F) & ~0x1F; + auto new_area = m_alloc.allocate(size); + for( size_type i = 0; i < m_size; i ++ ) + new_area[i] = m_data[i]; + m_alloc.deallocate(m_data, m_capacity); + m_data = new_area; + m_capacity = size; + //::_SysDebug("::std::vector::resize - m_capacity=%i for n=%i", m_capacity, n); + } } void shrink_to_fit() { } diff --git a/Usermode/Libraries/libc++.so_src/misc.cc b/Usermode/Libraries/libc++.so_src/misc.cc index ed0a2eb6..8daa7d46 100644 --- a/Usermode/Libraries/libc++.so_src/misc.cc +++ b/Usermode/Libraries/libc++.so_src/misc.cc @@ -9,6 +9,8 @@ extern "C" int SoMain() { + //extern void _init(); + //_init(); // nope return 0; } diff --git a/Usermode/Libraries/libc++.so_src/new.cc b/Usermode/Libraries/libc++.so_src/new.cc index f2b2458c..9dae8536 100644 --- a/Usermode/Libraries/libc++.so_src/new.cc +++ b/Usermode/Libraries/libc++.so_src/new.cc @@ -7,24 +7,29 @@ */ #include #include +#include // === CODE === void *operator new( size_t size ) { + //_SysDebug("libc++ - operator new(%i)", size); return malloc( size ); } void *operator new( size_t size, void* ptr ) { + //_SysDebug("libc++ - operator new(%i, %p)", size, ptr); size = size; return ptr; } void *operator new[]( size_t size ) { + //_SysDebug("libc++ - operator new[](%i)", size); return malloc( size ); } void *operator new[]( size_t size, void* ptr ) { + //_SysDebug("libc++ - operator new[](%i, %p)", size, ptr); size = size; return ptr; } diff --git a/Usermode/Libraries/libc++.so_src/typeinfo.cc b/Usermode/Libraries/libc++.so_src/typeinfo.cc index b0a9b3e1..c7cb5bc6 100644 --- a/Usermode/Libraries/libc++.so_src/typeinfo.cc +++ b/Usermode/Libraries/libc++.so_src/typeinfo.cc @@ -6,6 +6,7 @@ * - typeid and dynamic_cast */ #include +#include namespace std { @@ -16,16 +17,19 @@ type_info::~type_info() bool type_info::operator==(const type_info& other) const { + _SysDebug("type_info::operator== - '%s' == '%s'", this->__type_name, other.__type_name); return this->__type_name == other.__type_name; } bool type_info::operator!=(const type_info& other) const { + _SysDebug("type_info::operator!= - '%s' != '%s'", this->__type_name, other.__type_name); return this->__type_name != other.__type_name; } bool type_info::before(const type_info& other) const { + _SysDebug("type_info::before - '%s' < '%s'", this->__type_name, other.__type_name); return this->__type_name < other.__type_name; } @@ -47,4 +51,3 @@ type_info& type_info::operator=(const type_info& rhs) }; // namespace std -