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

Attachment: signature.asc
Description: PGP signature

Reply via email to