From 2f1050595d63a8e431201b6e578a62a5f4d3a5ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 11 May 2013 11:35:04 +0200 Subject: [PATCH] CppCheck: Added _simplify flag that can be used by clients to disable simplifications --- lib/cppcheck.cpp | 5 ++++- lib/cppcheck.h | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 84366838e..9d8b41bed 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -40,7 +40,7 @@ static const char ExtraVersion[] = ""; static TimerResults S_timerResults; CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions) - : _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), tooManyConfigs(false) + : _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), tooManyConfigs(false), _simplify(true) { } @@ -338,6 +338,9 @@ void CppCheck::checkFile(const std::string &code, const char FileName[]) if (_settings.isEnabled("unusedFunction") && _settings._jobs == 1) _checkUnusedFunctions.parseTokens(_tokenizer); + if (!_simplify) + return; + Timer timer3("Tokenizer::simplifyTokenList", _settings._showtime, &S_timerResults); result = _tokenizer.simplifyTokenList(); timer3.Stop(); diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 5ef01df1e..60125e484 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -133,6 +133,10 @@ public: void tooManyConfigsError(const std::string &file, const std::size_t numberOfConfigurations); + void dontSimplify() { + _simplify = false; + } + private: /** @brief There has been a internal error => Report information message */ @@ -197,6 +201,9 @@ private: /** Are there too many configs? */ bool tooManyConfigs; + + /** Simplify code? true by default */ + bool _simplify; }; /// @}