refactor(ast2ir): 重构ABI类型系统并修复union结构问题
- 将scc_ast_def.h中的attr_of从union改为struct以修复结构定义问题 - 添加type_abi依赖到ast2ir模块的cbuild.toml配置文件中 - 重命名scc_ast2ir.h中的abi字段为type_abi,并更新相关初始化函数签名 - 移除废弃的scc_abi_type.h和相关平台ABI头文件 - 添加辅助函数is_variadic_marker和fixed_param_count用于处理可变参数 - 添加数组和聚合类型初始化的辅助函数
This commit is contained in:
@@ -4,9 +4,12 @@
|
||||
#include "scc_core_pal.h"
|
||||
#include "scc_core_type.h"
|
||||
|
||||
#define scc_malloc scc_pal_malloc
|
||||
#define scc_calloc scc_pal_calloc
|
||||
#define scc_realloc scc_pal_realloc
|
||||
void *__scc_malloc(size_t size);
|
||||
void *__scc_calloc(size_t count, size_t size);
|
||||
void *__scc_realloc(void *ptr, size_t new_size);
|
||||
#define scc_malloc __scc_malloc
|
||||
#define scc_calloc __scc_calloc
|
||||
#define scc_realloc __scc_realloc
|
||||
#define scc_free scc_pal_free
|
||||
#define scc_exit scc_pal_exit
|
||||
#define scc_abort scc_pal_abort
|
||||
|
||||
@@ -5,6 +5,30 @@
|
||||
#define __SCC_LOG_IMPL_IMPORT_SRC__
|
||||
#include <scc_core_log.h>
|
||||
|
||||
void *__scc_malloc(size_t size) {
|
||||
void *p = scc_pal_malloc(size);
|
||||
if (!p) {
|
||||
LOG_FATAL("__scc_malloc: allocation failed (%zu bytes)", size);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void *__scc_calloc(size_t count, size_t size) {
|
||||
void *p = scc_pal_calloc(count, size);
|
||||
if (!p) {
|
||||
LOG_FATAL("__scc_calloc: allocation failed (%zu x %zu)", count, size);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void *__scc_realloc(void *ptr, size_t new_size) {
|
||||
void *p = scc_pal_realloc(ptr, new_size);
|
||||
if (!p) {
|
||||
LOG_FATAL("__scc_realloc: allocation failed (%zu bytes)", new_size);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void putchar_(char ch) {
|
||||
(void)ch;
|
||||
LOG_FATAL("you can't use printf.c directly");
|
||||
|
||||
Reference in New Issue
Block a user