refactor(log): 统一日志系统并添加链接器实现
- 为所有模块添加统一的 scc_*_log.h 日志头文件,删除旧的 lexer_log.h/c - 将运行时日志从 scc_utils 迁移到 scc_core 目录,统一日志管理 - 在解析器表达式/语句/类型解析中添加 LOG_TRACE 调试日志 - 实现 SCCF 链接器 (sccf_linker) 支持多目标文件链接 - 重构 CLI 主程序 (main.c/config.c),新增 cmd_log.h 调试支持 - 优化 x86 指令编码操作数对齐检查 - 修复预处理器的指令处理和宏展开逻辑
This commit is contained in:
@@ -43,14 +43,14 @@ static inline void scc_mcode_drop(scc_mcode_t *mcode) {
|
||||
* 避免拷贝大块代码数据。
|
||||
*/
|
||||
static inline void scc_mcode_adopt_buf(scc_mcode_t *mcode,
|
||||
scc_mcode_buff_t *buf) {
|
||||
scc_mcode_buff_t *buf) {
|
||||
scc_vec_free(mcode->code);
|
||||
mcode->code.size = buf->size;
|
||||
mcode->code.cap = buf->cap;
|
||||
mcode->code.data = buf->data;
|
||||
buf->size = 0;
|
||||
buf->cap = 0;
|
||||
buf->data = NULL;
|
||||
buf->data = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,14 +61,14 @@ static inline void scc_mcode_adopt_buf(scc_mcode_t *mcode,
|
||||
* 避免拷贝大块代码数据。
|
||||
*/
|
||||
static inline void scc_mcode_disown_buf(scc_mcode_t *mcode,
|
||||
scc_mcode_buff_t *out) {
|
||||
scc_mcode_buff_t *out) {
|
||||
scc_vec_free(*out);
|
||||
out->size = mcode->code.size;
|
||||
out->cap = mcode->code.cap;
|
||||
out->data = mcode->code.data;
|
||||
mcode->code.size = 0;
|
||||
mcode->code.cap = 0;
|
||||
mcode->code.data = NULL;
|
||||
mcode->code.data = nullptr;
|
||||
}
|
||||
|
||||
static inline void scc_mcode_add_u8(scc_mcode_t *mcode, u8 data) {
|
||||
|
||||
26
libs/mcode/include/scc_mcode_log.h
Normal file
26
libs/mcode/include/scc_mcode_log.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __SCC_MCODE_LOG_H__
|
||||
#define __SCC_MCODE_LOG_H__
|
||||
|
||||
typedef struct logger logger_t;
|
||||
extern logger_t __scc_mcode_log;
|
||||
extern logger_t __scc_mcode_user;
|
||||
|
||||
#define SCC_LOG_HANDLER &__scc_mcode_user
|
||||
#define LOG_DEFAULT_HANDLER &__scc_mcode_log
|
||||
#include <scc_log.h>
|
||||
|
||||
#ifdef __SCC_MCODE_LOG_IMPL__
|
||||
logger_t __scc_mcode_log = {
|
||||
.name = "mcode",
|
||||
.level = LOG_LEVEL_ALL,
|
||||
.handler = log_default_handler,
|
||||
};
|
||||
|
||||
logger_t __scc_mcode_user = {
|
||||
.name = "mcode",
|
||||
.level = LOG_LEVEL_ALL,
|
||||
.user_handler = scc_log_handler,
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user