--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 }
코드에 존재하지 않는 상황 일
억제 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
(예상대로)
2
상황 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)