diff options
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bd/Makefile | 9 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bd/notype.in | 13 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bd/notype.out_ascii | 12 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint | 1 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/Makefile | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint | 8 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in | 39 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_ascii | 36 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint | 2 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/notype.in | 18 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/notype.out_ascii | 15 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 17 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 30 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 16 |
16 files changed, 187 insertions, 47 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bd/Makefile b/regress/usr.bin/mandoc/mdoc/Bd/Makefile index 609215b66ae..1231c86730b 100644 --- a/regress/usr.bin/mandoc/mdoc/Bd/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bd/Makefile @@ -1,7 +1,10 @@ -# $OpenBSD: Makefile,v 1.10 2014/07/02 11:42:56 schwarze Exp $ +# $OpenBSD: Makefile,v 1.11 2014/07/04 01:50:03 schwarze Exp $ -REGRESS_TARGETS = blank nested spacing empty offset-empty break broken -LINT_TARGETS = nested break broken +REGRESS_TARGETS = blank nested spacing +REGRESS_TARGETS += notype empty offset-empty +REGRESS_TARGETS += break broken + +LINT_TARGETS = nested notype break broken # groff defect: # - a display breaking another block continues indefinitely diff --git a/regress/usr.bin/mandoc/mdoc/Bd/notype.in b/regress/usr.bin/mandoc/mdoc/Bd/notype.in new file mode 100644 index 00000000000..3b40023b74b --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/notype.in @@ -0,0 +1,13 @@ +.Dd July 4, 2014 +.Dt BD-NOTYPE 1 +.Os OpenBSD +.Sh NAME +.Nm Bd-notype +.Nd no type specified for a display +.Sh DESCRIPTION +initial text +.Bd -offset 0n +displayed +text +.Ed +final text diff --git a/regress/usr.bin/mandoc/mdoc/Bd/notype.out_ascii b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_ascii new file mode 100644 index 00000000000..92f0d8e27e0 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_ascii @@ -0,0 +1,12 @@ +BD-NOTYPE(1) OpenBSD Reference Manual BD-NOTYPE(1) + +NNAAMMEE + BBdd--nnoottyyppee - no type specified for a display + +DDEESSCCRRIIPPTTIIOONN + initial text + + displayed text + final text + +OpenBSD July 4, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint new file mode 100644 index 00000000000..dd66ae959bd --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint @@ -0,0 +1 @@ +mandoc: notype.in:9:2: WARNING: missing display type, using -ragged diff --git a/regress/usr.bin/mandoc/mdoc/Bl/Makefile b/regress/usr.bin/mandoc/mdoc/Bl/Makefile index 16a1e144965..bb848afc905 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bl/Makefile @@ -1,21 +1,22 @@ -# $OpenBSD: Makefile,v 1.20 2014/07/03 23:23:45 schwarze Exp $ +# $OpenBSD: Makefile,v 1.21 2014/07/04 01:50:03 schwarze Exp $ REGRESS_TARGETS = item inset diag ohang bullet dash enum hang tag REGRESS_TARGETS += column extend nested -REGRESS_TARGETS += multitype multitag -REGRESS_TARGETS += empty noIt emptyhead emptytag +REGRESS_TARGETS += notype multitype multitag +REGRESS_TARGETS += empty noIt emptyhead emptytag emptyitem REGRESS_TARGETS += bareTa unclosed break broken -LINT_TARGETS = noIt emptyhead emptytag break broken +LINT_TARGETS = notype noIt emptyhead emptytag emptyitem break broken # groff-1.22.2 defects: +# - lists with missing or late type ruin indentation # - empty lists ruin indentation and sometimes cause empty lines # - breaking lists continue indefinitely # - breaking a list aborts processing # - empty -tag item heads lose the blank line and the indentation -SKIP_GROFF ?= empty break broken emptytag +SKIP_GROFF ?= notype empty break broken emptytag SKIP_TMAN ?= column multitype multitag bareTa break broken diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint index 7ba1b4770e0..9ccdd840157 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint @@ -1,4 +1,4 @@ -mandoc: emptyhead.in:12:2: WARNING: missing head in list item: hang -mandoc: emptyhead.in:21:2: WARNING: missing head in list item: ohang -mandoc: emptyhead.in:30:2: WARNING: missing head in list item: inset -mandoc: emptyhead.in:39:2: WARNING: missing head in list item: diag +mandoc: emptyhead.in:12:2: WARNING: empty head in list item: hang +mandoc: emptyhead.in:21:2: WARNING: empty head in list item: ohang +mandoc: emptyhead.in:30:2: WARNING: empty head in list item: inset +mandoc: emptyhead.in:39:2: WARNING: empty head in list item: diag diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in new file mode 100644 index 00000000000..738fdceb06d --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in @@ -0,0 +1,39 @@ +.Dd July 3, 2014 +.Dt BL-EMPTYITEM 1 +.Os OpenBSD +.Sh NAME +.Nm Bl-emptyitem +.Nd lists with fixed heads and empty items +.Sh DESCRIPTION +bullet list: +.Bl -bullet +.It +one +.It +.It +three +.El +dash list: +.Bl -dash +.It +one +.It +.It +three +.El +enum list: +.Bl -enum +.It +one +.It +.It +three +.El +hyphen list: +.Bl -hyphen +.It +one +.It +.It +three +.El diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_ascii new file mode 100644 index 00000000000..2de9533ea06 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_ascii @@ -0,0 +1,36 @@ +BL-EMPTYITEM(1) OpenBSD Reference Manual BL-EMPTYITEM(1) + +NNAAMMEE + BBll--eemmppttyyiitteemm - lists with fixed heads and empty items + +DDEESSCCRRIIPPTTIIOONN + bullet list: + + oo one + + oo + + oo three + dash list: + + -- one + + -- + + -- three + enum list: + + 1. one + + 2. + + 3. three + hyphen list: + + -- one + + -- + + -- three + +OpenBSD July 3, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint new file mode 100644 index 00000000000..23539409184 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint @@ -0,0 +1,4 @@ +mandoc: emptyitem.in:12:2: WARNING: empty list item: bullet +mandoc: emptyitem.in:20:2: WARNING: empty list item: dash +mandoc: emptyitem.in:28:2: WARNING: empty list item: enum +mandoc: emptyitem.in:36:2: WARNING: empty list item: hyphen diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint index 56ff9da3cd5..fc263308240 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint @@ -1 +1 @@ -mandoc: emptytag.in:12:2: WARNING: missing head in list item: tag +mandoc: emptytag.in:12:2: WARNING: empty head in list item: tag diff --git a/regress/usr.bin/mandoc/mdoc/Bl/notype.in b/regress/usr.bin/mandoc/mdoc/Bl/notype.in new file mode 100644 index 00000000000..bc66a5cd5da --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/notype.in @@ -0,0 +1,18 @@ +.Dd July 4, 2014 +.Dt BL-NOTYPE 1 +.Os OpenBSD +.Sh NAME +.Nm Bl-notype +.Nd lists with late or missing types +.Sh DESCRIPTION +initial text +.Bl -offset indent -bullet +.It +Some text. +.El +middle text +.Bl -offset indent +.It +Some text. +.El +final text diff --git a/regress/usr.bin/mandoc/mdoc/Bl/notype.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_ascii new file mode 100644 index 00000000000..02a9960338a --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_ascii @@ -0,0 +1,15 @@ +BL-NOTYPE(1) OpenBSD Reference Manual BL-NOTYPE(1) + +NNAAMMEE + BBll--nnoottyyppee - lists with late or missing types + +DDEESSCCRRIIPPTTIIOONN + initial text + + oo Some text. + middle text + + Some text. + final text + +OpenBSD July 4, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint new file mode 100644 index 00000000000..0ab6bb372a5 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint @@ -0,0 +1,3 @@ +mandoc: notype.in:9:2: WARNING: list type is not the first argument: offset +mandoc: notype.in:14:2: WARNING: list type is not the first argument: offset +mandoc: notype.in:14:2: ERROR: missing list type, using -item diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index c1e7a5413cc..1cab21d4555 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.76 2014/07/03 23:23:45 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.77 2014/07/04 01:50:03 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -88,11 +88,13 @@ enum mandocerr { MANDOCERR_COND_EMPTY, /* conditional request controls empty scope */ MANDOCERR_MACRO_EMPTY, /* skipping empty macro: macro */ MANDOCERR_ARGCWARN, /* argument count wrong */ - MANDOCERR_DISPTYPE, /* missing display type */ - MANDOCERR_LISTFIRST, /* list type must come first */ - MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */ - MANDOCERR_IT_NOHEAD, /* missing head in list item: type */ + MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged */ + MANDOCERR_BL_LATETYPE, /* list type is not the first argument: arg */ + MANDOCERR_BL_WIDTH, /* missing -width in -tag list, using 8n */ + MANDOCERR_IT_NOHEAD, /* empty head in list item: type */ + MANDOCERR_IT_NOBODY, /* empty list item: type */ MANDOCERR_FONTTYPE, /* missing font type */ + MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */ /* related to bad macro arguments */ MANDOCERR_IGNARGV, /* skipping argument */ @@ -146,11 +148,8 @@ enum mandocerr { MANDOCERR_SCOPEBROKEN, /* missing end of block */ MANDOCERR_SCOPEEXIT, /* scope open on exit */ MANDOCERR_UNAME, /* uname(3) system call failed */ - /* FIXME: merge following with MANDOCERR_ARGCOUNT */ - MANDOCERR_NOBODY, /* macro requires body argument(s) */ - MANDOCERR_NOARGV, /* macro requires argument(s) */ MANDOCERR_NUMERIC, /* request requires a numeric argument */ - MANDOCERR_LISTTYPE, /* missing list type */ + MANDOCERR_BL_NOTYPE, /* missing list type, using -item */ MANDOCERR_ARGSLOST, /* line argument(s) will be lost */ MANDOCERR_FATAL, /* ===== start of fatal errors ===== */ diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 1011c147470..a0b92f12b66 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.142 2014/07/03 23:23:45 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.143 2014/07/04 01:50:03 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -723,15 +723,16 @@ pre_bl(PRE_ARGS) if (n->norm->Bl.width || n->norm->Bl.offs || n->norm->Bl.comp) - mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST); - + mandoc_msg(MANDOCERR_BL_LATETYPE, + mdoc->parse, n->line, n->pos, + mdoc_argnames[n->args->argv[0].arg]); continue; } /* Allow lists to default to LIST_item. */ if (LIST__NONE == n->norm->Bl.type) { - mdoc_nmsg(mdoc, n, MANDOCERR_LISTTYPE); + mdoc_nmsg(mdoc, n, MANDOCERR_BL_NOTYPE); n->norm->Bl.type = LIST_item; } @@ -745,7 +746,7 @@ pre_bl(PRE_ARGS) switch (n->norm->Bl.type) { case LIST_tag: if (NULL == n->norm->Bl.width) - mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG); + mdoc_nmsg(mdoc, n, MANDOCERR_BL_WIDTH); break; case LIST_column: /* FALLTHROUGH */ @@ -865,7 +866,7 @@ pre_bd(PRE_ARGS) } if (DISP__NONE == n->norm->Bd.type) { - mdoc_nmsg(mdoc, n, MANDOCERR_DISPTYPE); + mdoc_nmsg(mdoc, n, MANDOCERR_BD_NOTYPE); n->norm->Bd.type = DISP_ragged; } @@ -930,7 +931,8 @@ pre_std(PRE_ARGS) if (MDOC_Std == n->args->argv[0].arg) return(1); - mdoc_nmsg(mdoc, n, MANDOCERR_NOARGV); + mandoc_msg(MANDOCERR_ARG_STD, mdoc->parse, + n->line, n->pos, mdoc_macronames[n->tok]); return(1); } @@ -1276,11 +1278,6 @@ post_it(POST_ARGS) nbl = nit->parent->parent; lt = nbl->norm->Bl.type; - if (LIST__NONE == lt) { - mdoc_nmsg(mdoc, nit, MANDOCERR_LISTTYPE); - return(1); - } - switch (lt) { case LIST_tag: /* FALLTHROUGH */ @@ -1304,7 +1301,9 @@ post_it(POST_ARGS) /* FALLTHROUGH */ case LIST_hyphen: if (NULL == nit->body->child) - mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY); + mandoc_msg(MANDOCERR_IT_NOBODY, + mdoc->parse, nit->line, nit->pos, + mdoc_argnames[nbl->args->argv[0].arg]); /* FALLTHROUGH */ case LIST_item: if (NULL != nit->head->child) @@ -1315,9 +1314,6 @@ post_it(POST_ARGS) assert(NULL == nit->head->child); - if (NULL == nit->body->child) - mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY); - for (i = 0, nch = nit->child; nch; nch = nch->next) if (MDOC_BODY == nch->type) i++; @@ -1333,7 +1329,7 @@ post_it(POST_ARGS) "columns == %d (have %d)", cols, i); return(MANDOCERR_ARGCOUNT == er); default: - break; + abort(); } return(1); diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 9381ae0407f..88f025b4eca 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.37 2014/07/03 23:23:45 schwarze Exp $ */ +/* $Id: read.c,v 1.38 2014/07/04 01:50:03 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -124,11 +124,13 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "conditional request controls empty scope", "skipping empty macro", "argument count wrong", - "missing display type", - "list type must come first", - "tag lists require a width argument", - "missing head in list item", + "missing display type, using -ragged", + "list type is not the first argument", + "missing -width in -tag list, using 8n", + "empty head in list item", + "empty list item", "missing font type", + "missing -std argument, adding it", /* related to bad macro arguments */ "skipping argument", @@ -182,10 +184,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "missing end of block", "scope open on exit", "uname(3) system call failed", - "macro requires body argument(s)", - "macro requires argument(s)", "request requires a numeric argument", - "missing list type", + "missing list type, using -item", "line argument(s) will be lost", "generic fatal error", |