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);
|
||||
|
||||
else if (std::strcmp(argv[i], "--experimental-fast") == 0)
|
||||
// Skip slow simplifications and see how that affect the results, the
|
||||
// goal is to remove the simplifications.
|
||||
mSettings->experimentalFast = true;
|
||||
// TODO: Reomve this flag!
|
||||
;
|
||||
|
||||
// (Experimental) exception handling inside cppcheck client
|
||||
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);
|
||||
|
||||
// simplify more if required, skip rest of iteration if failed
|
||||
if (mSimplify) {
|
||||
if (!mSettings.experimentalFast) {
|
||||
if (mSimplify && hasRule("simple")) {
|
||||
// if further simplification fails then skip rest of iteration
|
||||
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
|
||||
result = mTokenizer.simplifyTokenList2();
|
||||
timer3.Stop();
|
||||
if (!result)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check simplified tokens
|
||||
checkSimplifiedTokens(mTokenizer);
|
||||
if (!mSettings.terminated())
|
||||
executeRules("simple", mTokenizer);
|
||||
}
|
||||
|
||||
} catch (const simplecpp::Output &o) {
|
||||
|
@ -604,16 +602,22 @@ void CppCheck::checkNormalTokens(const Tokenizer &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())
|
||||
executeRules("simple", tokenizer);
|
||||
#ifdef HAVE_RULES
|
||||
for (const Settings::Rule &rule : mSettings.rules) {
|
||||
if (rule.tokenlist == tokenlist)
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void)tokenlist;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_RULES
|
||||
|
||||
static const char * pcreErrorCodeToString(const int pcreExecRet)
|
||||
|
@ -754,15 +758,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
|||
(void)tokenizer;
|
||||
|
||||
#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
|
||||
if (isrule == false)
|
||||
if (!hasRule(tokenlist))
|
||||
return;
|
||||
|
||||
// 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();
|
||||
const std::string str(ostr.str());
|
||||
|
||||
for (std::list<Settings::Rule>::const_iterator it = mSettings.rules.begin(); it != mSettings.rules.end(); ++it) {
|
||||
const Settings::Rule &rule = *it;
|
||||
for (const Settings::Rule &rule : mSettings.rules) {
|
||||
if (rule.pattern.empty() || rule.id.empty() || rule.severity == Severity::none || rule.tokenlist != tokenlist)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -145,6 +145,9 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
/** Are there "simple" rules */
|
||||
bool hasRule(const std::string &tokenlist) const;
|
||||
|
||||
/** @brief There has been an internal error => Report information message */
|
||||
void internalError(const std::string &filename, const std::string &msg);
|
||||
|
||||
|
@ -169,12 +172,6 @@ private:
|
|||
*/
|
||||
void checkNormalTokens(const Tokenizer &tokenizer);
|
||||
|
||||
/**
|
||||
* @brief Check simplified tokens
|
||||
* @param tokenizer tokenizer instance
|
||||
*/
|
||||
void checkSimplifiedTokens(const Tokenizer &tokenizer);
|
||||
|
||||
/**
|
||||
* @brief Execute rules, if any
|
||||
* @param tokenlist token list to use (normal / simple)
|
||||
|
|
|
@ -34,7 +34,6 @@ Settings::Settings()
|
|||
inconclusive(false),
|
||||
jointSuppressionReport(false),
|
||||
experimental(false),
|
||||
experimentalFast(false),
|
||||
quiet(false),
|
||||
inlineSuppressions(false),
|
||||
verbose(false),
|
||||
|
|
|
@ -111,11 +111,6 @@ public:
|
|||
*/
|
||||
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? */
|
||||
bool quiet;
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ def hasInclude(path, includes):
|
|||
return False
|
||||
|
||||
|
||||
def scanPackage(workPath, cppcheckPath, jobs, fast):
|
||||
def scanPackage(workPath, cppcheckPath, jobs):
|
||||
print('Analyze..')
|
||||
os.chdir(workPath)
|
||||
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
|
||||
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
|
||||
print(cmd)
|
||||
startTime = time.time()
|
||||
|
@ -506,7 +504,7 @@ while True:
|
|||
current_cppcheck_dir = 'cppcheck'
|
||||
else:
|
||||
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:
|
||||
crash = True
|
||||
count += ' Crash!'
|
||||
|
@ -517,15 +515,6 @@ while True:
|
|||
if ver == 'head':
|
||||
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
|
||||
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
||||
results_exist = False
|
||||
|
|
Loading…
Reference in New Issue