diff options
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/main.c | 25 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 45 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 7 |
4 files changed, 54 insertions, 29 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 50071caf5ef..2165b2ef0e8 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.192 2017/04/18 15:59:56 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.193 2017/05/16 19:05:36 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -938,15 +938,16 @@ static int woptions(struct curparse *curp, char *arg) { char *v, *o; - const char *toks[7]; + const char *toks[8]; toks[0] = "stop"; toks[1] = "all"; - toks[2] = "warning"; - toks[3] = "error"; - toks[4] = "unsupp"; - toks[5] = "fatal"; - toks[6] = NULL; + toks[2] = "style"; + toks[3] = "warning"; + toks[4] = "error"; + toks[5] = "unsupp"; + toks[6] = "fatal"; + toks[7] = NULL; while (*arg) { o = arg; @@ -956,15 +957,18 @@ woptions(struct curparse *curp, char *arg) break; case 1: case 2: - curp->wlevel = MANDOCLEVEL_WARNING; + curp->wlevel = MANDOCLEVEL_STYLE; break; case 3: - curp->wlevel = MANDOCLEVEL_ERROR; + curp->wlevel = MANDOCLEVEL_WARNING; break; case 4: - curp->wlevel = MANDOCLEVEL_UNSUPP; + curp->wlevel = MANDOCLEVEL_ERROR; break; case 5: + curp->wlevel = MANDOCLEVEL_UNSUPP; + break; + case 6: curp->wlevel = MANDOCLEVEL_BADARG; break; default: @@ -972,7 +976,6 @@ woptions(struct curparse *curp, char *arg) return 0; } } - return 1; } diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index e47795ab97a..21dfcae265d 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.108 2017/03/27 18:51:20 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.109 2017/05/16 19:05:36 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 27 2017 $ +.Dd $Mdocdate: May 16 2017 $ .Dt MANDOC 1 .Os .Sh NAME @@ -146,13 +146,14 @@ to be reported on the standard error output and to affect the exit status. The .Ar level can be +.Cm style , .Cm warning , .Cm error , or .Cm unsupp ; .Cm all is an alias for -.Cm warning . +.Cm style . By default, .Nm is silent. @@ -594,27 +595,32 @@ option: .Pp .Bl -tag -width Ds -compact .It 0 -No warnings or errors occurred, or those that did were ignored because -they were lower than the requested +No style suggestions, warnings or errors occurred, or those that +did were ignored because they were lower than the requested .Ar level . +.It 1 +At least one style suggestion occurred, but no warning or error, and +.Fl W Cm style +was specified. .It 2 At least one warning occurred, but no error, and .Fl W Cm warning +or +.Fl W Cm style was specified. .It 3 At least one parsing error occurred, but no unsupported feature was encountered, and .Fl W Cm error -or -.Fl W Cm warning -was specified. +or a lower +.Ar level +was requested. .It 4 At least one unsupported feature was encountered, and -.Fl W Cm unsupp , -.Fl W Cm error -or -.Fl W Cm warning -was specified. +.Fl W Cm unsupp +or a lower +.Ar level +was requested. .It 5 Invalid command line arguments were specified. No input files have been read. @@ -714,9 +720,22 @@ rendering can be produced. Documents causing warnings may render poorly when using other formatting tools instead of .Nm . +.It Cm style +An input file uses dubious or discouraged style. +This is not a complaint about the syntax, and probably neither +formatting nor portability are in danger. +While great care is taken to avoid false positives on the higher +message levels, the +.Cm style +level tries to reduce the probability that issues go unnoticed, +so it may occasionally issue bogus suggestions. +Please use your good judgement to decide whether any particular +.Cm style +suggestion really justifies a change to the input file. .El .Pp Messages of the +.Cm style , .Cm warning , .Cm error , and diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 074354f69ef..f42429cfee0 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.157 2017/03/06 17:25:24 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.158 2017/05/16 19:05:36 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -28,7 +28,7 @@ */ enum mandoclevel { MANDOCLEVEL_OK = 0, - MANDOCLEVEL_RESERVED, + MANDOCLEVEL_STYLE, /* style suggestions */ MANDOCLEVEL_WARNING, /* warnings: syntax, whitespace, etc. */ MANDOCLEVEL_ERROR, /* input has been thrown away */ MANDOCLEVEL_UNSUPP, /* input needs unimplemented features */ @@ -44,6 +44,8 @@ enum mandoclevel { enum mandocerr { MANDOCERR_OK, + MANDOCERR_STYLE, /* ===== start of style suggestions ===== */ + MANDOCERR_WARNING, /* ===== start of warnings ===== */ /* related to the prologue */ diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index fe2aad9e198..1ea665b33b8 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.136 2017/04/29 12:43:55 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.137 2017/05/16 19:05:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -71,7 +71,7 @@ static void mparse_parse_buffer(struct mparse *, struct buf, static const enum mandocerr mandoclimits[MANDOCLEVEL_MAX] = { MANDOCERR_OK, - MANDOCERR_WARNING, + MANDOCERR_STYLE, MANDOCERR_WARNING, MANDOCERR_ERROR, MANDOCERR_UNSUPP, @@ -82,6 +82,7 @@ static const enum mandocerr mandoclimits[MANDOCLEVEL_MAX] = { static const char * const mandocerrs[MANDOCERR_MAX] = { "ok", + "generic style suggestion", "generic warning", /* related to the prologue */ @@ -237,7 +238,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { static const char * const mandoclevels[MANDOCLEVEL_MAX] = { "SUCCESS", - "RESERVED", + "STYLE", "WARNING", "ERROR", "UNSUPP", |