summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-05 01:46:39 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-05 01:46:39 +0000
commit58b5978a4979bccacfd37ca3d20f8173e83422ec (patch)
treedc50dcf718a8711457188fd162bff9bbf29323f1
parent3249c63187cc9cf174a23f9b5c82957879a1bb01 (diff)
fix handling of empty .An macros
-rw-r--r--regress/usr.bin/mandoc/mdoc/An/break.in20
-rw-r--r--regress/usr.bin/mandoc/mdoc/An/break.out_ascii14
-rw-r--r--regress/usr.bin/mandoc/mdoc/An/break.out_lint16
-rw-r--r--usr.bin/mandoc/mdoc_html.c5
-rw-r--r--usr.bin/mandoc/mdoc_macro.c4
-rw-r--r--usr.bin/mandoc/mdoc_term.c5
-rw-r--r--usr.bin/mandoc/mdoc_validate.c12
7 files changed, 53 insertions, 23 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/An/break.in b/regress/usr.bin/mandoc/mdoc/An/break.in
index 98c5bfd9ced..b783b337d59 100644
--- a/regress/usr.bin/mandoc/mdoc/An/break.in
+++ b/regress/usr.bin/mandoc/mdoc/An/break.in
@@ -1,4 +1,4 @@
-.Dd July 31, 2014
+.Dd February 5, 2015
.Dt AN-BREAK 1
.Os OpenBSD
.Sh NAME
@@ -10,18 +10,32 @@ inline is the default:
.An Ingo ,
and
.An Joerg .
+empty
+.An
+trailing
+.An .
.Pp
.An -split -nosplit bogus
split mode:
.An Kristaps
.An Ingo
.An Joerg
+.Pp
+empty
+.An
+trailing
+.An .
.An -nosplit
.Sh AUTHORS
split mode is the default:
.An Kristaps
.An Ingo
.An Joerg
+.Pp
+empty
+.An
+trailing
+.An .
.An -nosplit -split bogus
.Pp
inline:
@@ -29,3 +43,7 @@ inline:
.An Ingo ,
and
.An Joerg .
+empty
+.An
+trailing
+.An .
diff --git a/regress/usr.bin/mandoc/mdoc/An/break.out_ascii b/regress/usr.bin/mandoc/mdoc/An/break.out_ascii
index f03ffac81cc..92cec3439e6 100644
--- a/regress/usr.bin/mandoc/mdoc/An/break.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/An/break.out_ascii
@@ -4,18 +4,26 @@ NNAAMMEE
AAnn--bbrreeaakk - line breaking of the author macro
DDEESSCCRRIIPPTTIIOONN
- inline is the default: Kristaps, Ingo, and Joerg.
+ inline is the default: Kristaps, Ingo, and Joerg. empty trailing .
split mode:
Kristaps
Ingo
Joerg
+ empty
+ trailing
+ .
+
AAUUTTHHOORRSS
split mode is the default: Kristaps
Ingo
Joerg
- inline: Kristaps, Ingo, and Joerg.
+ empty
+ trailing
+ .
+
+ inline: Kristaps, Ingo, and Joerg. empty trailing .
-OpenBSD July 31, 2014 OpenBSD
+OpenBSD February 5, 2015 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/An/break.out_lint b/regress/usr.bin/mandoc/mdoc/An/break.out_lint
index 18b0b222a72..25622fd1db0 100644
--- a/regress/usr.bin/mandoc/mdoc/An/break.out_lint
+++ b/regress/usr.bin/mandoc/mdoc/An/break.out_lint
@@ -1,4 +1,12 @@
-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
+mandoc: break.in:14:2: WARNING: skipping empty macro: An
+mandoc: break.in:16:2: WARNING: skipping empty macro: An
+mandoc: break.in:18:12: WARNING: skipping duplicate argument: An -nosplit
+mandoc: break.in:18:21: ERROR: skipping excess arguments: An ... bogus
+mandoc: break.in:25:2: WARNING: skipping empty macro: An
+mandoc: break.in:27:2: WARNING: skipping empty macro: An
+mandoc: break.in:36:2: WARNING: skipping empty macro: An
+mandoc: break.in:38:2: WARNING: skipping empty macro: An
+mandoc: break.in:39:14: WARNING: skipping duplicate argument: An -split
+mandoc: break.in:39:21: ERROR: skipping excess arguments: An ... bogus
+mandoc: break.in:47:2: WARNING: skipping empty macro: An
+mandoc: break.in:49:2: WARNING: skipping empty macro: An
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 2835470e487..80575e0b236 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.97 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.98 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1251,9 +1251,6 @@ mdoc_an_pre(MDOC_ARGS)
return(0);
}
- if (n->child == NULL)
- return(0);
-
if (h->flags & HTML_SPLIT)
print_otag(h, TAG_BR, 0, NULL);
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index c4c1a1e562b..cc00c8c1471 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.131 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.132 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -770,7 +770,7 @@ in_line(MACRO_PROT_ARGS)
*/
if (ac == ARGS_PUNCT) {
- if (cnt == 0 && nc == 0)
+ if (cnt == 0 && (nc == 0 || tok == MDOC_An))
mdoc->flags |= MDOC_NODELIMC;
break;
}
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index d4e32ff4c1c..2434d19193e 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.206 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.207 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1089,9 +1089,6 @@ termp_an_pre(DECL_ARGS)
return(0);
}
- if (n->child == NULL)
- return(0);
-
if (p->flags & TERMP_SPLIT)
term_newln(p);
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 1930d9861d0..81318d6261e 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.186 2015/02/04 22:29:28 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.187 2015/02/05 01:46:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1159,10 +1159,12 @@ post_an(POST_ARGS)
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 ((nch = np->child) != NULL)
+ nch = np->child;
+ if (np->norm->An.auth == AUTH__NONE) {
+ if (nch == NULL)
+ mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ np->line, np->pos, "An");
+ } else if (nch != NULL)
mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
nch->line, nch->pos, "An ... %s", nch->string);
}