summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/mdoc/An/break.in4
-rw-r--r--regress/usr.bin/mandoc/mdoc/An/break.out_lint6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Pp/Makefile5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Pp/arg.in6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Pp/arg.out_ascii5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Pp/arg.out_lint3
-rw-r--r--usr.bin/mandoc/mdoc_validate.c26
7 files changed, 36 insertions, 19 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/An/break.in b/regress/usr.bin/mandoc/mdoc/An/break.in
index 933639aca9f..98c5bfd9ced 100644
--- a/regress/usr.bin/mandoc/mdoc/An/break.in
+++ b/regress/usr.bin/mandoc/mdoc/An/break.in
@@ -11,7 +11,7 @@ inline is the default:
and
.An Joerg .
.Pp
-.An -split -nosplit
+.An -split -nosplit bogus
split mode:
.An Kristaps
.An Ingo
@@ -22,7 +22,7 @@ split mode is the default:
.An Kristaps
.An Ingo
.An Joerg
-.An -nosplit -split
+.An -nosplit -split bogus
.Pp
inline:
.An Kristaps ,
diff --git a/regress/usr.bin/mandoc/mdoc/An/break.out_lint b/regress/usr.bin/mandoc/mdoc/An/break.out_lint
index c2cbfad6e2f..18b0b222a72 100644
--- a/regress/usr.bin/mandoc/mdoc/An/break.out_lint
+++ b/regress/usr.bin/mandoc/mdoc/An/break.out_lint
@@ -1,2 +1,4 @@
-mandoc: break.in:14:20: WARNING: skipping duplicate argument: An -nosplit
-mandoc: break.in:25:20: WARNING: skipping duplicate argument: An -split
+mandoc: break.in:14:12: WARNING: skipping duplicate argument: An -nosplit
+mandoc: break.in:14:21: ERROR: skipping excess arguments: An ... bogus
+mandoc: break.in:25:14: WARNING: skipping duplicate argument: An -split
+mandoc: break.in:25:21: ERROR: skipping excess arguments: An ... bogus
diff --git a/regress/usr.bin/mandoc/mdoc/Pp/Makefile b/regress/usr.bin/mandoc/mdoc/Pp/Makefile
index 4eacaf5271f..04e1bc3b394 100644
--- a/regress/usr.bin/mandoc/mdoc/Pp/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Pp/Makefile
@@ -1,5 +1,6 @@
-# $OpenBSD: Makefile,v 1.3 2012/07/07 14:10:55 schwarze Exp $
+# $OpenBSD: Makefile,v 1.4 2015/02/04 19:11:17 schwarze Exp $
-REGRESS_TARGETS=arg
+REGRESS_TARGETS = arg
+LINT_TARGETS = arg
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Pp/arg.in b/regress/usr.bin/mandoc/mdoc/Pp/arg.in
index 4db6c9fe515..563a4e98f5e 100644
--- a/regress/usr.bin/mandoc/mdoc/Pp/arg.in
+++ b/regress/usr.bin/mandoc/mdoc/Pp/arg.in
@@ -1,4 +1,4 @@
-.Dd September 20, 2010
+.Dd February 4, 2015
.Dt PP-ARG 1
.Os OpenBSD
.Sh NAME
@@ -8,3 +8,7 @@
line 1
.Pp drop this
line 2
+.br drop this
+line 3
+.sp 1v drop this
+line 4
diff --git a/regress/usr.bin/mandoc/mdoc/Pp/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Pp/arg.out_ascii
index 21eb3ca6bab..543772f8ea9 100644
--- a/regress/usr.bin/mandoc/mdoc/Pp/arg.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Pp/arg.out_ascii
@@ -7,5 +7,8 @@ DDEESSCCRRIIPPTTIIOONN
line 1
line 2
+ line 3
-OpenBSD September 20, 2010 OpenBSD
+ line 4
+
+OpenBSD February 4, 2015 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Pp/arg.out_lint b/regress/usr.bin/mandoc/mdoc/Pp/arg.out_lint
new file mode 100644
index 00000000000..2e0a2f63739
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Pp/arg.out_lint
@@ -0,0 +1,3 @@
+mandoc: arg.in:9:2: ERROR: skipping all arguments: Pp drop
+mandoc: arg.in:11:2: ERROR: skipping all arguments: br drop
+mandoc: arg.in:13:8: ERROR: skipping excess arguments: sp ... drop
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 6873ab49870..00018254a0c 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.184 2015/02/04 18:03:28 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.185 2015/02/04 19:11:17 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1165,14 +1165,15 @@ post_at(POST_ARGS)
static void
post_an(POST_ARGS)
{
- struct mdoc_node *np;
+ struct mdoc_node *np, *nch;
np = mdoc->last;
if (AUTH__NONE == np->norm->An.auth) {
if (0 == np->child)
check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
- } else if (np->child)
- check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+ } else if ((nch = np->child) != NULL)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ nch->line, nch->pos, "An ... %s", nch->string);
}
static void
@@ -2125,14 +2126,17 @@ post_par(POST_ARGS)
{
struct mdoc_node *np;
- if (mdoc->last->tok == MDOC_sp)
- check_count(mdoc, MDOC_ELEM, CHECK_LT, 2);
- else
- check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+ np = mdoc->last;
- if (MDOC_ELEM != mdoc->last->type &&
- MDOC_BLOCK != mdoc->last->type)
- return;
+ if (np->tok == MDOC_sp) {
+ if (np->nchild > 1)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ np->child->next->line, np->child->next->pos,
+ "sp ... %s", np->child->next->string);
+ } else if (np->child != NULL)
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, np->line, np->pos, "%s %s",
+ mdoc_macronames[np->tok], np->child->string);
if (NULL == (np = mdoc->last->prev)) {
np = mdoc->last->parent;