--suppress=unmatchedSuppression
は、cppcheckオプションで不一致の抑制タイプのみを抑制しますが、比類のないインライン抑制は抑制しません。cppcheckインライン非適合抑制を抑制する方法は?
これは予期された動作ですか?
test.cの
4行目は間違っています。
arrayIndexOutOfBounds
ライン7は大丈夫です。私が両方のラインのインライン
cppcheck-suppress
を持って
arrayIndexOutOfBounds
を警告してはいけません。
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 }
コードに存在しない状況1
抑制cstyleCast
、。
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast test.c
2>cppcheckresults.xml
私は
unmatchedSuppression: arrayIndexOutOfBounds
に(他の無関係な警告の中で)について警告を受けるtest.c
line 7
(予想通り)unmatchedSuppression: cstyleCast
で*
line 0
(予想通り)
状況1と同じですが、追加の--suppress=unmatchedSuppression
オプション
cppcheck --inline-suppr --force --enable=all
--xml-version=2 --suppress=cstyleCast --suppress=unmatchedSuppressiontest.c
2>cppcheckresults.xml
私は両方以前unmatchedSuppression
警告が離れて行くことを期待して状況。しかし、私はまだ取得中
unmatchedSuppression
test.c
line 7
(予想NOT)