summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-06 17:26:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-06 17:26:04 +0000
commit78f3b980a3571b0a981193a493a0291762bd2aca (patch)
tree677a7e13080f682d4bd8540edae3277db581341b /mdoc_validate.c
parent006240c00075748ea6caaf15bc37a67cf3454ee5 (diff)
downloadmandoc-78f3b980a3571b0a981193a493a0291762bd2aca.tar.gz
Using .Nd only makes sense in the NAME section.
Warn if that macro occurs elsewhere. Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 48d4fd31..95abef4f 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1035,6 +1035,10 @@ post_nd(POST_ARGS)
if (n->type != ROFFT_BODY)
return;
+ if (n->sec != SEC_NAME)
+ mandoc_msg(MANDOCERR_ND_LATE, mdoc->parse,
+ n->line, n->pos, "Nd");
+
if (n->child == NULL)
mandoc_msg(MANDOCERR_ND_EMPTY, mdoc->parse,
n->line, n->pos, "Nd");