Fix compiler warnings about incomplete handling of library error codes

This commit is contained in:
Alexander Mai 2015-01-06 18:10:19 +01:00
parent a87fb96eaf
commit d72fbdda27
1 changed files with 10 additions and 4 deletions

View File

@ -558,7 +558,7 @@ Settings MainWindow::GetCppcheckSettings()
QStringList dirs = pfile->GetIncludeDirs(); QStringList dirs = pfile->GetIncludeDirs();
AddIncludeDirs(dirs, result); AddIncludeDirs(dirs, result);
QStringList defines = pfile->GetDefines(); const QStringList defines = pfile->GetDefines();
QString define; QString define;
foreach(define, defines) { foreach(define, defines) {
if (!result.userDefines.empty()) if (!result.userDefines.empty())
@ -566,7 +566,7 @@ Settings MainWindow::GetCppcheckSettings()
result.userDefines += define.toStdString(); result.userDefines += define.toStdString();
} }
QStringList libraries = pfile->GetLibraries(); const QStringList libraries = pfile->GetLibraries();
foreach(QString library, libraries) { foreach(QString library, libraries) {
const QString filename = library + ".cfg"; const QString filename = library + ".cfg";
const Library::Error error = LoadLibrary(&result.library, filename); const Library::Error error = LoadLibrary(&result.library, filename);
@ -596,6 +596,12 @@ Settings MainWindow::GetCppcheckSettings()
case Library::ErrorCode::UNSUPPORTED_FORMAT: case Library::ErrorCode::UNSUPPORTED_FORMAT:
errmsg = tr("Unsupported format"); errmsg = tr("Unsupported format");
break; break;
case Library::ErrorCode::DUPLICATE_PLATFORM_TYPE:
errmsg = tr("Duplicate platform type");
break;
case Library::ErrorCode::PLATFORM_TYPE_REDEFINED:
errmsg = tr("Platform type redefined");
break;
} }
if (!error.reason.empty()) if (!error.reason.empty())
errmsg += " '" + QString::fromStdString(error.reason) + "'"; errmsg += " '" + QString::fromStdString(error.reason) + "'";
@ -603,7 +609,7 @@ Settings MainWindow::GetCppcheckSettings()
} }
} }
QStringList suppressions = pfile->GetSuppressions(); const QStringList suppressions = pfile->GetSuppressions();
foreach(QString suppression, suppressions) { foreach(QString suppression, suppressions) {
result.nomsg.addSuppressionLine(suppression.toStdString()); result.nomsg.addSuppressionLine(suppression.toStdString());
} }
@ -642,7 +648,7 @@ Settings MainWindow::GetCppcheckSettings()
result.standards.c = mSettings->value(SETTINGS_STD_C99, true).toBool() ? Standards::C99 : (mSettings->value(SETTINGS_STD_C11, false).toBool() ? Standards::C11 : Standards::C89); result.standards.c = mSettings->value(SETTINGS_STD_C99, true).toBool() ? Standards::C99 : (mSettings->value(SETTINGS_STD_C11, false).toBool() ? Standards::C11 : Standards::C89);
result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool(); result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool();
bool std = (LoadLibrary(&result.library, "std.cfg").errorcode == Library::ErrorCode::OK); const bool std = (LoadLibrary(&result.library, "std.cfg").errorcode == Library::ErrorCode::OK);
bool posix = true; bool posix = true;
if (result.standards.posix) if (result.standards.posix)
posix = (LoadLibrary(&result.library, "posix.cfg").errorcode == Library::ErrorCode::OK); posix = (LoadLibrary(&result.library, "posix.cfg").errorcode == Library::ErrorCode::OK);