diff --git a/scripts/check_style.sh b/scripts/check_style.sh index dd1f58348..6a1b2c15e 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -85,16 +85,27 @@ FORMATERROR=$( # unqualified move()/forward() checks, i.e. make sure that std::move() and std::forward() are used instead of move() and forward() preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move" preparedGrep "forward\(.+\)" | grep -v "std::forward" | grep -E "[^a-z]forward" - # make sure `using namespace std` is not used in INCLUDE_DIRECTORIES - # shellcheck disable=SC2068,SC2068 - grep -nIE -d skip "using namespace std;" ${NAMESPACE_STD_FREE_FILES[@]} ) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true ) -if [[ "$FORMATERROR" != "" ]] +# Special error handling for `using namespace std;` exclusion, since said statement can be present in the test directory +# and its subdirectories, but is excluded in the above ruleset. In order to have consistent codestyle with regards to +# std namespace usage, test directory must also be covered. +FORMATSTDERROR=$( +( + # make sure `using namespace std` is not used in INCLUDE_DIRECTORIES + # shellcheck disable=SC2068,SC2068 + grep -nIE -d skip "using namespace std;" ${NAMESPACE_STD_FREE_FILES[@]} +) || true +) + +# Merge errors into single string +FORMATEDERRORS="$FORMATERROR$FORMATSTDERROR" + +if [[ "$FORMATEDERRORS" != "" ]] then echo "Coding style error:" | tee -a "$ERROR_LOG" - echo "$FORMATERROR" | tee -a "$ERROR_LOG" + echo "$FORMATEDERRORS" | tee -a "$ERROR_LOG" scripts/ci/post_style_errors_on_github.sh "$ERROR_LOG" exit 1 fi diff --git a/test/libsolidity/NatspecJSONTest.cpp b/test/libsolidity/NatspecJSONTest.cpp index 434d5b392..c8b9369ca 100644 --- a/test/libsolidity/NatspecJSONTest.cpp +++ b/test/libsolidity/NatspecJSONTest.cpp @@ -29,11 +29,11 @@ #include -using namespace std; using namespace solidity::frontend::test; using namespace solidity::util; +using namespace std::string_literals; -ostream& solidity::frontend::test::operator<<(ostream& _output, NatspecJSONKind _kind) +std::ostream& solidity::frontend::test::operator<<(std::ostream& _output, NatspecJSONKind _kind) { switch (_kind) { case NatspecJSONKind::Devdoc: _output << "devdoc"; break; @@ -42,12 +42,12 @@ ostream& solidity::frontend::test::operator<<(ostream& _output, NatspecJSONKind return _output; } -unique_ptr NatspecJSONTest::create(Config const& _config) +std::unique_ptr NatspecJSONTest::create(Config const& _config) { - return make_unique(_config.filename, _config.evmVersion); + return std::make_unique(_config.filename, _config.evmVersion); } -void NatspecJSONTest::parseCustomExpectations(istream& _stream) +void NatspecJSONTest::parseCustomExpectations(std::istream& _stream) { soltestAssert(m_expectedNatspecJSON.empty()); @@ -56,21 +56,21 @@ void NatspecJSONTest::parseCustomExpectations(istream& _stream) // // // // - string line; + std::string line; while (getline(_stream, line)) { - string_view strippedLine = expectLinePrefix(line); + std::string_view strippedLine = expectLinePrefix(line); if (strippedLine.empty()) continue; auto [contractName, kind] = parseExpectationHeader(strippedLine); - string rawJSON = extractExpectationJSON(_stream); - string jsonErrors; + std::string rawJSON = extractExpectationJSON(_stream); + std::string jsonErrors; Json::Value parsedJSON; bool jsonParsingSuccessful = jsonParseStrict(rawJSON, parsedJSON, &jsonErrors); if (!jsonParsingSuccessful) - BOOST_THROW_EXCEPTION(runtime_error(fmt::format( + BOOST_THROW_EXCEPTION(std::runtime_error(fmt::format( "Malformed JSON in {} expectation for contract {}.\n" "Note that JSON expectations must be pretty-printed to be split correctly. " "The object is assumed to and at the first unindented closing brace.\n" @@ -80,7 +80,7 @@ void NatspecJSONTest::parseCustomExpectations(istream& _stream) rawJSON ))); - m_expectedNatspecJSON[string(contractName)][kind] = parsedJSON; + m_expectedNatspecJSON[std::string(contractName)][kind] = parsedJSON; } } @@ -94,51 +94,51 @@ bool NatspecJSONTest::expectationsMatch() prettyPrinted(obtainedNatspec()) == prettyPrinted(m_expectedNatspecJSON); } -void NatspecJSONTest::printExpectedResult(ostream& _stream, string const& _linePrefix, bool _formatted) const +void NatspecJSONTest::printExpectedResult(std::ostream& _stream, std::string const& _linePrefix, bool _formatted) const { SyntaxTest::printExpectedResult(_stream, _linePrefix, _formatted); if (!m_expectedNatspecJSON.empty()) { - _stream << _linePrefix << "----" << endl; + _stream << _linePrefix << "----" << std::endl; printIndented(_stream, formatNatspecExpectations(m_expectedNatspecJSON), _linePrefix); } } -void NatspecJSONTest::printObtainedResult(ostream& _stream, string const& _linePrefix, bool _formatted) const +void NatspecJSONTest::printObtainedResult(std::ostream& _stream, std::string const& _linePrefix, bool _formatted) const { SyntaxTest::printObtainedResult(_stream, _linePrefix, _formatted); NatspecMap natspecJSON = obtainedNatspec(); if (!natspecJSON.empty()) { - _stream << _linePrefix << "----" << endl; + _stream << _linePrefix << "----" << std::endl; // TODO: Diff both versions and highlight differences. // We should have a helper for doing that in newly defined test cases without much effort. printIndented(_stream, formatNatspecExpectations(natspecJSON), _linePrefix); } } -tuple NatspecJSONTest::parseExpectationHeader(string_view _line) +std::tuple NatspecJSONTest::parseExpectationHeader(std::string_view _line) { for (NatspecJSONKind kind: {NatspecJSONKind::Devdoc, NatspecJSONKind::Userdoc}) { - string kindSuffix = " " + toString(kind); + std::string kindSuffix = " " + toString(kind); if (boost::algorithm::ends_with(_line, kindSuffix)) return {_line.substr(0, _line.size() - kindSuffix.size()), kind}; } - BOOST_THROW_EXCEPTION(runtime_error( + BOOST_THROW_EXCEPTION(std::runtime_error( "Natspec kind (devdoc/userdoc) not present in the expectation: "s.append(_line) )); } -string NatspecJSONTest::extractExpectationJSON(istream& _stream) +std::string NatspecJSONTest::extractExpectationJSON(std::istream& _stream) { - string rawJSON; - string line; + std::string rawJSON; + std::string line; while (getline(_stream, line)) { - string_view strippedLine = expectLinePrefix(line); + std::string_view strippedLine = expectLinePrefix(line); rawJSON += strippedLine; rawJSON += "\n"; @@ -149,11 +149,11 @@ string NatspecJSONTest::extractExpectationJSON(istream& _stream) return rawJSON; } -string_view NatspecJSONTest::expectLinePrefix(string_view _line) +std::string_view NatspecJSONTest::expectLinePrefix(std::string_view _line) { size_t startPosition = 0; if (!boost::algorithm::starts_with(_line, "//")) - BOOST_THROW_EXCEPTION(runtime_error( + BOOST_THROW_EXCEPTION(std::runtime_error( "Expectation line is not a comment: "s.append(_line) )); @@ -164,9 +164,9 @@ string_view NatspecJSONTest::expectLinePrefix(string_view _line) return _line.substr(startPosition, _line.size() - startPosition); } -string NatspecJSONTest::formatNatspecExpectations(NatspecMap const& _expectations) const +std::string NatspecJSONTest::formatNatspecExpectations(NatspecMap const& _expectations) const { - string output; + std::string output; bool first = true; // NOTE: Not sorting explicitly because CompilerStack seems to put contracts roughly in the // order in which they appear in the source, which is much better than alphabetical order. @@ -190,7 +190,7 @@ NatspecMap NatspecJSONTest::obtainedNatspec() const return {}; NatspecMap result; - for (string contractName: compiler().contractNames()) + for (std::string contractName: compiler().contractNames()) { result[contractName][NatspecJSONKind::Devdoc] = compiler().natspecDev(contractName); result[contractName][NatspecJSONKind::Userdoc] = compiler().natspecUser(contractName); diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 14ccbba46..e0f010c49 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -31,7 +31,6 @@ #include -using namespace std; using namespace solidity::langutil; namespace solidity::frontend::test @@ -50,7 +49,7 @@ ASTPointer parseText(std::string const& _source, ErrorList& if (!sourceUnit) return ASTPointer(); for (ASTPointer const& node: sourceUnit->nodes()) - if (ASTPointer contract = dynamic_pointer_cast(node)) + if (ASTPointer contract = std::dynamic_pointer_cast(node)) return contract; BOOST_FAIL("No contract found in source."); return ASTPointer(); @@ -525,7 +524,7 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved) for (auto const& keyword: keywords) { auto text = std::string("contract ") + keyword + " {}"; - CHECK_PARSE_ERROR(text.c_str(), string("Expected identifier but got reserved keyword '") + keyword + "'"); + CHECK_PARSE_ERROR(text.c_str(), std::string("Expected identifier but got reserved keyword '") + keyword + "'"); } } @@ -591,7 +590,7 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location) class CheckInlineAsmLocation: public ASTConstVisitor { public: - explicit CheckInlineAsmLocation(string _sourceCode): m_sourceCode(_sourceCode) {} + explicit CheckInlineAsmLocation(std::string _sourceCode): m_sourceCode(_sourceCode) {} bool visited = false; bool visit(InlineAssembly const& _inlineAsm) override { @@ -602,7 +601,7 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location) return false; } - string m_sourceCode; + std::string m_sourceCode; }; CheckInlineAsmLocation visitor{sourceCode}; diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index db43f49c0..e4523292f 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -27,7 +27,6 @@ #include #include -using namespace std; using namespace solidity::langutil; namespace solidity::frontend::test @@ -86,9 +85,9 @@ BOOST_AUTO_TEST_CASE(storage_layout_simple) BOOST_REQUIRE(members.memberStorageOffset("first") != nullptr); BOOST_REQUIRE(members.memberStorageOffset("second") != nullptr); BOOST_REQUIRE(members.memberStorageOffset("wraps") != nullptr); - BOOST_CHECK(*members.memberStorageOffset("first") == make_pair(u256(0), unsigned(0))); - BOOST_CHECK(*members.memberStorageOffset("second") == make_pair(u256(0), unsigned(16))); - BOOST_CHECK(*members.memberStorageOffset("wraps") == make_pair(u256(1), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("first") == std::make_pair(u256(0), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("second") == std::make_pair(u256(0), unsigned(16))); + BOOST_CHECK(*members.memberStorageOffset("wraps") == std::make_pair(u256(1), unsigned(0))); } BOOST_AUTO_TEST_CASE(storage_layout_mapping) @@ -114,10 +113,10 @@ BOOST_AUTO_TEST_CASE(storage_layout_mapping) BOOST_REQUIRE(members.memberStorageOffset("second") != nullptr); BOOST_REQUIRE(members.memberStorageOffset("third") != nullptr); BOOST_REQUIRE(members.memberStorageOffset("final") != nullptr); - BOOST_CHECK(*members.memberStorageOffset("first") == make_pair(u256(0), unsigned(0))); - BOOST_CHECK(*members.memberStorageOffset("second") == make_pair(u256(1), unsigned(0))); - BOOST_CHECK(*members.memberStorageOffset("third") == make_pair(u256(2), unsigned(0))); - BOOST_CHECK(*members.memberStorageOffset("final") == make_pair(u256(3), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("first") == std::make_pair(u256(0), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("second") == std::make_pair(u256(1), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("third") == std::make_pair(u256(2), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("final") == std::make_pair(u256(3), unsigned(0))); } BOOST_AUTO_TEST_CASE(storage_layout_arrays) @@ -162,7 +161,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers) BOOST_CHECK_EQUAL(RationalNumberType(rational(2 * 200, 2 * 77)).identifier(), "t_rational_200_by_77"); BOOST_CHECK_EQUAL(RationalNumberType(rational(-2 * 200, 2 * 77)).identifier(), "t_rational_minus_200_by_77"); BOOST_CHECK_EQUAL( - StringLiteralType(Literal(++id, SourceLocation{}, Token::StringLiteral, make_shared("abc - def"))).identifier(), + StringLiteralType(Literal(++id, SourceLocation{}, Token::StringLiteral, std::make_shared("abc - def"))).identifier(), "t_stringliteral_196a9142ee0d40e274a6482393c762b16dd8315713207365e1e13d8d85b74fc4" ); BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("bytes1")->identifier(), "t_bytes1"); @@ -183,15 +182,15 @@ BOOST_AUTO_TEST_CASE(type_identifiers) Type const* multiArray = TypeProvider::array(DataLocation::Storage, stringArray); BOOST_CHECK_EQUAL(multiArray->identifier(), "t_array$_t_array$_t_string_storage_$20_storage_$dyn_storage_ptr"); - ContractDefinition c(++id, SourceLocation{}, make_shared("MyContract$"), SourceLocation{}, {}, {}, {}, ContractKind::Contract); + ContractDefinition c(++id, SourceLocation{}, std::make_shared("MyContract$"), SourceLocation{}, {}, {}, {}, ContractKind::Contract); BOOST_CHECK_EQUAL(c.type()->identifier(), "t_type$_t_contract$_MyContract$$$_$2_$"); BOOST_CHECK_EQUAL(ContractType(c, true).identifier(), "t_super$_MyContract$$$_$2"); - StructDefinition s(++id, {}, make_shared("Struct"), {}, {}, {}); + StructDefinition s(++id, {}, std::make_shared("Struct"), {}, {}, {}); s.annotation().recursive = false; BOOST_CHECK_EQUAL(s.type()->identifier(), "t_type$_t_struct$_Struct_$3_storage_ptr_$"); - EnumDefinition e(++id, {}, make_shared("Enum"), {}, {}, {}); + EnumDefinition e(++id, {}, std::make_shared("Enum"), {}, {}, {}); BOOST_CHECK_EQUAL(e.type()->identifier(), "t_type$_t_enum$_Enum_$4_$"); TupleType t({e.type(), s.type(), stringArray, nullptr}); @@ -209,8 +208,8 @@ BOOST_AUTO_TEST_CASE(type_identifiers) // TypeType is tested with contract - auto emptyParams = make_shared(++id, SourceLocation(), std::vector>()); - ModifierDefinition mod(++id, SourceLocation{}, make_shared("modif"), SourceLocation{}, {}, emptyParams, {}, {}, {}); + auto emptyParams = std::make_shared(++id, SourceLocation(), std::vector>()); + ModifierDefinition mod(++id, SourceLocation{}, std::make_shared("modif"), SourceLocation{}, {}, emptyParams, {}, {}, {}); BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier$__$"); SourceUnit su(++id, {}, {}, {}, {}); @@ -250,34 +249,34 @@ BOOST_AUTO_TEST_CASE(helper_bool_result) { BoolResult r1{true}; BoolResult r2 = BoolResult::err("Failure."); - r1.merge(r2, logical_and()); + r1.merge(r2, std::logical_and()); BOOST_REQUIRE_EQUAL(r1.get(), false); BOOST_REQUIRE_EQUAL(r1.message(), "Failure."); BoolResult r3{false}; BoolResult r4{true}; - r3.merge(r4, logical_and()); + r3.merge(r4, std::logical_and()); BOOST_REQUIRE_EQUAL(r3.get(), false); BOOST_REQUIRE_EQUAL(r3.message(), ""); BoolResult r5{true}; BoolResult r6{true}; - r5.merge(r6, logical_and()); + r5.merge(r6, std::logical_and()); BOOST_REQUIRE_EQUAL(r5.get(), true); BOOST_REQUIRE_EQUAL(r5.message(), ""); } BOOST_AUTO_TEST_CASE(helper_string_result) { - using StringResult = util::Result; + using StringResult = util::Result; - StringResult r1{string{"Success"}}; + StringResult r1{std::string{"Success"}}; StringResult r2 = StringResult::err("Failure"); BOOST_REQUIRE_EQUAL(r1.get(), "Success"); BOOST_REQUIRE_EQUAL(r2.get(), ""); - r1.merge(r2, [](string const&, string const& _rhs) { return _rhs; }); + r1.merge(r2, [](std::string const&, std::string const& _rhs) { return _rhs; }); BOOST_REQUIRE_EQUAL(r1.get(), ""); BOOST_REQUIRE_EQUAL(r1.message(), "Failure"); diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 7d02e0a9e..df5a2137b 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -32,8 +32,8 @@ #include #include -using namespace std; using namespace solidity::evmasm; +using namespace std::string_literals; namespace solidity::frontend::test { @@ -41,9 +41,9 @@ namespace solidity::frontend::test namespace { -langutil::Error::Severity str2Severity(string const& _cat) +langutil::Error::Severity str2Severity(std::string const& _cat) { - map cats{ + std::map cats{ {"info", langutil::Error::Severity::Info}, {"Info", langutil::Error::Severity::Info}, {"warning", langutil::Error::Severity::Warning}, @@ -55,7 +55,7 @@ langutil::Error::Severity str2Severity(string const& _cat) } /// Helper to match a specific error type and message -bool containsError(Json::Value const& _compilerResult, string const& _type, string const& _message) +bool containsError(Json::Value const& _compilerResult, std::string const& _type, std::string const& _message) { if (!_compilerResult.isMember("errors")) return false; @@ -88,7 +88,7 @@ bool containsAtMostWarnings(Json::Value const& _compilerResult) return true; } -Json::Value getContractResult(Json::Value const& _compilerResult, string const& _file, string const& _name) +Json::Value getContractResult(Json::Value const& _compilerResult, std::string const& _file, std::string const& _name) { if ( !_compilerResult["contracts"].isObject() || @@ -107,10 +107,10 @@ void checkLinkReferencesSchema(Json::Value const& _contractResult) Json::Value const& linkReferenceResult = _contractResult["evm"]["bytecode"]["linkReferences"]; BOOST_TEST_REQUIRE(linkReferenceResult.isObject()); - for (string const& fileName: linkReferenceResult.getMemberNames()) + for (std::string const& fileName: linkReferenceResult.getMemberNames()) { BOOST_TEST_REQUIRE(linkReferenceResult[fileName].isObject()); - for (string const& libraryName: linkReferenceResult[fileName].getMemberNames()) + for (std::string const& libraryName: linkReferenceResult[fileName].getMemberNames()) { BOOST_TEST_REQUIRE(linkReferenceResult[fileName][libraryName].isArray()); BOOST_TEST_REQUIRE(!linkReferenceResult[fileName][libraryName].empty()); @@ -125,7 +125,7 @@ void checkLinkReferencesSchema(Json::Value const& _contractResult) } } -void expectLinkReferences(Json::Value const& _contractResult, map> const& _expectedLinkReferences) +void expectLinkReferences(Json::Value const& _contractResult, std::map> const& _expectedLinkReferences) { checkLinkReferencesSchema(_contractResult); @@ -136,15 +136,15 @@ void expectLinkReferences(Json::Value const& _contractResult, map>(optimizer["details"]["yulDetails"].getMemberNames()) == - (set{"stackAllocation", "optimizerSteps"}) + util::convertContainer>(optimizer["details"]["yulDetails"].getMemberNames()) == + (std::set{"stackAllocation", "optimizerSteps"}) ); BOOST_CHECK(optimizer["details"]["yulDetails"]["stackAllocation"].asBool() == true); BOOST_CHECK( @@ -1259,7 +1259,7 @@ BOOST_AUTO_TEST_CASE(metadata_without_compilation) BOOST_AUTO_TEST_CASE(license_in_metadata) { - string const input = R"( + std::string const input = R"( { "language": "Solidity", "sources": { @@ -1387,7 +1387,7 @@ BOOST_AUTO_TEST_CASE(use_stack_optimization) // Now disable stack optimizations and UnusedFunctionParameterPruner (p) // results in "stack too deep" - string optimiserSteps = OptimiserSettings::DefaultYulOptimiserSteps; + std::string optimiserSteps = OptimiserSettings::DefaultYulOptimiserSteps; optimiserSteps.erase( remove_if(optimiserSteps.begin(), optimiserSteps.end(), [](char ch) { return ch == 'p'; }), optimiserSteps.end() @@ -1728,16 +1728,16 @@ BOOST_AUTO_TEST_CASE(dependency_tracking_of_abstract_contract_yul) BOOST_REQUIRE(result["contracts"]["A.sol"]["C"].isObject()); BOOST_REQUIRE(result["contracts"]["A.sol"]["C"]["ir"].isString()); - const string& irCode = result["contracts"]["A.sol"]["C"]["ir"].asString(); + const std::string& irCode = result["contracts"]["A.sol"]["C"]["ir"].asString(); // Make sure C and B contracts are deployed - BOOST_REQUIRE(irCode.find("object \"C") != string::npos); - BOOST_REQUIRE(irCode.find("object \"B") != string::npos); + BOOST_REQUIRE(irCode.find("object \"C") != std::string::npos); + BOOST_REQUIRE(irCode.find("object \"B") != std::string::npos); // Make sure A and D are NOT deployed as they were not requested and are not // in any dependency - BOOST_REQUIRE(irCode.find("object \"A") == string::npos); - BOOST_REQUIRE(irCode.find("object \"D") == string::npos); + BOOST_REQUIRE(irCode.find("object \"A") == std::string::npos); + BOOST_REQUIRE(irCode.find("object \"D") == std::string::npos); BOOST_REQUIRE(result["sources"].isObject()); @@ -1770,15 +1770,15 @@ BOOST_AUTO_TEST_CASE(source_location_of_bare_block) solidity::frontend::StandardCompiler compiler; Json::Value result = compiler.compile(parsedInput); - string sourceMap = result["contracts"]["A.sol"]["A"]["evm"]["bytecode"]["sourceMap"].asString(); + std::string sourceMap = result["contracts"]["A.sol"]["A"]["evm"]["bytecode"]["sourceMap"].asString(); // Check that the bare block's source location is referenced. - string sourceRef = + std::string sourceRef = ";" + - to_string(string{"contract A { constructor() { uint x = 2; "}.size()) + + std::to_string(std::string{"contract A { constructor() { uint x = 2; "}.size()) + ":" + - to_string(string{"{ uint y = 3; }"}.size()); - BOOST_REQUIRE(sourceMap.find(sourceRef) != string::npos); + std::to_string(std::string{"{ uint y = 3; }"}.size()); + BOOST_REQUIRE(sourceMap.find(sourceRef) != std::string::npos); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 906391e01..5cdd22b42 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -28,7 +28,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::util::formatting; @@ -39,7 +38,7 @@ using namespace boost::unit_test; namespace fs = boost::filesystem; SyntaxTest::SyntaxTest( - string const& _filename, + std::string const& _filename, langutil::EVMVersion _evmVersion, Error::Severity _minSeverity ): @@ -80,14 +79,14 @@ void SyntaxTest::parseAndAnalyze() // failing compilation after successful analysis is a rare case, // it assumes that errors contain exactly one error, and the error is of type Error::Type::CodeGenerationError if (codeGeneretionErrorCount != 1 || errorCount != 1) - BOOST_THROW_EXCEPTION(runtime_error("Compilation failed even though analysis was successful.")); + BOOST_THROW_EXCEPTION(std::runtime_error("Compilation failed even though analysis was successful.")); } } catch (UnimplementedFeatureError const& _e) { m_errorList.emplace_back(SyntaxTestError{ "UnimplementedFeatureError", - nullopt, + std::nullopt, errorMessage(_e), "", -1, @@ -107,7 +106,7 @@ void SyntaxTest::filterObtainedErrors() int locationStart = -1; int locationEnd = -1; - string sourceName; + std::string sourceName; if (SourceLocation const* location = currentError->sourceLocation()) { locationStart = location->start;