From 65401e5b37b0d02f80360ca00050b7a66ebb4ce5 Mon Sep 17 00:00:00 2001 From: Tim Hughes Date: Sun, 14 Sep 2014 23:26:57 +0100 Subject: [PATCH] Fixed all the VS2013 build issues. - Updated projects after all the re-potting. - For simplicity, there's just one VS project for all the libethereum projects, however VS doesn't like duplicate source file names within the same project. To get around this I've created some "single compilation units" for some folders, these probably also compile faster than multiple files. - Some 32bit only compile errors in RLP (cryptic template ambiguity) were resolved by explicitly invoking operator T() rather than doing a cast to T. - Moved multiple implementations of toString(h256s const& _bs) into FixedHash.h - Release shutdown deadlock problem is outstanding. --- libdevcore/FixedHash.h | 10 + libdevcore/RLP.h | 57 ++++- libdevcore/_libdevcore.cpp | 8 + libethcore/All.h | 10 +- libethcore/_libethcore.cpp | 4 + libethereum/CommonNet.cpp | 3 + libethereum/EthereumPeer.cpp | 10 - libethereum/Interface.cpp | 3 + libethereum/PastMessage.cpp | 3 + libevm/_libevm.cpp | 4 + libp2p/Host.h | 2 +- libp2p/Session.h | 1 + libp2p/_libp2p.cpp | 8 + libwhisper/Common.h | 2 + libwhisper/WhisperPeer.h | 2 +- libwhisper/_libwhisper.cpp | 3 + windows/LibEthereum.vcxproj | 355 +++++++++++++++++++++++---- windows/LibEthereum.vcxproj.filters | 363 +++++++++++++++++----------- 18 files changed, 643 insertions(+), 205 deletions(-) create mode 100644 libdevcore/_libdevcore.cpp create mode 100644 libethcore/_libethcore.cpp create mode 100644 libevm/_libevm.cpp create mode 100644 libp2p/_libp2p.cpp create mode 100644 libwhisper/_libwhisper.cpp diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index f979f0b68..36b10d0bf 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -217,6 +217,16 @@ inline h160 left160(h256 const& _t) return ret; } +inline std::string toString(h256s const& _bs) +{ + std::ostringstream out; + out << "[ "; + for (auto i: _bs) + out << i.abridged() << ", "; + out << "]"; + return out.str(); +} + } namespace std diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index d3cb5eed1..ed311a082 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -178,10 +178,59 @@ public: /// Converts to string. @throws BadCast if not a string. std::string toStringStrict() const { if (!isData()) throw BadCast(); return payload().cropped(0, length()).toString(); } - template std::vector toVector() const { std::vector ret; if (isList()) { ret.reserve(itemCount()); for (auto const& i: *this) ret.push_back((T)i); } return ret; } - template std::set toSet() const { std::set ret; if (isList()) { for (auto const& i: *this) ret.insert((T)i); } return ret; } - template std::pair toPair() const { std::pair ret; if (isList()) { ret.first = (T)((*this)[0]); ret.second = (U)((*this)[1]); } return ret; } - template std::array toArray() const { if (itemCount() != N || !isList()) throw BadCast(); std::array ret; for (unsigned i = 0; i < N; ++i) ret[i] = (T)operator[](i); return ret; } + template + std::vector toVector() const + { + std::vector ret; + if (isList()) + { + ret.reserve(itemCount()); + for (auto const& i: *this) + { + ret.push_back((T)i); + } + } + return ret; + } + + template + std::set toSet() const + { + std::set ret; + if (isList()) + { + for (auto const& i: *this) + { + ret.insert((T)i); + } + } + return ret; + } + + template + std::pair toPair() const + { + std::pair ret; + if (isList()) + { + ret.first = (*this)[0].operator T(); + ret.second = (*this)[1].operator U(); + } + return ret; + } + + template + std::array toArray() const + { + if (itemCount() != N || !isList()) + throw BadCast(); + std::array ret; + for (unsigned i = 0; i < N; ++i) + { + ret[i] = (T)operator[](i); + } + return ret; + } /// Int conversion flags enum diff --git a/libdevcore/_libdevcore.cpp b/libdevcore/_libdevcore.cpp new file mode 100644 index 000000000..fa0882d81 --- /dev/null +++ b/libdevcore/_libdevcore.cpp @@ -0,0 +1,8 @@ +#include "All.h" +#include "Common.cpp" +#include "CommonData.cpp" +#include "CommonIO.cpp" +#include "FixedHash.cpp" +#include "Guards.cpp" +#include "Log.cpp" +#include "RLP.cpp" diff --git a/libethcore/All.h b/libethcore/All.h index 9cd9b72ee..4a6747ff0 100644 --- a/libethcore/All.h +++ b/libethcore/All.h @@ -3,10 +3,6 @@ #include "BlockInfo.h" #include "CommonEth.h" #include "Dagger.h" -#include "FileSystem.h" -#include "MemoryDB.h" -#include "OverlayDB.h" -#include "SHA3.h" -#include "TrieCommon.h" -#include "TrieDB.h" -#include "UPnP.h" +#include "CryptoHeaders.h" +#include "Exceptions.h" + diff --git a/libethcore/_libethcore.cpp b/libethcore/_libethcore.cpp new file mode 100644 index 000000000..5f2208665 --- /dev/null +++ b/libethcore/_libethcore.cpp @@ -0,0 +1,4 @@ +#include "All.h" +#include "BlockInfo.cpp" +#include "CommonEth.cpp" +#include "Dagger.cpp" diff --git a/libethereum/CommonNet.cpp b/libethereum/CommonNet.cpp index acf8e220f..eb92f0b18 100644 --- a/libethereum/CommonNet.cpp +++ b/libethereum/CommonNet.cpp @@ -23,3 +23,6 @@ using namespace std; using namespace dev; using namespace dev::eth; + +#pragma GCC diagnostic ignored "-Wunused-variable" +namespace { char dummy; }; diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 1211ac03d..9e72f8429 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -91,16 +91,6 @@ void EthereumPeer::startInitialSync() } } -inline string toString(h256s const& _bs) -{ - ostringstream out; - out << "[ "; - for (auto i: _bs) - out << i.abridged() << ", "; - out << "]"; - return out.str(); -} - void EthereumPeer::giveUpOnFetch() { clogS(NetNote) << "GIVE UP FETCH; can't get" << toString(m_askedBlocks); diff --git a/libethereum/Interface.cpp b/libethereum/Interface.cpp index a9801cc33..7d731bb1f 100644 --- a/libethereum/Interface.cpp +++ b/libethereum/Interface.cpp @@ -20,3 +20,6 @@ */ #include "Interface.h" + +#pragma GCC diagnostic ignored "-Wunused-variable" +namespace { char dummy; }; diff --git a/libethereum/PastMessage.cpp b/libethereum/PastMessage.cpp index 377b7e4d2..d81ae672c 100644 --- a/libethereum/PastMessage.cpp +++ b/libethereum/PastMessage.cpp @@ -23,3 +23,6 @@ using namespace std; using namespace dev; using namespace dev::eth; + +#pragma GCC diagnostic ignored "-Wunused-variable" +namespace { char dummy; }; diff --git a/libevm/_libevm.cpp b/libevm/_libevm.cpp new file mode 100644 index 000000000..ca1926ae0 --- /dev/null +++ b/libevm/_libevm.cpp @@ -0,0 +1,4 @@ +#include "All.h" +#include "ExtVMFace.cpp" +#include "FeeStructure.cpp" +#include "VM.cpp" diff --git a/libp2p/Host.h b/libp2p/Host.h index d6673a072..54e8f967e 100644 --- a/libp2p/Host.h +++ b/libp2p/Host.h @@ -70,7 +70,7 @@ public: /// Register a peer-capability; all new peer connections will have this capability. template std::shared_ptr registerCapability(T* _t) { _t->m_host = this; auto ret = std::shared_ptr(_t); m_capabilities[T::staticName()] = ret; return ret; } - bool haveCapability(std::string const& _name) const { return m_capabilities.count(_name); } + bool haveCapability(std::string const& _name) const { return m_capabilities.count(_name) != 0; } std::vector caps() const { std::vector ret; for (auto const& i: m_capabilities) ret.push_back(i.first); return ret; } template std::shared_ptr cap() const { try { return std::static_pointer_cast(m_capabilities.at(T::staticName())); } catch (...) { return nullptr; } } diff --git a/libp2p/Session.h b/libp2p/Session.h index 289ec1063..bc43934b3 100644 --- a/libp2p/Session.h +++ b/libp2p/Session.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/libp2p/_libp2p.cpp b/libp2p/_libp2p.cpp new file mode 100644 index 000000000..ecf61159a --- /dev/null +++ b/libp2p/_libp2p.cpp @@ -0,0 +1,8 @@ +#include "All.h" +#include "Capability.cpp" +#include "Common.cpp" +#include "Host.cpp" +#include "HostCapability.cpp" +#include "Session.cpp" +#include "UPnP.cpp" + diff --git a/libwhisper/Common.h b/libwhisper/Common.h index 2324be024..ba4285f2b 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -33,6 +33,7 @@ namespace dev namespace shh { +/* this makes these symbols ambiguous on VS2013 using h256 = dev::h256; using h512 = dev::h512; using h256s = dev::h256s; @@ -42,6 +43,7 @@ using RLP = dev::RLP; using bytesRef = dev::bytesRef; using bytesConstRef = dev::bytesConstRef; using h256Set = dev::h256Set; +*/ class WhisperHost; class WhisperPeer; diff --git a/libwhisper/WhisperPeer.h b/libwhisper/WhisperPeer.h index d428670c3..ea79572c8 100644 --- a/libwhisper/WhisperPeer.h +++ b/libwhisper/WhisperPeer.h @@ -95,7 +95,7 @@ class MessageFilter public: MessageFilter() {} MessageFilter(std::vector > const& _m): m_topicMasks(_m) {} - MessageFilter(RLP const& _r): m_topicMasks((std::vector >)_r) {} + MessageFilter(RLP const& _r): m_topicMasks(_r.operator std::vector>()) {} void fillStream(RLPStream& _s) const { _s << m_topicMasks; } h256 sha3() const { RLPStream s; fillStream(s); return dev::eth::sha3(s.out()); } diff --git a/libwhisper/_libwhisper.cpp b/libwhisper/_libwhisper.cpp new file mode 100644 index 000000000..0d6f96cf8 --- /dev/null +++ b/libwhisper/_libwhisper.cpp @@ -0,0 +1,3 @@ +#include "All.h" +#include "Common.cpp" +#include "WhisperPeer.cpp" diff --git a/windows/LibEthereum.vcxproj b/windows/LibEthereum.vcxproj index c806de064..196325353 100644 --- a/windows/LibEthereum.vcxproj +++ b/windows/LibEthereum.vcxproj @@ -19,22 +19,69 @@ - - - - - - - - - - - - - - - - + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + @@ -44,9 +91,10 @@ - + + @@ -56,14 +104,68 @@ - - - + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + + true + true + true + true + + stdafx.h Create @@ -73,30 +175,114 @@ - - - - - - - - - - - - - - - - - - - - - - + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + @@ -104,9 +290,10 @@ - + + @@ -116,10 +303,30 @@ - - - - + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + @@ -127,6 +334,60 @@ + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + diff --git a/windows/LibEthereum.vcxproj.filters b/windows/LibEthereum.vcxproj.filters index 3280140fc..5a650b0c5 100644 --- a/windows/LibEthereum.vcxproj.filters +++ b/windows/LibEthereum.vcxproj.filters @@ -22,15 +22,6 @@ libethereum - - libethereum - - - libethereum - - - libethereum - libethereum @@ -40,15 +31,6 @@ libethereum - - libethcore - - - libethcore - - - libethcore - libevm @@ -58,48 +40,9 @@ libevm - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - libevmface - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - liblll @@ -136,6 +79,102 @@ libethereum + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libethcore + + + libethcore + + + libethcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libethcore + + + libevm + + + libethereum + + + libethereum + + + libethereum + + + libethereum + + + libethereum + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libwhisper + + + libwhisper + @@ -159,15 +198,6 @@ libethereum - - libethereum - - - libethereum - - - libethereum - libethereum @@ -177,18 +207,6 @@ libethereum - - libethcore - - - libethcore - - - libethcore - - - libethcore - libevm @@ -198,66 +216,12 @@ libevm - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - - - libethential - libevm libevmface - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - - - libethcore - liblll @@ -300,6 +264,126 @@ libethereum + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libdevcrypto + + + libethcore + + + libethcore + + + libethcore + + + libethcore + + + libethcore + + + libethcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libdevcore + + + libethereum + + + libethereum + + + libethereum + + + libethereum + + + libethereum + + + libethereum + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libp2p + + + libwhisper + + + libwhisper + @@ -317,11 +401,20 @@ {ed9ad1b3-700c-47f9-8548-a90b5ef179ac} - - {35c32f6c-3f19-4603-8084-1b88ec9ae498} - {e6332606-e0ca-48aa-8a6b-303971ba7a93} + + {fae2102b-d574-40fc-9f90-1b9ed0d117ac} + + + {35c32f6c-3f19-4603-8084-1b88ec9ae498} + + + {fc2cb618-ab0c-45b6-8eb9-6d88e0336fa9} + + + {36748e80-c977-4fee-84e6-699c039dff87} + \ No newline at end of file