Skip to content

Commit b1e85d7

Browse files
authored
Merge branch 'main' into fix-14687
2 parents da6390e + 2c03f19 commit b1e85d7

38 files changed

Lines changed: 925 additions & 506 deletions

.selfcheck_suppressions

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,46 @@ missingIncludeSystem
33
checkersReport
44

55
# warnings in Qt generated code we cannot fix
6+
funcArgNamesDifferentUnnamed:*/moc_aboutdialog.cpp
7+
funcArgNamesDifferentUnnamed:*/moc_applicationdialog.cpp
8+
funcArgNamesDifferentUnnamed:*/moc_applicationlist.cpp
69
funcArgNamesDifferent:*/moc_checkthread.cpp
10+
funcArgNamesDifferentUnnamed:*/moc_checkthread.cpp
11+
funcArgNamesDifferentUnnamed:*/moc_codeeditor.cpp
712
funcArgNamesDifferent:*/moc_codeeditstylecontrols.cpp
13+
funcArgNamesDifferentUnnamed:*/moc_codeeditstylecontrols.cpp
14+
funcArgNamesDifferentUnnamed:*/moc_compliancereportdialog.cpp
15+
funcArgNamesDifferentUnnamed:*/moc_codeeditstyledialog.cpp
16+
funcArgNamesDifferentUnnamed:*/moc_fileviewdialog.cpp
17+
funcArgNamesDifferentUnnamed:*/moc_helpdialog.cpp
18+
funcArgNamesDifferentUnnamed:*/moc_libraryaddfunctiondialog.cpp
19+
funcArgNamesDifferentUnnamed:*/moc_librarydialog.cpp
20+
funcArgNamesDifferentUnnamed:*/moc_libraryeditargdialog.cpp
21+
funcArgNamesDifferentUnnamed:*/moc_mainwindow.cpp
22+
funcArgNamesDifferentUnnamed:*/moc_newsuppressiondialog.cpp
23+
funcArgNamesDifferentUnnamed:*/moc_platforms.cpp
24+
funcArgNamesDifferentUnnamed:*/moc_projectfile.cpp
25+
funcArgNamesDifferentUnnamed:*/moc_projectfiledialog.cpp
826
funcArgNamesDifferent:*/moc_resultstree.cpp
27+
funcArgNamesDifferentUnnamed:*/moc_resultstree.cpp
928
funcArgNamesDifferent:*/moc_resultsview.cpp
29+
funcArgNamesDifferentUnnamed:*/moc_resultsview.cpp
30+
funcArgNamesDifferentUnnamed:*/moc_scratchpad.cpp
31+
funcArgNamesDifferentUnnamed:*/moc_settingsdialog.cpp
32+
funcArgNamesDifferentUnnamed:*/moc_statsdialog.cpp
33+
funcArgNamesDifferentUnnamed:*/moc_testcppchecklibrarydata.cpp
34+
funcArgNamesDifferentUnnamed:*/moc_testfilelist.cpp
35+
funcArgNamesDifferentUnnamed:*/moc_testprojectfile.cpp
36+
funcArgNamesDifferentUnnamed:*/moc_testresultstree.cpp
37+
funcArgNamesDifferentUnnamed:*/moc_testtranslationhandler.cpp
38+
funcArgNamesDifferentUnnamed:*/moc_testxmlreportv2.cpp
39+
funcArgNamesDifferentUnnamed:*/moc_threaddetails.cpp
1040
funcArgNamesDifferent:*/moc_threadhandler.cpp
41+
funcArgNamesDifferentUnnamed:*/moc_threadhandler.cpp
1142
funcArgNamesDifferent:*/moc_threadresult.cpp
43+
funcArgNamesDifferentUnnamed:*/moc_threadresult.cpp
44+
funcArgNamesDifferentUnnamed:*/moc_translationhandler.cpp
45+
funcArgNamesDifferentUnnamed:*/moc_txtreport.cpp
1246
naming-varname:*/gui/ui_*.h
1347
functionStatic:*/gui/ui_*.h
1448

@@ -37,7 +71,10 @@ invalidPrintfArgType_sint:externals/tinyxml2/tinyxml2.h
3771
naming-privateMemberVariable:externals/tinyxml2/tinyxml2.h
3872
functionStatic:externals/tinyxml2/tinyxml2.cpp
3973
funcArgNamesDifferent:externals/tinyxml2/tinyxml2.cpp
74+
funcArgNamesDifferentUnnamed:externals/tinyxml2/tinyxml2.cpp
75+
funcArgNamesDifferentUnnamed:externals/tinyxml2/tinyxml2.h
4076
nullPointerRedundantCheck:externals/tinyxml2/tinyxml2.cpp
4177
knownConditionTrueFalse:externals/tinyxml2/tinyxml2.cpp
4278
useStlAlgorithm:externals/simplecpp/simplecpp.cpp
79+
funcArgNamesDifferentUnnamed:externals/simplecpp/simplecpp.h
4380
missingMemberCopy:externals/simplecpp/simplecpp.h

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ Vesa Pikki
428428
Ville-Pekka Vahteala
429429
Ville Skyttä
430430
Vincent Le Garrec
431+
Vít Kučera
431432
Vladimir Petrigo
432433
Wang Haoyu
433434
Wang Yang

gui/codeeditor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ class CodeEditor : public QPlainTextEdit {
129129
void resizeEvent(QResizeEvent *event) override;
130130

131131
private slots:
132-
void updateLineNumberAreaWidth(int newBlockCount);
132+
void updateLineNumberAreaWidth(int /*newBlockCount*/);
133133
void highlightErrorLine();
134-
void updateLineNumberArea(const QRect & /*rect*/, int /*dy*/);
134+
void updateLineNumberArea(const QRect& rect, int dy);
135135

136136
private:
137137
QString generateStyleString();

gui/librarydialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ private slots:
4747
void addFunction();
4848
void changeFunction();
4949
void editArg();
50-
void editFunctionName(QListWidgetItem* /*item*/);
51-
void filterFunctions(const QString& /*filter*/);
50+
void editFunctionName(QListWidgetItem* item);
51+
void filterFunctions(const QString& filter);
5252
void selectFunction();
53-
void sortFunctions(bool /*sort*/);
53+
void sortFunctions(bool sort);
5454

5555
private:
5656
Ui::LibraryDialog *mUi;

gui/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ bool MainWindow::getCppcheckSettings(Settings& settings, Suppressions& supprs)
11221122
for (const QString& undefine : undefines)
11231123
settings.userUndefs.insert(undefine.toStdString());
11241124

1125-
settings.userIncludes.push_back(mProjectFile->getUserInclude().toStdString());
1125+
mProjectFile->setSettingsUserIncludes(settings);
11261126

11271127
const QStringList libraries = mProjectFile->getLibraries();
11281128
for (const QString& library : libraries) {

gui/projectfile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,12 @@ void ProjectFile::writeStringList(QXmlStreamWriter &xmlWriter, const QStringList
10781078
xmlWriter.writeEndElement();
10791079
}
10801080

1081+
void ProjectFile::setSettingsUserIncludes(Settings &settings) const
1082+
{
1083+
if (!mUserInclude.isEmpty())
1084+
settings.userIncludes.push_back(mUserInclude.toStdString());
1085+
}
1086+
10811087
QStringList ProjectFile::fromNativeSeparators(const QStringList &paths)
10821088
{
10831089
QStringList ret;

gui/projectfile.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class ProjectFile : public QObject {
146146
}
147147

148148
void setUserInclude(const QString& userInclude) {
149-
mUserInclude = userInclude;
149+
mUserInclude = userInclude.trimmed();
150150
}
151151

152152
/**
@@ -452,8 +452,13 @@ class ProjectFile : public QObject {
452452

453453
/** Get paths where we should glob for certain files (dir="cfg"/"platforms"/etc */
454454
QStringList getSearchPaths(const QString& dir) const;
455+
455456
static QStringList getSearchPaths(const QString& projectPath, const QString& appPath, const QString& datadir, const QString& dir);
456457

458+
/** Set user includes in settings if non-empty */
459+
void setSettingsUserIncludes(Settings &settings) const;
460+
461+
457462
protected:
458463

459464
/**

gui/projectfiledialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ private slots:
280280
/**
281281
* @brief Edit suppression (double clicking on suppression)
282282
*/
283-
void editSuppression(const QModelIndex &index);
283+
void editSuppression(const QModelIndex& /*index*/);
284284

285285
/**
286286
* @brief Browse for misra file

gui/test/projectfile/testprojectfile.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,14 @@ void TestProjectFile::getCheckingSuppressionsStar() const
199199
QCOMPARE(projectFile.getCheckingSuppressions()[0].fileName, "*.cpp");
200200
}
201201

202+
void TestProjectFile::emptyUserInclude() const
203+
{
204+
ProjectFile projectFile;
205+
Settings settings;
206+
projectFile.setUserInclude(" ");
207+
projectFile.setSettingsUserIncludes(settings);
208+
QCOMPARE(settings.userIncludes.size(), 0);
209+
}
210+
202211
QTEST_MAIN(TestProjectFile)
203212

gui/test/projectfile/testprojectfile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ private slots:
3636
void getCheckingSuppressionsRelative() const;
3737
void getCheckingSuppressionsAbsolute() const;
3838
void getCheckingSuppressionsStar() const;
39+
40+
void emptyUserInclude() const;
3941
};

0 commit comments

Comments
 (0)