diag.h (935B)
1 #ifndef KIT_DIAG_H 2 #define KIT_DIAG_H 3 4 #include "core/core.h" 5 6 /* DiagKind / DiagSink struct are public (see <kit.h>). The internal 7 * aliases below keep terse names; the unprefixed enum constants below 8 * are the names libkit's source uses internally. */ 9 typedef KitDiagKind DiagKind; 10 #define DIAG_NOTE KIT_DIAG_NOTE 11 #define DIAG_WARN KIT_DIAG_WARN 12 #define DIAG_ERROR KIT_DIAG_ERROR 13 #define DIAG_FATAL KIT_DIAG_FATAL 14 15 /* Convenience varargs wrappers around `sink->emit`. Internal use only. */ 16 void diag_emit(DiagSink*, DiagKind, SrcLoc, const char* fmt, ...); 17 void diag_emitv(DiagSink*, DiagKind, SrcLoc, const char* fmt, va_list); 18 19 /* Emit a DIAG_ERROR with no source location through the context's diag sink. 20 * No-op when `ctx` or `ctx->diag` is NULL. Shared by the public-API bridges 21 * (core/cas/compress/package) for human-readable operational errors. */ 22 void kit_ctx_diagf(const KitContext* ctx, const char* fmt, ...); 23 24 #endif