[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / openmp / libomptarget / utils / generate_microtask_cases.py
blobf162b2c75c32ae5b9e3e4a22399e60f7bbb720c8
1 #!/usr/bin/env python3
3 import argparse
5 def main():
6 parser = argparse.ArgumentParser()
7 parser.add_argument('--max_args', type=int, help='Max number of arguments to generate case statements for', required=True)
8 parser.add_argument('--output', help='Output header file to include', required=True)
9 args = parser.parse_args()
11 output=''
12 for i in range(args.max_args+1):
13 output += 'case %d:\n'%(i)
14 output += '((void (*)(kmp_int32 *, kmp_int32 *\n'
15 for j in range(i):
16 output += ', void *'
17 if (j+1)%4 == 0:
18 output += '\n'
19 output += '))fn)(&global_tid, &bound_tid\n'
20 for j in range(i):
21 output += ', args[%d]'%(j)
22 if (j+1)%4 == 0:
23 output += '\n'
24 output += ');\n'
25 output += 'break;\n'
27 with open(args.output, 'w') as f:
28 print(output, file=f)
30 if __name__ == "__main__":
31 main()