Manual: Clarify section about inline suppressions. For backwards compatibility we might need to handle a comment after a '{' differently.
This commit is contained in:
parent
1251d35ba4
commit
7ff6d691e2
|
@ -473,6 +473,20 @@ Or at the same line as the code:
|
|||
arr[10] = 0; // cppcheck-suppress arrayIndexOutOfBounds
|
||||
}
|
||||
|
||||
In this example there are 2 lines with code and 1 suppression comment. The suppression comment only applies to 1 line: `a = b + c;`.
|
||||
|
||||
void f() {
|
||||
a = b + c; // cppcheck-suppress abc
|
||||
d = e + f;
|
||||
}
|
||||
|
||||
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;`:
|
||||
|
||||
void f()
|
||||
{ // cppcheck-suppress abc
|
||||
a = b + c;
|
||||
}
|
||||
|
||||
### Multiple suppressions
|
||||
|
||||
For a line of code there might be several warnings you want to suppress.
|
||||
|
|
Loading…
Reference in New Issue