diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 022fbd767..c862167f3 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1221,8 +1221,8 @@ std::list Preprocessor::getcfgs(const std::string &filedata, const void Preprocessor::simplifyCondition(const std::map &cfg, std::string &condition, bool match) { - Settings settings; - Tokenizer tokenizer(&settings, NULL); + const Settings settings; + Tokenizer tokenizer(&settings, _errorLogger); std::istringstream istr("(" + condition + ")"); if (!tokenizer.tokenize(istr, "", "", true)) { // If tokenize returns false, then there is syntax error in the diff --git a/lib/preprocessor.h b/lib/preprocessor.h index f73aa094b..2e881c518 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -99,7 +99,7 @@ public: * @param condition The condition to simplify * @param match if true, 'defined(A)' is replaced with 0 if A is not defined */ - static void simplifyCondition(const std::map &variables, std::string &condition, bool match); + void simplifyCondition(const std::map &variables, std::string &condition, bool match); /** * preprocess all whitespaces diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 4825353f5..ab626fe53 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -2858,7 +2858,8 @@ private: std::map cfg; cfg["C"] = ""; std::string condition("defined(A) || defined(B) || defined(C)"); - Preprocessor::simplifyCondition(cfg, condition, true); + Preprocessor preprocessor(NULL, this); + preprocessor.simplifyCondition(cfg, condition, true); ASSERT_EQUALS("1", condition); }