diff options
| author | 2026-02-24 14:09:19 +0100 | |
|---|---|---|
| committer | 2026-02-24 14:09:19 +0100 | |
| commit | f73f0301fd2d4306f173984fc8089ad463da26fe (patch) | |
| tree | 8e20f34b0d2a7b621ec3dd8b44e563ed359e3f77 /io.c | |
| parent | 6417c31a69ce06f35e00771fd2ecc87dbe48cd7a (diff) | |
diagnostics: also print #include provenance for warnings
Diffstat (limited to 'io.c')
| -rw-r--r-- | io.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |