Browse Source

More attempts to fix for the ultra-pedantic clang compiler.

cl-refactor
Gav Wood 10 years ago
parent
commit
d93cccc463
  1. 1
      exp/main.cpp
  2. 2
      libdevcore/CommonIO.cpp
  3. 1
      libdevcore/Exceptions.h
  4. 35
      libethcore/Exceptions.cpp
  5. 35
      libethcore/Exceptions.h
  6. 1
      libethereum/Executive.cpp
  7. 8
      libethereum/Miner.cpp
  8. 2
      libethereum/Miner.h
  9. 1
      libethereum/State.cpp
  10. 2
      libevm/ExtVMFace.h
  11. 1
      libevmface/Instruction.cpp
  12. 1
      liblll/CodeFragment.cpp
  13. 1
      libp2p/Host.cpp
  14. 1
      libp2p/Session.cpp
  15. 1
      libp2p/Session.h
  16. 1
      libp2p/UPnP.cpp
  17. 3
      test/hexPrefix.cpp
  18. 1
      test/rlp.cpp
  19. 1
      test/trie.cpp
  20. 1
      test/vm.cpp

1
exp/main.cpp

@ -24,6 +24,7 @@
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonData.h> #include <libdevcore/CommonData.h>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/CommonIO.h>
#include <libp2p/All.h> #include <libp2p/All.h>
#include <libdevcore/RangeMask.h> #include <libdevcore/RangeMask.h>
#include <libethereum/DownloadMan.h> #include <libethereum/DownloadMan.h>

2
libdevcore/CommonIO.cpp

@ -19,7 +19,7 @@
* @date 2014 * @date 2014
*/ */
#include "Common.h" #include "CommonIO.h"
#include <fstream> #include <fstream>
#include "Exceptions.h" #include "Exceptions.h"

1
libdevcore/Exceptions.h

@ -25,7 +25,6 @@
#include <boost/exception/all.hpp> #include <boost/exception/all.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <libdevcrypto/Common.h> #include <libdevcrypto/Common.h>
#include "CommonIO.h"
#include "CommonData.h" #include "CommonData.h"
#include "FixedHash.h" #include "FixedHash.h"

35
libethcore/Exceptions.cpp

@ -0,0 +1,35 @@
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file Exceptions.cpp
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#include "Exceptions.h"
#include <libdevcore/CommonIO.h>
using namespace dev;
using namespace dev::eth;
const char* InvalidBlockFormat::what() const noexcept { return ("Invalid block format: Bad field " + toString(m_f) + " (" + toHex(m_d) + ")").c_str(); }
const char* UncleInChain::what() const noexcept { return ("Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")").c_str(); }
const char* InvalidTransactionsHash::what() const noexcept { return ("Invalid transactions hash: header says: " + toHex(m_head.ref()) + " block is:" + toHex(m_real.ref())).c_str(); }
const char* InvalidGasLimit::what() const noexcept { return ("Invalid gas limit (provided: " + toString(provided) + " valid:" + toString(valid) + ")").c_str(); }
const char* InvalidMinGasPrice::what() const noexcept { return ("Invalid minimum gas price (provided: " + toString(provided) + " limit:" + toString(limit) + ")").c_str(); }
const char* InvalidNonce::what() const noexcept { return ("Invalid nonce (r: " + toString(required) + " c:" + toString(candidate) + ")").c_str(); }
const char* InvalidBlockNonce::what() const noexcept { return ("Invalid nonce (h: " + toString(h) + " n:" + toString(n) + " d:" + toString(d) + ")").c_str(); }

35
libethcore/Exceptions.h

@ -1,3 +1,24 @@
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file Exceptions.h
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#pragma once #pragma once
#include <libdevcore/Exceptions.h> #include <libdevcore/Exceptions.h>
@ -23,23 +44,23 @@ struct FeeTooSmall: virtual dev::Exception {};
struct TooMuchGasUsed: virtual dev::Exception {}; struct TooMuchGasUsed: virtual dev::Exception {};
struct ExtraDataTooBig: virtual dev::Exception {}; struct ExtraDataTooBig: virtual dev::Exception {};
struct InvalidSignature: virtual dev::Exception {}; struct InvalidSignature: virtual dev::Exception {};
class InvalidBlockFormat: public dev::Exception { public: InvalidBlockFormat(int _f, bytesConstRef _d): m_f(_f), m_d(_d.toBytes()) {} int m_f; bytes m_d; virtual const char* what() const noexcept { return ("Invalid block format: Bad field " + toString(m_f) + " (" + toHex(m_d) + ")").c_str(); } }; class InvalidBlockFormat: public dev::Exception { public: InvalidBlockFormat(int _f, bytesConstRef _d): m_f(_f), m_d(_d.toBytes()) {} int m_f; bytes m_d; virtual const char* what() const noexcept; };
struct InvalidUnclesHash: virtual dev::Exception {}; struct InvalidUnclesHash: virtual dev::Exception {};
struct InvalidUncle: virtual dev::Exception {}; struct InvalidUncle: virtual dev::Exception {};
struct UncleTooOld: virtual dev::Exception {}; struct UncleTooOld: virtual dev::Exception {};
class UncleInChain: public dev::Exception { public: UncleInChain(h256Set _uncles, h256 _block): m_uncles(_uncles), m_block(_block) {} h256Set m_uncles; h256 m_block;virtual const char* what() const noexcept { return ("Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")").c_str(); } }; class UncleInChain: public dev::Exception { public: UncleInChain(h256Set _uncles, h256 _block): m_uncles(_uncles), m_block(_block) {} h256Set m_uncles; h256 m_block;virtual const char* what() const noexcept; };
struct DuplicateUncleNonce: virtual dev::Exception {}; struct DuplicateUncleNonce: virtual dev::Exception {};
struct InvalidStateRoot: virtual dev::Exception {}; struct InvalidStateRoot: virtual dev::Exception {};
class InvalidTransactionsHash: public dev::Exception { public: InvalidTransactionsHash(h256 _head, h256 _real): m_head(_head), m_real(_real) {} h256 m_head; h256 m_real; virtual const char* what() const noexcept { return ("Invalid transactions hash: header says: " + toHex(m_head.ref()) + " block is:" + toHex(m_real.ref())).c_str(); } }; class InvalidTransactionsHash: public dev::Exception { public: InvalidTransactionsHash(h256 _head, h256 _real): m_head(_head), m_real(_real) {} h256 m_head; h256 m_real; virtual const char* what() const noexcept; };
struct InvalidTransaction: virtual dev::Exception {}; struct InvalidTransaction: virtual dev::Exception {};
struct InvalidDifficulty: virtual dev::Exception {}; struct InvalidDifficulty: virtual dev::Exception {};
class InvalidGasLimit: public dev::Exception { public: InvalidGasLimit(u256 _provided = 0, u256 _valid = 0): provided(_provided), valid(_valid) {} u256 provided; u256 valid; virtual const char* what() const noexcept { return ("Invalid gas limit (provided: " + toString(provided) + " valid:" + toString(valid) + ")").c_str(); } }; class InvalidGasLimit: public dev::Exception { public: InvalidGasLimit(u256 _provided = 0, u256 _valid = 0): provided(_provided), valid(_valid) {} u256 provided; u256 valid; virtual const char* what() const noexcept; };
class InvalidMinGasPrice: public dev::Exception { public: InvalidMinGasPrice(u256 _provided = 0, u256 _limit = 0): provided(_provided), limit(_limit) {} u256 provided; u256 limit; virtual const char* what() const noexcept { return ("Invalid minimum gas price (provided: " + toString(provided) + " limit:" + toString(limit) + ")").c_str(); } }; class InvalidMinGasPrice: public dev::Exception { public: InvalidMinGasPrice(u256 _provided = 0, u256 _limit = 0): provided(_provided), limit(_limit) {} u256 provided; u256 limit; virtual const char* what() const noexcept; };
struct InvalidTransactionGasUsed: virtual dev::Exception {}; struct InvalidTransactionGasUsed: virtual dev::Exception {};
struct InvalidTransactionStateRoot: virtual dev::Exception {}; struct InvalidTransactionStateRoot: virtual dev::Exception {};
struct InvalidTimestamp: virtual dev::Exception {}; struct InvalidTimestamp: virtual dev::Exception {};
class InvalidNonce: public dev::Exception { public: InvalidNonce(u256 _required = 0, u256 _candidate = 0): required(_required), candidate(_candidate) {} u256 required; u256 candidate; virtual const char* what() const noexcept { return ("Invalid nonce (r: " + toString(required) + " c:" + toString(candidate) + ")").c_str(); } }; class InvalidNonce: public dev::Exception { public: InvalidNonce(u256 _required = 0, u256 _candidate = 0): required(_required), candidate(_candidate) {} u256 required; u256 candidate; virtual const char* what() const noexcept; };
class InvalidBlockNonce: public dev::Exception { public: InvalidBlockNonce(h256 _h = h256(), h256 _n = h256(), u256 _d = 0): h(_h), n(_n), d(_d) {} h256 h; h256 n; u256 d; virtual const char* what() const noexcept { return ("Invalid nonce (h: " + toString(h) + " n:" + toString(n) + " d:" + toString(d) + ")").c_str(); } }; class InvalidBlockNonce: public dev::Exception { public: InvalidBlockNonce(h256 _h = h256(), h256 _n = h256(), u256 _d = 0): h(_h), n(_n), d(_d) {} h256 h; h256 n; u256 d; virtual const char* what() const noexcept; };
struct InvalidParentHash: virtual dev::Exception {}; struct InvalidParentHash: virtual dev::Exception {};
struct InvalidNumber: virtual dev::Exception {}; struct InvalidNumber: virtual dev::Exception {};
struct InvalidContractAddress: virtual dev::Exception {}; struct InvalidContractAddress: virtual dev::Exception {};

1
libethereum/Executive.cpp

@ -20,6 +20,7 @@
*/ */
#include <boost/timer.hpp> #include <boost/timer.hpp>
#include <libdevcore/CommonIO.h>
#include <libevm/VM.h> #include <libevm/VM.h>
#include "Executive.h" #include "Executive.h"
#include "State.h" #include "State.h"

8
libethereum/Miner.cpp

@ -21,6 +21,8 @@
*/ */
#include "Miner.h" #include "Miner.h"
#include <libdevcore/CommonIO.h>
#include "State.h" #include "State.h"
using namespace std; using namespace std;
using namespace dev; using namespace dev;
@ -32,6 +34,12 @@ Miner::Miner(MinerHost* _host, unsigned _id):
{ {
} }
void Miner::setup(MinerHost* _host, unsigned _id)
{
m_host = _host;
setName("miner-" + toString(_id));
}
void Miner::doWork() void Miner::doWork()
{ {
// Do some mining. // Do some mining.

2
libethereum/Miner.h

@ -94,7 +94,7 @@ public:
~Miner() { stop(); } ~Miner() { stop(); }
/// Setup its basics. /// Setup its basics.
void setup(MinerHost* _host, unsigned _id = 0) { m_host = _host; setName("miner-" + toString(_id)); } void setup(MinerHost* _host, unsigned _id = 0);
/// Start mining. /// Start mining.
void start() { startWorking(); } void start() { startWorking(); }

1
libethereum/State.cpp

@ -25,6 +25,7 @@
#include <time.h> #include <time.h>
#include <random> #include <random>
#include <secp256k1/secp256k1.h> #include <secp256k1/secp256k1.h>
#include <libdevcore/CommonIO.h>
#include <libevmface/Instruction.h> #include <libevmface/Instruction.h>
#include <libethcore/Exceptions.h> #include <libethcore/Exceptions.h>
#include <libethcore/Dagger.h> #include <libethcore/Dagger.h>

2
libevm/ExtVMFace.h

@ -21,6 +21,8 @@
#pragma once #pragma once
#include <list>
#include <functional>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libevmface/Instruction.h> #include <libevmface/Instruction.h>
#include <libethcore/CommonEth.h> #include <libethcore/CommonEth.h>

1
libevmface/Instruction.cpp

@ -22,6 +22,7 @@
#include "Instruction.h" #include "Instruction.h"
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
using namespace std; using namespace std;
using namespace dev; using namespace dev;

1
liblll/CodeFragment.cpp

@ -24,6 +24,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/spirit/include/support_utree.hpp> #include <boost/spirit/include/support_utree.hpp>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
#include <libdevcore/CommonIO.h>
#include <libevmface/Instruction.h> #include <libevmface/Instruction.h>
#include "CompilerState.h" #include "CompilerState.h"
#include "Parser.h" #include "Parser.h"

1
libp2p/Host.cpp

@ -36,6 +36,7 @@
#include <thread> #include <thread>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libethcore/Exceptions.h> #include <libethcore/Exceptions.h>
#include "Session.h" #include "Session.h"
#include "Common.h" #include "Common.h"

1
libp2p/Session.cpp

@ -23,6 +23,7 @@
#include <chrono> #include <chrono>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libethcore/Exceptions.h> #include <libethcore/Exceptions.h>
#include "Host.h" #include "Host.h"
#include "Capability.h" #include "Capability.h"

1
libp2p/Session.h

@ -27,6 +27,7 @@
#include <set> #include <set>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include "Common.h" #include "Common.h"

1
libp2p/UPnP.cpp

@ -31,6 +31,7 @@
#endif #endif
#include <libdevcore/Exceptions.h> #include <libdevcore/Exceptions.h>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
using namespace std; using namespace std;
using namespace dev; using namespace dev;

3
test/hexPrefix.cpp

@ -22,8 +22,9 @@
#include <fstream> #include <fstream>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"
#include <libdevcrypto/TrieCommon.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
#include <libdevcore/CommonIO.h>
#include <libdevcrypto/TrieCommon.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
using namespace std; using namespace std;

1
test/rlp.cpp

@ -25,6 +25,7 @@
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <algorithm> #include <algorithm>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"

1
test/trie.cpp

@ -23,6 +23,7 @@
#include <fstream> #include <fstream>
#include <random> #include <random>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"
#include <libdevcore/CommonIO.h>
#include <libdevcrypto/TrieDB.h> #include <libdevcrypto/TrieDB.h>
#include "TrieHash.h" #include "TrieHash.h"
#include "MemTrie.h" #include "MemTrie.h"

1
test/vm.cpp

@ -21,6 +21,7 @@
*/ */
#include "vm.h" #include "vm.h"
#include <libdevcore/CommonIO.h>
#define FILL_TESTS #define FILL_TESTS

Loading…
Cancel
Save