Report 'unknown macro' as information message with id unknownMacro
This commit is contained in:
parent
a50eb56d8d
commit
152be6df63
|
@ -451,14 +451,16 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
|||
locationList.push_back(loc);
|
||||
ErrorLogger::ErrorMessage errmsg(locationList,
|
||||
mTokenizer.list.getSourceFilePath(),
|
||||
Severity::error,
|
||||
e.type == InternalError::UNKNOWN_MACRO ? Severity::information : Severity::error,
|
||||
e.errorMessage,
|
||||
e.id,
|
||||
false);
|
||||
|
||||
reportErr(errmsg);
|
||||
if (!mSuppressInternalErrorFound)
|
||||
internalErrorFound = true;
|
||||
if (errmsg._severity == Severity::error || mSettings.isEnabled(errmsg._severity)) {
|
||||
reportErr(errmsg);
|
||||
if (!mSuppressInternalErrorFound)
|
||||
internalErrorFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <iomanip>
|
||||
|
||||
InternalError::InternalError(const Token *tok, const std::string &errorMsg, Type type) :
|
||||
token(tok), errorMessage(errorMsg)
|
||||
token(tok), errorMessage(errorMsg), type(type)
|
||||
{
|
||||
switch (type) {
|
||||
case AST:
|
||||
|
@ -43,6 +43,9 @@ InternalError::InternalError(const Token *tok, const std::string &errorMsg, Type
|
|||
case SYNTAX:
|
||||
id = "syntaxError";
|
||||
break;
|
||||
case UNKNOWN_MACRO:
|
||||
id = "unknownMacro";
|
||||
break;
|
||||
case INTERNAL:
|
||||
id = "cppcheckError";
|
||||
break;
|
||||
|
|
|
@ -54,10 +54,11 @@ namespace tinyxml2 {
|
|||
|
||||
/** @brief Simple container to be thrown when internal error is detected. */
|
||||
struct InternalError {
|
||||
enum Type {AST, SYNTAX, INTERNAL};
|
||||
enum Type {AST, SYNTAX, UNKNOWN_MACRO, INTERNAL};
|
||||
InternalError(const Token *tok, const std::string &errorMsg, Type type = INTERNAL);
|
||||
const Token *token;
|
||||
std::string errorMessage;
|
||||
Type type;
|
||||
std::string id;
|
||||
};
|
||||
|
||||
|
|
|
@ -7923,7 +7923,7 @@ void Tokenizer::syntaxErrorC(const Token *tok, const std::string &what) const
|
|||
void Tokenizer::unknownMacroError(const Token *tok1) const
|
||||
{
|
||||
printDebugOutput(0);
|
||||
throw InternalError(tok1, "There is an unknown macro here somewhere. Configuration is required. If " + tok1->str() + " is a macro then please configure it.", InternalError::SYNTAX);
|
||||
throw InternalError(tok1, "There is an unknown macro here somewhere. Configuration is required. If " + tok1->str() + " is a macro then please configure it.", InternalError::UNKNOWN_MACRO);
|
||||
}
|
||||
|
||||
void Tokenizer::unhandled_macro_class_x_y(const Token *tok) const
|
||||
|
|
Loading…
Reference in New Issue