Fixed #2552 (preprocessor check XX is already guaranteed to be defined -- too eager?)
This commit is contained in:
parent
f66bdad03d
commit
7c9e52546d
|
@ -908,6 +908,8 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
|||
def += ";";
|
||||
def += *it;
|
||||
}
|
||||
|
||||
/* TODO: Fix TestPreprocessor::test7e (#2552)
|
||||
else
|
||||
{
|
||||
std::ostringstream lineStream;
|
||||
|
@ -918,11 +920,12 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
|||
loc.setfile(filename);
|
||||
loc.line = linenr;
|
||||
errmsg._callStack.push_back(loc);
|
||||
errmsg._severity = Severity::fromString("error");
|
||||
errmsg._severity = Severity::error;
|
||||
errmsg.setmsg(*it+" is already guaranteed to be defined");
|
||||
errmsg._id = "preprocessor" + lineStream.str();
|
||||
_errorLogger->reportErr(errmsg);
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (from_negation)
|
||||
{
|
||||
|
|
|
@ -78,6 +78,11 @@ private:
|
|||
TEST_CASE(test5);
|
||||
TEST_CASE(test6);
|
||||
TEST_CASE(test7);
|
||||
TEST_CASE(test7a);
|
||||
TEST_CASE(test7b);
|
||||
TEST_CASE(test7c);
|
||||
TEST_CASE(test7d);
|
||||
TEST_CASE(test7e);
|
||||
|
||||
// #error => don't extract any code
|
||||
TEST_CASE(error1);
|
||||
|
@ -429,8 +434,9 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Make sure an error message is written..
|
||||
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
errout.str());
|
||||
TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
"",
|
||||
errout.str());
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS("\n\n\n\n\n\n", actual[""]);
|
||||
|
@ -511,8 +517,9 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Make sure an error message is written..
|
||||
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
errout.str());
|
||||
TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
"",
|
||||
errout.str());
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||
|
@ -536,7 +543,36 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Make sure an error message is written..
|
||||
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
|
||||
"",
|
||||
errout.str());
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||
}
|
||||
|
||||
void test7e()
|
||||
{
|
||||
const char filedata[] = "#ifdef ABC\n"
|
||||
"#file \"test.h\"\n"
|
||||
"#ifndef test_h\n"
|
||||
"#define test_h\n"
|
||||
"#ifdef ABC\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#endfile\n"
|
||||
"#endif\n";
|
||||
|
||||
// Preprocess => actual result..
|
||||
std::istringstream istr(filedata);
|
||||
std::map<std::string, std::string> actual;
|
||||
Settings settings;
|
||||
Preprocessor preprocessor(&settings, this);
|
||||
errout.str("");
|
||||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Make sure an error message is written..
|
||||
ASSERT_EQUALS("",
|
||||
errout.str());
|
||||
|
||||
// Compare results..
|
||||
|
|
Loading…
Reference in New Issue