From 20ae3ad555b363a140a57a0efd0ec191ddaf82cd Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 28 Mar 2019 12:59:39 +0100 Subject: [PATCH 1/2] Remove "using namespace". --- test/liblll/EndToEndTest.cpp | 1 + test/liblll/ExecutionFramework.h | 10 ++++------ test/liblll/LLL_ENS.cpp | 1 + test/liblll/LLL_ERC20.cpp | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/liblll/EndToEndTest.cpp b/test/liblll/EndToEndTest.cpp index 52153eb86..8c3191546 100644 --- a/test/liblll/EndToEndTest.cpp +++ b/test/liblll/EndToEndTest.cpp @@ -29,6 +29,7 @@ #include using namespace std; +using namespace dev::test; namespace dev { diff --git a/test/liblll/ExecutionFramework.h b/test/liblll/ExecutionFramework.h index 2f54afa8a..cbdd19887 100644 --- a/test/liblll/ExecutionFramework.h +++ b/test/liblll/ExecutionFramework.h @@ -22,13 +22,12 @@ #pragma once -#include -#include "../ExecutionFramework.h" +#include #include -using namespace dev::test; +#include namespace dev { @@ -38,9 +37,8 @@ namespace lll namespace test { -class LLLExecutionFramework: public ExecutionFramework +class LLLExecutionFramework: public dev::test::ExecutionFramework { - public: LLLExecutionFramework(); @@ -49,7 +47,7 @@ public: u256 const& _value = 0, std::string const& _contractName = "", bytes const& _arguments = bytes(), - std::map const& _libraryAddresses = std::map() + std::map const& _libraryAddresses = {} ) override { BOOST_REQUIRE(_contractName.empty()); diff --git a/test/liblll/LLL_ENS.cpp b/test/liblll/LLL_ENS.cpp index cfd6970cc..b79b78020 100644 --- a/test/liblll/LLL_ENS.cpp +++ b/test/liblll/LLL_ENS.cpp @@ -29,6 +29,7 @@ using namespace std; using namespace dev::lll; +using namespace dev::test; namespace dev { diff --git a/test/liblll/LLL_ERC20.cpp b/test/liblll/LLL_ERC20.cpp index 6c6762dd0..3777f4826 100644 --- a/test/liblll/LLL_ERC20.cpp +++ b/test/liblll/LLL_ERC20.cpp @@ -34,6 +34,7 @@ using namespace std; using namespace dev::lll; +using namespace dev::test; namespace dev { From f2cee9ec0c3008996d7966f402a99e8c38a1a93d Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 28 Mar 2019 13:07:52 +0100 Subject: [PATCH 2/2] Include cleanup. --- libdevcore/Assertions.h | 2 +- libdevcore/CommonIO.cpp | 8 +++++--- libdevcore/CommonIO.h | 4 ++-- libdevcore/JSON.cpp | 4 ++-- libdevcore/StringUtils.cpp | 2 +- libdevcore/UTF8.cpp | 8 +++----- libevmasm/Assembly.cpp | 2 +- libevmasm/JumpdestRemover.cpp | 2 +- libevmasm/KnownState.cpp | 7 ++++--- libevmasm/PathGasMeter.cpp | 2 +- libevmasm/PeepholeOptimiser.cpp | 2 +- liblll/CodeFragment.cpp | 10 +++++----- liblll/CodeFragment.h | 4 ++-- liblll/CompilerState.cpp | 4 ++-- liblll/CompilerState.h | 2 +- liblll/Parser.cpp | 2 +- liblll/Parser.h | 4 ++-- solc/main.cpp | 4 ++-- 18 files changed, 37 insertions(+), 36 deletions(-) diff --git a/libdevcore/Assertions.h b/libdevcore/Assertions.h index 729ffb05d..4e427fc7e 100644 --- a/libdevcore/Assertions.h +++ b/libdevcore/Assertions.h @@ -24,7 +24,7 @@ #pragma once -#include "Exceptions.h" +#include namespace dev { diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 29b31ebc1..fa236b189 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -19,7 +19,11 @@ * @date 2014 */ -#include "CommonIO.h" +#include +#include + +#include + #include #include #include @@ -29,8 +33,6 @@ #include #include #endif -#include -#include "Assertions.h" using namespace std; using namespace dev; diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index 0d8aca79b..61fa230aa 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -23,10 +23,10 @@ #pragma once +#include +#include #include #include -#include -#include "Common.h" namespace dev { diff --git a/libdevcore/JSON.cpp b/libdevcore/JSON.cpp index 086fae500..29627d98f 100644 --- a/libdevcore/JSON.cpp +++ b/libdevcore/JSON.cpp @@ -19,9 +19,9 @@ * @date 2018 */ -#include "JSON.h" +#include -#include "CommonIO.h" +#include #include #include diff --git a/libdevcore/StringUtils.cpp b/libdevcore/StringUtils.cpp index 196ac8f7d..e14f704e9 100644 --- a/libdevcore/StringUtils.cpp +++ b/libdevcore/StringUtils.cpp @@ -21,7 +21,7 @@ * String routines */ -#include "StringUtils.h" +#include #include #include #include diff --git a/libdevcore/UTF8.cpp b/libdevcore/UTF8.cpp index c61fea8f7..a9fcf0ce3 100644 --- a/libdevcore/UTF8.cpp +++ b/libdevcore/UTF8.cpp @@ -21,12 +21,10 @@ * UTF-8 related helpers */ -#include "UTF8.h" - +#include namespace dev { - namespace { @@ -77,6 +75,8 @@ bool isWellFormed(unsigned char byte1, unsigned char byte2) return false; } +} + bool validateUTF8(unsigned char const* _input, size_t _length, size_t& _invalidPosition) { bool valid = true; @@ -133,8 +133,6 @@ bool validateUTF8(unsigned char const* _input, size_t _length, size_t& _invalidP return false; } -} - bool validateUTF8(std::string const& _input, size_t& _invalidPosition) { return validateUTF8(reinterpret_cast(_input.c_str()), _input.length(), _invalidPosition); diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 6b9ece01e..494b2ed93 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#include "Assembly.h" +#include #include #include diff --git a/libevmasm/JumpdestRemover.cpp b/libevmasm/JumpdestRemover.cpp index 60493a99e..457853c53 100644 --- a/libevmasm/JumpdestRemover.cpp +++ b/libevmasm/JumpdestRemover.cpp @@ -19,7 +19,7 @@ * Removes unused JUMPDESTs. */ -#include "JumpdestRemover.h" +#include #include diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index d6cc5ddd0..73db60560 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -21,10 +21,11 @@ * Contains knowledge about the state of the virtual machine at a specific instruction. */ -#include "KnownState.h" -#include -#include +#include #include +#include + +#include using namespace std; using namespace dev; diff --git a/libevmasm/PathGasMeter.cpp b/libevmasm/PathGasMeter.cpp index 0b199806c..761defdc5 100644 --- a/libevmasm/PathGasMeter.cpp +++ b/libevmasm/PathGasMeter.cpp @@ -19,7 +19,7 @@ * @date 2015 */ -#include "PathGasMeter.h" +#include #include #include diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 2279f24a1..3e2c45b6f 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -19,7 +19,7 @@ * Performs local optimising code changes to assembly. */ -#include "PeepholeOptimiser.h" +#include #include #include diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index b9cb96151..4ddd7e318 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -19,7 +19,11 @@ * @date 2014 */ -#include "CodeFragment.h" +#include +#include +#include +#include +#include #include @@ -34,10 +38,6 @@ #pragma GCC diagnostic pop #endif // defined(__GNUC__) -#include -#include -#include "CompilerState.h" -#include "Parser.h" using namespace std; using namespace dev; diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index f59a5d6fd..e2978e8cc 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -21,10 +21,10 @@ #pragma once -#include +#include #include #include -#include "Exceptions.h" +#include namespace boost { namespace spirit { class utree; } } namespace sp = boost::spirit; diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp index dbd6e91cd..2ae2b0af3 100644 --- a/liblll/CompilerState.cpp +++ b/liblll/CompilerState.cpp @@ -19,8 +19,8 @@ * @date 2014 */ -#include "CompilerState.h" -#include "CodeFragment.h" +#include +#include using namespace std; using namespace dev; diff --git a/liblll/CompilerState.h b/liblll/CompilerState.h index 0fa502884..d7ba38c33 100644 --- a/liblll/CompilerState.h +++ b/liblll/CompilerState.h @@ -21,8 +21,8 @@ #pragma once +#include #include -#include "CodeFragment.h" namespace dev { diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp index 854aeecc8..3b68bc2da 100644 --- a/liblll/Parser.cpp +++ b/liblll/Parser.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#include "Parser.h" +#include #if _MSC_VER #pragma warning(disable:4348) diff --git a/liblll/Parser.h b/liblll/Parser.h index cfbec4181..37b39c6b6 100644 --- a/liblll/Parser.h +++ b/liblll/Parser.h @@ -21,10 +21,10 @@ #pragma once +#include +#include #include #include -#include -#include "Exceptions.h" namespace boost { namespace spirit { class utree; } } namespace sp = boost::spirit; diff --git a/solc/main.cpp b/solc/main.cpp index 6d5595422..f4a4c5d24 100644 --- a/solc/main.cpp +++ b/solc/main.cpp @@ -20,10 +20,10 @@ * Solidity commandline compiler. */ -#include "CommandLineInterface.h" +#include +#include #include #include -#include using namespace std;