diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-07-04 16:11:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-07-04 16:11:43 +0000 |
commit | 2c6982d062b7ce1ae253db8021bc097ca2d00311 (patch) | |
tree | 2919649c07a9aa9c36789b93bd731e844e44b77a | |
parent | 9144ba6ca272f3983a9b8843ee75d03b753e020b (diff) |
Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.
Also fix the handling of excess .It head arguments in -Tman.
30 files changed, 213 insertions, 68 deletions
diff --git a/regress/usr.bin/mandoc/man/PP/Makefile b/regress/usr.bin/mandoc/man/PP/Makefile index 33e1961ce66..7655d294203 100644 --- a/regress/usr.bin/mandoc/man/PP/Makefile +++ b/regress/usr.bin/mandoc/man/PP/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 2014/07/02 05:51:49 schwarze Exp $ +# $OpenBSD: Makefile,v 1.4 2014/07/04 16:11:41 schwarze Exp $ -REGRESS_TARGETS = empty -LINT_TARGETS = empty +REGRESS_TARGETS = args empty +LINT_TARGETS = args empty .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/man/PP/args.in b/regress/usr.bin/mandoc/man/PP/args.in new file mode 100644 index 00000000000..e608d9b94b4 --- /dev/null +++ b/regress/usr.bin/mandoc/man/PP/args.in @@ -0,0 +1,11 @@ +.TH PP-ARG 1 "July 4, 2014" OpenBSD +.SH NAME +PP-arg \- paragraphs macros with arguments +.SH DESCRIPTION +PP with argument: +.PP arg +LP with arguments: +.LP arg1 arg2 +P with argument: +.P arg +final text diff --git a/regress/usr.bin/mandoc/man/PP/args.out_ascii b/regress/usr.bin/mandoc/man/PP/args.out_ascii new file mode 100644 index 00000000000..256a9e02009 --- /dev/null +++ b/regress/usr.bin/mandoc/man/PP/args.out_ascii @@ -0,0 +1,19 @@ +PP-ARG(1) OpenBSD Reference Manual PP-ARG(1) + + + +NNAAMMEE + PP-arg - paragraphs macros with arguments + +DDEESSCCRRIIPPTTIIOONN + PP with argument: + + LP with arguments: + + P with argument: + + final text + + + +OpenBSD July 4, 2014 PP-ARG(1) diff --git a/regress/usr.bin/mandoc/man/PP/args.out_lint b/regress/usr.bin/mandoc/man/PP/args.out_lint new file mode 100644 index 00000000000..f2862245245 --- /dev/null +++ b/regress/usr.bin/mandoc/man/PP/args.out_lint @@ -0,0 +1,3 @@ +mandoc: args.in:6:2: ERROR: skipping all arguments: PP arg +mandoc: args.in:8:2: ERROR: skipping all arguments: LP arg1 ... +mandoc: args.in:10:2: ERROR: skipping all arguments: P arg diff --git a/regress/usr.bin/mandoc/mdoc/Bd/notype.in b/regress/usr.bin/mandoc/mdoc/Bd/notype.in index 3b40023b74b..f59cb6be4d1 100644 --- a/regress/usr.bin/mandoc/mdoc/Bd/notype.in +++ b/regress/usr.bin/mandoc/mdoc/Bd/notype.in @@ -9,5 +9,5 @@ initial text .Bd -offset 0n displayed text -.Ed +.Ed some arguments final text diff --git a/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint index dd66ae959bd..4735ba3bd04 100644 --- a/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bd/notype.out_lint @@ -1 +1,2 @@ mandoc: notype.in:9:2: WARNING: missing display type, using -ragged +mandoc: notype.in:12:2: ERROR: skipping all arguments: Ed some arguments diff --git a/regress/usr.bin/mandoc/mdoc/Bf/Makefile b/regress/usr.bin/mandoc/mdoc/Bf/Makefile index f7f1b73b834..799c8af91bd 100644 --- a/regress/usr.bin/mandoc/mdoc/Bf/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bf/Makefile @@ -1,13 +1,15 @@ -# $OpenBSD: Makefile,v 1.3 2014/07/02 11:42:56 schwarze Exp $ +# $OpenBSD: Makefile,v 1.4 2014/07/04 16:11:42 schwarze Exp $ -REGRESS_TARGETS = nest break broken -LINT_TARGETS = break broken +REGRESS_TARGETS = nest multiargs badargs break broken +LINT_TARGETS = multiargs badargs break broken -# groff-1.20.1 defect: +# groff-1.22.2 defects: +# - If the first argument to .Bf is a bad one, +# no block is opened at all and the .Ef causes another error. # - If a font block breaks another block, # fonts get mixed up when the other block finally ends. -SKIP_GROFF = break +SKIP_GROFF = badargs break SKIP_TMAN = break broken diff --git a/regress/usr.bin/mandoc/mdoc/Bf/badargs.in b/regress/usr.bin/mandoc/mdoc/Bf/badargs.in new file mode 100644 index 00000000000..7752ae75596 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/badargs.in @@ -0,0 +1,20 @@ +.Dd July 4, 2014 +.Dt BF-BADARGS 1 +.Os OpenBSD +.Sh NAME +.Nm Bf-badargs +.Nd font blocks with bad arguments +.Sh DESCRIPTION +normal text +.Bf -emphasis +emphasis +.Bf +no argument +.Ef +back to emphasis +.Bf badarg +bad argument +.Ef tail argument +back to emphasis +.Ef +back to normal diff --git a/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_ascii b/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_ascii new file mode 100644 index 00000000000..7010d30d2dd --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_ascii @@ -0,0 +1,10 @@ +BF-BADARGS(1) OpenBSD Reference Manual BF-BADARGS(1) + +NNAAMMEE + BBff--bbaaddaarrggss - font blocks with bad arguments + +DDEESSCCRRIIPPTTIIOONN + normal text _e_m_p_h_a_s_i_s no argument _b_a_c_k _t_o _e_m_p_h_a_s_i_s bad argument _b_a_c_k _t_o + _e_m_p_h_a_s_i_s back to normal + +OpenBSD July 4, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_lint b/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_lint new file mode 100644 index 00000000000..74c5b7ae8af --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/badargs.out_lint @@ -0,0 +1,3 @@ +mandoc: badargs.in:11:2: WARNING: missing font type, using \fR +mandoc: badargs.in:15:5: WARNING: unknown font type, using \fR: Bf badarg +mandoc: badargs.in:17:2: ERROR: skipping all arguments: Ef tail argument diff --git a/regress/usr.bin/mandoc/mdoc/Bf/multiargs.in b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.in new file mode 100644 index 00000000000..31837ec555d --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.in @@ -0,0 +1,32 @@ +.Dd July 4, 2014 +.Dt BF-MULTIARGS 1 +.Os OpenBSD +.Sh NAME +.Nm Bf-multiargs +.Nd font blocks with multiple arguments +.Sh DESCRIPTION +normal text +.Bf -symbolic -emphasis +symbolic emphasis +.Ef +back to normal +.Bf -symbolic Em +symbolic Em +.Ef +back to normal +.Bf -symbolic badarg +symbolic badarg +.Ef +back to normal +.Bf Sy -emphasis +Sy -emphasis +.Ef +back to normal +.Bf Sy Em +Sy Em +.Ef +back to normal +.Bf Sy badarg +Sy Em +.Ef +back to normal diff --git a/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_ascii b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_ascii new file mode 100644 index 00000000000..653bf46c21b --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_ascii @@ -0,0 +1,11 @@ +BF-MULTIARGS(1) OpenBSD Reference Manual BF-MULTIARGS(1) + +NNAAMMEE + BBff--mmuullttiiaarrggss - font blocks with multiple arguments + +DDEESSCCRRIIPPTTIIOONN + normal text ssyymmbboolliicc eemmpphhaassiiss back to normal ssyymmbboolliicc EEmm back to normal + ssyymmbboolliicc bbaaddaarrgg back to normal SSyy --eemmpphhaassiiss back to normal SSyy EEmm back to + normal SSyy EEmm back to normal + +OpenBSD July 4, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_lint b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_lint new file mode 100644 index 00000000000..031b1e01312 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bf/multiargs.out_lint @@ -0,0 +1,5 @@ +mandoc: multiargs.in:13:15: ERROR: skipping excess arguments: Bf ... Em +mandoc: multiargs.in:17:15: ERROR: skipping excess arguments: Bf ... badarg +mandoc: multiargs.in:21:8: ERROR: skipping excess arguments: Bf ... -emphasis +mandoc: multiargs.in:25:8: ERROR: skipping excess arguments: Bf ... Em +mandoc: multiargs.in:29:8: ERROR: skipping excess arguments: Bf ... badarg diff --git a/regress/usr.bin/mandoc/mdoc/Bk/Makefile b/regress/usr.bin/mandoc/mdoc/Bk/Makefile index ac178847d18..a13f69639a2 100644 --- a/regress/usr.bin/mandoc/mdoc/Bk/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bk/Makefile @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile,v 1.5 2013/12/24 16:01:15 schwarze Exp $ +# $OpenBSD: Makefile,v 1.6 2014/07/04 16:11:42 schwarze Exp $ REGRESS_TARGETS = break inputlines synopsis badarg lines +LINT_TARGETS = badarg SKIP_TMAN ?= badarg diff --git a/regress/usr.bin/mandoc/mdoc/Bk/badarg.in b/regress/usr.bin/mandoc/mdoc/Bk/badarg.in index 567d4dda871..1f331e56519 100644 --- a/regress/usr.bin/mandoc/mdoc/Bk/badarg.in +++ b/regress/usr.bin/mandoc/mdoc/Bk/badarg.in @@ -21,7 +21,7 @@ .Ar x x x x x x .Bk -lines .Op o Ar a -.Ek +.Ek tail argument .Pp .Nm .Ar x x x x x x x x diff --git a/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_lint b/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_lint new file mode 100644 index 00000000000..3ced9f1087d --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_lint @@ -0,0 +1,6 @@ +mandoc: badarg.in:13:2: WARNING: argument count wrong: want 0 children (have 1) +mandoc: badarg.in:22:2: WARNING: argument count wrong: want 0 children (have 1) +mandoc: badarg.in:24:2: ERROR: skipping all arguments: Ek tail argument +mandoc: badarg.in:31:2: WARNING: argument count wrong: want 0 children (have 1) +mandoc: badarg.in:49:2: WARNING: argument count wrong: want 0 children (have 1) +mandoc: badarg.in:54:2: WARNING: argument count wrong: want more than 0 children (have 0) diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in index 738fdceb06d..94e19840c53 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.in @@ -7,7 +7,7 @@ .Sh DESCRIPTION bullet list: .Bl -bullet -.It +.It head argument one .It .It @@ -17,7 +17,7 @@ dash list: .Bl -dash .It one -.It +.It head argument .It three .El @@ -26,12 +26,12 @@ enum list: .It one .It -.It +.It head argument three .El hyphen list: .Bl -hyphen -.It +.It head argument one .It .It diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint index 23539409184..737fc273f96 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyitem.out_lint @@ -1,4 +1,8 @@ +mandoc: emptyitem.in:10:2: ERROR: skipping all arguments: It head argument mandoc: emptyitem.in:12:2: WARNING: empty list item: bullet mandoc: emptyitem.in:20:2: WARNING: empty list item: dash +mandoc: emptyitem.in:20:2: ERROR: skipping all arguments: It head argument mandoc: emptyitem.in:28:2: WARNING: empty list item: enum +mandoc: emptyitem.in:29:2: ERROR: skipping all arguments: It head argument +mandoc: emptyitem.in:34:2: ERROR: skipping all arguments: It head argument mandoc: emptyitem.in:36:2: WARNING: empty list item: hyphen diff --git a/regress/usr.bin/mandoc/mdoc/Bl/notype.in b/regress/usr.bin/mandoc/mdoc/Bl/notype.in index bc66a5cd5da..d28a5b0d82f 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/notype.in +++ b/regress/usr.bin/mandoc/mdoc/Bl/notype.in @@ -9,7 +9,7 @@ initial text .Bl -offset indent -bullet .It Some text. -.El +.El tail argument middle text .Bl -offset indent .It diff --git a/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint index 0ab6bb372a5..649ef14f21d 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/notype.out_lint @@ -1,3 +1,4 @@ mandoc: notype.in:9:2: WARNING: list type is not the first argument: offset +mandoc: notype.in:12:2: ERROR: skipping all arguments: El tail argument mandoc: notype.in:14:2: WARNING: list type is not the first argument: offset mandoc: notype.in:14:2: ERROR: missing list type, using -item diff --git a/regress/usr.bin/mandoc/roff/de/escname.in b/regress/usr.bin/mandoc/roff/de/escname.in index a75a2679551..da6d885fe71 100644 --- a/regress/usr.bin/mandoc/roff/de/escname.in +++ b/regress/usr.bin/mandoc/roff/de/escname.in @@ -34,9 +34,9 @@ Remove all but second: .first\\second .Pp macro seperated from argument by an escape sequence: -.de witharg +.de witharg end4 excess arguments .Dq \\$1 -.. +.end4 tail argument .witharg\(enargument .Pp .de\e diff --git a/regress/usr.bin/mandoc/roff/de/escname.out_lint b/regress/usr.bin/mandoc/roff/de/escname.out_lint index 2eecd35d7e0..fa41ec2e606 100644 --- a/regress/usr.bin/mandoc/roff/de/escname.out_lint +++ b/regress/usr.bin/mandoc/roff/de/escname.out_lint @@ -2,6 +2,7 @@ mandoc: escname.in:21:1: ERROR: escaped character not allowed in a name mandoc: escname.in:31:19: ERROR: escaped character not allowed in a name mandoc: escname.in:32:2: ERROR: skipping unknown macro: .first mandoc: escname.in:34:2: ERROR: skipping unknown macro: .first\\second +mandoc: escname.in:37:5: ERROR: skipping excess arguments: .de ... excess arguments mandoc: escname.in:40:1: ERROR: escaped character not allowed in a name mandoc: escname.in:42:1: ERROR: escaped character not allowed in a name mandoc: escname.in:42:1: WARNING: skipping empty request: de diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c index bd38431d1b1..4226671384f 100644 --- a/usr.bin/mandoc/eqn.c +++ b/usr.bin/mandoc/eqn.c @@ -1,4 +1,4 @@ -/* $Id: eqn.c,v 1.9 2014/04/23 21:06:33 schwarze Exp $ */ +/* $Id: eqn.c,v 1.10 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -296,7 +296,8 @@ eqn_read(struct eqn_node **epp, int ln, p++; if ('\0' == *p) return(er); - mandoc_msg(MANDOCERR_ARGSLOST, ep->parse, ln, pos, NULL); + mandoc_vmsg(MANDOCERR_ARG_SKIP, ep->parse, + ln, pos, "EN %s", p); return(er); } diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index d1c69a4dabb..e42f9acb79e 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.68 2014/07/02 11:42:56 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.69 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -359,7 +359,11 @@ check_par(CHKARGS) break; case MAN_HEAD: if (n->nchild) - man_nmsg(man, n, MANDOCERR_ARGSLOST); + mandoc_vmsg(MANDOCERR_ARG_SKIP, + man->parse, n->line, n->pos, + "%s %s%s", man_macronames[n->tok], + n->child->string, + n->nchild > 1 ? " ..." : ""); break; default: break; diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 1cab21d4555..63e84a82d02 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.77 2014/07/04 01:50:03 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.78 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -93,7 +93,8 @@ enum mandocerr { MANDOCERR_BL_WIDTH, /* missing -width in -tag list, using 8n */ MANDOCERR_IT_NOHEAD, /* empty head in list item: type */ MANDOCERR_IT_NOBODY, /* empty list item: type */ - MANDOCERR_FONTTYPE, /* missing font type */ + MANDOCERR_BF_NOFONT, /* missing font type, using \fR */ + MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */ MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */ /* related to bad macro arguments */ @@ -150,7 +151,8 @@ enum mandocerr { MANDOCERR_UNAME, /* uname(3) system call failed */ MANDOCERR_NUMERIC, /* request requires a numeric argument */ MANDOCERR_BL_NOTYPE, /* missing list type, using -item */ - MANDOCERR_ARGSLOST, /* line argument(s) will be lost */ + MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */ + MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */ MANDOCERR_FATAL, /* ===== start of fatal errors ===== */ @@ -158,7 +160,6 @@ enum mandocerr { MANDOCERR_NOTMANUAL, /* not a manual */ MANDOCERR_COLUMNS, /* column syntax is inconsistent */ MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */ - MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */ MANDOCERR_SYNTCHILD, /* child violates parent syntax */ MANDOCERR_SYNTARGCOUNT, /* argument count wrong, violates syntax */ MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */ diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 97ed9daab10..1bf68f70b3b 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.92 2014/07/02 20:18:42 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.93 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -765,11 +765,12 @@ blk_exp_close(MACRO_PROT_ARGS) later = n; } - if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) { - /* FIXME: do this in validate */ - if (buf[*pos]) - mdoc_pmsg(mdoc, line, ppos, MANDOCERR_ARGSLOST); - + if ( ! (MDOC_PARSED & mdoc_macros[tok].flags)) { + if ('\0' != buf[*pos]) + mandoc_vmsg(MANDOCERR_ARG_SKIP, + mdoc->parse, line, ppos, + "%s %s", mdoc_macronames[tok], + buf + *pos); if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) return(0); return(rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)); diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index bd6d38b23ac..b8041d58836 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.64 2014/07/02 19:54:39 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.65 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> * @@ -1304,17 +1304,20 @@ pre_it(DECL_ARGS) else print_word("-"); font_pop(); - break; + outflags |= MMAN_nl; + return(0); case LIST_enum: print_width(bln->norm->Bl.width, NULL, 0); TPremain = 0; outflags |= MMAN_nl; print_count(&bln->norm->Bl.count); - break; + outflags |= MMAN_nl; + return(0); case LIST_hang: print_width(bln->norm->Bl.width, n->child, 6); TPremain = 0; - break; + outflags |= MMAN_nl; + return(1); case LIST_tag: print_width(bln->norm->Bl.width, n->child, 0); putchar('\n'); @@ -1323,7 +1326,6 @@ pre_it(DECL_ARGS) default: return(1); } - outflags |= MMAN_nl; default: break; } diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index a0b92f12b66..a1ff663a527 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.143 2014/07/04 01:50:03 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.144 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -80,7 +80,6 @@ static int ewarn_le1(POST_ARGS); static int hwarn_eq0(POST_ARGS); static int hwarn_eq1(POST_ARGS); static int hwarn_ge1(POST_ARGS); -static int hwarn_le1(POST_ARGS); static int post_an(POST_ARGS); static int post_at(POST_ARGS); @@ -133,7 +132,7 @@ static int pre_std(PRE_ARGS); static v_post posts_an[] = { post_an, NULL }; static v_post posts_at[] = { post_at, post_defaults, NULL }; static v_post posts_bd[] = { post_literal, hwarn_eq0, bwarn_ge1, NULL }; -static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; +static v_post posts_bf[] = { post_bf, NULL }; static v_post posts_bk[] = { hwarn_eq0, bwarn_ge1, NULL }; static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; static v_post posts_bx[] = { post_bx, NULL }; @@ -511,12 +510,6 @@ hwarn_ge1(POST_ARGS) return(check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_GT, 0)); } -static int -hwarn_le1(POST_ARGS) -{ - return(check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_LT, 2)); -} - static void check_args(struct mdoc *mdoc, struct mdoc_node *n) { @@ -994,7 +987,7 @@ pre_dd(PRE_ARGS) static int post_bf(POST_ARGS) { - struct mdoc_node *np; + struct mdoc_node *np, *nch; enum mdocargt arg; /* @@ -1021,18 +1014,19 @@ post_bf(POST_ARGS) assert(MDOC_BLOCK == np->parent->type); assert(MDOC_Bf == np->parent->tok); - /* - * Cannot have both argument and parameter. - * If neither is specified, let it through with a warning. - */ + /* Check the number of arguments. */ - if (np->parent->args && np->child) { - mdoc_nmsg(mdoc, np, MANDOCERR_SYNTARGVCOUNT); - return(0); - } else if (NULL == np->parent->args && NULL == np->child) { - mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE); - return(1); + nch = np->child; + if (NULL == np->parent->args) { + if (NULL == nch) { + mdoc_nmsg(mdoc, np, MANDOCERR_BF_NOFONT); + return(1); + } + nch = nch->next; } + if (NULL != nch) + mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, + nch->line, nch->pos, "Bf ... %s", nch->string); /* Extract argument into data. */ @@ -1058,7 +1052,9 @@ post_bf(POST_ARGS) else if (0 == strcmp(np->child->string, "Sy")) np->norm->Bf.font = FONT_Sy; else - mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE); + mandoc_vmsg(MANDOCERR_BF_BADFONT, mdoc->parse, + np->child->line, np->child->pos, + "Bf %s", np->child->string); return(1); } @@ -1091,9 +1087,14 @@ post_lb(POST_ARGS) static int post_eoln(POST_ARGS) { + const struct mdoc_node *n; - if (mdoc->last->child) - mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST); + n = mdoc->last; + if (n->child) + mandoc_vmsg(MANDOCERR_ARG_SKIP, + mdoc->parse, n->line, n->pos, + "%s %s", mdoc_macronames[n->tok], + n->child->string); return(1); } @@ -1307,7 +1308,9 @@ post_it(POST_ARGS) /* FALLTHROUGH */ case LIST_item: if (NULL != nit->head->child) - mdoc_nmsg(mdoc, nit, MANDOCERR_ARGSLOST); + mandoc_vmsg(MANDOCERR_ARG_SKIP, + mdoc->parse, nit->line, nit->pos, + "It %s", nit->head->child->string); break; case LIST_column: cols = (int)nbl->norm->Bl.ncols; diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 88f025b4eca..920cf2f6065 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.38 2014/07/04 01:50:03 schwarze Exp $ */ +/* $Id: read.c,v 1.39 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -129,7 +129,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "missing -width in -tag list, using 8n", "empty head in list item", "empty list item", - "missing font type", + "missing font type, using \\fR", + "unknown font type, using \\fR", "missing -std argument, adding it", /* related to bad macro arguments */ @@ -186,7 +187,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "uname(3) system call failed", "request requires a numeric argument", "missing list type, using -item", - "line argument(s) will be lost", + "skipping all arguments", + "skipping excess arguments", "generic fatal error", @@ -194,7 +196,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "not a manual", "column syntax is inconsistent", "NOT IMPLEMENTED: .Bd -file", - "argument count wrong, violates syntax", "child violates parent syntax", "argument count wrong, violates syntax", "NOT IMPLEMENTED: .so with absolute path or \"..\"", diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index e7ac91ec990..4514d50b4e1 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.89 2014/07/03 21:23:08 schwarze Exp $ */ +/* $Id: roff.c,v 1.90 2014/07/04 16:11:41 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -852,7 +852,8 @@ roff_cblock(ROFF_ARGS) } if ((*bufp)[pos]) - mandoc_msg(MANDOCERR_ARGSLOST, r->parse, ln, pos, NULL); + mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, + ".. %s", *bufp + pos); roffnode_pop(r); roffnode_cleanscope(r); @@ -956,7 +957,8 @@ roff_block(ROFF_ARGS) r->last->end = mandoc_strndup(name, namesz); if ('\0' != *cp) - mandoc_msg(MANDOCERR_ARGSLOST, r->parse, ln, pos, NULL); + mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, + ln, pos, ".%s ... %s", roffs[tok].name, cp); return(ROFF_IGN); } |