Fixed #3418 (preprocessor define assignment not propagated)
This commit is contained in:
parent
6221145be8
commit
fd78816181
|
@ -1857,7 +1857,11 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str
|
|||
else if (line.find("(") == std::string::npos) {
|
||||
const std::string::size_type pos = line.find(" ", 8);
|
||||
tag = line.substr(8,pos-8);
|
||||
defs[tag] = line.substr(pos+1);
|
||||
const std::string value(line.substr(pos+1));
|
||||
if (defs.find(value) != defs.end())
|
||||
defs[tag] = defs[value];
|
||||
else
|
||||
defs[tag] = value;
|
||||
}
|
||||
|
||||
if (undefs.find(tag) != undefs.end()) {
|
||||
|
|
|
@ -3084,6 +3084,19 @@ private:
|
|||
actual.erase(actual.find("\n"),1);
|
||||
ASSERT_EQUALS("124", actual);
|
||||
}
|
||||
|
||||
// #3418
|
||||
{
|
||||
defs.clear();
|
||||
const char code[] = "#define A 1\n"
|
||||
"#define B A\n"
|
||||
"#if A == B\n"
|
||||
"123\n"
|
||||
"#endif\n";
|
||||
|
||||
std::string actual(preprocessor.handleIncludes(code, filePath, includePaths, defs));
|
||||
ASSERT_EQUALS("#define A 1\n#define B A\n\n123\n\n", actual);
|
||||
}
|
||||
}
|
||||
|
||||
void undef1() {
|
||||
|
|
Loading…
Reference in New Issue