diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-12-28 17:34:18 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-12-28 17:34:18 +0000 |
commit | d7c46d2d16226010fc23d4fc28e1515a70a52ed3 (patch) | |
tree | daef3e4a96ce67b1d9d64938fca56436df268077 /mdoc_validate.c | |
parent | e3f5b4421b6d2e53c29f596fe31bbca8f1b4ca0c (diff) | |
download | mandoc-d7c46d2d16226010fc23d4fc28e1515a70a52ed3.tar.gz |
Make the second, section number argument of .Xr mandatory.
In fact, we have been requiring it for many years.
The only reason to not warn when it was missing
was excessive traditionalism - it was optional in 4.4BSD.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 97985558..f5f73df0 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -103,6 +103,7 @@ static void post_sh_authors(POST_ARGS); static void post_sm(POST_ARGS); static void post_st(POST_ARGS); static void post_std(POST_ARGS); +static void post_xr(POST_ARGS); static v_post mdoc_valids[MDOC_MAX] = { NULL, /* Ap */ @@ -145,7 +146,7 @@ static v_post mdoc_valids[MDOC_MAX] = { post_st, /* St */ NULL, /* Va */ NULL, /* Vt */ - NULL, /* Xr */ + post_xr, /* Xr */ NULL, /* %A */ post_hyph, /* %B */ /* FIXME: can be used outside Rs/Re. */ NULL, /* %D */ @@ -1807,6 +1808,21 @@ post_sh_head(POST_ARGS) } static void +post_xr(POST_ARGS) +{ + struct roff_node *n, *nch; + + n = mdoc->last; + nch = n->child; + if (nch->next == NULL) { + mandoc_vmsg(MANDOCERR_XR_NOSEC, mdoc->parse, + n->line, n->pos, "Xr %s", nch->string); + return; + } + assert(nch->next == n->last); +} + +static void post_ignpar(POST_ARGS) { struct roff_node *np; @@ -2002,7 +2018,7 @@ post_dt(POST_ARGS) } } - /* Mandatory second argument: section. */ + /* Mandatory second argument: section. */ if (nn != NULL) nn = nn->next; |