diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 6e5589042..f5277e6ef 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -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; diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 1cf4e4765..d3ad863d4 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -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() {