Fixed #4838 (False positive for ... seems to be invalid)
This commit is contained in:
parent
f5a3492e3a
commit
9eac4489ac
|
@ -2741,7 +2741,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg)
|
||||||
continue;
|
continue;
|
||||||
// macro is used in code, return false
|
// macro is used in code, return false
|
||||||
if (_settings->isEnabled("information"))
|
if (_settings->isEnabled("information"))
|
||||||
validateCfgError(cfg);
|
validateCfgError(cfg, macro);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2750,7 +2750,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::validateCfgError(const std::string &cfg)
|
void Preprocessor::validateCfgError(const std::string &cfg, const std::string ¯o)
|
||||||
{
|
{
|
||||||
const std::string id = "ConfigurationNotChecked";
|
const std::string id = "ConfigurationNotChecked";
|
||||||
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
|
||||||
|
@ -2758,7 +2758,7 @@ void Preprocessor::validateCfgError(const std::string &cfg)
|
||||||
loc.line = 1;
|
loc.line = 1;
|
||||||
loc.setfile(file0);
|
loc.setfile(file0);
|
||||||
locationList.push_back(loc);
|
locationList.push_back(loc);
|
||||||
ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, "Skipping configuration '" + cfg + "' because it seems to be invalid. Use -D if you want to check it.", id, false);
|
ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, "Skipping configuration '" + cfg + "' since the value of '" + macro + "' is unknown. Use -D if you want to check it.", id, false);
|
||||||
_errorLogger->reportInfo(errmsg);
|
_errorLogger->reportInfo(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3041,6 +3041,6 @@ void Preprocessor::getErrorMessages(ErrorLogger *errorLogger, const Settings *se
|
||||||
settings2.checkConfiguration=true;
|
settings2.checkConfiguration=true;
|
||||||
preprocessor.missingInclude("", 1, "", UserHeader);
|
preprocessor.missingInclude("", 1, "", UserHeader);
|
||||||
preprocessor.missingInclude("", 1, "", SystemHeader);
|
preprocessor.missingInclude("", 1, "", SystemHeader);
|
||||||
preprocessor.validateCfgError("X");
|
preprocessor.validateCfgError("X", "X");
|
||||||
preprocessor.error("", 1, "#error message"); // #error ..
|
preprocessor.error("", 1, "#error message"); // #error ..
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public:
|
||||||
* @return true => configuration is valid
|
* @return true => configuration is valid
|
||||||
*/
|
*/
|
||||||
bool validateCfg(const std::string &code, const std::string &cfg);
|
bool validateCfg(const std::string &code, const std::string &cfg);
|
||||||
void validateCfgError(const std::string &cfg);
|
void validateCfgError(const std::string &cfg, const std::string ¯o);
|
||||||
|
|
||||||
void handleUndef(std::list<std::string> &configurations) const;
|
void handleUndef(std::list<std::string> &configurations) const;
|
||||||
|
|
||||||
|
|
|
@ -3766,7 +3766,7 @@ private:
|
||||||
settings.addEnabled("all");
|
settings.addEnabled("all");
|
||||||
preprocessor.setFile0("test.c");
|
preprocessor.setFile0("test.c");
|
||||||
ASSERT_EQUALS(false, preprocessor.validateCfg("int a=A;", "A"));
|
ASSERT_EQUALS(false, preprocessor.validateCfg("int a=A;", "A"));
|
||||||
ASSERT_EQUALS("[test.c:1]: (information) Skipping configuration 'A' because it seems to be invalid. Use -D if you want to check it.\n", errout.str());
|
ASSERT_EQUALS("[test.c:1]: (information) Skipping configuration 'A' since the value of 'A' is unknown. Use -D if you want to check it.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void if_sizeof() { // #4071
|
void if_sizeof() { // #4071
|
||||||
|
|
Loading…
Reference in New Issue