summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-19 07:29:22 -0700
committerCarl Worth <cworth@cworth.org>2010-05-19 07:29:22 -0700
commitbe0e2e9b2ada51be66afb6b44330acb44e0261f2 (patch)
tree4795965a9dce8645680f2f0aa423f035d27eebd1 /tests
parenta807fb72c45888b5ff915aa08d8bd10069be4a2e (diff)
Fix bug (and add tests) for a function-like macro defined as itself.
This case worked previously, but broke in the recent rewrite of function- like macro expansion. The recursion was still terminated correctly, but any parenthesized expression after the macro name was still being swallowed even though the identifier was not being expanded as a macro. The fix is to notice earlier that the identifier is an already-expanding macro. We let the lexer know this through the classify_token function so that an already-expanding macro is lexed as an identifier, not a FUNC_MACRO.
Diffstat (limited to 'tests')
-rw-r--r--tests/032-define-func-self-recurse.c2
-rw-r--r--tests/033-define-func-self-compose.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/032-define-func-self-recurse.c b/tests/032-define-func-self-recurse.c
new file mode 100644
index 0000000000..60d8526c0a
--- /dev/null
+++ b/tests/032-define-func-self-recurse.c
@@ -0,0 +1,2 @@
+#define foo(a) foo(2 * (a))
+foo(3)
diff --git a/tests/033-define-func-self-compose.c b/tests/033-define-func-self-compose.c
new file mode 100644
index 0000000000..8abaaf6be9
--- /dev/null
+++ b/tests/033-define-func-self-compose.c
@@ -0,0 +1,2 @@
+#define foo(a) foo(2 * (a))
+foo(foo(3))