Browse Source

Compile fix for Apple's handicapped clang.

cl-refactor
Gav Wood 10 years ago
parent
commit
565e3f19ff
  1. 2
      libdevcore/Exceptions.h
  2. 11
      libethcore/Exceptions.cpp

2
libdevcore/Exceptions.h

@ -31,7 +31,7 @@
namespace dev
{
// base class for all exceptions
struct Exception: virtual std::exception, virtual boost::exception {};
struct Exception: virtual std::exception, virtual boost::exception { mutable std::string m_message; };
struct BadHexCharacter: virtual Exception {};
struct RLPException: virtual Exception {};

11
libethcore/Exceptions.cpp

@ -27,11 +27,14 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
#if _MSC_VER
#define thread_local __declspec( thread )
#endif
#if ALL_COMPILERS_ARE_CPP11
#define ETH_RETURN_STRING(S) thread_local static string s_what; s_what = S; return s_what.c_str();
#elsif USE_BOOST_TLS
static boost::thread_specific_ptr<string> g_exceptionMessage;
#define ETH_RETURN_STRING(S) if (!g_exceptionMessage.get()); g_exceptionMessage.reset(new string); *g_exceptionMessage.get() = S; return g_exceptionMessage.get()->c_str();
#else
#define ETH_RETURN_STRING(S) m_message = S; return m_message.c_str();
#endif
const char* InvalidBlockFormat::what() const noexcept { ETH_RETURN_STRING("Invalid block format: Bad field " + toString(m_f) + " (" + toHex(m_d) + ")"); }
const char* UncleInChain::what() const noexcept { ETH_RETURN_STRING("Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")"); }

Loading…
Cancel
Save