From b569383bbdfa22ed591255f56fb93832633a95ae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 20 May 2010 08:01:44 -0700 Subject: Avoid re-expanding a macro name that has once been rejected from expansion. The specification of the preprocessor in C99 says that when we see a macro name that we are already expanding that we refuse to expand it now, (which we've done for a while), but also that we refuse to ever expand it later if seen in other contexts at which it would be legitimate to expand. We add a test case for that here, and fix it to work. The fix takes advantage of a new token_t value for tokens and argument words along with the recently added IDENTIFIER_FINALIZED token type which instructs the parser to not even look for another expansion. --- tests/037-finalize-unexpanded-macro.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/037-finalize-unexpanded-macro.c (limited to 'tests') diff --git a/tests/037-finalize-unexpanded-macro.c b/tests/037-finalize-unexpanded-macro.c new file mode 100644 index 0000000000..b3a2f37f1b --- /dev/null +++ b/tests/037-finalize-unexpanded-macro.c @@ -0,0 +1,3 @@ +#define expand(x) expand(x once) +#define foo(x) x +foo(expand(just)) -- cgit v1.2.3