diff --git a/lib/check.h b/lib/check.h index ab9c53414..8384b2d87 100644 --- a/lib/check.h +++ b/lib/check.h @@ -127,7 +127,7 @@ protected: } /** report an error */ - void reportError(const std::list &callstack, const Severity::SeverityType severity, const std::string &id, std::string msg) + void reportError(const std::list &callstack, Severity::SeverityType severity, const std::string &id, std::string msg) { // If the verbose flag hasn't been given, don't show verbose information if (!_settings || !_settings->_verbose) @@ -150,7 +150,7 @@ protected: locationList.push_back(loc); } - const ErrorLogger::ErrorMessage errmsg(locationList, Severity::toString(severity), msg, id); + const ErrorLogger::ErrorMessage errmsg(locationList, severity, msg, id); if (_errorLogger) _errorLogger->reportErr(errmsg); else diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 58cdbfc07..21d47adf6 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -325,7 +325,7 @@ void CheckMemoryLeak::reportErr(const std::list &callstack, Sever locations.push_back(loc); } - const ErrorLogger::ErrorMessage errmsg(locations, Severity::toString(severity), msg, id); + const ErrorLogger::ErrorMessage errmsg(locations, severity, msg, id); if (errorLogger) errorLogger->reportErr(errmsg); diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index bebfb2d9f..5645c7e56 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -192,7 +192,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger, locationList.push_back(fileLoc); } - const ErrorLogger::ErrorMessage errmsg(locationList, Severity::toString(Severity::style), "The function '" + funcname + "' is never used", "unusedFunction"); + const ErrorLogger::ErrorMessage errmsg(locationList, Severity::style, "The function '" + funcname + "' is never used", "unusedFunction"); if (errorLogger) errorLogger->reportErr(errmsg); else diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index bf7db4eed..f419b30c3 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -23,15 +23,15 @@ #include ErrorLogger::ErrorMessage::ErrorMessage() - :_severity(Severity::none) + :_severity(Severity::none) { } #include -ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, const std::string &severity, const std::string &msg, const std::string &id) +ErrorLogger::ErrorMessage::ErrorMessage(const std::list &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id) { _callStack = callStack; - _severity = Severity::fromString(severity); + _severity = severity; _msg = msg; _id = id; } @@ -224,12 +224,10 @@ void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const std::list &callStack) { std::ostringstream ostr; diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 9c637cf06..f03571a20 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -95,7 +95,7 @@ public: unsigned int line; }; - ErrorMessage(const std::list &callStack, const std::string &severity, const std::string &msg, const std::string &id); + ErrorMessage(const std::list &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id); ErrorMessage(); std::string toXML() const; diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index dfacad64c..09d45ae50 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -49,7 +49,7 @@ void Preprocessor::writeError(const std::string &fileName, const int linenr, Err loc.file = fileName; locationList.push_back(loc); errorLogger->reportErr(ErrorLogger::ErrorMessage(locationList, - "error", + Severity::error, errorText, errorType)); } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2fb66ac58..fbb8eea11 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -415,7 +415,7 @@ void Tokenizer::duplicateTypedefError(const Token *tok1, const Token *tok2, cons locationList.push_back(loc); const ErrorLogger::ErrorMessage errmsg(locationList, - "style", + Severity::style, std::string(type + " '" + tok2->str() + "' hides typedef with same name"), "variableHidingTypedef"); @@ -441,7 +441,7 @@ void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2, locationList.push_back(loc); const ErrorLogger::ErrorMessage errmsg(locationList, - "style", + Severity::style, std::string(type + " '" + tok2->str() + "' forward declaration unnecessary, already declared"), "unnecessaryForwardDeclaration"); @@ -2288,7 +2288,7 @@ void Tokenizer::simplifyTemplates() locationList.push_back(loc); const ErrorLogger::ErrorMessage errmsg(locationList, - "debug", + Severity::debug, "Failed to instantiate template. The checking continues anyway.", "templateInstantiate"); @@ -6184,7 +6184,7 @@ void Tokenizer::duplicateEnumError(const Token * tok1, const Token * tok2, const locationList.push_back(loc); const ErrorLogger::ErrorMessage errmsg(locationList, - "style", + Severity::style, std::string(type + " '" + tok2->str() + "' hides enumerator with same name"), "variableHidingEnum"); @@ -6931,7 +6931,7 @@ void Tokenizer::syntaxError(const Token *tok, char c) } const ErrorLogger::ErrorMessage errmsg(locationList, - "error", + Severity::error, std::string("Invalid number of character (") + c + ") " + @@ -6974,7 +6974,7 @@ void Tokenizer::cppcheckError(const Token *tok) const } const ErrorLogger::ErrorMessage errmsg(locationList, - "error", + Severity::error, "### Internal error in Cppcheck. Please report it.", "cppcheckError");