=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.61 retrieving revision 1.66 diff -u -p -r1.61 -r1.66 --- mandoc/mdoc_validate.c 2010/04/03 14:02:10 1.61 +++ mandoc/mdoc_validate.c 2010/04/06 16:27:53 1.66 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.61 2010/04/03 14:02:10 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.66 2010/04/06 16:27:53 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -77,6 +77,7 @@ static int ewarn_ge1(POST_ARGS); static int herr_eq0(POST_ARGS); static int herr_ge1(POST_ARGS); static int hwarn_eq1(POST_ARGS); +static int hwarn_eq0(POST_ARGS); static int hwarn_le1(POST_ARGS); static int post_an(POST_ARGS); @@ -113,7 +114,7 @@ static int pre_ss(PRE_ARGS); static v_post posts_an[] = { post_an, NULL }; static v_post posts_at[] = { post_at, NULL }; -static v_post posts_bd[] = { herr_eq0, bwarn_ge1, NULL }; +static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NULL }; static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; @@ -133,7 +134,7 @@ static v_post posts_text1[] = { eerr_eq1, NULL }; static v_post posts_vt[] = { post_vt, NULL }; static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; static v_post posts_wtext[] = { ewarn_ge1, NULL }; -static v_post posts_xr[] = { eerr_ge1, NULL }; +static v_post posts_xr[] = { ewarn_ge1, NULL }; static v_pre pres_an[] = { pre_an, NULL }; static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; static v_pre pres_bl[] = { pre_bl, NULL }; @@ -414,6 +415,7 @@ CHECK_HEAD_DEFN(eq0, err, err_child_eq, 0) /* herr_eq0 CHECK_HEAD_DEFN(le1, warn, warn_child_lt, 2) /* hwarn_le1() */ CHECK_HEAD_DEFN(ge1, err, err_child_gt, 0) /* herr_ge1() */ CHECK_HEAD_DEFN(eq1, warn, warn_child_eq, 1) /* hwarn_eq1() */ +CHECK_HEAD_DEFN(eq0, warn, warn_child_eq, 0) /* hwarn_eq0() */ static int @@ -627,6 +629,8 @@ pre_bl(PRE_ARGS) * over. If we don't do this, mdoc_action will * become confused when it scans over multiple * types whilst setting its bitmasks. + * + * FIXME: this should occur in mdoc_action.c. */ if (type >= 0) { if ( ! mdoc_nwarn(mdoc, n, EMULTILIST)) @@ -1093,21 +1097,23 @@ post_bl_head(POST_ARGS) { int i; const struct mdoc_node *n; + const struct mdoc_argv *a; n = mdoc->last->parent; assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) - if (n->args->argv[i].arg == MDOC_Column) - break; + for (i = 0; i < (int)n->args->argc; i++) { + a = &n->args->argv[i]; + if (a->arg == MDOC_Column) { + if (a->sz && mdoc->last->nchild) + return(mdoc_nerr(mdoc, n, ECOLMIS)); + return(1); + } + } - if (i == (int)n->args->argc) + if (0 == (i = mdoc->last->nchild)) return(1); - - if (n->args->argv[i].sz && mdoc->last->child) - return(mdoc_nerr(mdoc, n, ECOLMIS)); - - return(1); + return(warn_count(mdoc, "==", 0, "line arguments", i)); }