1 /* ===-- trampoline_setup_test.c - Test __trampoline_setup -----------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
18 * Tests nested functions
19 * The ppc compiler generates a call to __trampoline_setup
20 * The i386 and x86_64 compilers generate a call to ___enable_execute_stack
24 * Note that, nested functions are not ISO C and are not supported in Clang.
27 #if !defined(__clang__)
29 typedef int (*nested_func_t
)(int x
);
38 /* Define a nested function: */
39 int bar(int x
) { return x
*5 + c
*d
; };
41 /* Assign global to point to nested function
42 * (really points to trampoline). */
45 /* Invoke nested function: */
47 if ( (*proc
)(3) != 43 )
50 if ( (*proc
)(4) != 40 )