File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ | test.cpp:7:12:7:21 | staticVar5 | Static variable staticVar5 is never read |
2+ | test.cpp:8:12:8:21 | staticVar6 | Static variable staticVar6 is never read |
3+ | test.cpp:9:40:9:49 | staticVar7 | Static variable staticVar7 is never read |
Original file line number Diff line number Diff line change 1+ Best Practices/Unused Entities/UnusedStaticVariables.ql
Original file line number Diff line number Diff line change 1+
2+ int globalVar; // GOOD (not static)
3+ static int staticVar1; // GOOD (used)
4+ static int staticVar2; // GOOD (used)
5+ static int staticVar3 = 3 ; // GOOD (used)
6+ static int staticVar4 = staticVar3; // GOOD (used)
7+ static int staticVar5; // BAD (unused)
8+ static int staticVar6 = 6 ; // BAD (unused)
9+ static __attribute__ ((__unused__)) int staticVar7; // GOOD (unused but this is expected) [FALSE POSITIVE]
10+
11+ void f ()
12+ {
13+ int *ptr = &staticVar4;
14+
15+ staticVar1 = staticVar2;
16+ (*ptr) = 0 ;
17+ }
18+
You can’t perform that action at this time.
0 commit comments