diff options
50 files changed, 271 insertions, 139 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cc59c6f4..6bceb514 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.5.2") +set(PROJECT_VERSION "0.5.3") project(solidity VERSION ${PROJECT_VERSION}) option(LLL "Build LLL" OFF) diff --git a/Changelog.md b/Changelog.md index 60e3904c..3d298f6f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,18 @@ -### 0.5.2 (unreleased) +### 0.5.3 (unreleased) + +Language Features: + + +Compiler Features: + + +Bugfixes: + + +Build System: + + +### 0.5.2 (2018-12-19) Language Features: * Control Flow Graph: Detect every access to uninitialized storage pointers. @@ -9,21 +23,24 @@ Compiler Features: * Code Generator: Only check callvalue once if all functions are non-payable. * Code Generator: Use codecopy for string constants more aggressively. * Code Generator: Use binary search for dispatch function if more efficient. The size/speed tradeoff can be tuned using ``--optimize-runs``. - * Compiler Interface: Disallow unknown keys in standard JSON input. * SMTChecker: Support mathematical and cryptographic functions in an uninterpreted way. + * SMTChecker: Support one-dimensional mappings. + * Standard JSON Interface: Disallow unknown keys in standard JSON input. + * Standard JSON Interface: Only run code generation if it has been requested. This could lead to unsupported feature errors only being reported at the point where you request bytecode. * Static Analyzer: Do not warn about unused variables or state mutability for functions with an empty body. * Type Checker: Add an additional reason to be displayed when type conversion fails. * Yul: Support object access via ``datasize``, ``dataoffset`` and ``datacopy`` in standalone assembly mode. Bugfixes: - * Compiler Interface: Report specific error message for json input errors instead of internal compiler error + * Standard JSON Interface: Report specific error message for json input errors instead of internal compiler error. Build System: * Replace the trusty PPA build by a static build on cosmic that is used for the trusty package instead. * Remove support for Visual Studio 2015. + ### 0.5.1 (2018-12-03) Language Features: diff --git a/ReleaseChecklist.md b/ReleaseChecklist.md index 04734544..c10db742 100644 --- a/ReleaseChecklist.md +++ b/ReleaseChecklist.md @@ -4,11 +4,13 @@ Checklist for making a release: - [ ] Check that all issues and pull requests from the Github project to be released are merged to ``develop``. - [ ] Create a commit in ``develop`` that updates the ``Changelog`` to include a release date (run ``./scripts/tests.sh`` to update the bug list). Sort the changelog entries alphabetically and correct any errors you notice. - [ ] Create a pull request and wait for the tests, merge it. + - [ ] Thank voluntary contributors in the Github release page (use ``git shortlog -s -n -e origin/release..origin/develop``). - [ ] Create a pull request from ``develop`` to ``release``, wait for the tests, then merge it. - - [ ] Make a final check that there are no platform-dependency issues in the ``solc-test-bytecode`` repository. + - [ ] Make a final check that there are no platform-dependency issues in the ``solidity-test-bytecode`` repository. - [ ] Wait for the tests for the commit on ``release``, create a release in Github, creating the tag. - - [ ] Thank voluntary contributors in the Github release page (use ``git shortlog -s -n -e origin/release..origin/develop``). - [ ] Wait for the CI runs on the tag itself (they should push artifacts onto the Github release page). + - [ ] Run ``scripts/create_source_tarball.sh`` while being on the tag to create the source tarball. + - [ ] Upload the source tarball (in the upload directory) to the release page. - [ ] Run ``scripts/release_ppa.sh release`` to create the PPA release (you need the relevant openssl key). - [ ] Once the ``~ethereum/ubuntu/ethereum-static`` PPA build is finished and published for all platforms (make sure not to do this earlier), copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` while selecting ``Copy existing binaries``. - [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh release``). diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 658aab9c..438abbdd 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -616,5 +616,9 @@ "0.5.1": { "bugs": [], "released": "2018-12-03" + }, + "0.5.2": { + "bugs": [], + "released": "2018-12-19" } }
\ No newline at end of file diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index d263e0c6..ae25b935 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -16,11 +16,6 @@ Enums are not supported by the ABI, they are just supported by Solidity. You have to do the mapping yourself for now, we might provide some help later. -How do structs work? -==================== - -See `struct_and_for_loop_tester.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/65_struct_and_for_loop_tester.sol>`_. - What are some examples of basic string manipulation (``substring``, ``indexOf``, ``charAt``, etc)? ================================================================================================== @@ -71,12 +66,6 @@ arguments for you. See `ping.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_ping.sol>`_ and `pong.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_pong.sol>`_. -Are comments included with deployed contracts and do they increase deployment gas? -================================================================================== - -No, everything that is not needed for execution is removed during compilation. -This includes, among others, comments, variable names and type names. - What happens if you send ether along with a function call to a contract? ======================================================================== diff --git a/libdevcore/IndentedWriter.h b/libdevcore/IndentedWriter.h index 4ddd87ed..563c4c96 100644 --- a/libdevcore/IndentedWriter.h +++ b/libdevcore/IndentedWriter.h @@ -34,8 +34,6 @@ DEV_SIMPLE_EXCEPTION(IndentedWriterError); class IndentedWriter { public: - explicit IndentedWriter(): m_lines(std::vector<Line>{{std::string(), 0}}) {} - // Returns the formatted output. std::string format() const; @@ -61,7 +59,7 @@ private: unsigned indentation; }; - std::vector<Line> m_lines; + std::vector<Line> m_lines{{std::string(), 0}}; }; } diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index d846b475..5dc6ef0e 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -45,8 +45,6 @@ using AssemblyPointer = std::shared_ptr<Assembly>; class Assembly { public: - Assembly() {} - AssemblyItem newTag() { assertThrow(m_usedTags < 0xffffffff, AssemblyException, ""); return AssemblyItem(Tag, m_usedTags++); } AssemblyItem newPushTag() { assertThrow(m_usedTags < 0xffffffff, AssemblyException, ""); return AssemblyItem(PushTag, m_usedTags++); } /// Returns a tag identified by the given name. Creates it if it does not yet exist. diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index be3b1026..0043f76b 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -110,7 +110,8 @@ int AssemblyItem::returnValues() const return 1; case Tag: return 0; - default:; + default: + break; } return 0; } @@ -135,9 +136,10 @@ bool AssemblyItem::canBeFunctional() const return true; case Tag: return false; - default:; + default: + break; } - return 0; + return false; } string AssemblyItem::getJumpTypeAsString() const diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index a5546e61..d6cc5ddd 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -304,7 +304,7 @@ KnownState::StoreOperation KnownState::storeInStorage( AssemblyItem item(Instruction::SSTORE, _location); Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber); - StoreOperation operation(StoreOperation::Storage, _slot, m_sequenceNumber, id); + StoreOperation operation{StoreOperation::Storage, _slot, m_sequenceNumber, id}; m_storageContent[_slot] = _value; // increment a second time so that we get unique sequence numbers for writes m_sequenceNumber++; @@ -336,7 +336,7 @@ KnownState::StoreOperation KnownState::storeInMemory(Id _slot, Id _value, Source AssemblyItem item(Instruction::MSTORE, _location); Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber); - StoreOperation operation(StoreOperation(StoreOperation::Memory, _slot, m_sequenceNumber, id)); + StoreOperation operation{StoreOperation::Memory, _slot, m_sequenceNumber, id}; m_memoryContent[_slot] = _value; // increment a second time so that we get unique sequence numbers for writes m_sequenceNumber++; diff --git a/libevmasm/KnownState.h b/libevmasm/KnownState.h index 3ab1c4b1..3b5e9e7a 100644 --- a/libevmasm/KnownState.h +++ b/libevmasm/KnownState.h @@ -74,18 +74,13 @@ public: struct StoreOperation { enum Target { Invalid, Memory, Storage }; - StoreOperation(): target(Invalid), sequenceNumber(-1) {} - StoreOperation( - Target _target, - Id _slot, - unsigned _sequenceNumber, - Id _expression - ): target(_target), slot(_slot), sequenceNumber(_sequenceNumber), expression(_expression) {} + bool isValid() const { return target != Invalid; } - Target target; - Id slot; - unsigned sequenceNumber; - Id expression; + + Target target{Invalid}; + Id slot{std::numeric_limits<Id>::max()}; + unsigned sequenceNumber{std::numeric_limits<unsigned>::max()}; + Id expression{std::numeric_limits<Id>::max()}; }; explicit KnownState( diff --git a/liblangutil/CharStream.h b/liblangutil/CharStream.h index f92beb30..0c998b2a 100644 --- a/liblangutil/CharStream.h +++ b/liblangutil/CharStream.h @@ -67,9 +67,9 @@ namespace langutil class CharStream { public: - CharStream(): m_position(0) {} + CharStream() = default; explicit CharStream(std::string const& _source, std::string const& name): - m_source(_source), m_name(name), m_position(0) {} + m_source(_source), m_name(name) {} int position() const { return m_position; } bool isPastEndOfInput(size_t _charsForward = 0) const { return (m_position + _charsForward) >= m_source.size(); } @@ -94,7 +94,7 @@ public: private: std::string m_source; std::string m_name; - size_t m_position; + size_t m_position{0}; }; } diff --git a/liblangutil/EVMVersion.h b/liblangutil/EVMVersion.h index 657727ac..21889bd9 100644 --- a/liblangutil/EVMVersion.h +++ b/liblangutil/EVMVersion.h @@ -39,7 +39,7 @@ class EVMVersion: boost::equality_comparable<EVMVersion> { public: - EVMVersion() {} + EVMVersion() = default; static EVMVersion homestead() { return {Version::Homestead}; } static EVMVersion tangerineWhistle() { return {Version::TangerineWhistle}; } diff --git a/liblangutil/ParserBase.cpp b/liblangutil/ParserBase.cpp index 391af291..c0770e04 100644 --- a/liblangutil/ParserBase.cpp +++ b/liblangutil/ParserBase.cpp @@ -100,10 +100,10 @@ void ParserBase::decreaseRecursionDepth() void ParserBase::parserError(string const& _description) { - m_errorReporter.parserError(SourceLocation(position(), endPosition(), source()), _description); + m_errorReporter.parserError(SourceLocation{position(), endPosition(), source()}, _description); } void ParserBase::fatalParserError(string const& _description) { - m_errorReporter.fatalParserError(SourceLocation(position(), endPosition(), source()), _description); + m_errorReporter.fatalParserError(SourceLocation{position(), endPosition(), source()}, _description); } diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 2d18a7d1..840891c2 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -38,10 +38,6 @@ namespace langutil */ struct SourceLocation { - SourceLocation(): start(-1), end(-1), source{nullptr} { } - SourceLocation(int _start, int _end, std::shared_ptr<CharStream> _source): - start(_start), end(_end), source{std::move(_source)} { } - bool operator==(SourceLocation const& _other) const { return source.get() == _other.source.get() && start == _other.start && end == _other.end; @@ -53,8 +49,8 @@ struct SourceLocation bool isEmpty() const { return start == -1 && end == -1; } - int start; - int end; + int start = -1; + int end = -1; std::shared_ptr<CharStream> source; }; diff --git a/liblangutil/SourceReferenceExtractor.h b/liblangutil/SourceReferenceExtractor.h index 0be7e9d8..bcbc50bc 100644 --- a/liblangutil/SourceReferenceExtractor.h +++ b/liblangutil/SourceReferenceExtractor.h @@ -31,28 +31,29 @@ namespace langutil struct LineColumn { - int line; - int column; + int line = {-1}; + int column = {-1}; + LineColumn() = default; LineColumn(std::tuple<int, int> const& _t): line{std::get<0>(_t)}, column{std::get<1>(_t)} {} - LineColumn(int _line, int _column): line{_line}, column{_column} {} - LineColumn(): line{-1}, column{-1} {} }; struct SourceReference { - std::string message; ///< A message that relates to this source reference (such as a warning or an error message). - std::string sourceName; ///< Underlying source name (for example the filename). - LineColumn position; ///< Actual (error) position this source reference is surrounding. - bool multiline; ///< Indicates whether the actual SourceReference is truncated to one line. - std::string text; ///< Extracted source code text (potentially truncated if multiline or too long). - int startColumn; ///< Highlighting range-start of text field. - int endColumn; ///< Highlighting range-end of text field. + std::string message; ///< A message that relates to this source reference (such as a warning or an error message). + std::string sourceName; ///< Underlying source name (for example the filename). + LineColumn position; ///< Actual (error) position this source reference is surrounding. + bool multiline = {false}; ///< Indicates whether the actual SourceReference is truncated to one line. + std::string text; ///< Extracted source code text (potentially truncated if multiline or too long). + int startColumn = {-1}; ///< Highlighting range-start of text field. + int endColumn = {-1}; ///< Highlighting range-end of text field. /// Constructs a SourceReference containing a message only. static SourceReference MessageOnly(std::string _msg) { - return SourceReference{std::move(_msg), "", LineColumn{-1, -1}, false, "", -1, -1}; + SourceReference sref; + sref.message = std::move(_msg); + return sref; } }; diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index e6e4d3b6..5c2f49a6 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -41,7 +41,7 @@ class CodeFragment public: using ReadCallback = std::function<std::string(std::string const&)>; - CodeFragment() {} + CodeFragment() = default; CodeFragment(sp::utree const& _t, CompilerState& _s, ReadCallback const& _readFile, bool _allowASM = false); static CodeFragment compile(std::string const& _src, CompilerState& _s, ReadCallback const& _readFile); diff --git a/libsolidity/analysis/ControlFlowGraph.h b/libsolidity/analysis/ControlFlowGraph.h index db8e1565..cc0113d8 100644 --- a/libsolidity/analysis/ControlFlowGraph.h +++ b/libsolidity/analysis/ControlFlowGraph.h @@ -103,7 +103,8 @@ struct CFGNode /** Describes the control flow of a function. */ struct FunctionFlow { - virtual ~FunctionFlow() {} + virtual ~FunctionFlow() = default; + /// Entry node. Control flow of the function starts here. /// This node is empty and does not have any entries. CFGNode* entry = nullptr; diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 33893a4f..d1acf90b 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -46,7 +46,7 @@ using TypePointer = std::shared_ptr<Type const>; struct ASTAnnotation { - virtual ~ASTAnnotation() {} + virtual ~ASTAnnotation() = default; }; struct DocTag @@ -57,7 +57,7 @@ struct DocTag struct DocumentedAnnotation { - virtual ~DocumentedAnnotation() {} + virtual ~DocumentedAnnotation() = default; /// Mapping docstring tag name -> content. std::multimap<std::string, DocTag> docTags; }; diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index ac1487b2..bee00661 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -601,7 +601,6 @@ private: class BoolType: public Type { public: - BoolType() {} Category category() const override { return Category::Bool; } std::string richIdentifier() const override { return "t_bool"; } TypeResult unaryOperatorResult(Token _operator) const override; diff --git a/libsolidity/codegen/LValue.h b/libsolidity/codegen/LValue.h index 3b44597f..3072ff11 100644 --- a/libsolidity/codegen/LValue.h +++ b/libsolidity/codegen/LValue.h @@ -49,7 +49,7 @@ protected: m_context(_compilerContext), m_dataType(_dataType) {} public: - virtual ~LValue() {} + virtual ~LValue() = default; /// @returns the number of stack slots occupied by the lvalue reference virtual unsigned sizeOnStack() const { return 1; } /// Copies the value of the current lvalue to the top of the stack and, if @a _remove is true, diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index adfb94bd..f9d889e7 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -389,18 +389,27 @@ string const CompilerStack::lastContractName() const eth::AssemblyItems const* CompilerStack::assemblyItems(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& currentContract = contract(_contractName); return currentContract.compiler ? &contract(_contractName).compiler->assemblyItems() : nullptr; } eth::AssemblyItems const* CompilerStack::runtimeAssemblyItems(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& currentContract = contract(_contractName); return currentContract.compiler ? &contract(_contractName).compiler->runtimeAssemblyItems() : nullptr; } string const* CompilerStack::sourceMapping(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& c = contract(_contractName); if (!c.sourceMapping) { @@ -412,6 +421,9 @@ string const* CompilerStack::sourceMapping(string const& _contractName) const string const* CompilerStack::runtimeSourceMapping(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& c = contract(_contractName); if (!c.runtimeSourceMapping) { @@ -447,17 +459,26 @@ std::string const CompilerStack::filesystemFriendlyName(string const& _contractN eth::LinkerObject const& CompilerStack::object(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + return contract(_contractName).object; } eth::LinkerObject const& CompilerStack::runtimeObject(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + return contract(_contractName).runtimeObject; } /// FIXME: cache this string string CompilerStack::assemblyString(string const& _contractName, StringMap _sourceCodes) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& currentContract = contract(_contractName); if (currentContract.compiler) return currentContract.compiler->assemblyString(_sourceCodes); @@ -468,6 +489,9 @@ string CompilerStack::assemblyString(string const& _contractName, StringMap _sou /// FIXME: cache the JSON Json::Value CompilerStack::assemblyJSON(string const& _contractName, StringMap _sourceCodes) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + Contract const& currentContract = contract(_contractName); if (currentContract.compiler) return currentContract.compiler->assemblyJSON(_sourceCodes); @@ -494,13 +518,16 @@ map<string, unsigned> CompilerStack::sourceIndices() const Json::Value const& CompilerStack::contractABI(string const& _contractName) const { + if (m_stackState < AnalysisSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); + return contractABI(contract(_contractName)); } Json::Value const& CompilerStack::contractABI(Contract const& _contract) const { if (m_stackState < AnalysisSuccessful) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); solAssert(_contract.contract, ""); @@ -513,13 +540,16 @@ Json::Value const& CompilerStack::contractABI(Contract const& _contract) const Json::Value const& CompilerStack::natspecUser(string const& _contractName) const { + if (m_stackState < AnalysisSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); + return natspecUser(contract(_contractName)); } Json::Value const& CompilerStack::natspecUser(Contract const& _contract) const { if (m_stackState < AnalysisSuccessful) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); solAssert(_contract.contract, ""); @@ -532,13 +562,16 @@ Json::Value const& CompilerStack::natspecUser(Contract const& _contract) const Json::Value const& CompilerStack::natspecDev(string const& _contractName) const { + if (m_stackState < AnalysisSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); + return natspecDev(contract(_contractName)); } Json::Value const& CompilerStack::natspecDev(Contract const& _contract) const { if (m_stackState < AnalysisSuccessful) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); solAssert(_contract.contract, ""); @@ -551,6 +584,9 @@ Json::Value const& CompilerStack::natspecDev(Contract const& _contract) const Json::Value CompilerStack::methodIdentifiers(string const& _contractName) const { + if (m_stackState < AnalysisSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); + Json::Value methodIdentifiers(Json::objectValue); for (auto const& it: contractDefinition(_contractName).interfaceFunctions()) methodIdentifiers[it.second->externalSignature()] = it.first.hex(); @@ -583,8 +619,8 @@ SourceUnit const& CompilerStack::ast(string const& _sourceName) const ContractDefinition const& CompilerStack::contractDefinition(string const& _contractName) const { - if (m_stackState != CompilationSuccessful) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + if (m_stackState < AnalysisSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Analysis was not successful.")); return *contract(_contractName).contract; } @@ -594,6 +630,9 @@ size_t CompilerStack::functionEntryPoint( FunctionDefinition const& _function ) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + shared_ptr<Compiler> const& compiler = contract(_contractName).compiler; if (!compiler) return 0; @@ -936,6 +975,9 @@ bytes CompilerStack::createCBORMetadata(string const& _metadata, bool _experimen string CompilerStack::computeSourceMapping(eth::AssemblyItems const& _items) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + string ret; map<string, unsigned> sourceIndicesMap = sourceIndices(); int prevStart = -1; @@ -1022,6 +1064,9 @@ Json::Value gasToJson(GasEstimator::GasConsumption const& _gas) Json::Value CompilerStack::gasEstimates(string const& _contractName) const { + if (m_stackState != CompilationSuccessful) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); + if (!assemblyItems(_contractName) && !runtimeAssemblyItems(_contractName)) return Json::Value(); diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index e99b1324..137a4439 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -28,6 +28,7 @@ #include <libdevcore/JSON.h> #include <libdevcore/Keccak256.h> +#include <boost/algorithm/cxx11/any_of.hpp> #include <boost/algorithm/string.hpp> #include <boost/optional.hpp> #include <algorithm> @@ -191,6 +192,31 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _fil return false; } +/// @returns true if any binary was requested, i.e. we actually have to perform compilation. +bool isBinaryRequested(Json::Value const& _outputSelection) +{ + if (!_outputSelection.isObject()) + return false; + + // This does not inculde "evm.methodIdentifiers" on purpose! + static vector<string> const outputsThatRequireBinaries{ + "*", + "metadata", // This is only generated at the end of compilation, but could be generated earlier. + "evm.deployedBytecode", "evm.deployedBytecode.object", "evm.deployedBytecode.opcodes", + "evm.deployedBytecode.sourceMap", "evm.deployedBytecode.linkReferences", + "evm.bytecode", "evm.bytecode.object", "evm.bytecode.opcodes", "evm.bytecode.sourceMap", + "evm.bytecode.linkReferences", + "evm.gasEstimates", "evm.legacyAssembly", "evm.assembly" + }; + + for (auto const& fileRequests: _outputSelection) + for (auto const& requests: fileRequests) + for (auto const& output: outputsThatRequireBinaries) + if (isArtifactRequested(requests, output)) + return true; + return false; +} + Json::Value formatLinkReferences(std::map<size_t, std::string> const& linkReferences) { Json::Value ret(Json::objectValue); @@ -564,9 +590,14 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) m_compilerStack.setRequestedContractNames(requestedContractNames(outputSelection)); + bool const binariesRequested = isBinaryRequested(outputSelection); + try { - m_compilerStack.compile(); + if (binariesRequested) + m_compilerStack.compile(); + else + m_compilerStack.parseAndAnalyze(); for (auto const& error: m_compilerStack.errors()) { @@ -655,7 +686,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) bool const compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful; /// Inconsistent state - stop here to receive error reports from users - if (!compilationSuccess && errors.empty()) + if (((binariesRequested && !compilationSuccess) || !analysisSuccess) && errors.empty()) return formatFatalError("InternalCompilerError", "No error reported, but compilation failed."); Json::Value output = Json::objectValue; @@ -681,7 +712,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) } Json::Value contractsOutput = Json::objectValue; - for (string const& contractName: compilationSuccess ? m_compilerStack.contractNames() : vector<string>()) + for (string const& contractName: analysisSuccess ? m_compilerStack.contractNames() : vector<string>()) { size_t colon = contractName.rfind(':'); solAssert(colon != string::npos, ""); @@ -692,7 +723,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) Json::Value contractData(Json::objectValue); if (isArtifactRequested(outputSelection, file, name, "abi")) contractData["abi"] = m_compilerStack.contractABI(contractName); - if (isArtifactRequested(outputSelection, file, name, "metadata")) + if (compilationSuccess && isArtifactRequested(outputSelection, file, name, "metadata")) contractData["metadata"] = m_compilerStack.metadata(contractName); if (isArtifactRequested(outputSelection, file, name, "userdoc")) contractData["userdoc"] = m_compilerStack.natspecUser(contractName); @@ -702,16 +733,16 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) // EVM Json::Value evmData(Json::objectValue); // @TODO: add ir - if (isArtifactRequested(outputSelection, file, name, "evm.assembly")) + if (compilationSuccess && isArtifactRequested(outputSelection, file, name, "evm.assembly")) evmData["assembly"] = m_compilerStack.assemblyString(contractName, createSourceList(_input)); - if (isArtifactRequested(outputSelection, file, name, "evm.legacyAssembly")) + if (compilationSuccess && isArtifactRequested(outputSelection, file, name, "evm.legacyAssembly")) evmData["legacyAssembly"] = m_compilerStack.assemblyJSON(contractName, createSourceList(_input)); if (isArtifactRequested(outputSelection, file, name, "evm.methodIdentifiers")) evmData["methodIdentifiers"] = m_compilerStack.methodIdentifiers(contractName); - if (isArtifactRequested(outputSelection, file, name, "evm.gasEstimates")) + if (compilationSuccess && isArtifactRequested(outputSelection, file, name, "evm.gasEstimates")) evmData["gasEstimates"] = m_compilerStack.gasEstimates(contractName); - if (isArtifactRequested( + if (compilationSuccess && isArtifactRequested( outputSelection, file, name, @@ -722,7 +753,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) m_compilerStack.sourceMapping(contractName) ); - if (isArtifactRequested( + if (compilationSuccess && isArtifactRequested( outputSelection, file, name, @@ -733,14 +764,18 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) m_compilerStack.runtimeSourceMapping(contractName) ); - contractData["evm"] = evmData; + if (!evmData.empty()) + contractData["evm"] = evmData; - if (!contractsOutput.isMember(file)) - contractsOutput[file] = Json::objectValue; - - contractsOutput[file][name] = contractData; + if (!contractData.empty()) + { + if (!contractsOutput.isMember(file)) + contractsOutput[file] = Json::objectValue; + contractsOutput[file][name] = contractData; + } } - output["contracts"] = contractsOutput; + if (!contractsOutput.empty()) + output["contracts"] = contractsOutput; return output; } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index bcb28988..8a6bc343 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -46,9 +46,9 @@ class Parser::ASTNodeFactory { public: explicit ASTNodeFactory(Parser const& _parser): - m_parser(_parser), m_location(_parser.position(), -1, _parser.source()) {} + m_parser(_parser), m_location{_parser.position(), -1, _parser.source()} {} ASTNodeFactory(Parser const& _parser, ASTPointer<ASTNode> const& _childNode): - m_parser(_parser), m_location(_childNode->location()) {} + m_parser(_parser), m_location{_childNode->location()} {} void markEndPosition() { m_location.end = m_parser.endPosition(); } void setLocation(SourceLocation const& _location) { m_location = _location; } diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index bf02c626..b8d0e9a8 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -47,7 +47,10 @@ private: struct VarDeclParserOptions { + // This is actually not needed, but due to a defect in the C++ standard, we have to. + // https://stackoverflow.com/questions/17430377 VarDeclParserOptions() {} + bool allowVar = false; bool isStateVariable = false; bool allowIndexed = false; @@ -85,7 +88,7 @@ private: ASTPointer<EnumDefinition> parseEnumDefinition(); ASTPointer<EnumValue> parseEnumValue(); ASTPointer<VariableDeclaration> parseVariableDeclaration( - VarDeclParserOptions const& _options = VarDeclParserOptions(), + VarDeclParserOptions const& _options = {}, ASTPointer<TypeName> const& _lookAheadArrayType = ASTPointer<TypeName>() ); ASTPointer<ModifierDefinition> parseModifierDefinition(); @@ -99,7 +102,7 @@ private: ASTPointer<FunctionTypeName> parseFunctionType(); ASTPointer<Mapping> parseMapping(); ASTPointer<ParameterList> parseParameterList( - VarDeclParserOptions const& _options, + VarDeclParserOptions const& _options = {}, bool _allowEmpty = true ); ASTPointer<Block> parseBlock(ASTPointer<ASTString> const& _docString = {}); diff --git a/libyul/Dialect.h b/libyul/Dialect.h index 2def566c..01fd98df 100644 --- a/libyul/Dialect.h +++ b/libyul/Dialect.h @@ -54,7 +54,7 @@ struct Dialect: boost::noncopyable virtual BuiltinFunction const* builtin(YulString /*_name*/) const { return nullptr; } Dialect(AsmFlavour _flavour): flavour(_flavour) {} - virtual ~Dialect() {} + virtual ~Dialect() = default; static std::shared_ptr<Dialect> yul() { diff --git a/libyul/Object.h b/libyul/Object.h index cfd8d02d..8484eb53 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -37,7 +37,7 @@ struct AsmAnalysisInfo; */ struct ObjectNode { - virtual ~ObjectNode() {} + virtual ~ObjectNode() = default; virtual std::string toString(bool _yul) const = 0; YulString name; diff --git a/libyul/YulString.h b/libyul/YulString.h index 35c1d92d..5cea5619 100644 --- a/libyul/YulString.h +++ b/libyul/YulString.h @@ -42,10 +42,9 @@ public: size_t id; std::uint64_t hash; }; - YulStringRepository(): - m_strings{std::make_shared<std::string>()}, - m_hashToID{std::make_pair(emptyHash(), 0)} - {} + + YulStringRepository() = default; + static YulStringRepository& instance() { static YulStringRepository inst; @@ -80,9 +79,10 @@ public: return hash; } static constexpr std::uint64_t emptyHash() { return 14695981039346656037u; } + private: - std::vector<std::shared_ptr<std::string>> m_strings; - std::unordered_multimap<std::uint64_t, size_t> m_hashToID; + std::vector<std::shared_ptr<std::string>> m_strings = {std::make_shared<std::string>()}; + std::unordered_multimap<std::uint64_t, size_t> m_hashToID = {{emptyHash(), 0}}; }; /// Wrapper around handles into the YulString repository. diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index 1f224ded..0cc41056 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -55,7 +55,7 @@ public: using LabelID = size_t; using SubID = size_t; - virtual ~AbstractAssembly() {} + virtual ~AbstractAssembly() = default; /// Set a new source location valid starting from the next instruction. virtual void setSourceLocation(langutil::SourceLocation const& _location) = 0; diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index cef9c19a..e62bc87e 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -38,7 +38,7 @@ class EVMAssembly: public AbstractAssembly { public: explicit EVMAssembly(bool _evm15 = false): m_evm15(_evm15) { } - virtual ~EVMAssembly() {} + virtual ~EVMAssembly() = default; /// Set a new source location valid starting from the next instruction. void setSourceLocation(langutil::SourceLocation const& _location) override; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 33ee19d4..935f05c6 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -38,7 +38,7 @@ using namespace dev::solidity; EVMDialect::EVMDialect(AsmFlavour _flavour, bool _objectAccess): - Dialect(_flavour), m_objectAccess(_objectAccess) + Dialect{_flavour}, m_objectAccess(_objectAccess) { // The EVM instructions will be moved to builtins at some point. if (!m_objectAccess) diff --git a/libyul/optimiser/RedundantAssignEliminator.h b/libyul/optimiser/RedundantAssignEliminator.h index 54d65823..4f82e7a2 100644 --- a/libyul/optimiser/RedundantAssignEliminator.h +++ b/libyul/optimiser/RedundantAssignEliminator.h @@ -115,7 +115,7 @@ public: static void run(Block& _ast); private: - RedundantAssignEliminator() {} + RedundantAssignEliminator() = default; class State { diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 0b22ca29..ff294adc 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -41,8 +41,6 @@ enum class DocumentationType: uint8_t; class CommandLineInterface { public: - CommandLineInterface() {} - /// Parse command line arguments and return false if we should not continue bool parseArguments(int _argc, char** _argv); /// Parse the files and create source code objects diff --git a/test/TestCase.h b/test/TestCase.h index 3c05ae4e..27320009 100644 --- a/test/TestCase.h +++ b/test/TestCase.h @@ -36,7 +36,7 @@ class TestCase public: using TestCaseCreator = std::unique_ptr<TestCase>(*)(std::string const&); - virtual ~TestCase() {} + virtual ~TestCase() = default; /// Runs the test case. /// Outputs error messages to @arg _stream. Each line of output is prefixed with @arg _linePrefix. diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index bb71e012..9d2ffa5f 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -132,7 +132,7 @@ test_solc_behaviour() { if [[ "$solc_args" == *"--standard-json"* ]]; then sed -i -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path" - sed -i -e 's/,"errors":\[\]//' "$stdout_path" + sed -i -e 's/"errors":\[\],\{0,1\}//' "$stdout_path" else sed -i -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path" sed -i -e 's/ Consider adding "pragma .*$//' "$stderr_path" diff --git a/test/cmdlineTests/standard.json.stdout b/test/cmdlineTests/standard.json.stdout index 490e1f80..59b90c8c 100644 --- a/test/cmdlineTests/standard.json.stdout +++ b/test/cmdlineTests/standard.json.stdout @@ -1 +1 @@ -{"contracts":{"A":{"C":{"evm":{}}}},"sources":{"A":{"id":0}}} +{"sources":{"A":{"id":0}}} diff --git a/test/cmdlineTests/standard_binaries_requested.json b/test/cmdlineTests/standard_binaries_requested.json new file mode 100644 index 00000000..65f19543 --- /dev/null +++ b/test/cmdlineTests/standard_binaries_requested.json @@ -0,0 +1,17 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + { + "outputSelection": + { + "*": { "*": ["evm.gasEstimates"] } + } + } +} diff --git a/test/cmdlineTests/standard_binaries_requested.json.stdout b/test/cmdlineTests/standard_binaries_requested.json.stdout new file mode 100644 index 00000000..2baef22a --- /dev/null +++ b/test/cmdlineTests/standard_binaries_requested.json.stdout @@ -0,0 +1 @@ +{"contracts":{"A":{"C":{"evm":{"gasEstimates":{"creation":{"codeDepositCost":"25600","executionCost":"75","totalCost":"25675"},"external":{"f()":"127"}}}}}},"sources":{"A":{"id":0}}}
\ No newline at end of file diff --git a/test/cmdlineTests/standard_methodIdentifiersRequested.json b/test/cmdlineTests/standard_methodIdentifiersRequested.json new file mode 100644 index 00000000..79a3c75d --- /dev/null +++ b/test/cmdlineTests/standard_methodIdentifiersRequested.json @@ -0,0 +1,17 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + { + "outputSelection": + { + "*": { "*": ["evm.methodIdentifiers"] } + } + } +} diff --git a/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout b/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout new file mode 100644 index 00000000..7e3f139f --- /dev/null +++ b/test/cmdlineTests/standard_methodIdentifiersRequested.json.stdout @@ -0,0 +1 @@ +{"contracts":{"A":{"C":{"evm":{"methodIdentifiers":{"f()":"26121ff0"}}}}},"sources":{"A":{"id":0}}} diff --git a/test/cmdlineTests/standard_only_ast_requested.json b/test/cmdlineTests/standard_only_ast_requested.json new file mode 100644 index 00000000..7abd6da5 --- /dev/null +++ b/test/cmdlineTests/standard_only_ast_requested.json @@ -0,0 +1,17 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "pragma solidity >=0.0; contract C { function f() public pure {} }" + } + }, + "settings": + { + "outputSelection": + { + "*": { "": ["ast"] } + } + } +} diff --git a/test/cmdlineTests/standard_only_ast_requested.json.stdout b/test/cmdlineTests/standard_only_ast_requested.json.stdout new file mode 100644 index 00000000..b884ab7d --- /dev/null +++ b/test/cmdlineTests/standard_only_ast_requested.json.stdout @@ -0,0 +1 @@ +{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"61:2:0","statements":[]},"documentation":null,"id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"46:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"61:0:0"},"scope":6,"src":"36:27:0","stateMutability":"pure","superFunction":null,"visibility":"public"}],"scope":7,"src":"23:42:0"}],"src":"0:65:0"},"id":0}}} diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index 6976755f..4e9040b9 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -56,11 +56,11 @@ BOOST_AUTO_TEST_CASE(all_assembly_items) { Assembly _assembly; auto root_asm = make_shared<CharStream>("", "root.asm"); - _assembly.setSourceLocation(SourceLocation(1, 3, root_asm)); + _assembly.setSourceLocation({1, 3, root_asm}); Assembly _subAsm; auto sub_asm = make_shared<CharStream>("", "sub.asm"); - _subAsm.setSourceLocation(SourceLocation(6, 8, sub_asm)); + _subAsm.setSourceLocation({6, 8, sub_asm}); _subAsm.append(Instruction::INVALID); shared_ptr<Assembly> _subAsmPtr = make_shared<Assembly>(_subAsm); diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 7d102948..c65d28d3 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -53,7 +53,7 @@ namespace // add dummy locations to each item so that we can check that they are not deleted AssemblyItems input = _input; for (AssemblyItem& item: input) - item.setLocation(SourceLocation(1, 3, nullptr)); + item.setLocation({1, 3, nullptr}); return input; } diff --git a/test/liblangutil/SourceLocation.cpp b/test/liblangutil/SourceLocation.cpp index ef4103da..5bdce88e 100644 --- a/test/liblangutil/SourceLocation.cpp +++ b/test/liblangutil/SourceLocation.cpp @@ -37,12 +37,12 @@ BOOST_AUTO_TEST_CASE(test_fail) auto const sourceA = std::make_shared<CharStream>("", "sourceA"); auto const sourceB = std::make_shared<CharStream>("", "sourceB"); - BOOST_CHECK(SourceLocation() == SourceLocation()); - BOOST_CHECK(SourceLocation(0, 3, sourceA) != SourceLocation(0, 3, sourceB)); - BOOST_CHECK(SourceLocation(0, 3, source) == SourceLocation(0, 3, source)); - BOOST_CHECK(SourceLocation(3, 7, source).contains(SourceLocation(4, 6, source))); - BOOST_CHECK(!SourceLocation(3, 7, sourceA).contains(SourceLocation(4, 6, sourceB))); - BOOST_CHECK(SourceLocation(3, 7, sourceA) < SourceLocation(4, 6, sourceB)); + BOOST_CHECK(SourceLocation{} == SourceLocation{}); + BOOST_CHECK((SourceLocation{0, 3, sourceA} != SourceLocation{0, 3, sourceB})); + BOOST_CHECK((SourceLocation{0, 3, source} == SourceLocation{0, 3, source})); + BOOST_CHECK((SourceLocation{3, 7, source}.contains(SourceLocation{4, 6, source}))); + BOOST_CHECK((!SourceLocation{3, 7, sourceA}.contains(SourceLocation{4, 6, sourceB}))); + BOOST_CHECK((SourceLocation{3, 7, sourceA} < SourceLocation{4, 6, sourceB})); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 5d8c89a4..baa9bff1 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -165,19 +165,19 @@ BOOST_AUTO_TEST_CASE(location_test) auto codegenCharStream = make_shared<CharStream>("", "--CODEGEN--"); vector<SourceLocation> locations = - vector<SourceLocation>(4, SourceLocation(2, 82, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(8, 17, codegenCharStream)) + - vector<SourceLocation>(3, SourceLocation(5, 7, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(30, 31, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(27, 28, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(20, 32, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(5, 7, codegenCharStream)) + - vector<SourceLocation>(hasShifts ? 19 : 20, SourceLocation(2, 82, sourceCode)) + - vector<SourceLocation>(24, SourceLocation(20, 79, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(49, 58, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(72, 74, sourceCode)) + - vector<SourceLocation>(2, SourceLocation(65, 74, sourceCode)) + - vector<SourceLocation>(2, SourceLocation(20, 79, sourceCode)); + vector<SourceLocation>(4, SourceLocation{2, 82, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{8, 17, codegenCharStream}) + + vector<SourceLocation>(3, SourceLocation{5, 7, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{30, 31, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{27, 28, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{20, 32, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{5, 7, codegenCharStream}) + + vector<SourceLocation>(hasShifts ? 19 : 20, SourceLocation{2, 82, sourceCode}) + + vector<SourceLocation>(24, SourceLocation{20, 79, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{49, 58, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{72, 74, sourceCode}) + + vector<SourceLocation>(2, SourceLocation{65, 74, sourceCode}) + + vector<SourceLocation>(2, SourceLocation{20, 79, sourceCode}); checkAssemblyLocations(items, locations); } diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 12c22604..d765d440 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -44,7 +44,6 @@ namespace test class GasMeterTestFramework: public SolidityExecutionFramework { public: - GasMeterTestFramework() { } void compile(string const& _sourceCode) { m_compiler.reset(false); diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp index 09c08700..ec97f22f 100644 --- a/test/libsolidity/LibSolc.cpp +++ b/test/libsolidity/LibSolc.cpp @@ -81,7 +81,9 @@ BOOST_AUTO_TEST_CASE(standard_compilation) // Only tests some assumptions. The StandardCompiler is tested properly in another suite. BOOST_CHECK(result.isMember("sources")); - BOOST_CHECK(result.isMember("contracts")); + // This used to test that it is a member, but we did not actually request any output, + // so there should not be a contract member. + BOOST_CHECK(!result.isMember("contracts")); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index a8a67bca..63f2b3a6 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -38,8 +38,6 @@ namespace test class JSONInterfaceChecker { public: - JSONInterfaceChecker(): m_compilerStack() {} - void checkInterface(std::string const& _code, std::string const& _contractName, std::string const& _expectedInterfaceString) { m_compilerStack.reset(false); diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index d930f697..000a7938 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -39,8 +39,6 @@ namespace test class DocumentationChecker { public: - DocumentationChecker(): m_compilerStack() {} - void checkNatspec( std::string const& _code, std::string const& _contractName, diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index f925d36e..b5ce6f2a 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -45,8 +45,6 @@ namespace test class OptimizerTestFramework: public SolidityExecutionFramework { public: - OptimizerTestFramework() { } - bytes const& compileAndRunWithOptimizer( std::string const& _sourceCode, u256 const& _value = 0, |