=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.304 retrieving revision 1.306 diff -u -p -r1.304 -r1.306 --- mandoc/mdoc_validate.c 2016/08/10 12:29:38 1.304 +++ mandoc/mdoc_validate.c 2016/08/11 10:47:16 1.306 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.304 2016/08/10 12:29:38 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.306 2016/08/11 10:47:16 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -886,9 +886,10 @@ 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->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) @@ -1761,8 +1762,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 @@ -1778,8 +1780,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. */