Skip to content

Commit 7148965

Browse files
committed
Experimental fix for #13825 (toomanyconfigs lacks file information)
1 parent e21be4e commit 7148965

3 files changed

Lines changed: 3 additions & 23 deletions

File tree

cli/cppcheckexecutor.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,6 @@ int CppCheckExecutor::check_internal(const Settings& settings, Suppressions& sup
432432
returnValue = settings.exitCode;
433433
}
434434

435-
if (!settings.checkConfiguration) {
436-
cppcheck.tooManyConfigsError("",0U);
437-
}
438-
439435
stdLogger.writeCheckersReport(supprs);
440436

441437
if (settings.outputFormat == Settings::OutputFormat::xml) {

lib/cppcheck.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,13 +1079,8 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
10791079
}
10801080
#endif
10811081

1082-
if (!mSettings.force && configurations.size() > mSettings.maxConfigs) {
1083-
if (mSettings.severity.isEnabled(Severity::information)) {
1084-
tooManyConfigsError(Path::toNativeSeparators(file.spath()),configurations.size());
1085-
} else {
1086-
mTooManyConfigs = true;
1087-
}
1088-
}
1082+
if (!mSettings.force && configurations.size() > mSettings.maxConfigs)
1083+
tooManyConfigsError(Path::toNativeSeparators(file.spath()), configurations.size());
10891084

10901085
FilesDeleter filesDeleter;
10911086

@@ -1661,12 +1656,7 @@ void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files
16611656

16621657
void CppCheck::tooManyConfigsError(const std::string &file, const int numberOfConfigurations)
16631658
{
1664-
if (!mSettings.severity.isEnabled(Severity::information) && !mTooManyConfigs)
1665-
return;
1666-
1667-
mTooManyConfigs = false;
1668-
1669-
if (mSettings.severity.isEnabled(Severity::information) && file.empty())
1659+
if (!mSettings.severity.isEnabled(Severity::information))
16701660
return;
16711661

16721662
std::list<ErrorMessage::FileLocation> loclist;
@@ -1700,8 +1690,6 @@ void CppCheck::tooManyConfigsError(const std::string &file, const int numberOfCo
17001690

17011691
void CppCheck::purgedConfigurationMessage(const std::string &file, const std::string& configuration)
17021692
{
1703-
mTooManyConfigs = false;
1704-
17051693
if (mSettings.severity.isEnabled(Severity::information) && file.empty())
17061694
return;
17071695

@@ -1730,7 +1718,6 @@ void CppCheck::getErrorMessages(ErrorLogger &errorlogger)
17301718

17311719
CppCheck cppcheck(settings, supprs, errorlogger, true, nullptr);
17321720
cppcheck.purgedConfigurationMessage("","");
1733-
cppcheck.mTooManyConfigs = true;
17341721
cppcheck.tooManyConfigsError("",0U);
17351722
// TODO: add functions to get remaining error messages
17361723

lib/cppcheck.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ class CPPCHECKLIB CppCheck {
249249

250250
bool mUseGlobalSuppressions;
251251

252-
/** Are there too many configs? */
253-
bool mTooManyConfigs{};
254-
255252
/** File info used for whole program analysis */
256253
std::list<Check::FileInfo*> mFileInfo;
257254

0 commit comments

Comments
 (0)