This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Traditional macro recursion
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 5 Jun 2002 14:43:13 -0700
- Subject: Re: Traditional macro recursion
- References: <20020605201321.GA4178@daikokuya.demon.co.uk>
On Wed, Jun 05, 2002 at 09:13:22PM +0100, Neil Booth wrote:
> Zack, I remember you had an example of a traditional macro
> expansion including the macro name but that didn't recurse.
> I kind find it any more; I recall it as being one of the ISO
> tests in the testsuite though. Could you remind me what it
> was? I'm trying to come up with a foolproof way of detecting
> recursion without waiting till the 200th expansion to find out.
The only example I know of is from cccp.c (look in a 2.95 tree):
/* Recursive macro use sometimes works traditionally.
#define foo(x,y) bar (x (y,0), y)
foo (foo, baz) */
This presumably expands first to
bar (foo (baz, 0), baz)
and then
bar (bar (baz (0, 0), baz), baz)
This comment was in some part of cpplib, too, until I ripped out the
old traditional support.
zw