m4-discuss
[Top][All Lists]
Advanced

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

rfc: new __program__ macro


From: Eric Blake
Subject: rfc: new __program__ macro
Date: Tue, 01 Aug 2006 21:49:48 -0600
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Would it be worth adding __program__ macro, to go along with __file__ and
__line__, which expands to argv[0] in the same manner that error messages
do?  That way, if a user invokes m4 via a symlink or absolute path, rather
than through their PATH, they can match internal m4 messages.  They can
also use that information to invoke a sub-m4 in syscmd using the same
version of m4 currently running, rather than picking up an arbitrary m4
from PATH.

I noticed this when testing mingw on branch-1_4.  When running a mingw
application, argv[0] includes .exe, so the code in checks/check-them runs
sed -e "s| m4:| $m4|" on expected output messages, where $m4 was
determined earlier, to match output correctly.  This has worked great when
all our message violated GNU coding standards ("file:line: m4: message"),
but when I experimented with swapping error messages to be compliant
("m4:file:line: message"), and changed the sed script to -e
"s|^m4:|$m4:|", it broke the tests that did
"errprint(`m4:'__line__:__file__`: message')", because those messages now
match the sed rules, but do not output the .exe that internal error
messages used.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE0CDc84KuGfSFAYARArQsAKCLk6BNXHEeWQLX8r4cllaDVM+ycgCfU06z
pKNG6thGwF2ZuGwHCmy7A1w=
=rYPi
-----END PGP SIGNATURE-----




reply via email to

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