Skip to content

Commit 11ab940

Browse files
committed
Merge
2 parents b306d90 + 7b22594 commit 11ab940

35 files changed

+137
-33
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ jobs:
373373
python3 -m pip install pip --upgrade
374374
python3 -m pip install pytest
375375
python3 -m pip install pytest-timeout
376+
python3 -m pip install psutil
376377
377378
- name: Build cppcheck
378379
run: |

.github/workflows/CI-windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888

8989
- name: Set up Python 3.12
9090
if: matrix.config == 'release'
91-
uses: actions/setup-python@v4
91+
uses: actions/setup-python@v5
9292
with:
9393
python-version: '3.12'
9494
check-latest: true
@@ -100,7 +100,7 @@ jobs:
100100

101101
- name: Cache PCRE
102102
id: cache-pcre
103-
uses: actions/cache@v3
103+
uses: actions/cache@v4
104104
with:
105105
path: |
106106
externals\pcre.h
@@ -132,6 +132,7 @@ jobs:
132132
python -m pip install pytest || exit /b !errorlevel!
133133
python -m pip install pytest-custom_exit_code || exit /b !errorlevel!
134134
python -m pip install pytest-timeout || exit /b !errorlevel!
135+
python -m pip install psutil || exit /b !errorlevel!
135136
136137
- name: Run CMake
137138
if: false # TODO: enable

.github/workflows/asan.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
3535

3636
- name: Set up Python 3.12
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: '3.12'
4040
check-latest: true
@@ -64,6 +64,7 @@ jobs:
6464
python3 -m pip install pip --upgrade
6565
python3 -m pip install pytest
6666
python3 -m pip install pytest-timeout
67+
python3 -m pip install psutil
6768
6869
# TODO: disable all warnings
6970
- name: CMake

.github/workflows/buildman.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
args: --output=output/manual-premium.pdf man/manual-premium.md
3737

38-
- uses: actions/upload-artifact@v3
38+
- uses: actions/upload-artifact@v4
3939
with:
4040
name: output
4141
path: output
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
make man
5656
57-
- uses: actions/upload-artifact@v3
57+
- uses: actions/upload-artifact@v4
5858
with:
5959
name: cppcheck.1
6060
path: cppcheck.1

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
dry-run: false
2828
language: c++
2929
- name: Upload Crash
30-
uses: actions/upload-artifact@v3
30+
uses: actions/upload-artifact@v4
3131
if: failure() && steps.build.outcome == 'success'
3232
with:
3333
name: artifacts

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info
5757
genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp
5858
59-
- uses: actions/upload-artifact@v3
59+
- uses: actions/upload-artifact@v4
6060
with:
6161
name: Coverage results
6262
path: coverage_report

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v3
2424

2525
- name: Cache uncrustify
26-
uses: actions/cache@v3
26+
uses: actions/cache@v4
2727
id: cache-uncrustify
2828
with:
2929
path: |

.github/workflows/iwyu.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ jobs:
113113
# -isystem/usr/lib/clang/17/include
114114
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments > iwyu.log
115115
116-
- uses: actions/upload-artifact@v3
116+
- uses: actions/upload-artifact@v4
117117
if: success() || failure()
118118
with:
119119
name: Compilation Database
120120
path: ./cmake.output/compile_commands.json
121121

122-
- uses: actions/upload-artifact@v3
122+
- uses: actions/upload-artifact@v4
123123
if: success() || failure()
124124
with:
125125
name: Logs (include-what-you-use)
@@ -182,7 +182,7 @@ jobs:
182182
# TODO: run multi-threaded
183183
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-18 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
184184
185-
- uses: actions/upload-artifact@v3
185+
- uses: actions/upload-artifact@v4
186186
with:
187187
name: Logs (clang-include-cleaner)
188188
path: ./*.log

.github/workflows/release-windows.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Cache PCRE
3939
id: cache-pcre
40-
uses: actions/cache@v3
40+
uses: actions/cache@v4
4141
with:
4242
path: |
4343
externals\pcre.h
@@ -133,12 +133,12 @@ jobs:
133133
echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel!
134134
msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel!
135135
136-
- uses: actions/upload-artifact@v3
136+
- uses: actions/upload-artifact@v4
137137
with:
138138
name: installer
139139
path: win_installer/Build/
140140

141-
- uses: actions/upload-artifact@v3
141+
- uses: actions/upload-artifact@v4
142142
with:
143143
name: deploy
144144
path: win_installer\files
@@ -162,7 +162,7 @@ jobs:
162162
del win_installer\files\Qt5Svg.dll || exit /b !errorlevel!
163163
del win_installer\files\vc_redist.x64.exe || exit /b !errorlevel!
164164
165-
- uses: actions/upload-artifact@v3
165+
- uses: actions/upload-artifact@v4
166166
with:
167167
name: portable
168168
path: win_installer\files

.github/workflows/scriptcheck.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
key: ${{ github.workflow }}-${{ runner.os }}
3030

3131
- name: Cache Cppcheck
32-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3333
with:
3434
path: cppcheck
3535
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
@@ -58,13 +58,13 @@ jobs:
5858
- uses: actions/checkout@v3
5959

6060
- name: Restore Cppcheck
61-
uses: actions/cache@v3
61+
uses: actions/cache@v4
6262
with:
6363
path: cppcheck
6464
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
6565

6666
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v4
67+
uses: actions/setup-python@v5
6868
with:
6969
python-version: ${{ matrix.python-version }}
7070
check-latest: true

.github/workflows/selfcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
env:
130130
DISABLE_VALUEFLOW: 1
131131

132-
- uses: actions/upload-artifact@v3
132+
- uses: actions/upload-artifact@v4
133133
with:
134134
name: Callgrind Output
135135
path: ./callgrind.*

.github/workflows/tsan.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
3535

3636
- name: Set up Python 3.12
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: '3.12'
4040
check-latest: true
@@ -64,6 +64,7 @@ jobs:
6464
python3 -m pip install pip --upgrade
6565
python3 -m pip install pytest
6666
python3 -m pip install pytest-timeout
67+
python3 -m pip install psutil
6768
6869
- name: CMake
6970
run: |

.github/workflows/ubsan.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
3535

3636
- name: Set up Python 3.12
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: '3.12'
4040
check-latest: true
@@ -63,6 +63,7 @@ jobs:
6363
python3 -m pip install pip --upgrade
6464
python3 -m pip install pytest
6565
python3 -m pip install pytest-timeout
66+
python3 -m pip install psutil
6667
6768
# TODO: disable warnings
6869
- name: CMake

.github/workflows/valgrind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
#env:
5656
# DEBUGINFOD_URLS: https://debuginfod.ubuntu.com
5757

58-
- uses: actions/upload-artifact@v3
58+
- uses: actions/upload-artifact@v4
5959
if: success() || failure()
6060
with:
6161
name: Logs

gui/mainwindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,8 @@ QPair<bool,Settings> MainWindow::getCppcheckSettings()
10181018
QStringList dirs = mProjectFile->getIncludeDirs();
10191019
addIncludeDirs(dirs, result);
10201020

1021+
result.inlineSuppressions = mProjectFile->getInlineSuppression();
1022+
10211023
const QStringList defines = mProjectFile->getDefines();
10221024
for (const QString& define : defines) {
10231025
if (!result.userDefines.empty())
@@ -1111,6 +1113,8 @@ QPair<bool,Settings> MainWindow::getCppcheckSettings()
11111113
result.setMisraRuleTexts(CheckThread::executeCommand);
11121114
}
11131115
}
1116+
else
1117+
result.inlineSuppressions = mSettings->value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool();
11141118

11151119
// Include directories (and files) are searched in listed order.
11161120
// Global include directories must be added AFTER the per project include
@@ -1135,7 +1139,6 @@ QPair<bool,Settings> MainWindow::getCppcheckSettings()
11351139
result.force = mSettings->value(SETTINGS_CHECK_FORCE, 1).toBool();
11361140
result.xml = false;
11371141
result.jobs = mSettings->value(SETTINGS_CHECK_THREADS, 1).toInt();
1138-
result.inlineSuppressions = mSettings->value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool();
11391142
result.certainty.setEnabled(Certainty::inconclusive, mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool());
11401143
if (!mProjectFile || result.platform.type == Platform::Type::Unspecified)
11411144
result.platform.set((Platform::Type) mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt());

gui/projectfile.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void ProjectFile::clear()
7777
mAnalyzeAllVsConfigs = false;
7878
mCheckHeaders = true;
7979
mCheckUnusedTemplates = true;
80+
mInlineSuppression = true;
8081
mMaxCtuDepth = settings.maxCtuDepth;
8182
mMaxTemplateRecursion = settings.maxTemplateRecursion;
8283
mCheckUnknownFunctionReturn.clear();
@@ -143,6 +144,9 @@ bool ProjectFile::read(const QString &filename)
143144
if (xmlReader.name() == QString(CppcheckXml::CheckUnusedTemplatesElementName))
144145
mCheckUnusedTemplates = readBool(xmlReader);
145146

147+
if (xmlReader.name() == QString(CppcheckXml::InlineSuppression))
148+
mInlineSuppression = readBool(xmlReader);
149+
146150
if (xmlReader.name() == QString(CppcheckXml::CheckLevelExhaustiveElementName))
147151
mCheckLevel = CheckLevel::exhaustive;
148152

@@ -873,6 +877,10 @@ bool ProjectFile::write(const QString &filename)
873877
xmlWriter.writeCharacters(bool_to_string(mCheckUnusedTemplates));
874878
xmlWriter.writeEndElement();
875879

880+
xmlWriter.writeStartElement(CppcheckXml::InlineSuppression);
881+
xmlWriter.writeCharacters(bool_to_string(mInlineSuppression));
882+
xmlWriter.writeEndElement();
883+
876884
xmlWriter.writeStartElement(CppcheckXml::MaxCtuDepthElementName);
877885
xmlWriter.writeCharacters(QString::number(mMaxCtuDepth));
878886
xmlWriter.writeEndElement();

gui/projectfile.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ class ProjectFile : public QObject {
107107
mCheckUnusedTemplates = b;
108108
}
109109

110+
bool getInlineSuppression() const {
111+
return mInlineSuppression;
112+
}
113+
114+
void setInlineSuppression(bool b) {
115+
mInlineSuppression = b;
116+
}
117+
110118
/**
111119
* @brief Get list of include directories.
112120
* @return list of directories.
@@ -557,6 +565,11 @@ class ProjectFile : public QObject {
557565
/** Check code in unused templates */
558566
bool mCheckUnusedTemplates;
559567

568+
/**
569+
* @brief Enable inline suppression.
570+
*/
571+
bool mInlineSuppression;
572+
560573
/**
561574
* @brief List of include directories used to search include files.
562575
*/

gui/projectfile.ui

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,13 @@
746746
</layout>
747747
</widget>
748748
</item>
749+
<item>
750+
<widget class="QCheckBox" name="mInlineSuppressions">
751+
<property name="text">
752+
<string>Enable inline suppressions</string>
753+
</property>
754+
</widget>
755+
</item>
749756
<item>
750757
<spacer name="verticalSpacer_9">
751758
<property name="orientation">

gui/projectfiledialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
312312
mUI->mCheckLevelNormal->setChecked(true);
313313
mUI->mCheckHeaders->setChecked(projectFile->getCheckHeaders());
314314
mUI->mCheckUnusedTemplates->setChecked(projectFile->getCheckUnusedTemplates());
315+
mUI->mInlineSuppressions->setChecked(projectFile->getInlineSuppression());
315316
mUI->mMaxCtuDepth->setValue(projectFile->getMaxCtuDepth());
316317
mUI->mMaxTemplateRecursion->setValue(projectFile->getMaxTemplateRecursion());
317318
if (projectFile->clangParser)
@@ -435,6 +436,7 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
435436
projectFile->setVSConfigurations(getProjectConfigurations());
436437
projectFile->setCheckHeaders(mUI->mCheckHeaders->isChecked());
437438
projectFile->setCheckUnusedTemplates(mUI->mCheckUnusedTemplates->isChecked());
439+
projectFile->setInlineSuppression(mUI->mInlineSuppressions->isChecked());
438440
projectFile->setMaxCtuDepth(mUI->mMaxCtuDepth->value());
439441
projectFile->setMaxTemplateRecursion(mUI->mMaxTemplateRecursion->value());
440442
projectFile->setIncludes(getIncludePaths());

gui/test/projectfile/testprojectfile.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ void TestProjectFile::getAddonFilePath() const
139139
QCOMPARE(ProjectFile::getAddonFilePath(tempdir.path(), filepath), filepath);
140140
}
141141

142+
void TestProjectFile::getInlineSuppressionDefaultValue() const
143+
{
144+
ProjectFile projectFile;
145+
projectFile.setFilename("/some/path/123.cppcheck");
146+
QCOMPARE(projectFile.getInlineSuppression(), true);
147+
}
148+
149+
void TestProjectFile::getInlineSuppression() const
150+
{
151+
ProjectFile projectFile;
152+
projectFile.setFilename("/some/path/123.cppcheck");
153+
projectFile.setInlineSuppression(false);
154+
QCOMPARE(projectFile.getInlineSuppression(), false);
155+
}
156+
142157
void TestProjectFile::getCheckingSuppressionsRelative() const
143158
{
144159
const SuppressionList::Suppression suppression("*", "externals/*");

gui/test/projectfile/testprojectfile.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ private slots:
3030

3131
void getAddonFilePath() const;
3232

33+
void getInlineSuppressionDefaultValue() const;
34+
void getInlineSuppression() const;
35+
3336
void getCheckingSuppressionsRelative() const;
3437
void getCheckingSuppressionsAbsolute() const;
3538
void getCheckingSuppressionsStar() const;

lib/importproject.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,8 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
12211221
checkLevelExhaustive = true;
12221222
else if (strcmp(node->Name(), CppcheckXml::CheckUnusedTemplatesElementName) == 0)
12231223
temp.checkUnusedTemplates = (strcmp(readSafe(node->GetText(), ""), "true") == 0);
1224+
else if (strcmp(node->Name(), CppcheckXml::InlineSuppression) == 0)
1225+
temp.inlineSuppressions = (strcmp(readSafe(node->GetText(), ""), "true") == 0);
12241226
else if (strcmp(node->Name(), CppcheckXml::MaxCtuDepthElementName) == 0)
12251227
temp.maxCtuDepth = strToInt<int>(readSafe(node->GetText(), "2")); // TODO: bail out when missing?
12261228
else if (strcmp(node->Name(), CppcheckXml::MaxTemplateRecursionElementName) == 0)
@@ -1284,6 +1286,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
12841286
settings->checkUnusedTemplates = temp.checkUnusedTemplates;
12851287
settings->maxCtuDepth = temp.maxCtuDepth;
12861288
settings->maxTemplateRecursion = temp.maxTemplateRecursion;
1289+
settings->inlineSuppressions |= temp.inlineSuppressions;
12871290
settings->safeChecks = temp.safeChecks;
12881291

12891292
if (checkLevelExhaustive)

lib/importproject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ namespace CppcheckXml {
163163
static constexpr char MaxCtuDepthElementName[] = "max-ctu-depth";
164164
static constexpr char MaxTemplateRecursionElementName[] = "max-template-recursion";
165165
static constexpr char CheckUnknownFunctionReturn[] = "check-unknown-function-return-values";
166+
static constexpr char InlineSuppression[] = "inline-suppression";
166167
static constexpr char ClangTidy[] = "clang-tidy";
167168
static constexpr char Name[] = "name";
168169
static constexpr char VSConfigurationElementName[] = "vs-configurations";

0 commit comments

Comments
 (0)