=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.228 retrieving revision 1.229 diff -u -r1.228 -r1.229 --- src/usr.bin/mandoc/mdoc_validate.c 2017/01/08 02:01:14 1.228 +++ src/usr.bin/mandoc/mdoc_validate.c 2017/01/10 12:54:28 1.229 @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.228 2017/01/08 02:01:14 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.229 2017/01/10 12:54:28 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -936,12 +936,15 @@ case MDOC_Ar: mdoc->next = ROFF_NEXT_CHILD; roff_word_alloc(mdoc, nn->line, nn->pos, "file"); + mdoc->last->flags |= NODE_NOSRC; roff_word_alloc(mdoc, nn->line, nn->pos, "..."); + mdoc->last->flags |= NODE_NOSRC; break; case MDOC_Pa: case MDOC_Mt: mdoc->next = ROFF_NEXT_CHILD; roff_word_alloc(mdoc, nn->line, nn->pos, "~"); + mdoc->last->flags |= NODE_NOSRC; break; default: abort(); @@ -1932,6 +1935,8 @@ char *datestr; n = mdoc->last; + n->flags |= NODE_NOPRT; + if (mdoc->meta.date != NULL) { mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse, n->line, n->pos, "Dd"); @@ -1949,7 +1954,7 @@ if (n->child == NULL || n->child->string[0] == '\0') { mdoc->meta.date = mdoc->quick ? mandoc_strdup("") : mandoc_normdate(mdoc->parse, NULL, n->line, n->pos); - goto out; + return; } datestr = NULL; @@ -1961,8 +1966,6 @@ datestr, n->line, n->pos); free(datestr); } -out: - roff_node_delete(mdoc, n); } static void @@ -1973,10 +1976,12 @@ char *p; n = mdoc->last; + n->flags |= NODE_NOPRT; + if (mdoc->flags & MDOC_PBODY) { mandoc_msg(MANDOCERR_DT_LATE, mdoc->parse, n->line, n->pos, "Dt"); - goto out; + return; } if (mdoc->meta.title != NULL) @@ -2028,7 +2033,7 @@ mdoc->parse, n->line, n->pos, "Dt %s", mdoc->meta.title); mdoc->meta.vol = mandoc_strdup("LOCAL"); - goto out; /* msec and arch remain NULL. */ + return; /* msec and arch remain NULL. */ } mdoc->meta.msec = mandoc_strdup(nn->string); @@ -2046,7 +2051,7 @@ /* Optional third argument: architecture. */ if ((nn = nn->next) == NULL) - goto out; + return; for (p = nn->string; *p != '\0'; p++) *p = tolower((unsigned char)*p); @@ -2057,9 +2062,6 @@ if ((nn = nn->next) != NULL) mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, nn->line, nn->pos, "Dt ... %s", nn->string); - -out: - roff_node_delete(mdoc, n); } static void @@ -2087,6 +2089,8 @@ struct roff_node *n; n = mdoc->last; + n->flags |= NODE_NOPRT; + if (mdoc->meta.os != NULL) mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse, n->line, n->pos, "Os"); @@ -2107,11 +2111,11 @@ mdoc->meta.os = NULL; deroff(&mdoc->meta.os, n); if (mdoc->meta.os) - goto out; + return; if (mdoc->defos) { mdoc->meta.os = mandoc_strdup(mdoc->defos); - goto out; + return; } #ifdef OSNAME @@ -2128,9 +2132,6 @@ } mdoc->meta.os = mandoc_strdup(defbuf); #endif /*!OSNAME*/ - -out: - roff_node_delete(mdoc, n); } /*