Skip to content

Fix #400 (inner macro not expanded after hash hash) #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2024
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
2 changes: 1 addition & 1 deletion simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ namespace simplecpp {
}
TokenList temp(files);
calledMacro.expand(&temp, loc, tokens.cfront(), macros, expandedmacros);
return recursiveExpandToken(output, temp, loc, tok2, macros, expandedmacros2, parametertokens);
return recursiveExpandToken(output, temp, loc, tok2, macros, expandedmacros, parametertokens);
}

if (tok->str() == DEFINED) {
Expand Down
10 changes: 10 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,15 @@ static void define_define_21() // #397 DEBRACKET macro
ASSERT_EQUALS("\n#line 5 \"a.c\"\nB", preprocess(code3));
}

static void define_define_22() // #400 inner macro not expanded after hash hash
{
const char code[] = "#define FOO(a) CAT(DO, STUFF)(1,2)\n"
"#define DOSTUFF(a, b) CAT(3, 4)\n"
"#define CAT(a, b) a##b\n"
"FOO(1)\n";
ASSERT_EQUALS("\n\n\n34", preprocess(code));
}

static void define_va_args_1()
{
const char code[] = "#define A(fmt...) dostuff(fmt)\n"
Expand Down Expand Up @@ -3020,6 +3029,7 @@ int main(int argc, char **argv)
TEST_CASE(define_define_19);
TEST_CASE(define_define_20); // 384 arg contains comma
TEST_CASE(define_define_21);
TEST_CASE(define_define_22); // #400
TEST_CASE(define_va_args_1);
TEST_CASE(define_va_args_2);
TEST_CASE(define_va_args_3);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy