CPPcheck Wie unterdrückt man die Inline -Unvergleiche -Unterdrückung?C++

Programme in C++. Entwicklerforum
Anonymous
 CPPcheck Wie unterdrückt man die Inline -Unvergleiche -Unterdrückung?

Post by Anonymous »

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>

  • 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
in test.c Zeile 7 (wie erwartet)
[*]

Code: Select all

unmatchedSuppression: cstyleCast
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>

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 
Zeile 7 (nicht erwartet)
[/list]

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post