autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: named diversions


From: Eric Blake
Subject: Re: named diversions
Date: Sat, 14 Mar 2015 20:20:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 03/14/2015 05:01 PM, Matěj Týč wrote:
> Hello again,
> In my m4 project where I use autom4te and m4sugar (for those who are
> curious - https://github.com/matejak/d8 ),
> in order to be able to output anything, one has to call
> m4_divert_push(1) (or something similar) at certain point. However,
> every time I do that, I get the
> warning: prefer named diversions
> warning. I know that I can use m4_divert_push(KILL) in place of
> m4_divert_push(0), but a trivial diversion e.g. for stdout is not
> available (or documented). There is also a lack of documentation on how
> to register a named diversion, using a macro instead of a number isn't
> the right way how to make a named diversion.
> Do you have any solution to this in mind? Telling autom4te to suppress
> warnings doesn't feel right.

According to the manual, m4sugar defines KILL and GROW as named
diversions; m4sh (if you use AS_INIT instead of m4_init) also adds
BINSH, several HEADER-*, M4SH-SANITIZE, M4SH-INIT, and BODY.  That is,
if you are using autom4te to generate a shell script, then you
eventually want to m4_divert_push([BODY]) (although you get it free by
using AS_INIT).

As for creating new named diversions, they are not documented in the
manual, but you can learn about them in the m4sugar source code
(basically, m4_define([_m4_divert(NAME)], NUMBER) will define
m4_divert_push(NAME) to use that diversion number).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]