Hi Eric. On Thursday 04 November 2010, Eric Blake wrote: > On 11/04/2010 03:28 PM, Stefano Lattarini wrote: > >>> +# Indirection used here, to avoid triggering the bug described > >>> +# above. > >>> +AC_DEFUN([MY_DEFUN], [m4_apply([AC_DEFUN], [$1], [$2])]) > >> > >> This is insufficiently quoted, it should be: > >> [m4_apply([AC_DEFUN], [[$1], [$2]])] > > I'm not an m4 quoting guru, but I think that one single level of quotes > > is sufficient to avoid *spurious* expansions. Do you have any reason or > > example showing that two levels of quotes are indeed needed? > > Yes - the documentation of m4_apply includes this example: > > m4_apply([m4_count], []) > 0 > m4_apply([m4_count], [[]]) > 1 > m4_apply([m4_count], [[1], [2]]) > 2 > m4_apply([m4_join], [[|], [1], [2]]) > 1|2 > > That is, m4_apply is implemented as $1($2). Notice that the entire > second argument to m4_apply is passed as a series of arguments to $1, so > each argument to $1 must be quoted, AND that series of arguments to > m4_apply must be quoted into a single unit. > > The way you wrote it, you would have called AC_DEFUN($1), and $2 would > be a spurious argument (not sure if it would be silently ignored or > trigger a warning), when you really wanted to call AC_DEFUN([$1], [$2]). > Thanks for the detailed explanation. I've addressed your and Nick's observations in an amended patch (attached to my reply to Nick's mail).
Thanks, Stefano