[Top][All Lists]

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

Re: How to use m4_require with arguments?

From: Eric Blake
Subject: Re: How to use m4_require with arguments?
Date: Thu, 16 Oct 2008 06:13:41 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080914 Thunderbird/ Mnenhy/

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             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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