=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.303 retrieving revision 1.307 diff -u -p -r1.303 -r1.307 --- mandoc/mdoc_validate.c 2016/08/10 12:06:41 1.303 +++ mandoc/mdoc_validate.c 2016/08/11 11:39:46 1.307 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.303 2016/08/10 12:06:41 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.307 2016/08/11 11:39:46 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -886,9 +886,11 @@ post_display(POST_ARGS) n = mdoc->last; switch (n->type) { case ROFFT_BODY: - if (n->end != ENDBODY_NOT) - break; - if (n->child == NULL) + if (n->end != ENDBODY_NOT) { + if (n->tok == MDOC_Bd && + n->body->parent->args == NULL) + roff_node_delete(mdoc, n); + } else if (n->child == NULL) mandoc_msg(MANDOCERR_BLK_EMPTY, mdoc->parse, n->line, n->pos, mdoc_macronames[n->tok]); else if (n->tok == MDOC_D1) @@ -1064,10 +1066,11 @@ post_it(POST_ARGS) mdoc_argnames[nbl->args->argv[0].arg]); /* FALLTHROUGH */ case LIST_item: - if (nit->head->child != NULL) + if ((nch = nit->head->child) != NULL) mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse, nit->line, nit->pos, - "It %s", nit->head->child->string); + "It %s", nch->string == NULL ? + mdoc_macronames[nch->tok] : nch->string); break; case LIST_column: cols = (int)nbl->norm->Bl.ncols; @@ -1760,8 +1763,9 @@ post_sh_authors(POST_ARGS) static void post_sh_head(POST_ARGS) { - const char *goodsec; - enum roff_sec sec; + struct roff_node *nch; + const char *goodsec; + enum roff_sec sec; /* * Process a new section. Sections are either "named" or @@ -1777,8 +1781,10 @@ post_sh_head(POST_ARGS) if (sec != SEC_NAME && mdoc->lastnamed == SEC_NONE) mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse, mdoc->last->line, mdoc->last->pos, "Sh %s", - sec == SEC_CUSTOM ? mdoc->last->child->string : - secnames[sec]); + sec != SEC_CUSTOM ? secnames[sec] : + (nch = mdoc->last->child) == NULL ? "" : + nch->type == ROFFT_TEXT ? nch->string : + mdoc_macronames[nch->tok]); /* The SYNOPSIS gets special attention in other areas. */