Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Update documentation with multiple source code comments in the same line #3597

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/analyzer/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2471,3 +2471,49 @@ void test() {
x = 1; // warn
}
```

## Change review status for multiple checker results in the same line
You can change multiple checker reports with a single source code comment:

```cpp
void test() {
// codechecker_confirmed [clang-diagnostic-division-by-zero, core.DivideZero] These are real problems.
int x = 1 / 0;
}
```

The limitation of this format is that you can't use separate status or message
for checkers. To solve this problem you can use one of the following format:

```cpp
void test_simple() {
// codechecker_confirmed [clang-diagnostic-division-by-zero, core.DivideZero] This is a real bug.
// codechecker_intentional [clang-diagnostic-unused-variable] This is not a bug.
int x = 1 / 0;
}

void test_simple() {
/**
* codechecker_intentional [core.DivideZero] This is a real bug.
* codechecker_confirmed [clang-diagnostic-unused-variable] This is not a bug.
*/
int x = 1 / 0;
}
```

**WARNING**: using multiple source code comments for the same checker is not
supported and will give you an error:

```cpp
void testError1() {
// codechecker_confirmed [clang-diagnostic-unused-variable] These are real problems.
// codechecker_intentional [clang-diagnostic-unused-variable] This is not a bug.
int x = 1 / 0;
}

void testError2() {
// codechecker_confirmed [all] These are real problems.
// codechecker_intentional [clang-diagnostic-unused-variable] This is not a bug.
int x = 1 / 0;
}
```