Proposed: kill off "right-brace" warning category
"G. Branden Robinson" <[email protected]>
| Newsgroups | gmane.comp.printing.groff.general |
|---|---|
| Message-ID | <20251107100328.6xjxivk233vavobb@illithid> |
Those who have fiddled with GNU troff's warning categories may be
familiar with this unusually specific beast.
troff(1):
Warnings
GNU troff divides its warning diagnostics into named, numbered
categories. The -w and -W options use the associated names. A
power of two characterizes each category; the warn request and the
.warn register respectively set and report the sum of enabled
category codes. Warnings of each category are produced under the
following circumstances.
┌───────────────────────┬─────────────────────────────┐
│ Bit Code Category │ Bit Code Category │
├───────────────────────┼─────────────────────────────┤
│ 0 1 char │ 10 1024 reg │
│ 1 2 number │ 11 2048 tab │
│ 2 4 break │ 12 4096 right-brace │
│ 3 8 delim │ 13 8192 missing │
│ 4 16 unused │ 14 16384 input │
│ 5 32 scale │ 15 32768 escape │
│ 6 64 range │ 16 65536 space │
│ 7 128 syntax │ 17 131072 font │
│ 8 256 di │ 18 262144 ig │
│ 9 512 mac │ 19 524288 color │
│ │ 20 1048576 file │
└───────────────────────┴─────────────────────────────┘
...
right-brace 4096 A right brace escape sequence \} was
encountered where a number was expected.
I believe Ingo has complained before about the narrow scope of this
warning category; I'd cite mailing list history but unfortunately
lists.gnu.org is timing out for me at the moment. I had a similar
reaction when I started learning GNU troff.
Further, this warning category is used in only once place in the code,
in the numeric expression parser.
I have a patch to eliminate this warning category, and reclassify the
problem of tabs and right braces being encountered when a numeric
expression is expected together as warnings in category "syntax".
Illustration:
$ printf '.nr a \\}2\n.tm \\na\n' | ~/groff-1.22.3/bin/nroff -Ww -wright-brace
<standard input>:1: warning: `\}' where number expected
0
$ printf '.nr a \\}2\n.tm \\na\n' | ~/groff-1.22.4/bin/nroff -Ww -wright-brace
troff: <standard input>:1: warning: '\}' where number expected
0
$ printf '.nr a \\}2\n.tm \\na\n' | ~/groff-1.23.0/bin/nroff -Ww -wright-brace
troff:<standard input>:1: warning: expected numeric expression, got rightbrace escape sequence
0
$ printf '.nr a \\}2\n.tm \\na\n' | ~/groff-HEAD/bin/nroff -Ww -wright-brace
troff:<standard input>:1: warning: expected numeric expression, got right brace escape sequence
0
$ printf '.nr a \\}2\n.tm \\na\n' | ./build/test-groff -Tutf8 -Ww -wright-brace
troff: error: unrecognized warning category 'right-brace'
0
$ printf '.nr a \\}2\n.tm \\na\n' | ./build/test-groff -Tutf8 -Ww -wsyntax
troff:<standard input>:1: warning: expected numeric expression, got an escaped '}'
0
Patch attached; reviews welcome.
Regards,
Branden
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmkNw+kACgkQ0Z6cfXEm bc56Ew/+JE+zynut08wF7R63uiqRaWR1raB/Wtlxk6oE4AChQUFu84aLX0vuuC2h I2ssOKB4XjAu/bO7yRvuHccYAUeyFVJ1MVxRIBGk1EhSAODKNgQYTSHZOgjsxQHz pvs4p2fls0LdWp57w6nPD7qn1tIq8GNoaS3t7ND5NYXhUFspvFcpMqvCgz/3nXZF ezZy/KC8OXc1xu/g5CqOvwXg+C5IkfqpMIOq0Zfy6Xx+haWwvUFk/lu8WrgjGASl 9cJ17uqxhd1pc0K0s/8DE0Dn7WerCdo/VpNNWA+39B6KGhNw9xKPbkhwH1TtRjkh pJCED1IBqei2pd4yMdcOKauHyUjQtFAlnn3OAcX0k0Vbx+wyVDNWSL7BKfEN/A5M NwaTUKikIjEX3a2lrP/fRZlTEFIy7yMsMqEBxAp2PPGSGyjKhjua98WX6K/e1Y1q HQO1TadASEBn01v6Ajc8V5OckKtTwI5R/nb/B3ICb2Qnqn+tg6kPKWAe9r9/H5Ib NTNbMleTGCW2qayagfvIZTaFX5frdBvYDP70g+FoaWEgQFUSi9vFH9ma5ubBFuqt avFVmZKkR7Wur59DKG4aFNkDtNQ7j/B6iM1Clju3mNkHUqbWpywesvIHovQkzKWO IS8zV4ZFcBslaYCcThWF194MwgyIT6ViTY8ZjnUErDDGDXotThE= =QzP6 -----END PGP SIGNATURE-----