Commit 9c977bd
authored
portable: Add const to local vars to suppress CPPCHECK warning (pytorch#20368)
`e93a285ebd "Extend CPPCHECK scope to portable kernels"`
My work branch was cut before this new lint coverage.
### Summary
CPPCHECK flagged apply_unary_map_reduce_fn<CTYPE, ACC> with a
constStatement warning. This is a false positive — the code compiles
correctly and the result is assigned to a variable used in subsequent
computation. Adding const to the declarations suppresses the warning.
### Test
```bash
$ lintrunner op_softmax.cpp op_log_softmax.cpp op_mean.cpp op_sum.cpp \
op_softmax_test.cpp op_log_softmax_test.cpp op_mean_test.cpp op_sum_test.cpp
ok No lint issues.
```
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils
@Sebastian-Larsson @robell @rascani
Signed-off-by: Youngsik Yang <vacu9708@gmail.com>1 parent 1b8ef9d commit 9c977bd
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments