Skip to content

Commit 69895d9

Browse files
dmcppcheckclaude
andcommitted
TestSuppressions: #undef after macro usage is now handled by simplecpp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5231855 commit 69895d9

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

‎test/testsuppressions.cpp‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,19 +1098,17 @@ class TestSuppressions : public TestFixture {
10981098
""));
10991099
ASSERT_EQUALS("", errout_str());
11001100

1101-
// TODO: simplecpp only reports the usages of macros that are defined when preprocessing ends
1102-
TODO_ASSERT_EQUALS(0, 1,
1103-
(this->*check)("#define DIV(A,B) A/B\n"
1104-
"// cppcheck-suppress-macro zerodiv\n"
1105-
"#define ALIAS(A,B) DIV(A,B)\n"
1106-
"void f() {\n"
1107-
" int a = ALIAS(1,0);\n"
1108-
"}\n"
1109-
"#undef ALIAS\n",
1110-
""));
1111-
TODO_ASSERT_EQUALS("",
1112-
"[test.cpp:5:13]: (error) Division by zero. [zerodiv]\n"
1113-
"[test.cpp:3:1]: (information) Unmatched suppression: zerodiv [unmatchedSuppression]\n", errout_str());
1101+
// macro is undefined after it has been used
1102+
ASSERT_EQUALS(0,
1103+
(this->*check)("#define DIV(A,B) A/B\n"
1104+
"// cppcheck-suppress-macro zerodiv\n"
1105+
"#define ALIAS(A,B) DIV(A,B)\n"
1106+
"void f() {\n"
1107+
" int a = ALIAS(1,0);\n"
1108+
"}\n"
1109+
"#undef ALIAS\n",
1110+
""));
1111+
ASSERT_EQUALS("", errout_str());
11141112
}
11151113

11161114
void suppressionsSettingsFiles() {

0 commit comments

Comments
 (0)