commit
4076c46a33
|
@ -889,7 +889,7 @@ static void simplifyVarMap(std::map<std::string, std::string> &variables)
|
|||
// TODO: 2. handle function-macros too.
|
||||
|
||||
std::map<std::string, std::string>::iterator it = variables.find(varValue);
|
||||
while (it != variables.end() && it != i) {
|
||||
while (it != variables.end() && it->first != it->second && it != i) {
|
||||
varValue = it->second;
|
||||
it = variables.find(varValue);
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ private:
|
|||
TEST_CASE(if_or_2);
|
||||
|
||||
TEST_CASE(if_macro_eq_macro); // #3536
|
||||
TEST_CASE(ticket_3675);
|
||||
|
||||
TEST_CASE(multiline1);
|
||||
TEST_CASE(multiline2);
|
||||
|
@ -1521,6 +1522,23 @@ private:
|
|||
ASSERT_EQUALS("\n\n\n\nWilma\n\n\n\n", actual[""]);
|
||||
}
|
||||
|
||||
void ticket_3675() {
|
||||
const std::string code("#ifdef YYSTACKSIZE\n"
|
||||
"#define YYMAXDEPTH YYSTACKSIZE\n"
|
||||
"#else\n"
|
||||
"#define YYSTACKSIZE YYMAXDEPTH\n"
|
||||
"#endif\n"
|
||||
"#if YYDEBUG\n"
|
||||
"#endif\n");
|
||||
Settings settings;
|
||||
Preprocessor preprocessor(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
std::map<std::string, std::string> actual;
|
||||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// There's nothing to assert. It just needs to not hang.
|
||||
}
|
||||
|
||||
void multiline1() {
|
||||
const char filedata[] = "#define str \"abc\" \\\n"
|
||||
" \"def\" \n"
|
||||
|
|
Loading…
Reference in New Issue