Ignore warnings when limited errors to 256

This commit is contained in:
Alex Beregszaszi 2018-04-05 15:14:31 +02:00
parent 3730f68d4b
commit 0812d1189a

View File

@ -61,6 +61,7 @@ void ErrorReporter::warning(
void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, string const& _description)
{
if (_type != Error::Type::Warning)
abortIfExcessive();
auto err = make_shared<Error>(_type);
@ -73,6 +74,7 @@ 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 (_type != Error::Type::Warning)
abortIfExcessive();
auto err = make_shared<Error>(_type);
@ -86,7 +88,12 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, Se
void ErrorReporter::abortIfExcessive()
{
if (m_errorList.size() > 256)
unsigned errorCount = 0;
for (auto const& error: m_errorList)
if (error->type() != Error::Type::Warning)
errorCount++;
if (errorCount > 256)
{
auto err = make_shared<Error>(Error::Type::Warning);
*err << errinfo_comment("There are more than 256 errors. Aborting.");