diff options
author | chriseth <chris@ethereum.org> | 2018-04-11 22:13:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 22:13:41 +0800 |
commit | c9bdbcf470f4ca7f8d2d71f1be180274f534888d (patch) | |
tree | c2e87c1f85164bf7631e22c2ec53f9fd7bed681c /libsolidity/interface/ErrorReporter.cpp | |
parent | b7b6d0ce7c0c01a3600421ee3a402b1c913d8892 (diff) | |
parent | 43d2954de83af5f64f526fd36f1cd5c3b5299498 (diff) | |
download | dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar.gz dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar.bz2 dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar.lz dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar.xz dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.tar.zst dexon-solidity-c9bdbcf470f4ca7f8d2d71f1be180274f534888d.zip |
Merge pull request #3309 from ethereum/limit-errors
Limit the number of errors output in a single run to 256
Diffstat (limited to 'libsolidity/interface/ErrorReporter.cpp')
-rw-r--r-- | libsolidity/interface/ErrorReporter.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libsolidity/interface/ErrorReporter.cpp b/libsolidity/interface/ErrorReporter.cpp index e6171756..368e25e0 100644 --- a/libsolidity/interface/ErrorReporter.cpp +++ b/libsolidity/interface/ErrorReporter.cpp @@ -61,6 +61,9 @@ void ErrorReporter::warning( void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, string const& _description) { + if (checkForExcessiveErrors(_type)) + return; + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -71,6 +74,9 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, st void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) { + if (checkForExcessiveErrors(_type)) + return; + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -80,6 +86,37 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, Se m_errorList.push_back(err); } +bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) +{ + if (_type == Error::Type::Warning) + { + m_warningCount++; + + if (m_warningCount == c_maxWarningsAllowed) + { + auto err = make_shared<Error>(Error::Type::Warning); + *err << errinfo_comment("There are more than 256 warnings. Ignoring the rest."); + m_errorList.push_back(err); + } + + if (m_warningCount >= c_maxWarningsAllowed) + return true; + } + else + { + m_errorCount++; + + if (m_errorCount > c_maxErrorsAllowed) + { + auto err = make_shared<Error>(Error::Type::Warning); + *err << errinfo_comment("There are more than 256 errors. Aborting."); + m_errorList.push_back(err); + BOOST_THROW_EXCEPTION(FatalError()); + } + } + + return false; +} void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description) { |