Clarify Cppcheck output
This commit is contained in:
parent
437800f46d
commit
23599428cb
|
@ -54,6 +54,19 @@ static TimerResults S_timerResults;
|
|||
// CWE ids used
|
||||
static const CWE CWE398(398U); // Indicator of Poor Code Quality
|
||||
|
||||
static std::vector<std::string> split(const std::string &str, const std::string &sep)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
for (std::string::size_type defineStartPos = 0U; defineStartPos < str.size();) {
|
||||
const std::string::size_type defineEndPos = str.find(sep, defineStartPos);
|
||||
ret.push_back((defineEndPos == std::string::npos) ? str.substr(defineStartPos) : str.substr(defineStartPos, defineEndPos - defineStartPos));
|
||||
if (defineEndPos == std::string::npos)
|
||||
break;
|
||||
defineStartPos = defineEndPos + 1U;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions)
|
||||
: mErrorLogger(errorLogger), mExitCode(0), mSuppressInternalErrorFound(false), mUseGlobalSuppressions(useGlobalSuppressions), mTooManyConfigs(false), mSimplify(true)
|
||||
{
|
||||
|
@ -325,12 +338,16 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
|||
if (!mSettings.force && ++checkCount > mSettings.maxConfigs)
|
||||
break;
|
||||
|
||||
mCurrentConfig = currCfg;
|
||||
|
||||
if (!mSettings.userDefines.empty()) {
|
||||
if (!mCurrentConfig.empty())
|
||||
mCurrentConfig = ";" + mCurrentConfig;
|
||||
mCurrentConfig = mSettings.userDefines + mCurrentConfig;
|
||||
mCurrentConfig = mSettings.userDefines;
|
||||
const std::vector<std::string> v1(split(mSettings.userDefines, ";"));
|
||||
for (const std::string &cfg: split(currCfg, ";")) {
|
||||
if (std::find(v1.begin(), v1.end(), cfg) == v1.end()) {
|
||||
mCurrentConfig += ";" + cfg;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mCurrentConfig = currCfg;
|
||||
}
|
||||
|
||||
if (mSettings.preprocessOnly) {
|
||||
|
|
Loading…
Reference in New Issue