diff options
-rw-r--r-- | libdevcore/Common.h | 58 | ||||
-rw-r--r-- | libdevcore/CommonData.h | 3 | ||||
-rw-r--r-- | libdevcore/FixedHash.h | 10 | ||||
-rw-r--r-- | libevmasm/BlockDeduplicator.cpp | 5 | ||||
-rw-r--r-- | libevmasm/ExpressionClasses.h | 6 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 1 | ||||
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 21 | ||||
-rw-r--r-- | libsolidity/parsing/Scanner.cpp | 2 | ||||
-rwxr-xr-x | scripts/release.sh | 35 |
9 files changed, 39 insertions, 102 deletions
diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 9d6dd408..2543855d 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -37,13 +37,7 @@ #pragma warning(disable:3682) //call through incomplete class #endif -#include <map> -#include <unordered_map> -#include <vector> -#include <set> -#include <unordered_set> -#include <functional> -#include <string> +#include <libdevcore/vector_ref.h> #if defined(__GNUC__) #pragma warning(push) @@ -67,14 +61,13 @@ #pragma GCC diagnostic pop #endif // defined(__GNUC__) -#include "vector_ref.h" +#include <map> +#include <vector> +#include <functional> +#include <string> using byte = uint8_t; -// Quote a given token stream to turn it into a string. -#define DEV_QUOTED_HELPER(s) #s -#define DEV_QUOTED(s) DEV_QUOTED_HELPER(s) - namespace dev { @@ -85,32 +78,15 @@ using bytesConstRef = vector_ref<byte const>; // Numeric types. using bigint = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<>>; -using u64 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using u128 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u256s = std::vector<u256>; -using u160s = std::vector<u160>; -using u256Set = std::set<u256>; -using u160Set = std::set<u160>; +using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; +using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; +using u160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; // Map types. using StringMap = std::map<std::string, std::string>; -// Hash types. -using StringHashMap = std::unordered_map<std::string, std::string>; - // String types. using strings = std::vector<std::string>; -// Fixed-length string types. -using string32 = std::array<char, 32>; - -// Null/Invalid values for convenience. -static const bytes NullBytes; /// Interprets @a _u as a two's complement signed number and returns the resulting s256. inline s256 u2s(u256 _u) @@ -143,16 +119,6 @@ inline std::ostream& operator<<(std::ostream& os, bytes const& _bytes) return os; } -template <size_t n> inline u256 exp10() -{ - return exp10<n - 1>() * u256(10); -} - -template <> inline u256 exp10<0>() -{ - return u256(1); -} - /// RAII utility class whose destructor calls a given function. class ScopeGuard { @@ -164,12 +130,4 @@ private: std::function<void(void)> m_f; }; -enum class WithExisting: int -{ - Trust = 0, - Verify, - Rescue, - Kill -}; - } diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 5df8986a..765707f8 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -26,11 +26,10 @@ #include <libdevcore/Common.h> #include <vector> -#include <algorithm> -#include <unordered_set> #include <type_traits> #include <cstring> #include <string> +#include <set> namespace dev { diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 141e9ffd..5bc70095 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -23,12 +23,16 @@ #pragma once +#include <libdevcore/CommonData.h> + +#include <boost/functional/hash.hpp> +#include <boost/io/ios_state.hpp> + #include <array> #include <cstdint> #include <algorithm> -#include <boost/functional/hash.hpp> -#include <boost/io/ios_state.hpp> -#include "CommonData.h" +#include <set> +#include <unordered_set> namespace dev { diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index d21be07e..b7c69531 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -22,10 +22,13 @@ */ #include <libevmasm/BlockDeduplicator.h> -#include <functional> + #include <libevmasm/AssemblyItem.h> #include <libevmasm/SemanticInformation.h> +#include <functional> +#include <set> + using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h index 5d53b292..6b426e97 100644 --- a/libevmasm/ExpressionClasses.h +++ b/libevmasm/ExpressionClasses.h @@ -23,11 +23,13 @@ #pragma once +#include <libdevcore/Common.h> +#include <libevmasm/AssemblyItem.h> + #include <vector> #include <map> #include <memory> -#include <libdevcore/Common.h> -#include <libevmasm/AssemblyItem.h> +#include <set> namespace dev { diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index ce2d3bf8..310c34fe 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -36,6 +36,7 @@ #include <memory> #include <string> #include <map> +#include <set> namespace dev { diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index ddfdb667..8429bf79 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -903,11 +903,13 @@ ASTPointer<Statement> Parser::parseStatement() { statement = ASTNodeFactory(*this).createNode<PlaceholderStatement>(docString); m_scanner->next(); - break; } - // fall-through + else + statement = parseSimpleStatement(docString); + break; default: statement = parseSimpleStatement(docString); + break; } expectToken(Token::Semicolon); return statement; @@ -1309,18 +1311,21 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() Literal::SubDenomination subdenomination = static_cast<Literal::SubDenomination>(m_scanner->currentToken()); m_scanner->next(); expression = nodeFactory.createNode<Literal>(token, literal, subdenomination); - break; } - if (Token::isTimeSubdenomination(m_scanner->peekNextToken())) + else if (Token::isTimeSubdenomination(m_scanner->peekNextToken())) { ASTPointer<ASTString> literal = getLiteralAndAdvance(); nodeFactory.markEndPosition(); Literal::SubDenomination subdenomination = static_cast<Literal::SubDenomination>(m_scanner->currentToken()); m_scanner->next(); expression = nodeFactory.createNode<Literal>(token, literal, subdenomination); - break; } - // fall-through + else + { + nodeFactory.markEndPosition(); + expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance()); + } + break; case Token::StringLiteral: nodeFactory.markEndPosition(); expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance()); @@ -1357,9 +1362,9 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() } nodeFactory.markEndPosition(); expectToken(oppositeToken); - return nodeFactory.createNode<TupleExpression>(components, isArray); + expression = nodeFactory.createNode<TupleExpression>(components, isArray); + break; } - default: if (Token::isElementaryTypeName(token)) { diff --git a/libsolidity/parsing/Scanner.cpp b/libsolidity/parsing/Scanner.cpp index fdca23ea..6541f6c2 100644 --- a/libsolidity/parsing/Scanner.cpp +++ b/libsolidity/parsing/Scanner.cpp @@ -435,7 +435,7 @@ void Scanner::scanToken() m_nextToken.location.start = sourcePos(); switch (m_char) { - case '\n': // fall-through + case '\n': case ' ': case '\t': token = selectToken(Token::Whitespace); diff --git a/scripts/release.sh b/scripts/release.sh index a2f4d98a..ebc7759f 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -35,47 +35,12 @@ ZIP_TEMP_DIR=$(pwd)/build/zip/ # There is an implicit assumption here that we HAVE to run from root directory. REPO_ROOT=$(pwd) -if [[ "$OSTYPE" == "darwin"* ]]; then - DLL_EXT=dylib -else - DLL_EXT=so -fi - mkdir -p $ZIP_TEMP_DIR # Copy all the solidity executables into a temporary directory prior to ZIP creation cp $REPO_ROOT/build/lllc/lllc $ZIP_TEMP_DIR cp $REPO_ROOT/build/solc/solc $ZIP_TEMP_DIR -cp $REPO_ROOT/build/soltest/soltest $ZIP_TEMP_DIR - -# Copy all the dynamic libraries into a temporary directory prior to ZIP creation. -# There are a lot of these, and it would be great if we didn't have to worry about them. -# There is work-in-progress to support static-linkage on the UNIX platforms, which -# is most promising on Alpine Linux using musl. macOS doesn't support statically -# linked binaries (ie. executables which make direct system calls to the kernel. -# -# See https://developer.apple.com/library/mac/qa/qa1118/_index.html. -# See https://github.com/ethereum/webthree-umbrella/issues/495. - -cp $REPO_ROOT/build/libdevcore/*.$DLL_EXT $ZIP_TEMP_DIR -cp $REPO_ROOT/build/libevmasm/*.$DLL_EXT $ZIP_TEMP_DIR -cp $REPO_ROOT/build/libsolidity/*.$DLL_EXT $ZIP_TEMP_DIR - -# For macOS, we also copy the dynamic libraries for our external dependencies. -# When building from source on your own machine, these libraries will be installed -# globally, using Homebrew, but we don't want to rely on that for these ZIPs, so -# we copy these into the ZIP temporary directory too. -# -# TODO - So what happens for Linux and other UNIX distros in this case? -# There will be runtime dependencies on equivalent SO files being present, likely in -# a completely analogous way. Does that mean that ZIPs are actually useless on such -# distros, because there will be symbol links to global install locations (distro-specific) -# and those files will just be missing on the target machines? - -if [[ "$OSTYPE" == "darwin"* ]]; then - cp /usr/local/opt/jsoncpp/lib/libjsoncpp.1.dylib $ZIP_TEMP_DIR -fi # For macOS, we run a fix-up script which alters all of the symbolic links within # the executables and dynamic libraries such that the ZIP becomes self-contained, by |