From 69db1c7181249a2b70fd39f8f5185166dc192815 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 21 Apr 2015 11:45:33 +0200 Subject: [PATCH] Removed (and added) some #ifs (but removed more than I added). --- alethzero/CMakeLists.txt | 4 +++- alethzero/Transact.cpp | 6 ++++++ test/CMakeLists.txt | 11 +++++------ test/libethereum/state.cpp | 2 ++ test/libevmcore/CMakeLists.txt | 5 ----- test/{libevmcore => libsolidity}/Assembly.cpp | 4 ---- test/libsolidity/SolidityABIJSON.cpp | 3 --- test/libsolidity/SolidityCompiler.cpp | 4 ---- test/libsolidity/SolidityEndToEndTest.cpp | 4 ---- test/libsolidity/SolidityExpressionCompiler.cpp | 4 ---- test/libsolidity/SolidityInterface.cpp | 4 ---- test/libsolidity/SolidityNameAndTypeResolution.cpp | 4 ---- test/libsolidity/SolidityNatspecJSON.cpp | 4 ---- test/libsolidity/SolidityOptimizer.cpp | 4 ---- test/libsolidity/SolidityParser.cpp | 4 ---- test/libsolidity/SolidityScanner.cpp | 4 ---- test/libsolidity/SolidityTypes.cpp | 4 ---- 17 files changed, 16 insertions(+), 59 deletions(-) delete mode 100644 test/libevmcore/CMakeLists.txt rename test/{libevmcore => libsolidity}/Assembly.cpp (99%) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index fb134a82d..d9e8dff6f 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -51,7 +51,9 @@ target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} solidity) +if (SOLIDITY) + target_link_libraries(${EXECUTABLE} solidity) +endif () target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} web3jsonrpc) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index 1ebdf9e23..d3e5650bf 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -168,6 +168,7 @@ static std::string toString(TransactionException _te) } } +#if ETH_SOLIDITY static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, string const& _contractName) { string ret = ""; @@ -182,6 +183,7 @@ static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, s } return ret; } +#endif static tuple, bytes, string> userInputToCode(string const& _user, bool _opt) { @@ -197,6 +199,7 @@ static tuple, bytes, string> userInputToCode(string const& _user, boost::replace_all_copy(u, " ", ""); data = fromHex(u); } +#if ETH_SOLIDITY else if (sourceIsSolidity(_user)) { dev::solidity::CompilerStack compiler(true); @@ -220,6 +223,7 @@ static tuple, bytes, string> userInputToCode(string const& _user, errors.push_back("Solidity: Uncaught exception"); } } +#endif #if ETH_SERPENT else if (sourceIsSerpent(_user)) { @@ -394,6 +398,7 @@ void Transact::on_send_clicked() // If execution is a contract creation, add Natspec to // a local Natspec LEVELDB ethereum()->submitTransaction(s, value(), m_data, ui->gas->value(), gasPrice()); +#if ETH_SOLIDITY string src = ui->data->toPlainText().toStdString(); if (sourceIsSolidity(src)) try @@ -407,6 +412,7 @@ void Transact::on_send_clicked() } } catch (...) {} +#endif } else ethereum()->submitTransaction(s, value(), m_context->fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice()); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b46ab06e5..a97bb86fc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,19 +23,18 @@ add_subdirectory(libdevcrypto) add_subdirectory(libethcore) add_subdirectory(libethereum) add_subdirectory(libevm) -add_subdirectory(libevmcore) add_subdirectory(libnatspec) add_subdirectory(libp2p) -add_subdirectory(libsolidity) +if (SOLIDITY) + add_subdirectory(libsolidity) +endif () +if (JSONRPC) add_subdirectory(libweb3jsonrpc) +endif () add_subdirectory(libwhisper) set(SRC_LIST ${SRC_LIST} ${SRC}) -if (NOT JSONRPC) - list(REMOVE_ITEM SRC_LIST "libweb3jsonrpc/./AccountHolder.cpp") -endif() - include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ..) include_directories(${Boost_INCLUDE_DIRS}) diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index e6811d972..670ed0330 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -171,10 +171,12 @@ BOOST_AUTO_TEST_CASE(stMemoryStressTest) dev::test::executeTests("stMemoryStressTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } +#if ETH_SOLIDITY BOOST_AUTO_TEST_CASE(stSolidityTest) { dev::test::executeTests("stSolidityTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } +#endif BOOST_AUTO_TEST_CASE(stMemoryTest) { diff --git a/test/libevmcore/CMakeLists.txt b/test/libevmcore/CMakeLists.txt deleted file mode 100644 index 3ceda13b0..000000000 --- a/test/libevmcore/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_policy(SET CMP0015 NEW) - -aux_source_directory(. SRCS) - -add_sources(${SRCS}) diff --git a/test/libevmcore/Assembly.cpp b/test/libsolidity/Assembly.cpp similarity index 99% rename from test/libevmcore/Assembly.cpp rename to test/libsolidity/Assembly.cpp index fab260a9d..8dcee7fb5 100644 --- a/test/libevmcore/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -20,8 +20,6 @@ * Unit tests for Assembly Items from evmcore/Assembly.h */ -#if ETH_SOLIDITY - #include #include #include @@ -120,5 +118,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index b0633cca1..f0e54a940 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -19,7 +19,6 @@ * @date 2014 * Unit tests for the solidity compiler JSON Interface output. */ -#if ETH_SOLIDITY #include "../TestHelper.h" #include @@ -501,5 +500,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } - -#endif diff --git a/test/libsolidity/SolidityCompiler.cpp b/test/libsolidity/SolidityCompiler.cpp index bb16c88cd..7b0ceedb6 100644 --- a/test/libsolidity/SolidityCompiler.cpp +++ b/test/libsolidity/SolidityCompiler.cpp @@ -20,8 +20,6 @@ * Unit tests for the solidity compiler. */ -#if ETH_SOLIDITY - #include #include #include @@ -193,5 +191,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index c345f5204..db58c3441 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -21,8 +21,6 @@ * Unit tests for the solidity expression compiler, testing the behaviour of the code. */ -#if ETH_SOLIDITY - #include #include #include @@ -3704,5 +3702,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 505cac991..613b0b1f7 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -20,8 +20,6 @@ * Unit tests for the solidity expression compiler. */ -#if ETH_SOLIDITY - #include #include @@ -491,5 +489,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityInterface.cpp b/test/libsolidity/SolidityInterface.cpp index ab6cb9029..c8f74e3aa 100644 --- a/test/libsolidity/SolidityInterface.cpp +++ b/test/libsolidity/SolidityInterface.cpp @@ -20,8 +20,6 @@ * Unit tests for generating source interfaces for Solidity contracts. */ -#if ETH_SOLIDITY - #include "../TestHelper.h" #include #include @@ -149,5 +147,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } - -#endif diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 917ea0007..076ea595b 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -20,8 +20,6 @@ * Unit tests for the name and type resolution of the solidity parser. */ -#if ETH_SOLIDITY - #include #include @@ -1671,5 +1669,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 99adcf199..d2c1ec186 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -20,8 +20,6 @@ * Unit tests for the solidity compiler JSON Interface output. */ -#if ETH_SOLIDITY - #include "../TestHelper.h" #include #include @@ -539,5 +537,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } - -#endif diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 8ab1de8f1..af9b51467 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -20,8 +20,6 @@ * Tests for the Solidity optimizer. */ -#if ETH_SOLIDITY - #include #include #include @@ -816,5 +814,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 7baa12921..ad17c40a6 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -20,8 +20,6 @@ * Unit tests for the solidity parser. */ -#if ETH_SOLIDITY - #include #include #include @@ -855,5 +853,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 20b946ee0..8d3e53929 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -20,8 +20,6 @@ * Unit tests for the solidity scanner. */ -#if ETH_SOLIDITY - #include #include @@ -288,5 +286,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces - -#endif diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index da8b48303..6b6306479 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -20,8 +20,6 @@ * Unit tests for the type system of Solidity. */ -#if ETH_SOLIDITY - #include #include @@ -93,5 +91,3 @@ BOOST_AUTO_TEST_SUITE_END() } } } - -#endif