diff options
| -rw-r--r-- | common.h | 1 | ||||
| -rw-r--r-- | io.c | 3 | ||||
| -rw-r--r-- | main.c | 3 |
3 files changed, 6 insertions, 1 deletions
@@ -129,6 +129,7 @@ struct option { bool trigraph; bool nocolor; bool pie, pic; + bool werror; union { struct { bool p : 1, /* after parsing */ @@ -1072,8 +1072,9 @@ warn(const struct span *span, const char *fmt, ...) { va_list ap; + if (ccopt.werror) ++nerror; va_start(ap, fmt); - vdiag(span, DGWARN, fmt, ap); + vdiag(span, ccopt.werror ? DGERROR : DGWARN, fmt, ap); va_end(ap); } @@ -202,6 +202,9 @@ optparse(char **args) } /* TODO depfiles */ } else if (*arg == 'W') { + if (!strcmp(arg+1, "error")) { + ccopt.werror = 1; + } /* TODO warning switches */ } else Bad: warn(NULL, "unrecognized option: %'s", arg-1); } |