Fix testrunner in cygwin
This commit is contained in:
parent
66d16b51f0
commit
db274e8308
|
@ -33,6 +33,7 @@
|
|||
#include "suppressions.h"
|
||||
#include "threadexecutor.h"
|
||||
#include "utils.h"
|
||||
#include "checkunusedfunctions.h"
|
||||
|
||||
#include <csignal>
|
||||
#include <cstdio>
|
||||
|
@ -179,6 +180,8 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
|||
Preprocessor::missingIncludeFlag = false;
|
||||
Preprocessor::missingSystemIncludeFlag = false;
|
||||
|
||||
CheckUnusedFunctions::clear();
|
||||
|
||||
CppCheck cppCheck(*this, true);
|
||||
|
||||
const Settings& settings = cppCheck.settings();
|
||||
|
|
|
@ -47,14 +47,12 @@ static const struct CWE CWE561(561U); // Dead Code
|
|||
// FUNCTION USAGE - Check for unused functions etc
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings, bool clear)
|
||||
void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings)
|
||||
{
|
||||
const bool doMarkup = settings->library.markupFile(FileName);
|
||||
const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase();
|
||||
|
||||
// Function declarations..
|
||||
if (clear)
|
||||
_functionDecl.clear();
|
||||
for (std::size_t i = 0; i < symbolDatabase->functionScopes.size(); i++) {
|
||||
const Scope* scope = symbolDatabase->functionScopes[i];
|
||||
const Function* func = scope->function;
|
||||
|
@ -88,8 +86,6 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
|||
}
|
||||
|
||||
// Function usage..
|
||||
if (clear)
|
||||
_functionCalls.clear();
|
||||
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) {
|
||||
|
||||
// parsing of library code to find called functions
|
||||
|
|
|
@ -50,10 +50,15 @@ public:
|
|||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
|
||||
static void clear() {
|
||||
instance._functions.clear();
|
||||
instance._functionCalls.clear();
|
||||
}
|
||||
|
||||
// Parse current tokens and determine..
|
||||
// * Check what functions are used
|
||||
// * What functions are declared
|
||||
void parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings, bool clear=true);
|
||||
void parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings);
|
||||
|
||||
// Return true if an error is reported.
|
||||
bool check(ErrorLogger * const errorLogger, const Settings& settings);
|
||||
|
|
|
@ -399,7 +399,7 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
|
|||
|
||||
// Analyze info..
|
||||
if (!_settings.buildDir.empty())
|
||||
checkUnusedFunctions.parseTokens(_tokenizer, filename.c_str(), &_settings, false);
|
||||
checkUnusedFunctions.parseTokens(_tokenizer, filename.c_str(), &_settings);
|
||||
|
||||
// simplify more if required, skip rest of iteration if failed
|
||||
if (_simplify) {
|
||||
|
|
Loading…
Reference in New Issue