From f73f0301fd2d4306f173984fc8089ad463da26fe Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 24 Feb 2026 14:09:19 +0100 Subject: diagnostics: also print #include provenance for warnings --- io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index e10c798..9da7b7c 100644 --- a/io.c +++ b/io.c @@ -1111,7 +1111,7 @@ fatal(const struct span *span, const char *fmt, ...) exit(1); } -int nerror; +int nerror, nwarn; enum { MAXERROR = 20 }; void @@ -1136,9 +1136,14 @@ warn(const struct span *span, const char *fmt, ...) if (ccopt.wnone) return; if (ccopt.werror) ++nerror; + else ++nwarn; va_start(ap, fmt); vdiag(span, ccopt.werror ? DGERROR : DGWARN, fmt, ap); va_end(ap); + if (nerror > MAXERROR) { + efmt("Too many errors emitted, stopping now.\n"); + exit(1); + } } void -- cgit v1.2.3