Fixed #5137 (Defining empty macro from commandline does not seem to work)

This commit is contained in:
Daniel Marjamki 2013-11-03 09:46:03 +01:00
parent bcc8384a95
commit 8910bae801
2 changed files with 2 additions and 6 deletions

View File

@ -377,10 +377,6 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
if (define.find("=") == std::string::npos)
define += "=1";
// DEF= => empty define
else if (define.find("=") + 1U == define.size())
define.erase(define.size() - 1U);
if (!_settings->userDefines.empty())
_settings->userDefines += ";";
_settings->userDefines += define;

View File

@ -346,10 +346,10 @@ private:
void defines4() {
REDIRECT;
const char *argv[] = {"cppcheck", "-DDEBUG=", "file.cpp"};
const char *argv[] = {"cppcheck", "-DDEBUG=", "file.cpp"}; // #5137 - defining empty macro
settings.userDefines.clear();
ASSERT(defParser.ParseFromArgs(3, argv));
ASSERT_EQUALS("DEBUG", settings.userDefines);
ASSERT_EQUALS("DEBUG=", settings.userDefines);
}
void enforceLanguage() {