Re: AT_LINE

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs,gmane.comp.gnu.m4.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ralf Wildenhues on 9/13/2009 9:48 AM:
> all debug output will list line N as the originator for the checks.
> 
> Is it possible to realize in M4 in Autotest to list another or yet
> another line as line numbers?

Unfortunately, current m4 treats all text created by a macro expansion as
coming from line N where the macro name occurred; there is no way to ask
for a count of lines relative to the expansion.  Therefore, the only way I
know of to specify line numbers is to provide them as arguments to the
macro call.  That is, instead of:

foo([    # line n
bar      # reports line n
bar      # reports line n
])

you would use something like:

foo([            # line n
bar(]__line__[)  # bar called with line n+1
bar(]__line__[)  # bar called with line n+2
])

But that gets hairy fast, and AT_CHECK doesn't have an interface that
currently allows the specification of an alternate line number.

Maybe it would be nice to patch m4 to track __line__ usage within an
expanded macro relative to the number of newlines encountered during the
expansion, but that would be quite a bit of upstream effort, and won't
appear in a stable released version of m4 for quite some time.

This also reminds me that I have plans to implement __line__(value) for m4
1.6, which allows one to change the current reported line on the fly; but
I haven't gotten to that yet.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkquMAEACgkQ84KuGfSFAYCNiQCZAV76uy+JwKIDWrOMXBx4qwqX
u2cAoM0CP7EfKKqdBxXnGyhjIKOFidQL
=HymG
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.