diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2023-04-28 20:23:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2023-04-28 20:23:19 +0000 |
commit | af7cf2f399b410f2137967b44e4590c494289ad3 (patch) | |
tree | 4741ec0e988ad21b6eb6acd8cc2094b67efbd627 /man_validate.c | |
parent | 0b0554bfc6a91450265f23d89c425a979a42d366 (diff) | |
download | mandoc-af7cf2f399b410f2137967b44e4590c494289ad3.tar.gz |
Do not rewrite MAN_LP and MAN_P to MAN_PP because doing that causes
confusing warning messages complaining about macros that don't even
appear in the input file.
As a welcome side effect, this also shortens the code...
Fixing a minibug
reported by Alejandro Colomar <alx dot manpages at gmail dot com>.
Diffstat (limited to 'man_validate.c')
-rw-r--r-- | man_validate.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/man_validate.c b/man_validate.c index 1f3c0159..722e4fdc 100644 --- a/man_validate.c +++ b/man_validate.c @@ -44,7 +44,6 @@ typedef void (*v_check)(CHKARGS); -static void check_abort(CHKARGS) __attribute__((__noreturn__)); static void check_par(CHKARGS); static void check_part(CHKARGS); static void check_root(CHKARGS); @@ -69,9 +68,9 @@ static const v_check man_valids[MAN_MAX - MAN_TH] = { post_SH, /* SS */ post_TP, /* TP */ post_TP, /* TQ */ - check_abort,/* LP */ + check_par, /* LP */ check_par, /* PP */ - check_abort,/* P */ + check_par, /* P */ post_IP, /* IP */ NULL, /* HP */ NULL, /* SM */ @@ -112,25 +111,11 @@ man_validate(struct roff_man *man) const v_check *cp; /* - * Translate obsolete macros such that later code - * does not need to look for them. - */ - - n = man->last; - switch (n->tok) { - case MAN_LP: - case MAN_P: - n->tok = MAN_PP; - break; - default: - break; - } - - /* * Iterate over all children, recursing into each one * in turn, depth-first. */ + n = man->last; man->last = man->last->child; while (man->last != NULL) { man_validate(man); @@ -200,12 +185,6 @@ check_root(CHKARGS) "(OpenBSD)" : "(NetBSD)"); } -static void -check_abort(CHKARGS) -{ - abort(); -} - /* * Skip leading whitespace, dashes, backslashes, and font escapes, * then create a tag if the first following byte is a letter. @@ -340,7 +319,8 @@ post_SH(CHKARGS) return; } - if (nc->tok == MAN_PP && nc->body->child != NULL) { + if ((nc->tok == MAN_LP || nc->tok == MAN_PP || nc->tok == MAN_P) && + nc->body->child != NULL) { while (nc->body->last != NULL) { man->next = ROFF_NEXT_CHILD; roff_node_relink(man, nc->body->last); @@ -348,7 +328,8 @@ post_SH(CHKARGS) } } - if (nc->tok == MAN_PP || nc->tok == ROFF_sp || nc->tok == ROFF_br) { + if (nc->tok == MAN_LP || nc->tok == MAN_PP || nc->tok == MAN_P || + nc->tok == ROFF_sp || nc->tok == ROFF_br) { mandoc_msg(MANDOCERR_PAR_SKIP, nc->line, nc->pos, "%s after %s", roff_name[nc->tok], roff_name[n->tok]); roff_node_delete(man, nc); |