aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mandoc.110
-rw-r--r--mandoc.h3
-rw-r--r--mdoc_validate.c52
-rw-r--r--read.c3
4 files changed, 39 insertions, 29 deletions
diff --git a/mandoc.1 b/mandoc.1
index 5976af7e..cda92aa2 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.141 2015/01/29 00:33:57 schwarze Exp $
+.\" $Id: mandoc.1,v 1.142 2015/02/04 16:38:56 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014, 2015 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: January 29 2015 $
+.Dd $Mdocdate: February 4 2015 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -784,6 +784,12 @@ This may confuse
.Xr makewhatis 8
and
.Xr apropos 1 .
+.It Sy "missing description line, using \(dq\(dq"
+.Pq mdoc
+The
+.Ic \&Nd
+macro lacks the required argument.
+The title line of the manual will end after the dash.
.It Sy "sections out of conventional order"
.Pq mdoc
A standard section occurs after another section it usually precedes.
diff --git a/mandoc.h b/mandoc.h
index 01dbafa6..efb2c8a2 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.194 2015/01/30 17:32:16 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.195 2015/02/04 16:38:56 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -66,6 +66,7 @@ enum mandocerr {
MANDOCERR_SEC_BEFORE, /* content before first section header: macro */
MANDOCERR_NAMESEC_FIRST, /* first section is not NAME: Sh title */
MANDOCERR_NAMESEC_BAD, /* bad NAME section contents: macro */
+ MANDOCERR_ND_EMPTY, /* missing description line, using "" */
MANDOCERR_SEC_ORDER, /* sections out of conventional order: Sh title */
MANDOCERR_SEC_REP, /* duplicate section title: Sh title */
MANDOCERR_SEC_MSEC, /* unexpected section: Sh title for ... only */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 9b495e67..8d218676 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.266 2015/02/03 00:48:47 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.267 2015/02/04 16:38:56 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -48,11 +48,6 @@ enum check_ineq {
CHECK_EQ
};
-enum check_lvl {
- CHECK_WARN,
- CHECK_ERROR,
-};
-
typedef void (*v_pre)(PRE_ARGS);
typedef void (*v_post)(POST_ARGS);
@@ -62,7 +57,7 @@ struct valids {
};
static void check_count(struct mdoc *, enum mdoc_type,
- enum check_lvl, enum check_ineq, int);
+ enum check_ineq, int);
static void check_text(struct mdoc *, int, int, char *);
static void check_argv(struct mdoc *,
struct mdoc_node *, struct mdoc_argv *);
@@ -374,10 +369,9 @@ mdoc_valid_post(struct mdoc *mdoc)
static void
check_count(struct mdoc *mdoc, enum mdoc_type type,
- enum check_lvl lvl, enum check_ineq ineq, int val)
+ enum check_ineq ineq, int val)
{
const char *p;
- enum mandocerr t;
if (mdoc->last->type != type)
return;
@@ -403,8 +397,7 @@ check_count(struct mdoc *mdoc, enum mdoc_type type,
/* NOTREACHED */
}
- t = lvl == CHECK_WARN ? MANDOCERR_ARGCWARN : MANDOCERR_ARGCOUNT;
- mandoc_vmsg(t, mdoc->parse, mdoc->last->line,
+ mandoc_vmsg(MANDOCERR_ARGCWARN, mdoc->parse, mdoc->last->line,
mdoc->last->pos, "want %s%d children (have %d)",
p, val, mdoc->last->nchild);
}
@@ -412,25 +405,25 @@ check_count(struct mdoc *mdoc, enum mdoc_type type,
static void
bwarn_ge1(POST_ARGS)
{
- check_count(mdoc, MDOC_BODY, CHECK_WARN, CHECK_GT, 0);
+ check_count(mdoc, MDOC_BODY, CHECK_GT, 0);
}
static void
ewarn_eq1(POST_ARGS)
{
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
+ check_count(mdoc, MDOC_ELEM, CHECK_EQ, 1);
}
static void
ewarn_ge1(POST_ARGS)
{
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_GT, 0);
+ check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
}
static void
hwarn_eq0(POST_ARGS)
{
- check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 0);
+ check_count(mdoc, MDOC_HEAD, CHECK_EQ, 0);
}
static void
@@ -941,7 +934,7 @@ post_lb(POST_ARGS)
const char *stdlibname;
char *libname;
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
+ check_count(mdoc, MDOC_ELEM, CHECK_EQ, 1);
n = mdoc->last->child;
assert(MDOC_TEXT == n->type);
@@ -995,7 +988,7 @@ static void
post_fo(POST_ARGS)
{
- check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 1);
+ check_count(mdoc, MDOC_HEAD, CHECK_EQ, 1);
bwarn_ge1(mdoc);
if (mdoc->last->type == MDOC_HEAD && mdoc->last->nchild)
post_fname(mdoc);
@@ -1069,8 +1062,17 @@ post_nm(POST_ARGS)
static void
post_nd(POST_ARGS)
{
+ struct mdoc_node *n;
+
+ n = mdoc->last;
+
+ if (n->type != MDOC_BODY)
+ return;
+
+ if (n->child == NULL)
+ mandoc_msg(MANDOCERR_ND_EMPTY, mdoc->parse,
+ n->line, n->pos, "Nd");
- check_count(mdoc, MDOC_BODY, CHECK_ERROR, CHECK_GT, 0);
post_hyph(mdoc);
}
@@ -1177,9 +1179,9 @@ post_an(POST_ARGS)
np = mdoc->last;
if (AUTH__NONE == np->norm->An.auth) {
if (0 == np->child)
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_GT, 0);
+ check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
} else if (np->child)
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 0);
+ check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
}
static void
@@ -1661,12 +1663,12 @@ post_rs(POST_ARGS)
switch (mdoc->last->type) {
case MDOC_HEAD:
- check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 0);
+ check_count(mdoc, MDOC_HEAD, CHECK_EQ, 0);
return;
case MDOC_BODY:
if (mdoc->last->child)
break;
- check_count(mdoc, MDOC_BODY, CHECK_WARN, CHECK_GT, 0);
+ check_count(mdoc, MDOC_BODY, CHECK_GT, 0);
return;
default:
return;
@@ -2072,7 +2074,7 @@ post_ignpar(POST_ARGS)
{
struct mdoc_node *np;
- check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_GT, 0);
+ check_count(mdoc, MDOC_HEAD, CHECK_GT, 0);
post_hyph(mdoc);
if (MDOC_BODY != mdoc->last->type)
@@ -2135,9 +2137,9 @@ post_par(POST_ARGS)
struct mdoc_node *np;
if (mdoc->last->tok == MDOC_sp)
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_LT, 2);
+ check_count(mdoc, MDOC_ELEM, CHECK_LT, 2);
else
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 0);
+ check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
if (MDOC_ELEM != mdoc->last->type &&
MDOC_BLOCK != mdoc->last->type)
diff --git a/read.c b/read.c
index c55776eb..ba69342c 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.120 2015/01/28 21:11:54 schwarze Exp $ */
+/* $Id: read.c,v 1.121 2015/02/04 16:38:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -110,6 +110,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"content before first section header",
"first section is not \"NAME\"",
"bad NAME section contents",
+ "missing description line, using \"\"",
"sections out of conventional order",
"duplicate section title",
"unexpected section",