From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s62BhLs8027395 for ; Wed, 2 Jul 2014 07:43:21 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s62BhKAY005390; Wed, 2 Jul 2014 07:43:20 -0400 (EDT) Date: Wed, 2 Jul 2014 07:43:20 -0400 (EDT) Message-Id: <201407021143.s62BhKAY005390@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Clean up warnings related to macros and nesting. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Clean up warnings related to macros and nesting. * Hierarchical naming of enum mandocerr items. * Improve the wording to make it comprehensible. * Mention the offending macro. * Garbage collect one chunk of ancient, long unreachable code. Modified Files: -------------- mdocml: man_validate.c mandoc.h mdoc_macro.c mdoc_validate.c read.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v retrieving revision 1.219 retrieving revision 1.220 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.219 -r1.220 --- mdoc_validate.c +++ mdoc_validate.c @@ -591,7 +591,9 @@ pre_display(PRE_ARGS) break; if (node) - mdoc_nmsg(mdoc, n, MANDOCERR_NESTEDDISP); + mandoc_vmsg(MANDOCERR_BD_NEST, + mdoc->parse, n->line, n->pos, + "%s in Bd", mdoc_macronames[n->tok]); return(1); } @@ -1903,7 +1905,7 @@ post_ns(POST_ARGS) { if (MDOC_LINE & mdoc->last->flags) - mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNNS); + mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NS_SKIP); return(1); } Index: mdoc_macro.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_macro.c,v retrieving revision 1.133 retrieving revision 1.134 diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.133 -r1.134 --- mdoc_macro.c +++ mdoc_macro.c @@ -528,7 +528,7 @@ make_pending(struct mdoc_node *broken, e taker->pending = broken->pending; } broken->pending = breaker; - mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos, + mandoc_vmsg(MANDOCERR_BLOCK_NEST, mdoc->parse, line, ppos, "%s breaks %s", mdoc_macronames[tok], mdoc_macronames[broken->tok]); return(1); @@ -1354,18 +1354,9 @@ blk_part_imp(MACRO_PROT_ARGS) return(1); } } + assert(n == body); - /* - * If we can't rewind to our body, then our scope has already - * been closed by another macro (like `Oc' closing `Op'). This - * is ugly behaviour nodding its head to OpenBSD's overwhelming - * crufty use of `Op' breakage. - */ - if (n != body) - mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, - ppos, "%s broken", mdoc_macronames[tok]); - - if (n && ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) + if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) return(0); /* Standard appending of delimiters. */ @@ -1375,7 +1366,7 @@ blk_part_imp(MACRO_PROT_ARGS) /* Rewind scope, if applicable. */ - if (n && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) + if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) return(0); /* Move trailing .Ns out of scope. */ Index: mandoc.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v retrieving revision 1.127 retrieving revision 1.128 diff -Lmandoc.h -Lmandoc.h -u -p -r1.127 -r1.128 --- mandoc.h +++ mandoc.h @@ -74,12 +74,13 @@ enum mandocerr { MANDOCERR_MACRO_OBS, /* obsolete macro: macro */ MANDOCERR_PAR_SKIP, /* skipping paragraph macro: macro ... */ MANDOCERR_PAR_MOVE, /* moving paragraph macro out of list: macro */ - MANDOCERR_IGNNS, /* skipping no-space macro */ - MANDOCERR_SCOPENEST, /* blocks badly nested */ + MANDOCERR_NS_SKIP, /* skipping no-space macro */ + MANDOCERR_BLOCK_NEST, /* blocks badly nested: macro ... */ MANDOCERR_CHILD, /* child violates parent syntax */ - MANDOCERR_NESTEDDISP, /* nested displays are not portable */ - MANDOCERR_SCOPEREP, /* already in literal mode */ - MANDOCERR_LINESCOPE, /* line scope broken */ + MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */ + MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping .fi */ + MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping .nf */ + MANDOCERR_LINESCOPE, /* line scope broken: macro breaks macro */ /* related to missing macro arguments */ MANDOCERR_MACROEMPTY, /* skipping empty macro */ @@ -88,7 +89,6 @@ enum mandocerr { MANDOCERR_LISTFIRST, /* list type must come first */ MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */ MANDOCERR_FONTTYPE, /* missing font type */ - MANDOCERR_WNOSCOPE, /* skipping end of block that is not open */ /* related to bad macro arguments */ MANDOCERR_IGNARGV, /* skipping argument */ Index: read.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v retrieving revision 1.55 retrieving revision 1.56 diff -Lread.c -Lread.c -u -p -r1.55 -r1.56 --- read.c +++ read.c @@ -122,7 +122,8 @@ static const char * const mandocerrs[MAN "blocks badly nested", "child violates parent syntax", "nested displays are not portable", - "already in literal mode", + "fill mode already enabled, skipping .fi", + "fill mode already disabled, skipping .nf", "line scope broken", /* related to missing macro arguments */ @@ -132,7 +133,6 @@ static const char * const mandocerrs[MAN "list type must come first", "tag lists require a width argument", "missing font type", - "skipping end of block that is not open", /* related to bad macro arguments */ "skipping argument", Index: man_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v retrieving revision 1.95 retrieving revision 1.96 diff -Lman_validate.c -Lman_validate.c -u -p -r1.95 -r1.96 --- man_validate.c +++ man_validate.c @@ -479,7 +479,7 @@ post_nf(CHKARGS) { if (MAN_LITERAL & man->flags) - man_nmsg(man, n, MANDOCERR_SCOPEREP); + man_nmsg(man, n, MANDOCERR_NF_SKIP); man->flags |= MAN_LITERAL; return(1); @@ -490,7 +490,7 @@ post_fi(CHKARGS) { if ( ! (MAN_LITERAL & man->flags)) - man_nmsg(man, n, MANDOCERR_WNOSCOPE); + man_nmsg(man, n, MANDOCERR_FI_SKIP); man->flags &= ~MAN_LITERAL; return(1); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv