aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-27 12:18:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-27 12:18:00 +0000
commitce3e6e6c76cc1cfca6d316eee86a713e5a145ba6 (patch)
tree1aa5f52f108bbce45fd93524e417ff0aae4ea242 /mdoc_validate.c
parent268c88f5433d2a87d1eeab40076c8737b5786b08 (diff)
downloadmandoc-ce3e6e6c76cc1cfca6d316eee86a713e5a145ba6.tar.gz
mandoc-ce3e6e6c76cc1cfca6d316eee86a713e5a145ba6.tar.zst
mandoc-ce3e6e6c76cc1cfca6d316eee86a713e5a145ba6.zip
warn about .Ns macros that have no effect because they are followed
by an isolated closing delimiter; inspired by mdoclint
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 08f23583..a7d91ec0 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.343 2017/06/25 17:43:45 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.344 2017/06/27 12:18:00 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1983,10 +1983,13 @@ post_hyph(POST_ARGS)
static void
post_ns(POST_ARGS)
{
+ struct roff_node *n;
- if (mdoc->last->flags & NODE_LINE)
+ n = mdoc->last;
+ if (n->flags & NODE_LINE ||
+ (n->next != NULL && n->next->flags & NODE_DELIMC))
mandoc_msg(MANDOCERR_NS_SKIP, mdoc->parse,
- mdoc->last->line, mdoc->last->pos, NULL);
+ n->line, n->pos, NULL);
}
static void