From aa4e49cc9d3fe36d11324e21efaae818c9b961be Mon Sep 17 00:00:00 2001 From: schwarze Date: Thu, 6 Jul 2017 22:58:44 +0000 Subject: [PATCH] Now that we have the -Wstyle message level, downgrade six warnings that are not syntax mistakes and that do not cause wrong formatting or content to style suggestions. Also upgrade two warnings that may cause information loss to errors. --- .../mandoc/char/space/trailing-mdoc.out_lint | 6 +- regress/usr.bin/mandoc/man/SH/noarg.out_lint | 2 +- regress/usr.bin/mandoc/man/SS/noarg.out_lint | 2 +- regress/usr.bin/mandoc/man/TH/case.out_lint | 2 +- regress/usr.bin/mandoc/man/nf/dupe.out_lint | 4 +- regress/usr.bin/mandoc/mdoc/Bd/blank.out_lint | 14 +-- regress/usr.bin/mandoc/mdoc/Dd/dupe.out_lint | 4 +- regress/usr.bin/mandoc/mdoc/Dt/case.out_lint | 2 +- regress/usr.bin/mandoc/mdoc/Dt/dupe.out_lint | 4 +- regress/usr.bin/mandoc/mdoc/Dt/late.out_lint | 2 +- regress/usr.bin/mandoc/mdoc/Os/dupe.out_lint | 4 +- .../mandoc/mdoc/blank/comment.out_lint | 2 +- regress/usr.bin/mandoc/roff/args/man.out_lint | 16 +-- .../usr.bin/mandoc/roff/args/mdoc.out_lint | 24 ++-- .../usr.bin/mandoc/roff/args/roff.out_lint | 32 ++--- .../usr.bin/mandoc/roff/nr/escname.out_lint | 2 +- .../usr.bin/mandoc/roff/string/name.out_lint | 14 +-- usr.bin/mandoc/mandoc.1 | 116 +++++++++--------- usr.bin/mandoc/mandoc.h | 18 +-- usr.bin/mandoc/read.c | 18 +-- 20 files changed, 144 insertions(+), 144 deletions(-) diff --git a/regress/usr.bin/mandoc/char/space/trailing-mdoc.out_lint b/regress/usr.bin/mandoc/char/space/trailing-mdoc.out_lint index 701f864aee7..68e501a1964 100644 --- a/regress/usr.bin/mandoc/char/space/trailing-mdoc.out_lint +++ b/regress/usr.bin/mandoc/char/space/trailing-mdoc.out_lint @@ -1,3 +1,3 @@ -mandoc: trailing-mdoc.in:9:16: WARNING: whitespace at end of input line -mandoc: trailing-mdoc.in:11:12: WARNING: whitespace at end of input line -mandoc: trailing-mdoc.in:12:27: WARNING: whitespace at end of input line +mandoc: trailing-mdoc.in:9:16: STYLE: whitespace at end of input line +mandoc: trailing-mdoc.in:11:12: STYLE: whitespace at end of input line +mandoc: trailing-mdoc.in:12:27: STYLE: whitespace at end of input line diff --git a/regress/usr.bin/mandoc/man/SH/noarg.out_lint b/regress/usr.bin/mandoc/man/SH/noarg.out_lint index 12a013c654b..db76fa1c823 100644 --- a/regress/usr.bin/mandoc/man/SH/noarg.out_lint +++ b/regress/usr.bin/mandoc/man/SH/noarg.out_lint @@ -10,5 +10,5 @@ mandoc: noarg.in:30:2: ERROR: skipping end of block that is not open: RE mandoc: noarg.in:32:2: WARNING: line scope broken: UR breaks SH mandoc: noarg.in:35:2: WARNING: line scope broken: UE breaks SH mandoc: noarg.in:36:2: ERROR: skipping end of block that is not open: UE -mandoc: noarg.in:42:2: WARNING: fill mode already enabled, skipping: fi +mandoc: noarg.in:42:2: STYLE: fill mode already enabled, skipping: fi mandoc: noarg.in:45:1: WARNING: skipping blank line in line scope diff --git a/regress/usr.bin/mandoc/man/SS/noarg.out_lint b/regress/usr.bin/mandoc/man/SS/noarg.out_lint index ea550861d55..e051dcae18a 100644 --- a/regress/usr.bin/mandoc/man/SS/noarg.out_lint +++ b/regress/usr.bin/mandoc/man/SS/noarg.out_lint @@ -10,5 +10,5 @@ mandoc: noarg.in:30:2: ERROR: skipping end of block that is not open: RE mandoc: noarg.in:32:2: WARNING: line scope broken: UR breaks SS mandoc: noarg.in:35:2: WARNING: line scope broken: UE breaks SS mandoc: noarg.in:36:2: ERROR: skipping end of block that is not open: UE -mandoc: noarg.in:42:2: WARNING: fill mode already enabled, skipping: fi +mandoc: noarg.in:42:2: STYLE: fill mode already enabled, skipping: fi mandoc: noarg.in:45:1: WARNING: skipping blank line in line scope diff --git a/regress/usr.bin/mandoc/man/TH/case.out_lint b/regress/usr.bin/mandoc/man/TH/case.out_lint index c6e8a65e05e..b62a714c0ba 100644 --- a/regress/usr.bin/mandoc/man/TH/case.out_lint +++ b/regress/usr.bin/mandoc/man/TH/case.out_lint @@ -1 +1 @@ -mandoc: case.in:2:8: WARNING: lower case character in document title: TH TH-case +mandoc: case.in:2:8: STYLE: lower case character in document title: TH TH-case diff --git a/regress/usr.bin/mandoc/man/nf/dupe.out_lint b/regress/usr.bin/mandoc/man/nf/dupe.out_lint index 1f4cb24128a..cbb1070a2ae 100644 --- a/regress/usr.bin/mandoc/man/nf/dupe.out_lint +++ b/regress/usr.bin/mandoc/man/nf/dupe.out_lint @@ -1,2 +1,2 @@ -mandoc: dupe.in:8:2: WARNING: fill mode already enabled, skipping: fi -mandoc: dupe.in:15:2: WARNING: fill mode already disabled, skipping: nf +mandoc: dupe.in:8:2: STYLE: fill mode already enabled, skipping: fi +mandoc: dupe.in:15:2: STYLE: fill mode already disabled, skipping: nf diff --git a/regress/usr.bin/mandoc/mdoc/Bd/blank.out_lint b/regress/usr.bin/mandoc/mdoc/Bd/blank.out_lint index f5702bdca91..b261432ca3e 100644 --- a/regress/usr.bin/mandoc/mdoc/Bd/blank.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bd/blank.out_lint @@ -1,8 +1,8 @@ -mandoc: blank.in:13:1: WARNING: whitespace at end of input line -mandoc: blank.in:15:1: WARNING: whitespace at end of input line -mandoc: blank.in:17:1: WARNING: whitespace at end of input line -mandoc: blank.in:22:36: WARNING: whitespace at end of input line -mandoc: blank.in:23:37: WARNING: whitespace at end of input line -mandoc: blank.in:24:32: WARNING: whitespace at end of input line -mandoc: blank.in:31:8: WARNING: whitespace at end of input line +mandoc: blank.in:13:1: STYLE: whitespace at end of input line +mandoc: blank.in:15:1: STYLE: whitespace at end of input line +mandoc: blank.in:17:1: STYLE: whitespace at end of input line +mandoc: blank.in:22:36: STYLE: whitespace at end of input line +mandoc: blank.in:23:37: STYLE: whitespace at end of input line +mandoc: blank.in:24:32: STYLE: whitespace at end of input line +mandoc: blank.in:31:8: STYLE: whitespace at end of input line mandoc: blank.in:31:2: WARNING: empty block: Dl diff --git a/regress/usr.bin/mandoc/mdoc/Dd/dupe.out_lint b/regress/usr.bin/mandoc/mdoc/Dd/dupe.out_lint index faa1f8354be..72ccde415ea 100644 --- a/regress/usr.bin/mandoc/mdoc/Dd/dupe.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Dd/dupe.out_lint @@ -1,3 +1,3 @@ mandoc: dupe.in:2:5: STYLE: Mdocdate missing: Dd August (OpenBSD) -mandoc: dupe.in:5:2: WARNING: duplicate prologue macro: Dd -mandoc: dupe.in:11:2: WARNING: duplicate prologue macro: Dd +mandoc: dupe.in:5:2: ERROR: duplicate prologue macro: Dd +mandoc: dupe.in:11:2: ERROR: duplicate prologue macro: Dd diff --git a/regress/usr.bin/mandoc/mdoc/Dt/case.out_lint b/regress/usr.bin/mandoc/mdoc/Dt/case.out_lint index 7a39ec2fab4..127afbfc481 100644 --- a/regress/usr.bin/mandoc/mdoc/Dt/case.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Dt/case.out_lint @@ -1 +1 @@ -mandoc: case.in:3:6: WARNING: lower case character in document title: Dt Dt-case +mandoc: case.in:3:6: STYLE: lower case character in document title: Dt Dt-case diff --git a/regress/usr.bin/mandoc/mdoc/Dt/dupe.out_lint b/regress/usr.bin/mandoc/mdoc/Dt/dupe.out_lint index 534a8eeccbf..8ae9c61b83a 100644 --- a/regress/usr.bin/mandoc/mdoc/Dt/dupe.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Dt/dupe.out_lint @@ -1,2 +1,2 @@ -mandoc: dupe.in:5:2: WARNING: duplicate prologue macro: Dt -mandoc: dupe.in:11:2: WARNING: skipping late title macro: Dt +mandoc: dupe.in:5:2: ERROR: duplicate prologue macro: Dt +mandoc: dupe.in:11:2: ERROR: skipping late title macro: Dt diff --git a/regress/usr.bin/mandoc/mdoc/Dt/late.out_lint b/regress/usr.bin/mandoc/mdoc/Dt/late.out_lint index 8c109bfb794..eb022107e05 100644 --- a/regress/usr.bin/mandoc/mdoc/Dt/late.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Dt/late.out_lint @@ -1,2 +1,2 @@ -mandoc: late.in:9:2: WARNING: skipping late title macro: Dt +mandoc: late.in:9:2: ERROR: skipping late title macro: Dt mandoc: late.in: WARNING: missing manual title, using UNTITLED: EOF diff --git a/regress/usr.bin/mandoc/mdoc/Os/dupe.out_lint b/regress/usr.bin/mandoc/mdoc/Os/dupe.out_lint index a0914e9d077..63b9dfd2fc6 100644 --- a/regress/usr.bin/mandoc/mdoc/Os/dupe.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Os/dupe.out_lint @@ -1,9 +1,9 @@ mandoc: dupe.in:3:5: STYLE: operating system explicitly specified: Os NetBSD (NetBSD) mandoc: dupe.in:2:5: STYLE: Mdocdate found: Dd $Mdocdate: (NetBSD) mandoc: dupe.in:4:2: WARNING: prologue macros out of order: Dt after Os -mandoc: dupe.in:5:2: WARNING: duplicate prologue macro: Os +mandoc: dupe.in:5:2: ERROR: duplicate prologue macro: Os mandoc: dupe.in:5:5: STYLE: operating system explicitly specified: Os FreeBSD (NetBSD) mandoc: dupe.in:2:5: STYLE: Mdocdate found: Dd $Mdocdate: (NetBSD) -mandoc: dupe.in:11:2: WARNING: duplicate prologue macro: Os +mandoc: dupe.in:11:2: ERROR: duplicate prologue macro: Os mandoc: dupe.in:11:5: STYLE: operating system explicitly specified: Os OpenBSD (NetBSD) mandoc: dupe.in: STYLE: RCS id missing: (NetBSD) diff --git a/regress/usr.bin/mandoc/mdoc/blank/comment.out_lint b/regress/usr.bin/mandoc/mdoc/blank/comment.out_lint index abcab92441a..9e924f2ae64 100644 --- a/regress/usr.bin/mandoc/mdoc/blank/comment.out_lint +++ b/regress/usr.bin/mandoc/mdoc/blank/comment.out_lint @@ -1 +1 @@ -mandoc: comment.in:12:3: WARNING: bad comment style +mandoc: comment.in:12:3: STYLE: bad comment style diff --git a/regress/usr.bin/mandoc/roff/args/man.out_lint b/regress/usr.bin/mandoc/roff/args/man.out_lint index 5b74f59e032..6d6bbd84e3d 100644 --- a/regress/usr.bin/mandoc/roff/args/man.out_lint +++ b/regress/usr.bin/mandoc/roff/args/man.out_lint @@ -1,9 +1,9 @@ -mandoc: man.in:35:13: WARNING: whitespace at end of input line -mandoc: man.in:39:14: WARNING: whitespace at end of input line -mandoc: man.in:43:15: WARNING: whitespace at end of input line -mandoc: man.in:83:25: WARNING: whitespace at end of input line -mandoc: man.in:87:26: WARNING: whitespace at end of input line -mandoc: man.in:91:27: WARNING: whitespace at end of input line -mandoc: man.in:104:5: WARNING: unterminated quoted argument -mandoc: man.in:107:9: WARNING: unterminated quoted argument +mandoc: man.in:35:13: STYLE: whitespace at end of input line +mandoc: man.in:39:14: STYLE: whitespace at end of input line +mandoc: man.in:43:15: STYLE: whitespace at end of input line +mandoc: man.in:83:25: STYLE: whitespace at end of input line +mandoc: man.in:87:26: STYLE: whitespace at end of input line +mandoc: man.in:91:27: STYLE: whitespace at end of input line +mandoc: man.in:104:5: STYLE: unterminated quoted argument +mandoc: man.in:107:9: STYLE: unterminated quoted argument mandoc: man.in:131:1: ERROR: escaped character not allowed in a name: IB\( diff --git a/regress/usr.bin/mandoc/roff/args/mdoc.out_lint b/regress/usr.bin/mandoc/roff/args/mdoc.out_lint index d28277a1131..f4715ba21ad 100644 --- a/regress/usr.bin/mandoc/roff/args/mdoc.out_lint +++ b/regress/usr.bin/mandoc/roff/args/mdoc.out_lint @@ -1,13 +1,13 @@ -mandoc: mdoc.in:38:13: WARNING: whitespace at end of input line -mandoc: mdoc.in:42:14: WARNING: whitespace at end of input line -mandoc: mdoc.in:46:15: WARNING: whitespace at end of input line -mandoc: mdoc.in:86:25: WARNING: whitespace at end of input line -mandoc: mdoc.in:90:26: WARNING: whitespace at end of input line -mandoc: mdoc.in:94:27: WARNING: whitespace at end of input line -mandoc: mdoc.in:102:9: WARNING: unterminated quoted argument -mandoc: mdoc.in:103:13: WARNING: unterminated quoted argument -mandoc: mdoc.in:107:10: WARNING: unterminated quoted argument -mandoc: mdoc.in:108:14: WARNING: unterminated quoted argument -mandoc: mdoc.in:112:11: WARNING: unterminated quoted argument -mandoc: mdoc.in:113:15: WARNING: unterminated quoted argument +mandoc: mdoc.in:38:13: STYLE: whitespace at end of input line +mandoc: mdoc.in:42:14: STYLE: whitespace at end of input line +mandoc: mdoc.in:46:15: STYLE: whitespace at end of input line +mandoc: mdoc.in:86:25: STYLE: whitespace at end of input line +mandoc: mdoc.in:90:26: STYLE: whitespace at end of input line +mandoc: mdoc.in:94:27: STYLE: whitespace at end of input line +mandoc: mdoc.in:102:9: STYLE: unterminated quoted argument +mandoc: mdoc.in:103:13: STYLE: unterminated quoted argument +mandoc: mdoc.in:107:10: STYLE: unterminated quoted argument +mandoc: mdoc.in:108:14: STYLE: unterminated quoted argument +mandoc: mdoc.in:112:11: STYLE: unterminated quoted argument +mandoc: mdoc.in:113:15: STYLE: unterminated quoted argument mandoc: mdoc.in:121:1: ERROR: escaped character not allowed in a name: Fl\( diff --git a/regress/usr.bin/mandoc/roff/args/roff.out_lint b/regress/usr.bin/mandoc/roff/args/roff.out_lint index d6817400d45..5ac03917282 100644 --- a/regress/usr.bin/mandoc/roff/args/roff.out_lint +++ b/regress/usr.bin/mandoc/roff/args/roff.out_lint @@ -1,16 +1,16 @@ -mandoc: roff.in:31:15: WARNING: whitespace at end of input line -mandoc: roff.in:33:16: WARNING: whitespace at end of input line -mandoc: roff.in:35:17: WARNING: whitespace at end of input line -mandoc: roff.in:55:27: WARNING: whitespace at end of input line -mandoc: roff.in:57:28: WARNING: whitespace at end of input line -mandoc: roff.in:59:29: WARNING: whitespace at end of input line -mandoc: roff.in:63:7: WARNING: unterminated quoted argument -mandoc: roff.in:64:11: WARNING: unterminated quoted argument -mandoc: roff.in:66:7: WARNING: unterminated quoted argument -mandoc: roff.in:66:12: WARNING: whitespace at end of input line -mandoc: roff.in:67:11: WARNING: unterminated quoted argument -mandoc: roff.in:67:16: WARNING: whitespace at end of input line -mandoc: roff.in:69:7: WARNING: unterminated quoted argument -mandoc: roff.in:69:13: WARNING: whitespace at end of input line -mandoc: roff.in:70:11: WARNING: unterminated quoted argument -mandoc: roff.in:70:17: WARNING: whitespace at end of input line +mandoc: roff.in:31:15: STYLE: whitespace at end of input line +mandoc: roff.in:33:16: STYLE: whitespace at end of input line +mandoc: roff.in:35:17: STYLE: whitespace at end of input line +mandoc: roff.in:55:27: STYLE: whitespace at end of input line +mandoc: roff.in:57:28: STYLE: whitespace at end of input line +mandoc: roff.in:59:29: STYLE: whitespace at end of input line +mandoc: roff.in:63:7: STYLE: unterminated quoted argument +mandoc: roff.in:64:11: STYLE: unterminated quoted argument +mandoc: roff.in:66:7: STYLE: unterminated quoted argument +mandoc: roff.in:66:12: STYLE: whitespace at end of input line +mandoc: roff.in:67:11: STYLE: unterminated quoted argument +mandoc: roff.in:67:16: STYLE: whitespace at end of input line +mandoc: roff.in:69:7: STYLE: unterminated quoted argument +mandoc: roff.in:69:13: STYLE: whitespace at end of input line +mandoc: roff.in:70:11: STYLE: unterminated quoted argument +mandoc: roff.in:70:17: STYLE: whitespace at end of input line diff --git a/regress/usr.bin/mandoc/roff/nr/escname.out_lint b/regress/usr.bin/mandoc/roff/nr/escname.out_lint index 00c1b5b2038..a2dabebeb3e 100644 --- a/regress/usr.bin/mandoc/roff/nr/escname.out_lint +++ b/regress/usr.bin/mandoc/roff/nr/escname.out_lint @@ -1,4 +1,4 @@ mandoc: escname.in:9:5: ERROR: escaped character not allowed in a name: first\e mandoc: escname.in:12:5: ERROR: escaped character not allowed in a name: first\e mandoc: escname.in:18:13: WARNING: invalid escape sequence: \n[second -mandoc: escname.in:18:12: WARNING: whitespace at end of input line +mandoc: escname.in:18:12: STYLE: whitespace at end of input line diff --git a/regress/usr.bin/mandoc/roff/string/name.out_lint b/regress/usr.bin/mandoc/roff/string/name.out_lint index 39260cde84c..795f5e8094d 100644 --- a/regress/usr.bin/mandoc/roff/string/name.out_lint +++ b/regress/usr.bin/mandoc/roff/string/name.out_lint @@ -2,16 +2,16 @@ mandoc: name.in:11:5: ERROR: escaped character not allowed in a name: bs\e mandoc: name.in:13:5: ERROR: escaped character not allowed in a name: bl\ mandoc: name.in:16:29: WARNING: invalid escape sequence: \*[norm mandoc: name.in:16:29: WARNING: undefined string, using "": norm -mandoc: name.in:16:28: WARNING: whitespace at end of input line +mandoc: name.in:16:28: STYLE: whitespace at end of input line mandoc: name.in:18:7: WARNING: undefined string, using "": quot -mandoc: name.in:18:6: WARNING: whitespace at end of input line +mandoc: name.in:18:6: STYLE: whitespace at end of input line mandoc: name.in:26:6: WARNING: undefined string, using "": bse -mandoc: name.in:26:5: WARNING: whitespace at end of input line +mandoc: name.in:26:5: STYLE: whitespace at end of input line mandoc: name.in:28:5: WARNING: undefined string, using "": bs -mandoc: name.in:28:4: WARNING: whitespace at end of input line +mandoc: name.in:28:4: STYLE: whitespace at end of input line mandoc: name.in:32:7: WARNING: undefined string, using "": bl e -mandoc: name.in:32:6: WARNING: whitespace at end of input line +mandoc: name.in:32:6: STYLE: whitespace at end of input line mandoc: name.in:34:6: WARNING: undefined string, using "": ble -mandoc: name.in:34:5: WARNING: whitespace at end of input line +mandoc: name.in:34:5: STYLE: whitespace at end of input line mandoc: name.in:36:5: WARNING: undefined string, using "": bl -mandoc: name.in:36:4: WARNING: whitespace at end of input line +mandoc: name.in:36:4: STYLE: whitespace at end of input line diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index abef1cd3373..56fce341d50 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.138 2017/07/04 14:40:30 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.139 2017/07/06 22:58:44 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 4 2017 $ +.Dd $Mdocdate: July 6 2017 $ .Dt MANDOC 1 .Os .Sh NAME @@ -866,6 +866,13 @@ Consider using the conventional date format .Dq "Month dd, yyyy" instead. +.It Sy "lower case character in document title" +.Pq mdoc , man +The title is still used as given in the +.Ic \&Dt +or +.Ic \&TH +macro. .It Sy "duplicate RCS id" A single manual page contains two copies of the RCS identifier for the same operating system. @@ -876,6 +883,14 @@ to the top of the page. Fuzzy string matching revealed that the argument of an .Ic \&Sh macro is similar, but not identical to a standard section name. +.It Sy "unterminated quoted argument" +.Pq roff +Macro arguments can be enclosed in double quote characters +such that space characters and macro names contained in the quoted +argument need not be escaped. +The closing quote of the last argument of a macro can be omitted. +However, omitting it is not recommended because it makes the code +harder to read. .It Sy "useless macro" .Pq mdoc A @@ -926,6 +941,20 @@ The last argument of a macro that supports trailing delimiter arguments is longer than one byte and ends with a trailing delimiter. Consider inserting a blank such that the delimiter becomes a separate argument, thus moving it out of the scope of the macro. +.It Sy "fill mode already enabled, skipping" +.Pq man +A +.Ic \&fi +request occurs even though the document is still in fill mode, +or already switched back to fill mode. +It has no effect. +.It Sy "fill mode already disabled, skipping" +.Pq man +An +.Ic \&nf +request occurs even though the document already switched to no-fill mode +and did not switch back to fill mode yet. +It has no effect. .It Sy "function name without markup" .Pq mdoc A word followed by an empty pair of parentheses occurs on a text line. @@ -934,6 +963,18 @@ Consider using an or .Ic \&Xr macro. +.It Sy "whitespace at end of input line" +.Pq mdoc , man , roff +Whitespace at the end of input lines is almost never semantically +significant \(em but in the odd case where it might be, it is +extremely confusing when reviewing and maintaining documents. +.It Sy "bad comment style" +.Pq roff +Comment lines start with a dot, a backslash, and a double-quote character. +The +.Nm +utility treats the line as a comment line even without the backslash, +but leaving out the backslash might not be portable. .El .Ss Warnings related to the document prologue .Bl -ohang @@ -949,13 +990,6 @@ macro before the first non-prologue macro. There is no .Ic \&TH macro, or it has no arguments. -.It Sy "lower case character in document title" -.Pq mdoc , man -The title is still used as given in the -.Ic \&Dt -or -.Ic \&TH -macro. .It Sy "missing manual section, using \(dq\(dq" .Pq mdoc , man A @@ -1002,10 +1036,6 @@ macro is more than a day ahead of the current system .It Sy "missing Os macro, using \(dq\(dq" .Pq mdoc The default or current system is not shown in this case. -.It Sy "duplicate prologue macro" -.Pq mdoc -One of the prologue macros occurs more than once. -The last instance overrides all previous ones. .It Sy "late prologue macro" .Pq mdoc A @@ -1013,17 +1043,6 @@ A or .Ic \&Os macro occurs after some non-prologue macro, but still takes effect. -.It Sy "skipping late title macro" -.Pq mdoc -The -.Ic \&Dt -macro appears after the first non-prologue macro. -Traditional formatters cannot handle this because -they write the page header before parsing the document body. -Even though this technical restriction does not apply to -.Nm , -traditional semantics is preserved. -The late macro is discarded including its arguments. .It Sy "prologue macros out of order" .Pq mdoc The prologue macros are not given in the conventional order @@ -1268,20 +1287,6 @@ Inside a list, a .Ic \&Ta macro occurs as the first macro on a line, which is not portable. -.It Sy "fill mode already enabled, skipping" -.Pq man -A -.Ic \&fi -request occurs even though the document is still in fill mode, -or already switched back to fill mode. -It has no effect. -.It Sy "fill mode already disabled, skipping" -.Pq man -An -.Ic \&nf -request occurs even though the document already switched to no-fill mode -and did not switch back to fill mode yet. -It has no effect. .It Sy "line scope broken" .Pq man While parsing the next-line scope of the previous macro, @@ -1495,14 +1500,6 @@ An empty box is inserted. .El .Ss "Warnings related to bad macro arguments" .Bl -ohang -.It Sy "unterminated quoted argument" -.Pq roff -Macro arguments can be enclosed in double quote characters -such that space characters and macro names contained in the quoted -argument need not be escaped. -The closing quote of the last argument of a macro can be omitted. -However, omitting it is not recommended because it makes the code -harder to read. .It Sy "duplicate argument" .Pq mdoc A @@ -1644,22 +1641,10 @@ As an implementation dependent choice, tab characters on text lines are passed through to the formatters in any case. Given that the text before the tab character will be filled, it is hard to predict which tab stop position the tab will advance to. -.It Sy "whitespace at end of input line" -.Pq mdoc , man , roff -Whitespace at the end of input lines is almost never semantically -significant \(em but in the odd case where it might be, it is -extremely confusing when reviewing and maintaining documents. .It Sy "new sentence, new line" .Pq mdoc A new sentence starts in the middle of a text line. Start it on a new input line to help formatters produce correct spacing. -.It Sy "bad comment style" -.Pq roff -Comment lines start with a dot, a backslash, and a double-quote character. -The -.Nm -utility treats the line as a comment line even without the backslash, -but leaving out the backslash might not be portable. .It Sy "invalid escape sequence" .Pq roff An escape sequence has an invalid opening argument delimiter, lacks the @@ -1766,6 +1751,21 @@ and any remaining cells stay empty. .El .Ss "Errors related to roff, mdoc, and man code" .Bl -ohang +.It Sy "duplicate prologue macro" +.Pq mdoc +One of the prologue macros occurs more than once. +The last instance overrides all previous ones. +.It Sy "skipping late title macro" +.Pq mdoc +The +.Ic \&Dt +macro appears after the first non-prologue macro. +Traditional formatters cannot handle this because +they write the page header before parsing the document body. +Even though this technical restriction does not apply to +.Nm , +traditional semantics is preserved. +The late macro is discarded including its arguments. .It Sy "input stack limit exceeded, infinite loop?" .Pq roff Explicit recursion limits are implemented for the following features, diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index c380b99bfd1..53e347a08b3 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.184 2017/07/05 15:03:20 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.185 2017/07/06 22:58:44 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -56,31 +56,34 @@ enum mandocerr { MANDOCERR_STYLE, /* ===== start of style suggestions ===== */ MANDOCERR_DATE_LEGACY, /* legacy man(7) date format: Dd ... */ + MANDOCERR_TITLE_CASE, /* lower case character in document title */ MANDOCERR_RCS_REP, /* duplicate RCS id: ... */ MANDOCERR_SEC_TYPO, /* typo in section name: Sh ... */ + MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */ MANDOCERR_MACRO_USELESS, /* useless macro: macro */ MANDOCERR_BX, /* consider using OS macro: macro */ MANDOCERR_ER_ORDER, /* errnos out of order: Er ... */ MANDOCERR_ER_REP, /* duplicate errno: Er ... */ MANDOCERR_DELIM, /* trailing delimiter: macro ... */ MANDOCERR_DELIM_NB, /* no blank before trailing delimiter: macro ... */ + MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */ + MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */ MANDOCERR_FUNC, /* function name without markup: name() */ + MANDOCERR_SPACE_EOL, /* whitespace at end of input line */ + MANDOCERR_COMMENT_BAD, /* bad comment style */ MANDOCERR_WARNING, /* ===== start of warnings ===== */ /* related to the prologue */ MANDOCERR_DT_NOTITLE, /* missing manual title, using UNTITLED: line */ MANDOCERR_TH_NOTITLE, /* missing manual title, using "": [macro] */ - MANDOCERR_TITLE_CASE, /* lower case character in document title */ MANDOCERR_MSEC_MISSING, /* missing manual section, using "": macro */ MANDOCERR_MSEC_BAD, /* unknown manual section: Dt ... section */ MANDOCERR_DATE_MISSING, /* missing date, using today's date */ MANDOCERR_DATE_BAD, /* cannot parse date, using it verbatim: date */ MANDOCERR_DATE_FUTURE, /* date in the future, using it anyway: date */ MANDOCERR_OS_MISSING, /* missing Os macro, using "" */ - MANDOCERR_PROLOG_REP, /* duplicate prologue macro: macro */ MANDOCERR_PROLOG_LATE, /* late prologue macro: macro */ - MANDOCERR_DT_LATE, /* skipping late title macro: Dt args */ MANDOCERR_PROLOG_ORDER, /* prologue macros out of order: macros */ /* related to document structure */ @@ -113,8 +116,6 @@ enum mandocerr { MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */ MANDOCERR_BL_MOVE, /* moving content out of list: macro */ MANDOCERR_TA_LINE, /* first macro on line: Ta */ - MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */ - MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */ MANDOCERR_BLK_LINE, /* line scope broken: macro breaks macro */ MANDOCERR_BLK_BLANK, /* skipping blank line in line scope */ @@ -143,7 +144,6 @@ enum mandocerr { MANDOCERR_EQN_NOBOX, /* missing eqn box, using "": op */ /* related to bad arguments */ - MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */ MANDOCERR_ARG_REP, /* duplicate argument: macro arg */ MANDOCERR_AN_REP, /* skipping duplicate argument: An -arg */ MANDOCERR_BD_REP, /* skipping duplicate display type: Bd -type */ @@ -162,9 +162,7 @@ enum mandocerr { /* related to plain text */ MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */ MANDOCERR_FI_TAB, /* tab in filled text */ - MANDOCERR_SPACE_EOL, /* whitespace at end of input line */ MANDOCERR_EOS, /* new sentence, new line */ - MANDOCERR_COMMENT_BAD, /* bad comment style */ MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */ MANDOCERR_STR_UNDEF, /* undefined string, using "": name */ @@ -190,6 +188,8 @@ enum mandocerr { /* related to document structure and macros */ MANDOCERR_FILE, /* cannot open file */ + MANDOCERR_PROLOG_REP, /* duplicate prologue macro: macro */ + MANDOCERR_DT_LATE, /* skipping late title macro: Dt args */ MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */ MANDOCERR_CHAR_BAD, /* skipping bad character: number */ MANDOCERR_MACRO, /* skipping unknown macro: macro */ diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index c7ee01560a9..d5c9e6d47c8 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.160 2017/07/04 14:40:30 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.161 2017/07/06 22:58:44 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -94,31 +94,34 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "generic style suggestion", "legacy man(7) date format", + "lower case character in document title", "duplicate RCS id", "typo in section name", + "unterminated quoted argument", "useless macro", "consider using OS macro", "errnos out of order", "duplicate errno", "trailing delimiter", "no blank before trailing delimiter", + "fill mode already enabled, skipping", + "fill mode already disabled, skipping", "function name without markup", + "whitespace at end of input line", + "bad comment style", "generic warning", /* related to the prologue */ "missing manual title, using UNTITLED", "missing manual title, using \"\"", - "lower case character in document title", "missing manual section, using \"\"", "unknown manual section", "missing date, using today's date", "cannot parse date, using it verbatim", "date in the future, using it anyway", "missing Os macro, using \"\"", - "duplicate prologue macro", "late prologue macro", - "skipping late title macro", "prologue macros out of order", /* related to document structure */ @@ -151,8 +154,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "nested displays are not portable", "moving content out of list", "first macro on line", - "fill mode already enabled, skipping", - "fill mode already disabled, skipping", "line scope broken", "skipping blank line in line scope", @@ -181,7 +182,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "missing eqn box, using \"\"", /* related to bad macro arguments */ - "unterminated quoted argument", "duplicate argument", "skipping duplicate argument", "skipping duplicate display type", @@ -200,9 +200,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { /* related to plain text */ "blank line in fill mode, using .sp", "tab in filled text", - "whitespace at end of input line", "new sentence, new line", - "bad comment style", "invalid escape sequence", "undefined string, using \"\"", @@ -228,6 +226,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { /* related to document structure and macros */ NULL, + "duplicate prologue macro", + "skipping late title macro", "input stack limit exceeded, infinite loop?", "skipping bad character", "skipping unknown macro", -- 2.20.1