Skip to content

Commit 7ff6d69

Browse files
committed
Manual: Clarify section about inline suppressions. For backwards compatibility we might need to handle a comment after a '{' differently.
1 parent 1251d35 commit 7ff6d69

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

man/manual.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,20 @@ Or at the same line as the code:
473473
arr[10] = 0; // cppcheck-suppress arrayIndexOutOfBounds
474474
}
475475

476+
In this example there are 2 lines with code and 1 suppression comment. The suppression comment only applies to 1 line: `a = b + c;`.
477+
478+
void f() {
479+
a = b + c; // cppcheck-suppress abc
480+
d = e + f;
481+
}
482+
483+
As a special case for backwards compatibility, if you have a `{` on its own line and a suppression comment after that, then that will suppress warnings for both the current and next line. This example will suppress `abc` warnings both for `{` and for `a = b + c;`:
484+
485+
void f()
486+
{ // cppcheck-suppress abc
487+
a = b + c;
488+
}
489+
476490
### Multiple suppressions
477491

478492
For a line of code there might be several warnings you want to suppress.

0 commit comments

Comments
 (0)