Eric Blake <ebb9 <at> byu.net> writes: > > One nice bit about this patch is we now match Solaris m4 behavior on this > (admittedly contrived) testcase: > m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)foo > ') > => 0 >
Just to set the record straight, I did more testing of how other implementations behave with builtin tokens given to m4wrap. The above quote is wrong, since neither Solaris nor BSD handle it the way patched GNU M4 does. But I was able to find at least one case where the other two implementations would support a builtin token in the argument to m4wrap: BSD$ m4 m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)-foo- ')dnl m4: unexpected end of input, unclosed parenthesis: stdin at line 3 BSD$ m4 m4wrap(`define(foo,'defn(`divnum')`)-foo- ')dnl -0- BSD$ Solaris$ /usr/xpg4/bin/m4 m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)-foo- ')dnl -- Solaris$ /usr/xpg4/bin/m4 m4wrap(`define(foo,'defn(`divnum')`)-foo- ')dnl -- Solaris$ /usr/xpg4/bin/m4 define(q,``$@'')m4wrap(`define'(q(foo,defn(`divnum')))`-foo- ')dnl -0- Solaris$ So this statement that I added to the GNU M4 manual is particularly true: "However, for portability, it is better to defer the evaluation of `defn' along with the rest of the wrapped text". -- Eric Blake _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
