diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp old mode 100644 new mode 100755 index c5ac76e2f..18dc23f2c --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1026,7 +1026,12 @@ void Preprocessor::simplifyCondition(const std::map &v { const std::map::const_iterator it = variables.find(tok->str()); if (it != variables.end()) - tok->str(it->second); + { + if (it->second.empty()) + tok->deleteThis(); + else + tok->str(it->second); + } } // simplify calculations.. @@ -1272,8 +1277,7 @@ std::string Preprocessor::getcode(const std::string &filedata, std::string cfg, // We must not remove #file tags or line numbers // are corrupted. File tags are removed by the tokenizer. } - else if (!match || - line[0] == '#') + else if (!match || line.compare(0,1,"#") == 0) { // Remove #if, #else, #pragma etc, leaving only // #define, #undef, #file and #endfile. and also lines diff --git a/lib/token.cpp b/lib/token.cpp index ddb9c6374..090956d26 100755 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -53,7 +53,7 @@ void Token::str(const std::string &s) if (std::isdigit(_str[0])) _isNumber = true; - else if (_str.length() > 1 && _str[0] == '-' && std::isdigit(_str[0])) + else if (_str.length() > 1 && _str[0] == '-' && std::isdigit(_str[1])) _isNumber = true; else _isNumber = false;