diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-08 23:54:43 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-08 23:54:43 +0900 |
| commit | 32b15c9dbfec14417bb0a4e04c0eaa8a8028fd42 (patch) | |
| tree | ca179e6cd36aabc747c7ea10cb0dc40fe1effe89 | |
| parent | a93fcf03efbe2ce56bfd649447247bb8daf2e463 (diff) | |
| download | ducc-32b15c9dbfec14417bb0a4e04c0eaa8a8028fd42.tar.gz ducc-32b15c9dbfec14417bb0a4e04c0eaa8a8028fd42.tar.zst ducc-32b15c9dbfec14417bb0a4e04c0eaa8a8028fd42.zip | |
fix: macro expansion
| -rw-r--r-- | src/preprocess.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/preprocess.c b/src/preprocess.c index 385a43e..7f635b8 100644 --- a/src/preprocess.c +++ b/src/preprocess.c @@ -949,8 +949,8 @@ static int expand_macro(Preprocessor* pp, bool skip_newline, MacroExpansionConte tokens_init(&single_token, 1); *tokens_push_new(&single_token) = *concatenated; replace_pp_tokens(pp, pos - 1, pos + 2, &single_token); + token_count -= 2; --i; - ++token_count2; } else { fatal_error("invalid usage of ## operator"); } @@ -1001,6 +1001,7 @@ static int expand_macro(Preprocessor* pp, bool skip_newline, MacroExpansionConte if (peek_pp_token(pp)->kind == TokenKind_ident) { processed_token_count += expand_macro(pp, skip_newline, ctx); } else { + next_pp_token(pp); processed_token_count += 1; } } |
