Remove building with NOCRYPTO option
[minix3.git] / sys / external / bsd / compiler_rt / dist / test / Unit / gcc_personality_test.c
blobf9598c697eb692a9198efe8c8ddfbd1e016e7782
1 /* ===-- gcc_personality_test.c - Tests __gcc_personality_v0 -------------===
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 * ===----------------------------------------------------------------------===
9 */
12 #include <stdlib.h>
13 #include <stdio.h>
15 extern void foo_clean(void* x);
16 extern void bar_clean(void* x);
17 extern void register_foo_local(int* x);
18 extern void register_bar_local(int* x);
19 extern void done_foo();
20 extern void done_bar();
24 * foo() is called by main() in gcc_personality_test_helper.cxx.
25 * done_bar() is implemented in C++ and will throw an exception.
26 * main() will catch the exception and verify that the cleanup
27 * routines for foo() and bar() were called by the personality
28 * function.
31 void bar() {
32 int x __attribute__((cleanup(bar_clean))) = 0;
33 register_bar_local(&x);
34 done_bar();
37 void foo() {
38 int x __attribute__((cleanup(foo_clean))) = 0;
39 register_foo_local(&x);
40 bar();
41 done_foo();