xref: /minix3/external/bsd/llvm/dist/clang/utils/TestUtils/deep-stack.py (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc#!/usr/bin/env python
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambucdef pcall(f, N):
4*f4a2713aSLionel Sambuc    if N == 0:
5*f4a2713aSLionel Sambuc        print >>f, '    f(0)'
6*f4a2713aSLionel Sambuc        return
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc    print >>f, '    f('
9*f4a2713aSLionel Sambuc    pcall(f, N - 1)
10*f4a2713aSLionel Sambuc    print >>f, '     )'
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambucdef main():
13*f4a2713aSLionel Sambuc    f = open('t.c','w')
14*f4a2713aSLionel Sambuc    print >>f, 'int f(int n) { return n; }'
15*f4a2713aSLionel Sambuc    print >>f, 'int t() {'
16*f4a2713aSLionel Sambuc    print >>f, '  return'
17*f4a2713aSLionel Sambuc    pcall(f, 10000)
18*f4a2713aSLionel Sambuc    print >>f, '  ;'
19*f4a2713aSLionel Sambuc    print >>f, '}'
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambucif __name__ == "__main__":
22*f4a2713aSLionel Sambuc    import sys
23*f4a2713aSLionel Sambuc    sys.setrecursionlimit(100000)
24*f4a2713aSLionel Sambuc    main()
25