Hi Alex,

At 2023-04-28T15:56:13+0200, Alejandro Colomar wrote:
> Considering a build system that builds man pages into several formats,
> including utf8, PostScript, HTML, and PDF, it is interesting to be
> able to see all available warnings, and see them only once.

Where you're headed with this already sounds tricky, since GNU troff
(like AT&T device-independent troff) reads information about the device
for which it is preparing output at the time it starts.  In fact, you
_cannot_ launch the formatter without a valid device description.

> For that, one could enable -ww in the main target, and then only
> enable device-dependent warnings for the other targets.

There isn't really any such thing as a device-dependent warning, unless
you count those thrown by the output driver itself, like grops(1) or
grotty(1).

> Would you create a category -wdev that only enables warnings that
> would be different for different devices?  Or maybe -wpdf and similar
> ones.

I don't know what I would put in it.  Another thing to be aware of is
that groff has a tradition of loading a device-specific macro package at
formatter startup.  Unlike the loading of a DESC file, noted above, this
isn't strictly _essential_ (you can prevent it with GNU troff's `-R`
option), but in practice macro packages and documents written for groff
can generally expect an appropriate one to have been loaded.

> I expect issues about fonts, for example, will not be reported in
> -Tutf8 but will be in -Tpdf.

I'm afraid I have to overturn your expectations here.

$ ./build/test-groff -Tutf8
foo
.ft B
bar
.ft C
troff:<standard input>:4: warning: cannot select font 'C'
baz
.pl \n(nlu
foo bar baz

(Both "bar" and "baz" are in bold.)

Now, it is true that groff 1.22.4 didn't warn here.  This wasn't because
fonts didn't matter to nroff devices in that release, but because a
_lot_ of erroneous uses of font-related requests (and escape sequences)
were not diagnosed.  This was nothing to do with them not being
meaningful for nroff devices--they are.

See [2] for background.

Regards,
Branden

[1] There are requests and escape sequences that the formatter flatly
    ignores in nroff mode, but because nroff devices still permit style
    changes ('.ft R', '.ft I', '.ft B', '.ft BI'), the `ft` request
    and `\f` escape sequence are not among them.

[2] 
https://git.savannah.gnu.org/cgit/groff.git/commit/?id=87efb8ff373d5cf3b92be9d21445a80b264fa961

Attachment: signature.asc
Description: PGP signature

Reply via email to