Fixed #5137 (Defining empty macro from commandline does not seem to work)
This commit is contained in:
parent
bcc8384a95
commit
8910bae801
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue