mandoc: args.in:7:2: ERROR: skipping all arguments: PP arg
-mandoc: args.in:9:2: ERROR: skipping all arguments: LP arg1 ...
-mandoc: args.in:11:2: ERROR: skipping all arguments: P arg
+mandoc: args.in:9:2: ERROR: skipping all arguments: PP arg1 ...
+mandoc: args.in:11:2: ERROR: skipping all arguments: PP arg
-/* $OpenBSD: man_html.c,v 1.110 2018/10/23 17:17:54 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.111 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
static int man_SS_pre(MAN_ARGS);
static int man_SY_pre(MAN_ARGS);
static int man_UR_pre(MAN_ARGS);
+static int man_abort_pre(MAN_ARGS);
static int man_alt_pre(MAN_ARGS);
static int man_ign_pre(MAN_ARGS);
static int man_in_pre(MAN_ARGS);
{ man_SS_pre, NULL }, /* SS */
{ man_IP_pre, NULL }, /* TP */
{ man_IP_pre, NULL }, /* TQ */
- { man_PP_pre, NULL }, /* LP */
+ { man_abort_pre, NULL }, /* LP */
{ man_PP_pre, NULL }, /* PP */
- { man_PP_pre, NULL }, /* P */
+ { man_abort_pre, NULL }, /* P */
{ man_IP_pre, NULL }, /* IP */
{ man_HP_pre, NULL }, /* HP */
{ man_SM_pre, NULL }, /* SM */
want_fillmode = MAN_fi;
/* FALLTHROUGH */
case MAN_PP: /* These have no head. */
- case MAN_LP: /* They will simply */
- case MAN_P: /* reopen .nf in the body. */
- case MAN_RS:
- case MAN_UR:
+ case MAN_RS: /* They will simply */
+ case MAN_UR: /* reopen .nf in the body. */
case MAN_MT:
fillmode(h, MAN_fi);
break;
return 0;
}
+
+static int
+man_abort_pre(MAN_ARGS)
+{
+ abort();
+}
-/* $OpenBSD: man_term.c,v 1.173 2018/08/26 16:18:38 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.174 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
static int pre_SY(DECL_ARGS);
static int pre_TP(DECL_ARGS);
static int pre_UR(DECL_ARGS);
+static int pre_abort(DECL_ARGS);
static int pre_alternate(DECL_ARGS);
static int pre_ign(DECL_ARGS);
static int pre_in(DECL_ARGS);
{ pre_SS, post_SS, 0 }, /* SS */
{ pre_TP, post_TP, 0 }, /* TP */
{ pre_TP, post_TP, 0 }, /* TQ */
- { pre_PP, NULL, 0 }, /* LP */
+ { pre_abort, NULL, 0 }, /* LP */
{ pre_PP, NULL, 0 }, /* PP */
- { pre_PP, NULL, 0 }, /* P */
+ { pre_abort, NULL, 0 }, /* P */
{ pre_IP, post_IP, 0 }, /* IP */
{ pre_HP, post_HP, 0 }, /* HP */
{ NULL, NULL, 0 }, /* SM */
}
+static int
+pre_abort(DECL_ARGS)
+{
+ abort();
+}
+
static int
pre_ign(DECL_ARGS)
{
-/* $OpenBSD: man_validate.c,v 1.108 2018/08/18 02:03:41 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.109 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
typedef void (*v_check)(CHKARGS);
+static void check_abort(CHKARGS);
static void check_par(CHKARGS);
static void check_part(CHKARGS);
static void check_root(CHKARGS);
NULL, /* SS */
NULL, /* TP */
NULL, /* TQ */
- check_par, /* LP */
+ check_abort,/* LP */
check_par, /* PP */
- check_par, /* P */
+ check_abort,/* P */
post_IP, /* IP */
NULL, /* HP */
NULL, /* SM */
};
+/* Validate the subtree rooted at man->last. */
void
man_node_validate(struct roff_man *man)
{
struct roff_node *n;
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.
+ */
+
man->last = man->last->child;
while (man->last != NULL) {
man_node_validate(man);
man->last = man->last->next;
}
+ /* Finally validate the macro itself. */
+
man->last = n;
man->next = ROFF_NEXT_SIBLING;
switch (n->type) {
"(OpenBSD)" : "(NetBSD)");
}
+static void
+check_abort(CHKARGS)
+{
+ abort();
+}
+
static void
check_text(CHKARGS)
{
case MAN_SH:
case MAN_SS:
case MAN_PP:
- case MAN_LP:
- case MAN_P:
mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
"%s after %s", roff_name[n->tok],
roff_name[n->parent->tok]);
-/* $OpenBSD: mdoc_html.c,v 1.190 2018/10/04 13:22:35 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.191 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
static void mdoc__x_post(MDOC_ARGS);
static int mdoc__x_pre(MDOC_ARGS);
+static int mdoc_abort_pre(MDOC_ARGS);
static int mdoc_ad_pre(MDOC_ARGS);
static int mdoc_an_pre(MDOC_ARGS);
static int mdoc_ap_pre(MDOC_ARGS);
{mdoc_nd_pre, NULL}, /* Nd */
{mdoc_nm_pre, NULL}, /* Nm */
{mdoc_quote_pre, mdoc_quote_post}, /* Op */
- {mdoc_ft_pre, NULL}, /* Ot */
+ {mdoc_abort_pre, NULL}, /* Ot */
{mdoc_pa_pre, NULL}, /* Pa */
{mdoc_ex_pre, NULL}, /* Rv */
{mdoc_st_pre, NULL}, /* St */
{mdoc_em_pre, NULL}, /* Fr */
{NULL, NULL}, /* Ud */
{mdoc_lb_pre, NULL}, /* Lb */
- {mdoc_pp_pre, NULL}, /* Lp */
+ {mdoc_abort_pre, NULL}, /* Lp */
{mdoc_lk_pre, NULL}, /* Lk */
{mdoc_mt_pre, NULL}, /* Mt */
{mdoc_quote_pre, mdoc_quote_post}, /* Brq */
case MDOC_Bl:
case MDOC_D1:
case MDOC_Dl:
- case MDOC_Lp:
case MDOC_Pp:
continue;
default:
else if ( ! tail)
h->flags &= ~HTML_NOSPACE;
}
+
+static int
+mdoc_abort_pre(MDOC_ARGS)
+{
+ abort();
+}
-/* $OpenBSD: mdoc_man.c,v 1.126 2018/08/23 19:32:03 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.127 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2011-2018 Ingo Schwarze <schwarze@openbsd.org>
*
static void post_sect(DECL_ARGS);
static void post_vt(DECL_ARGS);
static int pre__t(DECL_ARGS);
+static int pre_abort(DECL_ARGS);
static int pre_an(DECL_ARGS);
static int pre_ap(DECL_ARGS);
static int pre_aq(DECL_ARGS);
{ cond_head, pre_enc, NULL, "\\- ", NULL }, /* Nd */
{ NULL, pre_nm, post_nm, NULL, NULL }, /* Nm */
{ cond_body, pre_enc, post_enc, "[", "]" }, /* Op */
- { NULL, pre_Ft, post_font, NULL, NULL }, /* Ot */
+ { NULL, pre_abort, NULL, NULL, NULL }, /* Ot */
{ NULL, pre_em, post_font, NULL, NULL }, /* Pa */
{ NULL, pre_ex, NULL, NULL, NULL }, /* Rv */
{ NULL, NULL, NULL, NULL, NULL }, /* St */
{ NULL, pre_em, post_font, NULL, NULL }, /* Fr */
{ NULL, NULL, NULL, NULL, NULL }, /* Ud */
{ NULL, NULL, post_lb, NULL, NULL }, /* Lb */
- { NULL, pre_pp, NULL, NULL, NULL }, /* Lp */
+ { NULL, pre_abort, NULL, NULL, NULL }, /* Lp */
{ NULL, pre_lk, NULL, NULL, NULL }, /* Lk */
{ NULL, pre_em, post_font, NULL, NULL }, /* Mt */
{ cond_body, pre_enc, post_enc, "{", "}" }, /* Brq */
return n->type == ROFFT_BODY;
}
+static int
+pre_abort(DECL_ARGS)
+{
+ abort();
+}
+
static int
pre_enc(DECL_ARGS)
{
-/* $OpenBSD: mdoc_markdown.c,v 1.27 2018/10/25 01:21:30 schwarze Exp $ */
+/* $OpenBSD: mdoc_markdown.c,v 1.28 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "mandoc_aux.h"
static int md_cond_head(struct roff_node *);
static int md_cond_body(struct roff_node *);
+static int md_pre_abort(struct roff_node *);
static int md_pre_raw(struct roff_node *);
static int md_pre_word(struct roff_node *);
static int md_pre_skip(struct roff_node *);
{ md_cond_head, md_pre_Nd, NULL, NULL, NULL }, /* Nd */
{ NULL, md_pre_Nm, md_post_Nm, "**", "**" }, /* Nm */
{ md_cond_body, md_pre_word, md_post_word, "[", "]" }, /* Op */
- { NULL, md_pre_Fd, md_post_raw, "*", "*" }, /* Ot */
+ { NULL, md_pre_abort, NULL, NULL, NULL }, /* Ot */
{ NULL, md_pre_raw, md_post_raw, "*", "*" }, /* Pa */
{ NULL, NULL, NULL, NULL, NULL }, /* Rv */
{ NULL, NULL, NULL, NULL, NULL }, /* St */
{ NULL, md_pre_raw, md_post_raw, "*", "*" }, /* Fr */
{ NULL, NULL, NULL, NULL, NULL }, /* Ud */
{ NULL, NULL, md_post_Lb, NULL, NULL }, /* Lb */
- { NULL, md_pre_Pp, NULL, NULL, NULL }, /* Lp */
+ { NULL, md_pre_abort, NULL, NULL, NULL }, /* Lp */
{ NULL, md_pre_Lk, NULL, NULL, NULL }, /* Lk */
{ NULL, md_pre_Mt, NULL, NULL, NULL }, /* Mt */
{ md_cond_body, md_pre_word, md_post_word, "{", "}" }, /* Brq */
return n->type == ROFFT_BODY;
}
+static int
+md_pre_abort(struct roff_node *n)
+{
+ abort();
+}
+
static int
md_pre_raw(struct roff_node *n)
{
-/* $OpenBSD: mdoc_term.c,v 1.267 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.268 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
static int termp__a_pre(DECL_ARGS);
static int termp__t_pre(DECL_ARGS);
+static int termp_abort_pre(DECL_ARGS);
static int termp_an_pre(DECL_ARGS);
static int termp_ap_pre(DECL_ARGS);
static int termp_bd_pre(DECL_ARGS);
{ termp_nd_pre, NULL }, /* Nd */
{ termp_nm_pre, termp_nm_post }, /* Nm */
{ termp_quote_pre, termp_quote_post }, /* Op */
- { termp_ft_pre, NULL }, /* Ot */
+ { termp_abort_pre, NULL }, /* Ot */
{ termp_under_pre, NULL }, /* Pa */
{ termp_ex_pre, NULL }, /* Rv */
{ NULL, NULL }, /* St */
{ termp_under_pre, NULL }, /* Fr */
{ NULL, NULL }, /* Ud */
{ NULL, termp_lb_post }, /* Lb */
- { termp_pp_pre, NULL }, /* Lp */
+ { termp_abort_pre, NULL }, /* Lp */
{ termp_lk_pre, NULL }, /* Lk */
{ termp_under_pre, NULL }, /* Mt */
{ termp_quote_pre, termp_quote_post }, /* Brq */
case MDOC_Bl:
case MDOC_D1:
case MDOC_Dl:
- case MDOC_Lp:
case MDOC_Pp:
continue;
default:
tag_put(n->child->string, 1, p->line);
return 1;
}
+
+static int
+termp_abort_pre(DECL_ARGS)
+{
+ abort();
+}
-/* $OpenBSD: mdoc_validate.c,v 1.277 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.278 2018/12/03 21:00:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
static void rewrite_macro2len(struct roff_man *, char **);
static int similar(const char *, const char *);
+static void post_abort(POST_ARGS);
static void post_an(POST_ARGS);
static void post_an_norm(POST_ARGS);
static void post_at(POST_ARGS);
post_nd, /* Nd */
post_nm, /* Nm */
post_delim_nb, /* Op */
- post_obsolete, /* Ot */
+ post_abort, /* Ot */
post_defaults, /* Pa */
post_rv, /* Rv */
post_st, /* St */
post_obsolete, /* Fr */
post_eoln, /* Ud */
post_lb, /* Lb */
- post_par, /* Lp */
+ post_abort, /* Lp */
post_delim_nb, /* Lk */
post_defaults, /* Mt */
post_delim_nb, /* Brq */
};
+/* Validate the subtree rooted at mdoc->last. */
void
mdoc_node_validate(struct roff_man *mdoc)
{
struct roff_node *n, *np;
const v_post *p;
+ /*
+ * Translate obsolete macros to modern macros first
+ * such that later code does not need to look
+ * for the obsolete versions.
+ */
+
n = mdoc->last;
+ switch (n->tok) {
+ case MDOC_Lp:
+ n->tok = MDOC_Pp;
+ break;
+ case MDOC_Ot:
+ post_obsolete(mdoc);
+ n->tok = MDOC_Ft;
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Iterate over all children, recursing into each one
+ * in turn, depth-first.
+ */
+
mdoc->last = mdoc->last->child;
while (mdoc->last != NULL) {
mdoc_node_validate(mdoc);
mdoc->last = mdoc->last->next;
}
+ /* Finally validate the macro itself. */
+
mdoc->last = n;
mdoc->next = ROFF_NEXT_SIBLING;
switch (n->type) {
}
}
+static void
+post_abort(POST_ARGS)
+{
+ abort();
+}
+
static void
post_delim(POST_ARGS)
{
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))
+ if (n->last != NULL && n->last->tok == MDOC_Pp)
mdoc_node_relink(mdoc, n->last);
if (mdoc->meta.name == NULL)
while (nc != NULL) {
switch (nc->tok) {
case MDOC_Pp:
- case MDOC_Lp:
case ROFF_br:
break;
default:
}
if ((np = mdoc->last->child) != NULL)
- if (np->tok == MDOC_Pp || np->tok == MDOC_Lp) {
+ if (np->tok == MDOC_Pp) {
mandoc_vmsg(MANDOCERR_PAR_SKIP,
mdoc->parse, np->line, np->pos,
"%s after %s", roff_name[np->tok],
}
if ((np = mdoc->last->last) != NULL)
- if (np->tok == MDOC_Pp || np->tok == MDOC_Lp) {
+ if (np->tok == MDOC_Pp) {
mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
np->line, np->pos, "%s at the end of %s",
roff_name[np->tok],
return;
/*
- * Don't allow prior `Lp' or `Pp' prior to a paragraph-type
- * block: `Lp', `Pp', or non-compact `Bd' or `Bl'.
+ * Don't allow `Pp' prior to a paragraph-type
+ * block: `Pp' or non-compact `Bd' or `Bl'.
*/
- if (n->prev->tok != MDOC_Pp &&
- n->prev->tok != MDOC_Lp &&
- n->prev->tok != ROFF_br)
+ if (n->prev->tok != MDOC_Pp && n->prev->tok != ROFF_br)
return;
if (n->tok == MDOC_Bl && n->norm->Bl.comp)
return;
np = mdoc->last->parent;
if (np->tok != MDOC_Sh && np->tok != MDOC_Ss)
return;
- } else if (np->tok != MDOC_Pp && np->tok != MDOC_Lp &&
+ } else if (np->tok != MDOC_Pp &&
(mdoc->last->tok != ROFF_br ||
(np->tok != ROFF_sp && np->tok != ROFF_br)))
return;