Fixed #5254 (Warn about missing library files (.cfg))
This commit is contained in:
parent
5d5e347418
commit
4131c621c9
|
@ -151,14 +151,22 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
||||||
Settings& settings = cppCheck.settings();
|
Settings& settings = cppCheck.settings();
|
||||||
_settings = &settings;
|
_settings = &settings;
|
||||||
|
|
||||||
settings.library.load(argv[0], "std");
|
|
||||||
|
|
||||||
if (!parseFromArgs(&cppCheck, argc, argv)) {
|
if (!parseFromArgs(&cppCheck, argc, argv)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool std = settings.library.load(argv[0], "std");
|
||||||
|
bool posix = true;
|
||||||
if (settings.standards.posix)
|
if (settings.standards.posix)
|
||||||
settings.library.load(argv[0], "posix");
|
posix = settings.library.load(argv[0], "posix");
|
||||||
|
|
||||||
|
if (!std || !posix) {
|
||||||
|
const std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
|
||||||
|
const std::string msg("Failed to load " + std::string(!std ? "std.cfg" : "posix.cfg") + ". Your Cppcheck installation is broken.");
|
||||||
|
ErrorLogger::ErrorMessage errmsg(callstack, Severity::information, msg, "failedToLoadCfg", false);
|
||||||
|
reportErr(errmsg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.reportProgress)
|
if (settings.reportProgress)
|
||||||
time1 = std::time(0);
|
time1 = std::time(0);
|
||||||
|
|
|
@ -565,9 +565,13 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool();
|
result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool();
|
||||||
|
|
||||||
const QString applicationFilePath = QCoreApplication::applicationFilePath();
|
const QString applicationFilePath = QCoreApplication::applicationFilePath();
|
||||||
result.library.load(applicationFilePath.toLatin1(), "std");
|
bool std = result.library.load(applicationFilePath.toLatin1(), "std");
|
||||||
|
bool posix = true;
|
||||||
if (result.standards.posix)
|
if (result.standards.posix)
|
||||||
result.library.load(applicationFilePath.toLatin1(), "posix");
|
posix = result.library.load(applicationFilePath.toLatin1(), "posix");
|
||||||
|
|
||||||
|
if (!std || !posix)
|
||||||
|
QMessageBox::warning(this, "Error", "Failed to load " + QString(!std ? "std.cfg" : "posix.cfg") + ". Your Cppcheck installation is broken.");
|
||||||
|
|
||||||
if (result._jobs <= 1) {
|
if (result._jobs <= 1) {
|
||||||
result._jobs = 1;
|
result._jobs = 1;
|
||||||
|
|
Loading…
Reference in New Issue