feat(pproc): 修改宏展开器以支持连续函数式宏调用

修改了预处理器宏展开功能,将输出类型从环形缓冲区改为向量,
并实现了对连续函数式宏调用的支持。现在可以正确处理像
g(z) -> f(x * (z)) 这样的宏替换场景,其中标识符可能被重新
定义为新的函数式宏。

BREAKING CHANGE: 函数签名 scc_pproc_expand_by_vec 的输出参数
从 scc_lexer_tok_ring_t* 改为 scc_lexer_tok_vec_t*
This commit is contained in:
zzy
2026-03-01 14:23:17 +08:00
parent 8cbb9e6987
commit 60cdfd2c33
4 changed files with 67 additions and 12 deletions

View File

@@ -172,10 +172,12 @@ static void test_define_nested_macros(void) {
"f(x(0) * (f(x(0) * (x(0)))))\n"
"f(x(0) * (f(x(0) * (a))))\n");
TEST_CASE("NO NAME");
CHECK_PP_OUTPUT_EXACT("#define f() int\n"
"f()\n",
"int\n");
TEST_CASE("replace got new function-like macro");
CHECK_PP_OUTPUT_EXACT("#define f(a) f(x * (a))\n"
"#define g f\n"
"#define x 2\n"
"g(z)\n",
"f(2 * (z))\n");
}
static void test_undef_macros(void) {