Fixed #4301 (htmlreport broken)

This commit is contained in:
Daniel Marjamäki 2012-11-03 11:25:40 +01:00
parent 1714cea928
commit 24e71c479c
3 changed files with 19 additions and 4 deletions

View File

@ -2666,10 +2666,12 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg)
void Preprocessor::validateCfgError(const std::string &cfg)
{
const std::string id = "ConfigurationNotChecked";
const std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
const Severity::SeverityType severity = Severity::information;
ErrorLogger::ErrorMessage errmsg(locationList, severity, "Skipping configuration '" + cfg + "' because it seems to be invalid. Use -D if you want to check it.", id, false);
errmsg.file0 = file0;
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = 1;
loc.setfile(file0);
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->reportInfo(errmsg);
}

View File

@ -239,6 +239,10 @@ public:
*/
std::string handleIncludes(const std::string &code, const std::string &filePath, const std::list<std::string> &includePaths, std::map<std::string,std::string> &defs, std::list<std::string> includes = std::list<std::string>());
void setFile0(const std::string &f) {
file0 = f;
}
private:
void missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, bool userheader);

View File

@ -3676,6 +3676,15 @@ private:
ASSERT_EQUALS(true, preprocessor.validateCfg("\"\\\"DEBUG()\"", "DEBUG"));
ASSERT_EQUALS(false, preprocessor.validateCfg("\"DEBUG()\" DEBUG", "DEBUG"));
ASSERT_EQUALS(true, preprocessor.validateCfg("#undef DEBUG", "DEBUG"));
// #4301:
// #ifdef A
// int a = A; // <- using macro. must use -D so "A" will get a proper value
errout.str("");
settings.addEnabled("all");
preprocessor.setFile0("test.c");
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());
}
void if_sizeof() { // #4071