DACA: Try to avoid some crashes/hangs for the most crazy code so we can focus on most serious bugs first
This commit is contained in:
parent
28cd5d7ea2
commit
7577bdb1df
|
@ -664,6 +664,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
mSettings->templateFormat = "{file}:{line}:{column}: warning: {message} [{id}]\\n{code}";
|
||||
mSettings->templateLocation = "{file}:{line}:{column}: note: {info}\\n{code}";
|
||||
} else if (mSettings->templateFormat == "daca2") {
|
||||
mSettings->daca = true;
|
||||
mSettings->templateFormat = "{file}:{line}:{column}: {severity}: {message} [{id}]";
|
||||
mSettings->templateLocation = "{file}:{line}:{column}: note: {info}";
|
||||
} else if (mSettings->templateFormat == "vs")
|
||||
|
|
|
@ -36,6 +36,7 @@ Settings::Settings()
|
|||
checkUnusedTemplates(false),
|
||||
clang(false),
|
||||
clangTidy(false),
|
||||
daca(false),
|
||||
debugSimplified(false),
|
||||
debugnormal(false),
|
||||
debugwarnings(false),
|
||||
|
|
|
@ -105,6 +105,9 @@ public:
|
|||
/** @brief include paths excluded from checking the configuration */
|
||||
std::set<std::string> configExcludePaths;
|
||||
|
||||
/** @brief Are we running from DACA script? */
|
||||
bool daca;
|
||||
|
||||
/** @brief Is --debug-simplified given? */
|
||||
bool debugSimplified;
|
||||
|
||||
|
|
|
@ -4297,6 +4297,20 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
|||
}
|
||||
}
|
||||
|
||||
// Some special bailouts in DACA. To avoid too much hangs/crashes.
|
||||
// FIXME: This is hopefully temporary. Somehow it should not be used in releases.
|
||||
if (mSettings->daca) {
|
||||
int numcase = 0;
|
||||
for (const Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "%name% [ %num% ] = {") && MathLib::toLongNumber(tok->strAt(2)) > 10000)
|
||||
return false;
|
||||
if (tok->str() == "case") {
|
||||
if (++numcase > 10000)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is there C++ code in C file?
|
||||
validateC();
|
||||
|
||||
|
|
Loading…
Reference in New Issue