diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e580bbfc..4adac7060 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,10 @@ function(configureProject) add_definitions(-DETH_CURL) endif() - add_definitions(-DNOBOOST) + if (NOBOOST) + add_definitions(-DNOBOOST) + endif() + add_definitions(-DETH_TRUE) endfunction() diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index a609754dd..e123cdbb1 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -107,7 +107,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--opencl-platform" && i + 1 < argc) try { @@ -116,7 +116,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--opencl-device" && i + 1 < argc) try { @@ -126,7 +126,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--list-devices") m_shouldListDevices = true; @@ -144,7 +144,7 @@ public: else { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if (arg == "--benchmark-warmup" && i + 1 < argc) @@ -154,7 +154,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--benchmark-trial" && i + 1 < argc) try { @@ -163,7 +163,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--benchmark-trials" && i + 1 < argc) try { @@ -172,7 +172,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "-C" || arg == "--cpu") m_minerType = MinerType::CPU; @@ -195,7 +195,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc) @@ -232,7 +232,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if (arg == "-M" || arg == "--benchmark") @@ -245,7 +245,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } } else diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index 6e46807ab..6ae9c165b 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -292,7 +292,7 @@ public: RLPs toList() const; /// @returns the data payload. Valid for all types. - bytesConstRef payload() const { auto l = length(); if (l > m_data.size()) throw BadRLP(); return m_data.cropped(payloadOffset(), l); } + bytesConstRef payload() const { auto l = length(); if (l > m_data.size()) BOOST_THROW_EXCEPTION(BadRLP()); return m_data.cropped(payloadOffset(), l); } /// @returns the theoretical size of this item. /// @note Under normal circumstances, is equivalent to m_data.size() - use that unless you know it won't work. diff --git a/libethcore/BlockInfo.cpp b/libethcore/BlockInfo.cpp index 69da52b09..fec5b4678 100644 --- a/libethcore/BlockInfo.cpp +++ b/libethcore/BlockInfo.cpp @@ -122,7 +122,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const try { if (_header.itemCount() != 15) - throw InvalidBlockHeaderItemCount(); + BOOST_THROW_EXCEPTION(InvalidBlockHeaderItemCount()); parentHash = _header[field = 0].toHash(RLP::VeryStrict); sha3Uncles = _header[field = 1].toHash(RLP::VeryStrict); coinbaseAddress = _header[field = 2].toHash
(RLP::VeryStrict); @@ -146,7 +146,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const } if (number > ~(unsigned)0) - throw InvalidNumber(); + BOOST_THROW_EXCEPTION(InvalidNumber()); // check it hashes according to proof of work or that it's the genesis block. if (_s == CheckEverything && parentHash && !ProofOfWork::verify(*this)) diff --git a/libethcore/ICAP.cpp b/libethcore/ICAP.cpp index 158c297f8..12e8aed56 100644 --- a/libethcore/ICAP.cpp +++ b/libethcore/ICAP.cpp @@ -71,7 +71,7 @@ ICAP ICAP::decoded(std::string const& _encoded) std::string data; std::tie(country, data) = fromIBAN(_encoded); if (country != "XE") - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); if (data.size() == 30) { ret.m_type = Direct; @@ -88,10 +88,10 @@ ICAP ICAP::decoded(std::string const& _encoded) ret.m_client = data.substr(7); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); return ret; } @@ -101,7 +101,7 @@ std::string ICAP::encoded() const if (m_type == Direct) { if (!!m_direct[0]) - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); std::string d = toBase36(m_direct); while (d.size() < 30) d = "0" + d; @@ -118,11 +118,11 @@ std::string ICAP::encoded() const m_institution.size() != 4 || m_client.size() != 9 ) - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); return iban("XE", m_asset + m_institution + m_client); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); } pair ICAP::lookup(std::function const& _call, Address const& _reg) const @@ -149,9 +149,9 @@ pair ICAP::lookup(std::function const& _c else if (m_institution[0] != 'X') return make_pair(resolve(m_institution + "/" + m_client), bytes()); else - throw InterfaceNotSupported("ICAP::lookup(), bad institution"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad institution")); } - throw InterfaceNotSupported("ICAP::lookup(), bad asset"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad asset")); } } diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index a2b5a4e07..0e54f3f42 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -46,7 +46,7 @@ struct KeyInfo static h256 const UnknownPassword; /// Password query function that never returns a password. -static auto const DontKnowThrow = [](){ throw PasswordUnknown(); return std::string(); }; +static auto const DontKnowThrow = [](){ BOOST_THROW_EXCEPTION(PasswordUnknown()); return std::string(); }; enum class SemanticPassword { diff --git a/libethereum/State.cpp b/libethereum/State.cpp index f56c12c91..37978bedb 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -456,7 +456,7 @@ unordered_map State::addresses() const ret[i.first] = RLP(i.second)[1].toInt(); return ret; #else - throw InterfaceNotSupported("State::addresses()"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("State::addresses()")); #endif }