aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-02-24 14:09:19 +0100
committerlemon <lsof@mailbox.org>2026-02-24 14:09:19 +0100
commitf73f0301fd2d4306f173984fc8089ad463da26fe (patch)
tree8e20f34b0d2a7b621ec3dd8b44e563ed359e3f77 /io.c
parent6417c31a69ce06f35e00771fd2ecc87dbe48cd7a (diff)
diagnostics: also print #include provenance for warnings
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 6 insertions, 1 deletions
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