Skip to content

Commit 5016808

Browse files
authored
enabled information messages in selfchecks / mitigated unmatchedSuppression warnings (#3090)
The `unmatchedSuppression` messages might be a bug where the regular expression appears to be incorrectly validated. I saw this with local runs but didn't look into it yet. There was also different behavior between using no threads and `-j`. I will file tickets as soon as I have the time to look at it.
1 parent 98b6ff5 commit 5016808

21 files changed

+53
-50
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,9 @@ jobs:
623623
624624
- name: Self check
625625
run: |
626-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive"
626+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive"
627627
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
628+
gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt"
628629
ec=0
629630
630631
# TODO: add --check-config
@@ -643,10 +644,10 @@ jobs:
643644
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json --enable=internal lib || ec=1
644645
# check gui with qt settings
645646
mkdir b2
646-
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
647+
./cppcheck $selfcheck_options $cppcheck_options $gui_options --cppcheck-build-dir=b2 --addon=naming.json --suppress=simplifyUsing:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
647648
# self check test and tools
648649
./cppcheck $selfcheck_options $cppcheck_options -Ifrontend -Icli test/*.cpp || ec=1
649650
./cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
650651
# triage
651-
./cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
652+
./cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
652653
exit $ec

.github/workflows/asan.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ jobs:
142142
- name: Self check
143143
if: false
144144
run: |
145-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive"
145+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive"
146146
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
147+
gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt"
148+
gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp"
147149
ec=0
148150
./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1
149151
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1
150152
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1
151153
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1
152-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
154+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
153155
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1
154156
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
155-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
157+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
156158
exit $ec

.github/workflows/selfcheck.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
# TODO: enable information
1920
build:
2021

2122
runs-on: ubuntu-22.04

.github/workflows/tsan.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,18 @@ jobs:
143143
- name: Self check
144144
if: false
145145
run: |
146-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive"
146+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive"
147147
selfcheck_options="$selfcheck_options --executor=thread"
148148
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
149+
gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt"
150+
gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp"
149151
ec=0
150152
./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1
151153
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1
152154
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1
153155
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1
154-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
156+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
155157
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1
156158
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
157-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
159+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
158160
exit $ec

.github/workflows/ubsan.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ jobs:
137137
# TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError
138138
- name: Self check
139139
run: |
140-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive"
140+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive"
141141
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
142+
gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt"
143+
gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp"
142144
ec=0
143145
./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1
144146
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1
145147
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1
146148
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1
147-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
149+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
148150
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1
149151
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
150-
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
152+
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1
151153
exit $ec

.selfcheck_suppressions

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
11
missingIncludeSystem
2+
# should not be reported - see #13387
3+
checkersReport
24

35
# temporary suppressions - fix the warnings!
46
simplifyUsing:lib/valueptr.h
5-
varid0:gui/projectfile.cpp
67
naming-privateMemberVariable:gui/test/cppchecklibrarydata/testcppchecklibrarydata.h
7-
symbolDatabaseWarning:*/moc_*.cpp
8-
simplifyUsing:*/moc_*.cpp
8+
bitwiseOnBoolean:lib/library.cpp
9+
templateInstantiation:lib/checkunusedfunctions.cpp
10+
templateInstantiation:lib/errorlogger.cpp
11+
templateInstantiation:lib/liobrary.cpp
12+
shadowFunction:lib/checkbufferoverrun.cpp
13+
shadowFunction:lib/checkclass.cpp
14+
shadowFunction:lib/checknullpointer.cpp
15+
shadowFunction:lib/cppcheck.cpp
16+
shadowFunction:lib/fwdanalysis.cpp
17+
shadowFunction:lib/library.cpp
18+
shadowFunction:lib/symboldatabase.cpp
19+
shadowFunction:lib/templatesimplifier.cpp
20+
shadowFunction:lib/token.cpp
21+
shadowFunction:tools/triage/mainwindow.cpp
922

1023
# warnings in Qt generated code we cannot fix
11-
funcArgNamesDifferent:*/moc_*.cpp
12-
naming-varname:*/ui_*.h
24+
funcArgNamesDifferent:*/moc_checkthread.cpp
25+
funcArgNamesDifferent:*/moc_codeeditstylecontrols.cpp
26+
funcArgNamesDifferent:*/moc_resultstree.cpp
27+
funcArgNamesDifferent:*/moc_resultsview.cpp
28+
funcArgNamesDifferent:*/moc_threadhandler.cpp
29+
funcArgNamesDifferent:*/moc_threadresult.cpp
30+
naming-varname:*/gui/ui_*.h
1331
functionStatic:*/ui_fileview.h
14-
constVariablePointer:*/moc_test*.cpp
1532

1633
# --debug-warnings suppressions
1734
valueFlowBailout
1835
valueFlowBailoutIncompleteVar
19-
autoNoType
36+
autoNoType:externals/simplecpp/simplecpp.cpp
37+
autoNoType:cli/*.cpp
38+
autoNoType:lib/*.cpp
39+
autoNoType:lib/library.h
40+
autoNoType:gui/*.cpp
41+
autoNoType:test/*.cpp
42+
autoNoType:tools/triage/mainwindow.cpp
2043
# ticket 11631
2144
templateInstantiation:test/testutils.cpp
2245

2346
naming-varname:externals/simplecpp/simplecpp.h
2447
naming-privateMemberVariable:externals/simplecpp/simplecpp.h
2548

26-
valueFlowMaxIterations:externals/tinyxml2/tinyxml2.cpp
27-
2849
# TODO: these warnings need to be addressed upstream
2950
uninitMemberVar:externals/tinyxml2/tinyxml2.h
3051
noExplicitConstructor:externals/tinyxml2/tinyxml2.h
3152
missingOverride:externals/tinyxml2/tinyxml2.h
3253
invalidPrintfArgType_sint:externals/tinyxml2/tinyxml2.h
3354
naming-privateMemberVariable:externals/tinyxml2/tinyxml2.h
3455
functionStatic:externals/tinyxml2/tinyxml2.cpp
35-
invalidPrintfArgType_uint:externals/tinyxml2/tinyxml2.cpp
3656
funcArgNamesDifferent:externals/tinyxml2/tinyxml2.cpp
3757
nullPointerRedundantCheck:externals/tinyxml2/tinyxml2.cpp
38-
knownConditionTrueFalse:externals/tinyxml2/tinyxml2.cpp
3958
useStlAlgorithm:externals/simplecpp/simplecpp.cpp

cli/signalhandler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static const Signalmap_t listofsignals = {
108108
* but when ending up here something went terribly wrong anyway.
109109
* And all which is left is just printing some information and terminate.
110110
*/
111-
// cppcheck-suppress constParameterCallback
112111
static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
113112
{
114113
int type = -1;

gui/checkthread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static QString unquote(QString s) {
5858
}
5959

6060
// NOLINTNEXTLINE(performance-unnecessary-value-param) - used as callback so we need to preserve the signature
61-
int CheckThread::executeCommand(std::string exe, std::vector<std::string> args, std::string redirect, std::string &output) // cppcheck-suppress [passedByValue,passedByValueCallback]
61+
int CheckThread::executeCommand(std::string exe, std::vector<std::string> args, std::string redirect, std::string &output) // cppcheck-suppress passedByValueCallback
6262
{
6363
output.clear();
6464

lib/checkclass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3193,7 +3193,6 @@ void CheckClass::checkCopyCtorAndEqOperator()
31933193
{
31943194
// This is disabled because of #8388
31953195
// The message must be clarified. How is the behaviour different?
3196-
// cppcheck-suppress unreachableCode - remove when code is enabled again
31973196
if ((true) || !mSettings->severity.isEnabled(Severity::warning)) // NOLINT(readability-simplify-boolean-expr)
31983197
return;
31993198

lib/checkcondition.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,6 @@ void CheckCondition::checkIncorrectLogicOperator()
13411341
const std::string text = cond1str + " " + tok->str() + " " + cond2str;
13421342
incorrectLogicOperatorError(tok, text, alwaysTrue, inconclusive, std::move(errorPath));
13431343
} else if (printStyle && (firstTrue || secondTrue)) {
1344-
// cppcheck-suppress accessMoved - TODO: FP - see #12174
13451344
const int which = isfloat ? sufficientCondition(std::move(op1), not1, d1, std::move(op2), not2, d2, isAnd) : sufficientCondition(std::move(op1), not1, i1, std::move(op2), not2, i2, isAnd);
13461345
std::string text;
13471346
if (which != 0) {

0 commit comments

Comments
 (0)