stage1 重构代码新增c后端
This commit is contained in:
1 parent
fc2d8f8db4
commit
3714c2d142
24 files changed
+1539
-593
No files matched your search
+4
-25
@@ -109,29 +109,14 @@ void spl_diag_init(spl_diag_t *d, void *fout);
|
||||
void spl_diag_drop(spl_diag_t *d);
|
||||
void spl_diag_reset(spl_diag_t *d);
|
||||
void spl_diag_set_stage(spl_diag_t *d, spl_diag_stage_t stage);
|
||||
void spl_diag_set_output(spl_diag_t *d, FILE *out);
|
||||
void spl_diag_set_color(spl_diag_t *d, bool enabled);
|
||||
void spl_diag_set_collect(spl_diag_t *d, bool enabled);
|
||||
|
||||
void spl_diag_push(spl_diag_t *d, const spl_dbg_node_t *loc, const char *fn_name,
|
||||
const char *label);
|
||||
void spl_diag_pop(spl_diag_t *d);
|
||||
usize spl_diag_depth(const spl_diag_t *d);
|
||||
|
||||
/* ============================================================
|
||||
* 发射
|
||||
*
|
||||
* 每个级别都生成独立的 spl_diag_record_t:
|
||||
* - 计入 records(collect=true 时)
|
||||
* - error/fatal 计入 n_errors,warn 计入 n_warns
|
||||
* - 立刻输出到 out(如果非 NULL)
|
||||
*
|
||||
* 四种级别的语义区别:
|
||||
* note —— 一般信息;不阻塞;用在前序诊断之外的独立说明
|
||||
* warn —— 警告;不阻塞;driver 可忽略
|
||||
* error —— 用户代码错误;调用者应 return 0
|
||||
* fatal —— 用户代码错误到数据结构已损坏;调用者必须 return 0
|
||||
* ============================================================ */
|
||||
/* 每个级别生成独立 record;error/fatal 计入 n_errors,warn 计入 n_warns;
|
||||
非 NULL 时立刻输出到 out。note/warn 不阻塞,error/fatal 要求调用者停止。 */
|
||||
void spl_diag_note(spl_diag_t *d, spl_diag_kind_t kind, const spl_dbg_node_t *loc, const char *fmt,
|
||||
...);
|
||||
void spl_diag_warn(spl_diag_t *d, spl_diag_kind_t kind, const spl_dbg_node_t *loc, const char *fmt,
|
||||
@@ -141,14 +126,8 @@ void spl_diag_error(spl_diag_t *d, spl_diag_kind_t kind, const spl_dbg_node_t *l
|
||||
void spl_diag_fatal(spl_diag_t *d, spl_diag_kind_t kind, const spl_dbg_node_t *loc, const char *fmt,
|
||||
...);
|
||||
|
||||
/* 挂到最近一条记录(records 末尾)的 notes 列表下。
|
||||
* 不生成独立记录、不计入计数,输出时显示为:
|
||||
* note: <loc>
|
||||
* <msg>
|
||||
* 使用场景:辅助说明前一条诊断,例如
|
||||
* spl_diag_error(d, DUPLICATE_SYMBOL, &n->dbg, "duplicate symbol `foo`");
|
||||
* spl_diag_attach_note(d, &prev->dbg, "previously defined here");
|
||||
* 约束:只在 records 非空时生效;否则静默丢弃,不报错。 */
|
||||
/* 挂到最近一条记录(records 末尾)的 notes 下,用于辅助说明前一条诊断。
|
||||
不生成独立记录、不计入计数;records 为空时静默丢弃。 */
|
||||
void spl_diag_attach_note(spl_diag_t *d, const spl_dbg_node_t *loc, const char *fmt, ...);
|
||||
|
||||
bool spl_diag_has_error(const spl_diag_t *d);
|
||||
|
||||
Reference in new issue
Block a user