CPPcheck Wie unterdrückt man die Inline -Unvergleiche -Unterdrückung?
Posted: 02 Apr 2025, 04:08
Ich habe festgestellt, dass -suppress = nicht staziperischsuppression < /code> nur unerreichte Suppressionstypen in CPPcheck -Optionen unterdrückt, aber nicht unübertroffene Inline -Unterdrückungen. test.c < /strong> < /p>
< /blockquote>
Ich habe inline cppcheck-suppress für beide Zeilen.
in test.c Zeile 7 (wie erwartet)
[*] in * Zeile 0 (wie erwartet)
[/list]
Situation 2 [/b]
gleiche ABS -Situation 1, aber mit zusätzlich - -suppress = unmatchededuppration gleich 1, aber mit zusätzlich - -seuppress = -Suppress = -Suppress = -Suppress = -Suppress = -Suppress = unmallsuppress. Option < /p>
Zeile 7 (nicht erwartet)
[/list]
< /blockquote>
- Zeile 4 ist falsch. Es sollte gewarnt werden, dass ArrayIndexoutOfBounds
- Zeile 7 in Ordnung ist. Es sollte nicht gewarnt werden, dass ArrayIndexoutOfBounds
Ich habe inline cppcheck-suppress für beide Zeilen.
Code: Select all
1 void f() {
2 char arr[5];
3 // cppcheck-suppress arrayIndexOutOfBounds
4 arr[10] = 0;
5
6 // cppcheck-suppress arrayIndexOutOfBounds
7 const char ok[] = "this line is ok";
8 }
< /code>
Situation 1 < /strong> < /p>
< /blockquote>
Unterdrückung cstylecast < /code>, die in Code nicht existiert. < /p>
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast test.c
2>cppcheckresults.xml
< /code>
Ich werde (unter anderem irrelevante Warnungen) gewarnt < /p>
[list]
[*] unmatchedSuppression: arrayIndexOutOfBounds
[*]
Code: Select all
unmatchedSuppression: cstyleCast
[/list]
Situation 2 [/b]
gleiche ABS -Situation 1, aber mit zusätzlich - -suppress = unmatchededuppration gleich 1, aber mit zusätzlich - -seuppress = -Suppress = -Suppress = -Suppress = -Suppress = -Suppress = unmallsuppress. Option < /p>
Code: Select all
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast --suppress=unmatchedSuppressiontest.c
2>cppcheckresults.xml
< /code>
Ich erwarte, dass beide früheren nicht staziperierten Verschiebung < /code> Warnungen verschwinden werden. Aber ich bekomme immer noch < /strong> < /p>
[list]
[*]unmatchedSuppressionIn test.c
[/list]