это ожидаемое поведение? test.c < /strong> < /p>
< /blockquote>
- строка 4 неправильно. Следует предупреждать ArrayIndexoutofBounds
- строка 7 в порядке. Не следует предупреждать ArrayIndexoutOfBounds
Я имею встроенный cppcheck-suppress для обеих строк.
Код: Выделить всё
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>
ситуация 1 < /strong> < /p>
< /blockquote>
Подавить cstylecast < /code>, которого не существует в коде. < /p>
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast test.c
2>cppcheckresults.xml
< /code>
Меня предупреждают о (среди других неуместных предупреждений) < /p>
[list]
[*] unmatchedSuppression: arrayIndexOutOfBounds
[*]
Код: Выделить всё
unmatchedSuppression: cstyleCast
[/list]
Ситуация 2 [/b]
, такая же, как ситуация 1, но с дополнительным -suppress = umm опция < /p>
Код: Выделить всё
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast --suppress=unmatchedSuppressiontest.c
2>cppcheckresults.xml
< /code>
Я ожидаю, что оба предыдущих непревзойденных пособий < /code> предупреждения о том, чтобы уйти. Но я все еще получаю < /strong> < /p>
[list]
[*]unmatchedSuppression
[/list]
Подробнее здесь: https://stackoverflow.com/questions/410 ... uppression