diag.c (554B)
1 /* Varargs convenience over the host DiagSink.emit vtable slot. */ 2 3 #include "core/diag.h" 4 5 #include <stdarg.h> 6 7 void diag_emit(DiagSink* s, DiagKind k, SrcLoc loc, const char* fmt, ...) { 8 va_list ap; 9 va_start(ap, fmt); 10 diag_emitv(s, k, loc, fmt, ap); 11 va_end(ap); 12 } 13 14 void diag_emitv(DiagSink* s, DiagKind k, SrcLoc loc, const char* fmt, 15 va_list ap) { 16 if (s && s->emit) s->emit(s, k, loc, fmt, ap); 17 if (s) { 18 if (k == DIAG_WARN) 19 s->warnings++; 20 else if (k == DIAG_ERROR || k == DIAG_FATAL) 21 s->errors++; 22 } 23 }