diff options
author | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-10-29 00:27:08 +0000 |
---|---|---|
committer | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-10-29 00:27:08 +0000 |
commit | 07d6005bdc89f40ecd31fa2c4ab0ad84183b1b9d (patch) | |
tree | 6a054dc1c4cbf64b8e66546ff0a3677da79d113b | |
parent | a8eceedb82945e9c043e8160307dd66a6b866407 (diff) | |
download | bcm5719-llvm-07d6005bdc89f40ecd31fa2c4ab0ad84183b1b9d.tar.gz bcm5719-llvm-07d6005bdc89f40ecd31fa2c4ab0ad84183b1b9d.zip |
Nested function test in compiler-rt should not be run under Clang.
llvm-svn: 85456
-rw-r--r-- | compiler-rt/test/Unit/trampoline_setup_test.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/compiler-rt/test/Unit/trampoline_setup_test.c b/compiler-rt/test/Unit/trampoline_setup_test.c index 630d5c46ad8..60c3653cbe0 100644 --- a/compiler-rt/test/Unit/trampoline_setup_test.c +++ b/compiler-rt/test/Unit/trampoline_setup_test.c @@ -1,11 +1,12 @@ -//===-- trampoline_setup_test.c - Test __trampoline_setup -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===-- trampoline_setup_test.c - Test __trampoline_setup -----------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ #include <stdio.h> @@ -13,11 +14,17 @@ #include <stdint.h> #include <sys/mman.h> -// -// Tests nested functions -// The ppc compiler generates a call to __trampoline_setup -// The i386 and x86_64 compilers generate a call to ___enable_execute_stack -// +/* + * Tests nested functions + * The ppc compiler generates a call to __trampoline_setup + * The i386 and x86_64 compilers generate a call to ___enable_execute_stack + */ + +/* + * Note that, nested functions are not ISO C and are not supported in Clang. + */ + +#ifdef __gcc__ && !__clang__ typedef int (*nested_func_t)(int x); @@ -25,18 +32,18 @@ nested_func_t proc; int main() { - // some locals + /* Some locals */ int c = 10; int d = 7; - // define a nested function + /* Define a nested function: */ int bar(int x) { return x*5 + c*d; }; - // assign global to point to nested function - // (really points to trampoline) + /* Assign global to point to nested function + * (really points to trampoline). */ proc = bar; - // invoke nested function + /* Invoke nested function: */ c = 4; if ( (*proc)(3) != 43 ) return 1; @@ -44,6 +51,8 @@ int main() if ( (*proc)(4) != 40 ) return 1; - // success + /* Success. */ return 0; } + +#endif /* __clang__ */ |