Update debugf usage

This commit is contained in:
gingerBill
2023-01-14 13:42:04 +00:00
parent 518f30e523
commit 9aa9429135
3 changed files with 10 additions and 6 deletions
+4 -5
View File
@@ -5187,8 +5187,6 @@ gb_internal void check_unchecked_bodies(Checker *c) {
if (pi->body == nullptr) {
continue;
}
debugf("unchecked: %.*s\n", LIT(e->token.string));
check_procedure_later(c, pi);
}
}
@@ -5219,11 +5217,12 @@ gb_internal void check_safety_all_procedures_for_unchecked(Checker *c) {
GB_ASSERT(pi->decl != nullptr);
Entity *e = pi->decl->entity;
auto proc_checked_state = pi->decl->proc_checked_state.load();
gb_unused(proc_checked_state);
if (e && ((e->flags & EntityFlag_ProcBodyChecked) == 0)) {
if ((e->flags & EntityFlag_Used) != 0) {
debugf("%.*s :: %s\n", LIT(e->token.string), type_to_string(e->type));
debugf("proc body unchecked\n");
debugf("Checked State: %s\n\n", ProcCheckedState_strings[proc_checked_state]);
// debugf("%.*s :: %s\n", LIT(e->token.string), type_to_string(e->type));
// debugf("proc body unchecked\n");
// debugf("Checked State: %s\n\n", ProcCheckedState_strings[proc_checked_state]);
consume_proc_info(c, pi, &untyped);
}
+2 -1
View File
@@ -1283,7 +1283,7 @@ gb_internal WORKER_TASK_PROC(lb_llvm_emit_worker_proc) {
gb_printf_err("LLVM Error: %s\n", llvm_error);
gb_exit(1);
}
debugf("Generated File: %.*s\n", LIT(wd->filepath_obj));
return 0;
}
@@ -1659,6 +1659,7 @@ gb_internal bool lb_llvm_object_generation(lbGenerator *gen, bool do_threading)
gb_exit(1);
return false;
}
debugf("Generated File: %.*s\n", LIT(filepath_obj));
}
}
return true;
+4
View File
@@ -27,13 +27,17 @@ gb_internal void thread_pool_wait(void) {
}
gb_global BlockingMutex debugf_mutex;
gb_internal void debugf(char const *fmt, ...) {
if (build_context.show_debug_messages) {
mutex_lock(&debugf_mutex);
gb_printf_err("[DEBUG] ");
va_list va;
va_start(va, fmt);
(void)gb_printf_err_va(fmt, va);
va_end(va);
mutex_unlock(&debugf_mutex);
}
}