johnthagen / johnthagen/clion-cppcheck

Changed warning not displayed when line wasn't changed

Open
#78 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
35
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```cpp
static int bar(int t)
{
const int buf[3]= {0};
return buf[t];
}
static int f(void)
{
int t;
return bar((t=5));
}
int main(void)
{
f();
}
```

The code above will show

![image](https://user-images.githubusercontent.com/242857/184504587-88c3e2df-a414-4f2b-b3f5-76e4d50ce43f.png)

If you change the line with the `t` assignment to `3` it will report

![image](https://user-images.githubusercontent.com/242857/184504616-f50966b8-a061-4ee7-8d57-ee4caa7c4843.png)

Both messages should be adjusted for the index but only the one where we changed the line is.

If you add a newline at the end of the file the other message is updated as well.

![image](https://user-images.githubusercontent.com/242857/184504683-fe435947-5814-4e95-8ba6-4838f14367ab.png)

Note: I tested this with a standalone file (i.e. not belonging to any project).

I wonder if this might be related to #37.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.