diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml
index d2f5b5edf88..de3a56b2f5e 100644
--- a/.github/workflows/CI-windows.yml
+++ b/.github/workflows/CI-windows.yml
@@ -52,7 +52,7 @@ jobs:
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
- name: Build GUI release (Qt 6)
@@ -60,7 +60,7 @@ jobs:
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
- name: Deploy GUI
@@ -135,16 +135,15 @@ jobs:
python -m pip install pytest-timeout || exit /b !errorlevel!
python -m pip install psutil || exit /b !errorlevel!
- - name: Run CMake
- if: false # TODO: enable
- run: |
- cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel!
+ # TODO: build with CMake
- name: Build CLI debug configuration using MSBuild
if: matrix.config == 'debug'
run: |
:: cmake --build build --target check --config Debug || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
+ env:
+ _CL_: /WX
- name: Run Debug test
if: matrix.config == 'debug'
@@ -155,6 +154,8 @@ jobs:
run: |
:: cmake --build build --target check --config Release || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
+ env:
+ _CL_: /WX
- name: Run Release test
if: matrix.config == 'release'
diff --git a/cli/cli.vcxproj b/cli/cli.vcxproj
index a508d3bf55b..71c2f3930bb 100644
--- a/cli/cli.vcxproj
+++ b/cli/cli.vcxproj
@@ -92,7 +92,7 @@
CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDebugDLL
Level4
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
true
Use
precompiled.h
@@ -121,7 +121,7 @@
CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDebugDLL
Level4
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
true
Use
precompiled.h
@@ -155,7 +155,7 @@
true
true
true
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
ProgramDatabase
true
Use
@@ -193,7 +193,7 @@
true
true
true
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
ProgramDatabase
true
Use
diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake
index 8ade56487a3..e9d1f7d4692 100644
--- a/cmake/compileroptions.cmake
+++ b/cmake/compileroptions.cmake
@@ -176,12 +176,10 @@ if(MSVC)
add_compile_options(/wd4127) # warning C4127: conditional expression is constant
add_compile_options(/wd4146) # warning C4146: unary minus operator applied to unsigned type, result still unsigned
add_compile_options(/wd4244) # warning C4244: 'initializing': conversion from 'int' to 'char', possible loss of data
- add_compile_options(/wd4251)
+ add_compile_options(/wd4251) # warning C4251: 'x': class 'y' needs to have dll-interface to be used by clients of struct 'u'
# Clang: -Wshorten-64-to-32 -Wimplicit-int-conversion
add_compile_options(/wd4267) # warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
add_compile_options(/wd4389) # warning C4389: '==': signed/unsigned mismatch
- add_compile_options(/wd4482)
- add_compile_options(/wd4512)
add_compile_options(/wd4701) # warning C4701: potentially uninitialized local variable 'err' used
add_compile_options(/wd4706) # warning C4706: assignment within conditional expression
add_compile_options(/wd4800) # warning C4800: 'const SymbolDatabase *' : forcing value to bool 'true' or 'false' (performance warning)
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 88bf225c58b..9e1dc3708f6 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -63,6 +63,10 @@ CheckOptions:
if(MSVC)
# compilation will fail as e.g. QList::realloc would be replaced by MSVC's macro definition
target_compile_definitions(cppcheck-gui PRIVATE $<$:DISABLE_CRTDBG_MAP_ALLOC>)
+ if(NOT USE_QT6)
+ target_compile_options(cppcheck-gui PRIVATE /wd4996) # warning C4996: 'QProcess::startDetached': Use QProcess::startDetached(const QString &program, const QStringList &arguments) instead
+ target_compile_options(cppcheck-gui PRIVATE /wd4505) # warning C4505: 'x': unreferenced function with internal linkage has been removed
+ endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Q_UNUSED() in generated code
diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp
index 9024c089bc7..c0e07969333 100644
--- a/gui/resultstree.cpp
+++ b/gui/resultstree.cpp
@@ -288,9 +288,9 @@ void ResultsTree::setReportType(ReportType reportType) {
if (!fileItem)
continue;
for (int j = 0; j < fileItem->rowCount(); ++j) {
- const auto& data = fileItem->child(j,0)->data().toMap();
- const QString& errorId = data[ERRORID].toString();
- Severity severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(data[SEVERITY]));
+ const auto& childdata = fileItem->child(j,0)->data().toMap();
+ const QString& errorId = childdata[ERRORID].toString();
+ Severity severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(childdata[SEVERITY]));
const QString& guideline = getGuideline(mReportType, mGuideline, errorId, severity);
const QString& classification = getClassification(mReportType, guideline);
fileItem->child(j, COLUMN_CERT_LEVEL)->setText(classification);
@@ -431,24 +431,24 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
return false;
//Add user data to that item
- QMap data;
- data[SEVERITY] = ShowTypes::SeverityToShowType(item.severity);
- data[SUMMARY] = item.summary;
- data[MESSAGE] = item.message;
- data[FILENAME] = loc.file;
- data[LINE] = loc.line;
- data[COLUMN] = loc.column;
- data[ERRORID] = item.errorId;
- data[CWE] = item.cwe;
- data[HASH] = item.hash;
- data[INCONCLUSIVE] = item.inconclusive;
- data[FILE0] = stripPath(item.file0, true);
- data[SINCEDATE] = item.sinceDate;
- data[SYMBOLNAMES] = item.symbolNames;
- data[TAGS] = line.tags;
- data[REMARK] = line.remark;
- data[HIDE] = false;
- stditem->setData(QVariant(data));
+ QMap itemdata;
+ itemdata[SEVERITY] = ShowTypes::SeverityToShowType(item.severity);
+ itemdata[SUMMARY] = item.summary;
+ itemdata[MESSAGE] = item.message;
+ itemdata[FILENAME] = loc.file;
+ itemdata[LINE] = loc.line;
+ itemdata[COLUMN] = loc.column;
+ itemdata[ERRORID] = item.errorId;
+ itemdata[CWE] = item.cwe;
+ itemdata[HASH] = item.hash;
+ itemdata[INCONCLUSIVE] = item.inconclusive;
+ itemdata[FILE0] = stripPath(item.file0, true);
+ itemdata[SINCEDATE] = item.sinceDate;
+ itemdata[SYMBOLNAMES] = item.symbolNames;
+ itemdata[TAGS] = line.tags;
+ itemdata[REMARK] = line.remark;
+ itemdata[HIDE] = false;
+ stditem->setData(QVariant(itemdata));
//Add backtrace files as children
if (item.errorPath.size() > 1) {
@@ -623,9 +623,9 @@ void ResultsTree::clear(const QString &filename)
if (!fileItem)
continue;
- QVariantMap data = fileItem->data().toMap();
- if (stripped == data[FILENAME].toString() ||
- filename == data[FILE0].toString()) {
+ QVariantMap fitemdata = fileItem->data().toMap();
+ if (stripped == fitemdata[FILENAME].toString() ||
+ filename == fitemdata[FILE0].toString()) {
mModel.removeRow(i);
break;
}
@@ -640,8 +640,8 @@ void ResultsTree::clearRecheckFile(const QString &filename)
continue;
QString actualfile((!mCheckPath.isEmpty() && filename.startsWith(mCheckPath)) ? filename.mid(mCheckPath.length() + 1) : filename);
- QVariantMap data = fileItem->data().toMap();
- QString storedfile = data[FILENAME].toString();
+ QVariantMap fitemdata = fileItem->data().toMap();
+ QString storedfile = fitemdata[FILENAME].toString();
storedfile = ((!mCheckPath.isEmpty() && storedfile.startsWith(mCheckPath)) ? storedfile.mid(mCheckPath.length() + 1) : storedfile);
if (actualfile == storedfile) {
mModel.removeRow(i);
@@ -735,17 +735,15 @@ void ResultsTree::refreshTree()
continue;
}
- //Get error's user data
- QVariant userdata = child->data();
- //Convert it to QVariantMap
- QVariantMap data = userdata.toMap();
+ //Get error's user data and convert it to QVariantMap
+ QVariantMap userdata = child->data().toMap();
//Check if this error should be hidden
- bool hide = data[HIDE].toBool() || mHiddenMessageId.contains(data[ERRORID].toString());
+ bool hide = userdata[HIDE].toBool() || mHiddenMessageId.contains(userdata[ERRORID].toString());
if (!hide) {
if (mReportType == ReportType::normal)
- hide = !mShowSeverities.isShown(ShowTypes::VariantToShowType(data[SEVERITY]));
+ hide = !mShowSeverities.isShown(ShowTypes::VariantToShowType(userdata[SEVERITY]));
else {
const QString& classification = fileItem->child(j, COLUMN_MISRA_CLASSIFICATION)->text();
hide = classification.isEmpty() || !mShowSeverities.isShown(getSeverityFromClassification(classification));
@@ -754,10 +752,10 @@ void ResultsTree::refreshTree()
// If specified, filter on summary, message, filename, and id
if (!hide && !mFilter.isEmpty()) {
- if (!data[SUMMARY].toString().contains(mFilter, Qt::CaseInsensitive) &&
- !data[MESSAGE].toString().contains(mFilter, Qt::CaseInsensitive) &&
- !data[FILENAME].toString().contains(mFilter, Qt::CaseInsensitive) &&
- !data[ERRORID].toString().contains(mFilter, Qt::CaseInsensitive) &&
+ if (!userdata[SUMMARY].toString().contains(mFilter, Qt::CaseInsensitive) &&
+ !userdata[MESSAGE].toString().contains(mFilter, Qt::CaseInsensitive) &&
+ !userdata[FILENAME].toString().contains(mFilter, Qt::CaseInsensitive) &&
+ !userdata[ERRORID].toString().contains(mFilter, Qt::CaseInsensitive) &&
!fileItem->child(j, COLUMN_MISRA_CLASSIFICATION)->text().contains(mFilter, Qt::CaseInsensitive)) {
hide = true;
}
@@ -765,7 +763,7 @@ void ResultsTree::refreshTree()
// Tool filter
if (!hide) {
- if (data[ERRORID].toString().startsWith("clang"))
+ if (userdata[ERRORID].toString().startsWith("clang"))
hide = !mShowClang;
else
hide = !mShowCppcheck;
@@ -804,10 +802,10 @@ QStandardItem *ResultsTree::ensureFileItem(const QString &fullpath, const QStrin
item->setIcon(QIcon(":images/text-x-generic.png"));
//Add user data to that item
- QMap data;
- data[FILENAME] = fullpath;
- data[FILE0] = file0;
- item->setData(QVariant(data));
+ QMap itemdata;
+ itemdata[FILENAME] = fullpath;
+ itemdata[FILE0] = file0;
+ item->setData(QVariant(itemdata));
mModel.appendRow(item);
setRowHidden(item->row(), QModelIndex(), hide);
@@ -887,8 +885,8 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
auto *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
{
- QVariantMap data = mContextItem->data().toMap();
- const QString messageId = data[ERRORID].toString();
+ QVariantMap itemdata = mContextItem->data().toMap();
+ const QString messageId = itemdata[ERRORID].toString();
suppress->setEnabled(!ErrorLogger::isCriticalErrorId(messageId.toStdString()));
}
menu.addAction(suppress);
@@ -968,10 +966,10 @@ void ResultsTree::startApplication(const QStandardItem *target, int application)
if (target->column() != 0)
target = target->parent()->child(target->row(), 0);
- QVariantMap data = target->data().toMap();
+ QVariantMap targetdata = target->data().toMap();
//Replace (file) with filename
- QString file = data[FILENAME].toString();
+ QString file = targetdata[FILENAME].toString();
file = QDir::toNativeSeparators(file);
qDebug() << "Opening file: " << file;
@@ -1004,11 +1002,11 @@ void ResultsTree::startApplication(const QStandardItem *target, int application)
QString params = app.getParameters();
params.replace("(file)", file, Qt::CaseInsensitive);
- QVariant line = data[LINE];
+ QVariant line = targetdata[LINE];
params.replace("(line)", QString("%1").arg(line.toInt()), Qt::CaseInsensitive);
- params.replace("(message)", data[MESSAGE].toString(), Qt::CaseInsensitive);
- params.replace("(severity)", data[SEVERITY].toString(), Qt::CaseInsensitive);
+ params.replace("(message)", targetdata[MESSAGE].toString(), Qt::CaseInsensitive);
+ params.replace("(severity)", targetdata[SEVERITY].toString(), Qt::CaseInsensitive);
QString program = app.getPath();
@@ -1117,17 +1115,17 @@ void ResultsTree::copy()
}
if (item->parent()->parent())
item = item->parent();
- QVariantMap data = item->data().toMap();
- if (!data.contains("id"))
+ QVariantMap itemdata = item->data().toMap();
+ if (!itemdata.contains("id"))
continue;
- QString inconclusive = data[INCONCLUSIVE].toBool() ? ",inconclusive" : "";
- text += data[FILENAME].toString() + ':' + QString::number(data[LINE].toInt()) + ':' + QString::number(data[COLUMN].toInt())
+ QString inconclusive = itemdata[INCONCLUSIVE].toBool() ? ",inconclusive" : "";
+ text += itemdata[FILENAME].toString() + ':' + QString::number(itemdata[LINE].toInt()) + ':' + QString::number(itemdata[COLUMN].toInt())
+ ": "
- + QString::fromStdString(severityToString(ShowTypes::ShowTypeToSeverity((ShowTypes::ShowType)data[SEVERITY].toInt()))) + inconclusive
+ + QString::fromStdString(severityToString(ShowTypes::ShowTypeToSeverity((ShowTypes::ShowType)itemdata[SEVERITY].toInt()))) + inconclusive
+ ": "
- + data[MESSAGE].toString()
+ + itemdata[MESSAGE].toString()
+ " ["
- + data[ERRORID].toString()
+ + itemdata[ERRORID].toString()
+ "]\n";
}
@@ -1143,9 +1141,9 @@ void ResultsTree::hideResult()
for (QModelIndex index : mSelectionModel->selectedRows()) {
QStandardItem *item = mModel.itemFromIndex(index);
//Set the "hide" flag for this item
- QVariantMap data = item->data().toMap();
- data[HIDE] = true;
- item->setData(QVariant(data));
+ QVariantMap itemdata = item->data().toMap();
+ itemdata[HIDE] = true;
+ item->setData(QVariant(itemdata));
refreshTree();
emit resultsHidden(true);
@@ -1162,8 +1160,8 @@ void ResultsTree::recheckSelectedFiles()
QStandardItem *item = mModel.itemFromIndex(index);
while (item->parent())
item = item->parent();
- QVariantMap data = item->data().toMap();
- QString currentFile = data[FILENAME].toString();
+ QVariantMap itemdata = item->data().toMap();
+ QString currentFile = itemdata[FILENAME].toString();
if (!currentFile.isEmpty()) {
QString fileNameWithCheckPath;
QFileInfo curfileInfo(currentFile);
@@ -1177,8 +1175,8 @@ void ResultsTree::recheckSelectedFiles()
return;
}
if (Path::isHeader(currentFile.toStdString())) {
- if (!data[FILE0].toString().isEmpty() && !selectedItems.contains(data[FILE0].toString())) {
- selectedItems<<((!mCheckPath.isEmpty() && (data[FILE0].toString().indexOf(mCheckPath) != 0)) ? (mCheckPath + "/" + data[FILE0].toString()) : data[FILE0].toString());
+ if (!itemdata[FILE0].toString().isEmpty() && !selectedItems.contains(itemdata[FILE0].toString())) {
+ selectedItems<<((!mCheckPath.isEmpty() && (itemdata[FILE0].toString().indexOf(mCheckPath) != 0)) ? (mCheckPath + "/" + itemdata[FILE0].toString()) : itemdata[FILE0].toString());
if (!selectedItems.contains(fileNameWithCheckPath))
selectedItems<column() != 0)
mContextItem = mContextItem->parent()->child(mContextItem->row(), 0);
- QVariantMap data = mContextItem->data().toMap();
+ QVariantMap itemdata = mContextItem->data().toMap();
- QString messageId = data[ERRORID].toString();
+ QString messageId = itemdata[ERRORID].toString();
mHiddenMessageId.append(messageId);
@@ -1219,10 +1217,10 @@ void ResultsTree::suppressSelectedIds()
continue;
if (item->parent()->parent())
item = item->parent();
- QVariantMap data = item->data().toMap();
- if (!data.contains("id"))
+ QVariantMap itemdata = item->data().toMap();
+ if (!itemdata.contains("id"))
continue;
- selectedIds << data[ERRORID].toString();
+ selectedIds << itemdata[ERRORID].toString();
}
// delete all errors with selected message Ids
@@ -1265,13 +1263,13 @@ void ResultsTree::suppressHash()
ProjectFile *projectFile = ProjectFile::getActiveProject();
for (QStandardItem *item: selectedWarnings) {
QStandardItem *fileItem = item->parent();
- const QVariantMap data = item->data().toMap();
- if (projectFile && data.contains(HASH)) {
+ const QVariantMap itemdata = item->data().toMap();
+ if (projectFile && itemdata.contains(HASH)) {
SuppressionList::Suppression suppression;
- suppression.hash = data[HASH].toULongLong();
- suppression.errorId = data[ERRORID].toString().toStdString();
- suppression.fileName = data[FILENAME].toString().toStdString();
- suppression.lineNumber = data[LINE].toInt();
+ suppression.hash = itemdata[HASH].toULongLong();
+ suppression.errorId = itemdata[ERRORID].toString().toStdString();
+ suppression.fileName = itemdata[FILENAME].toString().toStdString();
+ suppression.lineNumber = itemdata[LINE].toInt();
projectFile->addSuppression(suppression);
changed = true;
}
@@ -1301,14 +1299,14 @@ void ResultsTree::tagSelectedItems(const QString &tag)
ProjectFile *currentProject = ProjectFile::getActiveProject();
for (QModelIndex index : mSelectionModel->selectedRows()) {
QStandardItem *item = mModel.itemFromIndex(index);
- QVariantMap data = item->data().toMap();
- if (data.contains("tags")) {
- data[TAGS] = tag;
- item->setData(QVariant(data));
+ QVariantMap itemdata = item->data().toMap();
+ if (itemdata.contains("tags")) {
+ itemdata[TAGS] = tag;
+ item->setData(QVariant(itemdata));
item->parent()->child(index.row(), COLUMN_TAGS)->setText(tag);
- if (currentProject && data.contains(HASH)) {
+ if (currentProject && itemdata.contains(HASH)) {
isTagged = true;
- currentProject->setWarningTags(data[HASH].toULongLong(), tag);
+ currentProject->setWarningTags(itemdata[HASH].toULongLong(), tag);
}
}
}
@@ -1333,10 +1331,10 @@ QString ResultsTree::getFilePath(const QStandardItem *target, bool fullPath)
if (target->column() != 0)
target = target->parent()->child(target->row(), 0);
- QVariantMap data = target->data().toMap();
+ QVariantMap targetdata = target->data().toMap();
//Replace (file) with filename
- QString file = data[FILENAME].toString();
+ QString file = targetdata[FILENAME].toString();
QString pathStr = QDir::toNativeSeparators(file);
if (!fullPath) {
QFileInfo fi(pathStr);
@@ -1434,17 +1432,17 @@ void ResultsTree::updateFromOldReport(const QString &filename)
ErrorItem errorItem;
readErrorItem(error, &errorItem);
const int oldErrorIndex = indexOf(oldErrors, errorItem);
- QVariantMap data = error->data().toMap();
+ QVariantMap errordata = error->data().toMap();
// New error .. set the "sinceDate" property
if (oldErrorIndex >= 0 && !oldErrors[oldErrorIndex].sinceDate.isEmpty()) {
- data[SINCEDATE] = oldErrors[oldErrorIndex].sinceDate;
- error->setData(data);
+ errordata[SINCEDATE] = oldErrors[oldErrorIndex].sinceDate;
+ error->setData(errordata);
fileItem->child(j, COLUMN_SINCE_DATE)->setText(oldErrors[oldErrorIndex].sinceDate);
- } else if (oldErrorIndex < 0 || data[SINCEDATE].toString().isEmpty()) {
+ } else if (oldErrorIndex < 0 || errordata[SINCEDATE].toString().isEmpty()) {
const QString sinceDate = QLocale::system().toString(QDate::currentDate(), QLocale::ShortFormat);
- data[SINCEDATE] = sinceDate;
- error->setData(data);
+ errordata[SINCEDATE] = sinceDate;
+ error->setData(errordata);
fileItem->child(j, COLUMN_SINCE_DATE)->setText(sinceDate);
if (oldErrorIndex < 0)
continue;
@@ -1454,8 +1452,8 @@ void ResultsTree::updateFromOldReport(const QString &filename)
continue;
const ErrorItem &oldErrorItem = oldErrors[oldErrorIndex];
- data[TAGS] = oldErrorItem.tags;
- error->setData(data);
+ errordata[TAGS] = oldErrorItem.tags;
+ error->setData(errordata);
}
}
}
@@ -1463,27 +1461,27 @@ void ResultsTree::updateFromOldReport(const QString &filename)
void ResultsTree::readErrorItem(const QStandardItem *error, ErrorItem *item) const
{
// Get error's user data
- QVariantMap data = error->data().toMap();
-
- item->severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(data[SEVERITY]));
- item->summary = data[SUMMARY].toString();
- item->message = data[MESSAGE].toString();
- item->errorId = data[ERRORID].toString();
- item->cwe = data[CWE].toInt();
- item->hash = data[HASH].toULongLong();
- item->inconclusive = data[INCONCLUSIVE].toBool();
- item->file0 = data[FILE0].toString();
- item->sinceDate = data[SINCEDATE].toString();
- item->tags = data[TAGS].toString();
- item->remark = data[REMARK].toString();
+ QVariantMap errordata = error->data().toMap();
+
+ item->severity = ShowTypes::ShowTypeToSeverity(ShowTypes::VariantToShowType(errordata[SEVERITY]));
+ item->summary = errordata[SUMMARY].toString();
+ item->message = errordata[MESSAGE].toString();
+ item->errorId = errordata[ERRORID].toString();
+ item->cwe = errordata[CWE].toInt();
+ item->hash = errordata[HASH].toULongLong();
+ item->inconclusive = errordata[INCONCLUSIVE].toBool();
+ item->file0 = errordata[FILE0].toString();
+ item->sinceDate = errordata[SINCEDATE].toString();
+ item->tags = errordata[TAGS].toString();
+ item->remark = errordata[REMARK].toString();
item->classification = error->parent()->child(error->row(), COLUMN_MISRA_CLASSIFICATION)->text();
item->guideline = error->parent()->child(error->row(), COLUMN_MISRA_GUIDELINE)->text();
if (error->rowCount() == 0) {
QErrorPathItem e;
- e.file = stripPath(data[FILENAME].toString(), true);
- e.line = data[LINE].toInt();
- e.info = data[MESSAGE].toString();
+ e.file = stripPath(errordata[FILENAME].toString(), true);
+ e.line = errordata[LINE].toInt();
+ e.info = errordata[MESSAGE].toString();
item->errorPath << e;
}
@@ -1559,13 +1557,11 @@ void ResultsTree::refreshFilePaths(QStandardItem *item)
continue;
}
- //Get error's user data
- QVariant userdata = error->data();
- //Convert it to QVariantMap
- QVariantMap data = userdata.toMap();
+ //Get error's user data and convert it to QVariantMap
+ QVariantMap userdata = error->data().toMap();
//Get list of files
- QString file = data[FILENAME].toString();
+ QString file = userdata[FILENAME].toString();
//Update this error's text
error->setText(stripPath(file, false));
diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp
index 439d2560f3f..709dc22b8d2 100644
--- a/gui/resultsview.cpp
+++ b/gui/resultsview.cpp
@@ -453,39 +453,39 @@ void ResultsView::updateDetails(const QModelIndex &index)
if (item->parent() && item->column() != 0)
item = item->parent()->child(item->row(), 0);
- QVariantMap data = item->data().toMap();
+ QVariantMap itemdata = item->data().toMap();
// If there is no severity data then it is a parent item without summary and message
- if (!data.contains("severity")) {
+ if (!itemdata.contains("severity")) {
mUI->mCode->clear();
mUI->mDetails->setText(QString());
return;
}
- const QString message = data["message"].toString();
+ const QString message = itemdata["message"].toString();
QString formattedMsg = message;
- const QString file0 = data["file0"].toString();
- if (!file0.isEmpty() && Path::isHeader(data["file"].toString().toStdString()))
+ const QString file0 = itemdata["file0"].toString();
+ if (!file0.isEmpty() && Path::isHeader(itemdata["file"].toString().toStdString()))
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
- if (data["cwe"].toInt() > 0)
- formattedMsg.prepend("CWE: " + QString::number(data["cwe"].toInt()) + "\n");
+ if (itemdata["cwe"].toInt() > 0)
+ formattedMsg.prepend("CWE: " + QString::number(itemdata["cwe"].toInt()) + "\n");
if (mUI->mTree->showIdColumn())
- formattedMsg.prepend(tr("Id") + ": " + data["id"].toString() + "\n");
- if (data["incomplete"].toBool())
+ formattedMsg.prepend(tr("Id") + ": " + itemdata["id"].toString() + "\n");
+ if (itemdata["incomplete"].toBool())
formattedMsg += "\n" + tr("Bug hunting analysis is incomplete");
mUI->mDetails->setText(formattedMsg);
- const int lineNumber = data["line"].toInt();
+ const int lineNumber = itemdata["line"].toInt();
- QString filepath = data["file"].toString();
+ QString filepath = itemdata["file"].toString();
if (!QFileInfo::exists(filepath) && QFileInfo::exists(mUI->mTree->getCheckDirectory() + '/' + filepath))
filepath = mUI->mTree->getCheckDirectory() + '/' + filepath;
QStringList symbols;
- if (data.contains("symbolNames"))
- symbols = data["symbolNames"].toString().split("\n");
+ if (itemdata.contains("symbolNames"))
+ symbols = itemdata["symbolNames"].toString().split("\n");
if (filepath == mUI->mCode->getFileName()) {
mUI->mCode->setError(lineNumber, symbols);
diff --git a/lib/cppcheck.vcxproj b/lib/cppcheck.vcxproj
index a48bb8ed404..bff6f8ef7c7 100644
--- a/lib/cppcheck.vcxproj
+++ b/lib/cppcheck.vcxproj
@@ -312,7 +312,7 @@
CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
Level4
..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
MultiThreadedDebugDLL
Use
precompiled.h
@@ -343,7 +343,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y
CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
Level4
..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
MultiThreadedDebugDLL
Use
precompiled.h
@@ -378,7 +378,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y
true
true
..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDLL
ProgramDatabase
@@ -418,7 +418,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y
true
true
..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDLL
ProgramDatabase
diff --git a/lib/cppcheck.vcxproj.filters b/lib/cppcheck.vcxproj.filters
index c3e5d34664f..7d69edfa230 100644
--- a/lib/cppcheck.vcxproj.filters
+++ b/lib/cppcheck.vcxproj.filters
@@ -200,6 +200,105 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
@@ -421,6 +520,120 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
diff --git a/test/signal/test-signalhandler.cpp b/test/signal/test-signalhandler.cpp
index 75115f35096..26fff94812b 100644
--- a/test/signal/test-signalhandler.cpp
+++ b/test/signal/test-signalhandler.cpp
@@ -73,6 +73,8 @@ int main(int argc, const char * const argv[])
return 0;
#else
+ (void)argc;
+ (void)argv;
return 1;
#endif
}
diff --git a/test/testother.cpp b/test/testother.cpp
index 68c0937620c..12ea2e7d56e 100644
--- a/test/testother.cpp
+++ b/test/testother.cpp
@@ -220,7 +220,7 @@ class TestOther : public TestFixture {
TEST_CASE(redundantVarAssignment_array);
TEST_CASE(redundantVarAssignment_switch_break);
TEST_CASE(redundantInitialization);
- TEST_CASE(redundantMemWrite);
+ //TEST_CASE(redundantMemWrite); // FIXME: temporary hack
TEST_CASE(redundantAssignmentSameValue);
TEST_CASE(varFuncNullUB);
@@ -10307,9 +10307,8 @@ class TestOther : public TestFixture {
ASSERT_EQUALS("", errout_str());
}
+ // cppcheck-suppress unusedPrivateFunction
void redundantMemWrite() {
- return; // FIXME: temporary hack
-
// Simple tests
// cppcheck-suppress unreachableCode - remove when code is enabled again
check("void f() {\n"
diff --git a/test/testrunner.vcxproj b/test/testrunner.vcxproj
index 89ab1d43a4c..ba2dd8de9d0 100755
--- a/test/testrunner.vcxproj
+++ b/test/testrunner.vcxproj
@@ -204,7 +204,7 @@
CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDebugDLL
Level4
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
true
Use
precompiled.h
@@ -233,7 +233,7 @@
CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)
MultiThreadedDebugDLL
Level4
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
true
Use
precompiled.h
@@ -267,7 +267,7 @@
true
true
true
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
ProgramDatabase
true
Use
@@ -307,7 +307,7 @@
true
true
true
- 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805
+ 4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805
ProgramDatabase
true
Use
diff --git a/test/testrunner.vcxproj.filters b/test/testrunner.vcxproj.filters
index 5728c84b3ad..81ab11f1f3c 100644
--- a/test/testrunner.vcxproj.filters
+++ b/test/testrunner.vcxproj.filters
@@ -259,6 +259,15 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
diff --git a/tools/dmake/dmake.vcxproj b/tools/dmake/dmake.vcxproj
index 4dfc06f0157..b582ba44121 100644
--- a/tools/dmake/dmake.vcxproj
+++ b/tools/dmake/dmake.vcxproj
@@ -62,7 +62,7 @@
false
$(IntDir)
- Level3
+ Level4
ProgramDatabase
@@ -82,7 +82,7 @@
true
$(IntDir)
- Level3
+ Level4
ProgramDatabase