Removed '--experimental-fast' flag
This commit is contained in:
parent
b0c92c1ac1
commit
c7155a8e08
|
@ -170,9 +170,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
mSettings->maxCtuDepth = std::atoi(argv[i] + 16);
|
mSettings->maxCtuDepth = std::atoi(argv[i] + 16);
|
||||||
|
|
||||||
else if (std::strcmp(argv[i], "--experimental-fast") == 0)
|
else if (std::strcmp(argv[i], "--experimental-fast") == 0)
|
||||||
// Skip slow simplifications and see how that affect the results, the
|
// TODO: Reomve this flag!
|
||||||
// goal is to remove the simplifications.
|
;
|
||||||
mSettings->experimentalFast = true;
|
|
||||||
|
|
||||||
// (Experimental) exception handling inside cppcheck client
|
// (Experimental) exception handling inside cppcheck client
|
||||||
else if (std::strcmp(argv[i], "--exception-handling") == 0)
|
else if (std::strcmp(argv[i], "--exception-handling") == 0)
|
||||||
|
|
|
@ -435,18 +435,16 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
||||||
checkUnusedFunctions.parseTokens(mTokenizer, filename.c_str(), &mSettings);
|
checkUnusedFunctions.parseTokens(mTokenizer, filename.c_str(), &mSettings);
|
||||||
|
|
||||||
// simplify more if required, skip rest of iteration if failed
|
// simplify more if required, skip rest of iteration if failed
|
||||||
if (mSimplify) {
|
if (mSimplify && hasRule("simple")) {
|
||||||
if (!mSettings.experimentalFast) {
|
|
||||||
// if further simplification fails then skip rest of iteration
|
// if further simplification fails then skip rest of iteration
|
||||||
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
|
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
|
||||||
result = mTokenizer.simplifyTokenList2();
|
result = mTokenizer.simplifyTokenList2();
|
||||||
timer3.Stop();
|
timer3.Stop();
|
||||||
if (!result)
|
if (!result)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// Check simplified tokens
|
if (!mSettings.terminated())
|
||||||
checkSimplifiedTokens(mTokenizer);
|
executeRules("simple", mTokenizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const simplecpp::Output &o) {
|
} catch (const simplecpp::Output &o) {
|
||||||
|
@ -604,16 +602,22 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
|
||||||
executeRules("normal", tokenizer);
|
executeRules("normal", tokenizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// CppCheck - A function that checks a simplified token list
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void CppCheck::checkSimplifiedTokens(const Tokenizer &tokenizer)
|
bool CppCheck::hasRule(const std::string &tokenlist) const
|
||||||
{
|
{
|
||||||
if (!mSettings.terminated())
|
#ifdef HAVE_RULES
|
||||||
executeRules("simple", tokenizer);
|
for (const Settings::Rule &rule : mSettings.rules) {
|
||||||
|
if (rule.tokenlist == tokenlist)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void)tokenlist;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_RULES
|
#ifdef HAVE_RULES
|
||||||
|
|
||||||
static const char * pcreErrorCodeToString(const int pcreExecRet)
|
static const char * pcreErrorCodeToString(const int pcreExecRet)
|
||||||
|
@ -754,15 +758,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
||||||
(void)tokenizer;
|
(void)tokenizer;
|
||||||
|
|
||||||
#ifdef HAVE_RULES
|
#ifdef HAVE_RULES
|
||||||
// Are there rules to execute?
|
|
||||||
bool isrule = false;
|
|
||||||
for (std::list<Settings::Rule>::const_iterator it = mSettings.rules.begin(); it != mSettings.rules.end(); ++it) {
|
|
||||||
if (it->tokenlist == tokenlist)
|
|
||||||
isrule = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is no rule to execute
|
// There is no rule to execute
|
||||||
if (isrule == false)
|
if (!hasRule(tokenlist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Write all tokens in a string that can be parsed by pcre
|
// Write all tokens in a string that can be parsed by pcre
|
||||||
|
@ -771,8 +768,7 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
||||||
ostr << " " << tok->str();
|
ostr << " " << tok->str();
|
||||||
const std::string str(ostr.str());
|
const std::string str(ostr.str());
|
||||||
|
|
||||||
for (std::list<Settings::Rule>::const_iterator it = mSettings.rules.begin(); it != mSettings.rules.end(); ++it) {
|
for (const Settings::Rule &rule : mSettings.rules) {
|
||||||
const Settings::Rule &rule = *it;
|
|
||||||
if (rule.pattern.empty() || rule.id.empty() || rule.severity == Severity::none || rule.tokenlist != tokenlist)
|
if (rule.pattern.empty() || rule.id.empty() || rule.severity == Severity::none || rule.tokenlist != tokenlist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/** Are there "simple" rules */
|
||||||
|
bool hasRule(const std::string &tokenlist) const;
|
||||||
|
|
||||||
/** @brief There has been an internal error => Report information message */
|
/** @brief There has been an internal error => Report information message */
|
||||||
void internalError(const std::string &filename, const std::string &msg);
|
void internalError(const std::string &filename, const std::string &msg);
|
||||||
|
|
||||||
|
@ -169,12 +172,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void checkNormalTokens(const Tokenizer &tokenizer);
|
void checkNormalTokens(const Tokenizer &tokenizer);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check simplified tokens
|
|
||||||
* @param tokenizer tokenizer instance
|
|
||||||
*/
|
|
||||||
void checkSimplifiedTokens(const Tokenizer &tokenizer);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Execute rules, if any
|
* @brief Execute rules, if any
|
||||||
* @param tokenlist token list to use (normal / simple)
|
* @param tokenlist token list to use (normal / simple)
|
||||||
|
|
|
@ -34,7 +34,6 @@ Settings::Settings()
|
||||||
inconclusive(false),
|
inconclusive(false),
|
||||||
jointSuppressionReport(false),
|
jointSuppressionReport(false),
|
||||||
experimental(false),
|
experimental(false),
|
||||||
experimentalFast(false),
|
|
||||||
quiet(false),
|
quiet(false),
|
||||||
inlineSuppressions(false),
|
inlineSuppressions(false),
|
||||||
verbose(false),
|
verbose(false),
|
||||||
|
|
|
@ -111,11 +111,6 @@ public:
|
||||||
*/
|
*/
|
||||||
bool experimental;
|
bool experimental;
|
||||||
|
|
||||||
/** Experimental "fast" checking. We skip slow simplifications. The
|
|
||||||
* goal is that there will not be significant effect on the results
|
|
||||||
* and that we can remove the slow simplifications. */
|
|
||||||
bool experimentalFast;
|
|
||||||
|
|
||||||
/** @brief Is --quiet given? */
|
/** @brief Is --quiet given? */
|
||||||
bool quiet;
|
bool quiet;
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ def hasInclude(path, includes):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def scanPackage(workPath, cppcheckPath, jobs, fast):
|
def scanPackage(workPath, cppcheckPath, jobs):
|
||||||
print('Analyze..')
|
print('Analyze..')
|
||||||
os.chdir(workPath)
|
os.chdir(workPath)
|
||||||
libraries = ' --library=posix --library=gnu'
|
libraries = ' --library=posix --library=gnu'
|
||||||
|
@ -257,8 +257,6 @@ def scanPackage(workPath, cppcheckPath, jobs, fast):
|
||||||
|
|
||||||
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
|
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
|
||||||
options = jobs + libraries + ' -D__GNUC__ --check-library --inconclusive --enable=style,information --platform=unix64 --template=daca2 -rp=temp temp'
|
options = jobs + libraries + ' -D__GNUC__ --check-library --inconclusive --enable=style,information --platform=unix64 --template=daca2 -rp=temp temp'
|
||||||
if fast:
|
|
||||||
options = '--experimental-fast ' + options
|
|
||||||
cmd = 'nice ' + cppcheckPath + '/cppcheck' + ' ' + options
|
cmd = 'nice ' + cppcheckPath + '/cppcheck' + ' ' + options
|
||||||
print(cmd)
|
print(cmd)
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
|
@ -506,7 +504,7 @@ while True:
|
||||||
current_cppcheck_dir = 'cppcheck'
|
current_cppcheck_dir = 'cppcheck'
|
||||||
else:
|
else:
|
||||||
current_cppcheck_dir = ver
|
current_cppcheck_dir = ver
|
||||||
c, errout, info, t, cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs, False)
|
c, errout, info, t, cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs)
|
||||||
if c < 0:
|
if c < 0:
|
||||||
crash = True
|
crash = True
|
||||||
count += ' Crash!'
|
count += ' Crash!'
|
||||||
|
@ -517,15 +515,6 @@ while True:
|
||||||
if ver == 'head':
|
if ver == 'head':
|
||||||
head_info_msg = info
|
head_info_msg = info
|
||||||
|
|
||||||
# Fast results
|
|
||||||
fast_c, fast_errout, fast_info, fast_t, fast_cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs, True)
|
|
||||||
if c > 0 and errout and fast_errout:
|
|
||||||
output = 'FAST\n'
|
|
||||||
output += 'elapsed-time: %.1f %.1f' % (t, fast_t)
|
|
||||||
output += '\ndiff:\n'
|
|
||||||
output += diffResults(workpath, 'head', errout, 'fast', fast_errout)
|
|
||||||
uploadResults(package, output, server_address)
|
|
||||||
|
|
||||||
results_exist = True
|
results_exist = True
|
||||||
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
||||||
results_exist = False
|
results_exist = False
|
||||||
|
|
Loading…
Reference in New Issue