File tree Expand file tree Collapse file tree
src/Best Practices/Unused Entities
test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,4 +25,5 @@ where v.isStatic()
2525 and not v instanceof MemberVariable
2626 and not declarationHasSideEffects ( v )
2727 and not v .getAnAttribute ( ) .hasName ( "used" )
28+ and not v .getAnAttribute ( ) .hasName ( "unused" )
2829select v , "Static variable " + v .getName ( ) + " is never read"
Original file line number Diff line number Diff line change 11| test.cpp:7:12:7:21 | staticVar5 | Static variable staticVar5 is never read |
22| 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 @@ -6,7 +6,7 @@ static int staticVar3 = 3; // GOOD (used)
66static int staticVar4 = staticVar3; // GOOD (used)
77static int staticVar5; // BAD (unused)
88static int staticVar6 = 6 ; // BAD (unused)
9- static __attribute__ ((__unused__)) int staticVar7; // GOOD (unused but this is expected) [FALSE POSITIVE]
9+ static __attribute__ ((__unused__)) int staticVar7; // GOOD (unused but this is expected)
1010
1111void f ()
1212{
You can’t perform that action at this time.
0 commit comments