Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,7 @@ namespace simplecpp {
if (tok->next->op == '(')
tok2 = appendTokens(&tokens, loc, tok->next, macros, expandedmacros, parametertokens);
else if (expandArg(&tokens, tok->next, loc, macros, expandedmacros, parametertokens)) {
tokens.front()->location = loc;
if (tokens.cfront()->next && tokens.cfront()->next->op == '(')
tok2 = tok->next;
}
Expand Down
6 changes: 6 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,12 @@ static void define_define_21() // #397 DEBRACKET macro
"#define B(val) val\n"
"A\n";
ASSERT_EQUALS("\n\n\nB ( 2 )", preprocess(code2));

const char code3[] = "#define __GET_ARG2_DEBRACKET(ignore_this, val, ...) __DEBRACKET val\n"
"#define __DEBRACKET(...) __VA_ARGS__\n"
"#5 \"a.c\"\n"
"__GET_ARG2_DEBRACKET(432 (33), (B))\n";
ASSERT_EQUALS("\n#line 5 \"a.c\"\nB", preprocess(code3));
}

static void define_va_args_1()
Expand Down