Skip to content

Commit

Permalink
Replace typeid with BOOST_CORE_TYPEID to allow using fc library in a …
Browse files Browse the repository at this point in the history
…project with -no-rtti
  • Loading branch information
elmato committed Nov 15, 2017
1 parent 3fd41ba commit 75fdf0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions libraries/fc/include/fc/exception/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <exception>
#include <functional>
#include <unordered_map>
#include <boost/core/typeinfo.hpp>

namespace fc
{
Expand Down Expand Up @@ -383,7 +384,7 @@ namespace fc
fc::exception fce( \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ", ("what",e.what())), \
fc::std_exception_code,\
typeid(e).name(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",fce.to_detail_string()) ); \
throw fce;\
Expand All @@ -404,7 +405,7 @@ namespace fc
fc::exception fce( \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ", FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what())), \
fc::std_exception_code,\
typeid(e).name(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",fce.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
Expand All @@ -426,7 +427,7 @@ namespace fc
fc::exception fce( \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ",FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what()) ), \
fc::std_exception_code,\
typeid(e).name(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",fce.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
Expand All @@ -451,7 +452,7 @@ namespace fc
fc::exception fce( \
FC_LOG_MESSAGE( LOG_LEVEL, "${what}: " FORMAT,__VA_ARGS__("what",e.what())), \
fc::std_exception_code,\
typeid(e).name(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; throw fce;\
} catch( ... ) { \
throw fc::unhandled_exception( \
Expand All @@ -466,7 +467,7 @@ namespace fc
fc::exception fce( \
FC_LOG_MESSAGE( warn, "${what}: ",FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("what",e.what())), \
fc::std_exception_code,\
typeid(e).name(), \
BOOST_CORE_TYPEID(decltype(e)).name(), \
e.what() ) ; throw fce;\
} catch( ... ) { \
throw fc::unhandled_exception( \
Expand Down
3 changes: 2 additions & 1 deletion libraries/fc/include/fc/static_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <stdexcept>
#include <typeinfo>
#include <fc/exception/exception.hpp>
#include <boost/core/typeinfo.hpp>

namespace fc {

Expand Down Expand Up @@ -385,5 +386,5 @@ struct visitor {
s.visit( to_static_variant(ar[1]) );
}

template<typename... T> struct get_typename { static const char* name() { return typeid(static_variant<T...>).name(); } };
template<typename... T> struct get_typename { static const char* name() { return BOOST_CORE_TYPEID(static_variant<T...>).name(); } };
} // namespace fc

0 comments on commit 75fdf0e

Please sign in to comment.