Merge pull request #837 from nablaa/master
Fixes preprocessor regression causing hang
This commit is contained in:
commit
e0f9171127
|
@ -217,6 +217,10 @@ static std::string readcondition(const simplecpp::Token *iftok, const std::set<s
|
|||
|
||||
static bool hasDefine(const std::string &userDefines, const std::string &cfg)
|
||||
{
|
||||
if (cfg.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string::size_type pos = 0;
|
||||
while (pos < userDefines.size()) {
|
||||
pos = userDefines.find(cfg, pos);
|
||||
|
|
|
@ -224,6 +224,7 @@ private:
|
|||
TEST_CASE(getConfigsU4);
|
||||
TEST_CASE(getConfigsU5);
|
||||
TEST_CASE(getConfigsU6);
|
||||
TEST_CASE(getConfigsU7);
|
||||
|
||||
TEST_CASE(validateCfg);
|
||||
|
||||
|
@ -2121,6 +2122,14 @@ private:
|
|||
ASSERT_EQUALS("\nX=0\n", getConfigsStr(filedata));
|
||||
}
|
||||
|
||||
void getConfigsU7() {
|
||||
const char code[] = "#ifndef Y\n"
|
||||
"#else\n"
|
||||
"#endif\n";
|
||||
ASSERT_EQUALS("\nY\n", getConfigsStr(code, "-DX"));
|
||||
}
|
||||
|
||||
|
||||
void validateCfg() {
|
||||
Settings settings;
|
||||
Preprocessor preprocessor(settings, this);
|
||||
|
|
Loading…
Reference in New Issue