Re: How to use m4_require with arguments?

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

 



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

According to Paolo Bonzini on 10/16/2008 3:55 AM:
> (Note: I wanted use this to provide different implementations of
> AC_COMPILE_IFELSE for different languages.  I think I can also do
> without it, but I thought I'd write nevertheless about a more general
> m4sugar problem).

I'm still digesting the technical content, but some quick comments:

> 
> This is quite robust, as I tried on more examples.  The problems are:
> 
> 1) that this requires a contract between the macros: if the definition
> uses m4_provide([$0($@)]), the caller should use m4_require_with_args;
> otherwise, it should use m4_require.

Perhaps we could redefine m4_require to always supply () (equivalent to 1
empty argument), then require that any m4_defun'd macro behave the same
with no arguments as it does with one empty argument.  Would that allow
the caller could get away with either style of require?

> 
> 2) that if "foo" might expand to something that includes commas, you
> have to use m4_expand(foo) in the arguments of m4_require_with_args.
> This is ugly.

m4_quote(foo) is much lighter weight than m4_expand(foo) at protecting
against commas; m4_expand is only needed if you are worried about
preserving the whitespace after commas in the expansion of foo.

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

Eric Blake             ebb9@xxxxxxx
-----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

iEYEARECAAYFAkj3L/UACgkQ84KuGfSFAYDJfgCfc7dsCy2IIQqQmR9JuWY11vb5
ZFUAoKXoWoL/uiibRVqveLuI7da0sTmn
=J6G1
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux