refactor(argparse): 将null替换为nullptr以提高C++兼容性

- 在argparse库中将所有null指针常量替换为nullptr
- 更新头文件和源文件中的指针初始化和比较操作
- 修改测试文件中的相关断言检查
- 更新AST定义文件中的注释说明
This commit is contained in:
zzy
2026-04-05 20:18:09 +08:00
parent 27d86d5685
commit 4144f7841c
76 changed files with 1430 additions and 998 deletions

View File

@@ -176,7 +176,7 @@ struct scc_ast_type {
} pointer;
struct {
scc_ast_type_t *element;
scc_ast_expr_t *size; // 可为 null <=> 不定长数组
scc_ast_expr_t *size; // 可为 nullptr <=> 不定长数组
} array;
struct {
scc_ast_type_t *return_type;
@@ -184,7 +184,7 @@ struct scc_ast_type {
} function;
struct {
const char *name;
scc_ast_decl_t *decl; // can be null
scc_ast_decl_t *decl; // can be nullptr
} record;
struct {
const char *name;
@@ -354,7 +354,7 @@ struct scc_ast_stmt {
struct {
scc_ast_expr_t *cond;
scc_ast_stmt_t *then_stmt;
scc_ast_stmt_t *opt_else_stmt; // stmt or null
scc_ast_stmt_t *opt_else_stmt; // stmt or nullptr
} if_stmt;
// while do-while 语句
struct {
@@ -363,9 +363,9 @@ struct scc_ast_stmt {
} while_stmt;
// for 语句
struct {
scc_ast_node_t *init; // expr or decl or null
scc_ast_expr_t *cond; // 可为 null
scc_ast_expr_t *incr; // 可为 null
scc_ast_node_t *init; // expr or decl or nullptr
scc_ast_expr_t *cond; // 可为 nullptr
scc_ast_expr_t *incr; // 可为 nullptr
scc_ast_stmt_t *body;
} for_stmt;
// switch 语句
@@ -388,7 +388,7 @@ struct scc_ast_stmt {
} jump;
// return 语句
struct {
scc_ast_expr_t *expr; // 可为 null
scc_ast_expr_t *expr; // 可为 nullptr
} return_stmt;
// goto 语句
struct {
@@ -416,12 +416,12 @@ struct scc_ast_decl {
// 变量声明
struct {
scc_ast_type_t *type;
scc_ast_expr_t *init; // 可为 NULL
scc_ast_expr_t *init; // 可为 nullptr
} var;
// 函数声明
struct {
scc_ast_type_t *type; // 函数类型
scc_ast_stmt_t *body; // 可为 null 表示只有声明
scc_ast_stmt_t *body; // 可为 nullptr 表示只有声明
} func;
// 参数声明
struct {