github / github/codeql

LGTM.com - c++ false positive "Expression has no effect"

Đang mở
#5,125 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
C++ false-positive
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

LGTM is reporting a false-positive "Expression has no effect" warning. The expression LGTM is highlighting is this:

```c++
add_global(varName);
```

The definition of `add_global` follows right after the constructor:

```c++
static auto add_global(std::string var) -> bool {
return variables.insert(std::move(var)).second;
}
```

The `variables` variable is a static class variable which is being mutated by this function, which is most definitely an observable side-effect (which is, indeed, observed on parse.yy). There is no other `add_global` function accessible on this point, and no other `variables` variable accessible.

Here is the [link to the alert page](https://lgtm.com/projects/g/flamewing/sorcery-xtractobb/snapshot/eef1e0280b104529e9cd9321ccb4720099e814b7/files/statement.hh?sort=name&dir=ASC&mode=heatmap#x780384747974377a:1).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.