diff options
-rw-r--r-- | main.c | 26 | ||||
-rw-r--r-- | mandoc.1 | 10 |
2 files changed, 13 insertions, 23 deletions
@@ -65,9 +65,7 @@ struct curparse { const char *file; /* Current parse. */ int fd; /* Current parse. */ int wflags; -#define WARN_WALL 0x03 /* All-warnings mask. */ -#define WARN_WCOMPAT (1 << 0) /* Compatibility warnings. */ -#define WARN_WSYNTAX (1 << 1) /* Syntax warnings. */ +#define WARN_WALL (1 << 0) /* All-warnings mask. */ #define WARN_WERR (1 << 2) /* Warnings->errors. */ int fflags; #define IGN_SCOPE (1 << 0) /* Ignore scope errors. */ @@ -596,13 +594,11 @@ static int woptions(int *wflags, char *arg) { char *v, *o; - char *toks[5]; + char *toks[3]; toks[0] = "all"; - toks[1] = "compat"; - toks[2] = "syntax"; - toks[3] = "error"; - toks[4] = NULL; + toks[1] = "error"; + toks[2] = NULL; while (*arg) { o = arg; @@ -611,12 +607,6 @@ woptions(int *wflags, char *arg) *wflags |= WARN_WALL; break; case (1): - *wflags |= WARN_WCOMPAT; - break; - case (2): - *wflags |= WARN_WSYNTAX; - break; - case (3): *wflags |= WARN_WERR; break; default: @@ -636,6 +626,7 @@ merr(void *arg, int line, int col, const char *msg) struct curparse *curp; curp = (struct curparse *)arg; + warnx("%s:%d: error: %s (column %d)", curp->file, line, msg, col); @@ -650,7 +641,10 @@ mdocwarn(void *arg, int line, int col, const char *msg) curp = (struct curparse *)arg; - warnx("%s:%d: warning: %s (column %d)", + if ( ! (curp->wflags & WARN_WALL)) + return(1); + + warnx("%s:%d: syntax warning: %s (column %d)", curp->file, line, msg, col); if ( ! (curp->wflags & WARN_WERR)) @@ -668,7 +662,7 @@ manwarn(void *arg, int line, int col, const char *msg) curp = (struct curparse *)arg; - if ( ! (curp->wflags & WARN_WSYNTAX)) + if ( ! (curp->wflags & WARN_WALL)) return(1); warnx("%s:%d: syntax warning: %s (column %d)", @@ -60,15 +60,11 @@ for available formats. Defaults to Print version and exit. .\" ITEM .It Fl W Ns Ar err... -Print warning messages. May be set to +Configure warning messages. Use .Fl W Ns Ar all -for all warnings, -.Ar compat -for groff/troff-compatibility warnings, or -.Ar syntax -for syntax warnings. If +to print warnings, .Fl W Ns Ar error -is specified, warnings are considered errors and cause utility +for warnings to be considered errors and cause utility termination. Multiple .Fl W arguments may be comma-separated, such as |