summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-17 10:15:23 -0700
committerCarl Worth <cworth@cworth.org>2010-05-17 10:15:23 -0700
commit420d05a15b90658680b87b4d83b092768590319a (patch)
tree52a5a0ffc1e4919ee08c2e1add30d78d8fbc6d4c /tests
parente36a4d5be9a9fa3abc4fb5d0b6c3601934f7a343 (diff)
Add test and fix bug leading to infinite recursion.
The test case here is simply "#define foo foo" and "#define bar foo" and then attempting to expand "bar". Previously, our termination condition for the recursion was overly simple---just looking for the single identifier that began the expansion. We now fix this to maintain a stack of identifiers and terminate when any one of them occurs in the replacement list.
Diffstat (limited to 'tests')
-rw-r--r--tests/024-define-chain-to-self-recursion.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/024-define-chain-to-self-recursion.c b/tests/024-define-chain-to-self-recursion.c
new file mode 100644
index 0000000000..e788adce30
--- /dev/null
+++ b/tests/024-define-chain-to-self-recursion.c
@@ -0,0 +1,3 @@
+#define foo foo
+#define bar foo
+bar