Fixed #8074 (Preprocessor::getConfigs: wrong configuration extracted 'A;B;;')
This commit is contained in:
parent
3930f2d6bc
commit
099b4435c3
|
@ -352,9 +352,12 @@ static void getConfigs(const simplecpp::TokenList &tokens, std::set<std::string>
|
|||
sameline(cmdtok->next, cmdtok->next->next) &&
|
||||
cmdtok->next->op == '#' &&
|
||||
cmdtok->next->next->str == "error") {
|
||||
const std::string &ifcfg = cfg(configs_if, userDefines);
|
||||
if (!ifcfg.empty()) {
|
||||
if (!elseError.empty())
|
||||
elseError += ';';
|
||||
elseError += cfg(configs_if, userDefines);
|
||||
elseError += ifcfg;
|
||||
}
|
||||
}
|
||||
if (!configs_if.empty())
|
||||
configs_if.pop_back();
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
TEST_CASE(error4); // #2919 - wrong filename is reported
|
||||
TEST_CASE(error5);
|
||||
TEST_CASE(error6);
|
||||
TEST_CASE(error7);
|
||||
|
||||
TEST_CASE(setPlatformInfo);
|
||||
|
||||
|
@ -409,6 +410,21 @@ private:
|
|||
|
||||
}
|
||||
|
||||
void error7() { // #8074
|
||||
const char filedata[] = "#define A\n"
|
||||
"\n"
|
||||
"#if defined(B)\n"
|
||||
"#else\n"
|
||||
"#error \"1\"\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#if defined(A)\n"
|
||||
"#else\n"
|
||||
"#error \"2\"\n"
|
||||
"#endif\n";
|
||||
ASSERT_EQUALS("\nB\n", getConfigsStr(filedata));
|
||||
}
|
||||
|
||||
void setPlatformInfo() {
|
||||
Settings settings;
|
||||
Preprocessor preprocessor(settings, this);
|
||||
|
|
Loading…
Reference in New Issue