=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.346 retrieving revision 1.347 diff -u -p -r1.346 -r1.347 --- mandoc/mdoc_validate.c 2017/07/01 09:47:30 1.346 +++ mandoc/mdoc_validate.c 2017/07/02 15:31:59 1.347 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.346 2017/07/01 09:47:30 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.347 2017/07/02 15:31:59 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -1104,6 +1104,8 @@ post_fname(POST_ARGS) if ( ! (cp[0] == '\0' || (cp[0] == '(' && cp[1] == '*'))) mandoc_msg(MANDOCERR_FN_PAREN, mdoc->parse, n->line, n->pos + pos, n->string); + if (n->sec == SEC_SYNOPSIS && mdoc->meta.msec != NULL) + mandoc_xr_add(mdoc->meta.msec, n->string, -1, -1); } static void @@ -1169,6 +1171,11 @@ post_nm(POST_ARGS) n = mdoc->last; + if ((n->sec == SEC_NAME || n->sec == SEC_SYNOPSIS) && + n->child != NULL && n->child->type == ROFFT_TEXT && + mdoc->meta.msec != NULL) + mandoc_xr_add(mdoc->meta.msec, n->child->string, -1, -1); + if (n->last != NULL && (n->last->tok == MDOC_Pp || n->last->tok == MDOC_Lp)) @@ -2339,8 +2346,11 @@ post_xr(POST_ARGS) n->line, n->pos, "Xr %s", nch->string); } else { assert(nch->next == n->last); - mandoc_xr_add(nch->next->string, nch->string, - nch->line, nch->pos); + if(mandoc_xr_add(nch->next->string, nch->string, + nch->line, nch->pos)) + mandoc_vmsg(MANDOCERR_XR_SELF, mdoc->parse, + nch->line, nch->pos, "Xr %s %s", + nch->string, nch->next->string); } post_delim(mdoc); }