Skip to content

Commit 78c0dce

Browse files
jketemaCopilot
andcommitted
Clarify maybe_unused test comment
Put the C++17 extractor option on the first line and name the maybe_unused attribute in the test expectation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e3f2400 commit 78c0dce

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

  • cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables

‎cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables/test.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
// semmle-extractor-options: -std=c++17
3-
43
int globalVar; // GOOD (not static)
54
static int staticVar1; // GOOD (used)
65
static int staticVar2; // GOOD (used)
@@ -12,7 +11,7 @@ static __attribute__((__unused__)) int staticVar7; // GOOD (unused but this is e
1211
const int constVar8 = 8; // $ Alert // BAD (const defaults to static)
1312
extern const int constVar9 = 9; // GOOD
1413
static int staticVar10 = 10; // $ SPURIOUS: Alert // GOOD [FALSE POSITIVE] (referenced in a never instantiated template)
15-
[[maybe_unused]] static int staticVar11; // GOOD (explicitly marked as unused)
14+
[[maybe_unused]] static int staticVar11; // GOOD (explicitly marked as maybe_unused)
1615

1716
void f()
1817
{

0 commit comments

Comments
 (0)