fix(argparse): 修复位置参数处理中的类型转换问题
在处理位置参数时,将 scc_vec_size 的返回值显式转换为 int, 以避免潜在的类型不匹配问题。 fix(pproc): 修复宏展开中的类型转换问题 在多个位置将 scc_vec_size 的返回值显式转换为 int, 确保比较操作的类型一致性。 fix(pproc): 修复头文件包含深度检查的类型转换 将文件栈大小检查中的 scc_vec_size 返回值转换为 int, 保持类型一致性。 fix(sstream): 修复位置日志中未使用的变量警告 更新未使用变量的声明方式,将逗号分隔改为分号分隔, 更好地抑制编译器警告。
This commit is contained in:
@@ -146,7 +146,8 @@ split_arguments(scc_pproc_macro_extened_params_t *splited_params,
|
||||
depth--;
|
||||
}
|
||||
if (depth != 0 || raw_arg->type != SCC_TOK_COMMA ||
|
||||
(is_variadic && scc_vec_size(*splited_params) == named_count - 1)) {
|
||||
(is_variadic &&
|
||||
(int)scc_vec_size(*splited_params) == named_count - 1)) {
|
||||
if (scc_vec_size(arg) == 0 && raw_arg->type == SCC_TOK_BLANK) {
|
||||
scc_lexer_tok_drop(raw_arg);
|
||||
} else {
|
||||
@@ -169,7 +170,7 @@ split_arguments(scc_pproc_macro_extened_params_t *splited_params,
|
||||
}
|
||||
|
||||
scc_vec_push(*splited_params, arg);
|
||||
if (is_variadic && scc_vec_size(*splited_params) == named_count - 1) {
|
||||
if (is_variadic && (int)scc_vec_size(*splited_params) == named_count - 1) {
|
||||
scc_vec_init(arg);
|
||||
scc_vec_push(*splited_params, arg);
|
||||
}
|
||||
@@ -318,10 +319,11 @@ static inline void expand_function_macro(scc_pproc_expand_t *expand_ctx,
|
||||
int left_idx = got_left_non_blank(i, ¯o->replaces);
|
||||
int right_idx = got_right_non_blank(i, ¯o->replaces);
|
||||
|
||||
if (left_idx < 0 || right_idx >= (int)macro->replaces.size) {
|
||||
if (left_idx < 0 ||
|
||||
right_idx >= (int)scc_vec_size(macro->replaces)) {
|
||||
LOG_FATAL("Invalid ## operator");
|
||||
}
|
||||
while (i++ < right_idx) {
|
||||
while ((int)i++ < right_idx) {
|
||||
scc_lexer_tok_drop(&scc_vec_pop(tok_buffer));
|
||||
}
|
||||
|
||||
@@ -448,7 +450,7 @@ static inline void expand_object_macro(scc_pproc_expand_t *expand_ctx,
|
||||
scc_lexer_tok_t *right = &scc_vec_at(macro->replaces, right_idx);
|
||||
|
||||
scc_lexer_tok_t concate_tok = concatenate_tokens(left, right);
|
||||
while (i++ < right_idx) {
|
||||
while ((int)i++ < right_idx) {
|
||||
scc_lexer_tok_drop(&scc_vec_pop(tok_buffer));
|
||||
}
|
||||
if (concate_tok.type == SCC_TOK_UNKNOWN) {
|
||||
|
||||
@@ -36,7 +36,7 @@ static int switch_file_stack(scc_pproc_t *pp, scc_cstring_t *fname,
|
||||
SCC_ERROR(*pos, "include file '%s' not found", scc_cstring_as_cstr(fname));
|
||||
return -1;
|
||||
FOPEN:
|
||||
if (scc_vec_size(pp->file_stack) >= pp->config.max_include_depth) {
|
||||
if ((int)scc_vec_size(pp->file_stack) >= pp->config.max_include_depth) {
|
||||
SCC_FATAL(*pos, "include depth exceeds maximum (%d)",
|
||||
pp->config.max_include_depth);
|
||||
LOG_FATAL("Include depth is too deep...");
|
||||
|
||||
Reference in New Issue
Block a user