aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mandoc.h17
-rw-r--r--mdoc_validate.c30
-rw-r--r--read.c16
3 files changed, 29 insertions, 34 deletions
diff --git a/mandoc.h b/mandoc.h
index 1a0256eb..83e6d06d 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.132 2014/07/03 23:24:56 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.133 2014/07/04 01:50:06 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/mdoc_validate.c b/mdoc_validate.c
index 7eb6ef17..42302cb5 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.224 2014/07/03 23:24:56 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.225 2014/07/04 01:50:07 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -727,15 +727,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;
}
@@ -749,7 +750,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 */
@@ -869,7 +870,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;
}
@@ -934,7 +935,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);
}
@@ -1280,11 +1282,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 */
@@ -1308,7 +1305,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)
@@ -1319,9 +1318,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++;
@@ -1337,7 +1333,7 @@ post_it(POST_ARGS)
"columns == %d (have %d)", cols, i);
return(MANDOCERR_ARGCOUNT == er);
default:
- break;
+ abort();
}
return(1);
diff --git a/read.c b/read.c
index 8cc2d17f..e33ab915 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.59 2014/07/03 23:24:56 schwarze Exp $ */
+/* $Id: read.c,v 1.60 2014/07/04 01:50:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -132,11 +132,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",
@@ -190,10 +192,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",