]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/builtins/Unit/gcc_personality_test_helper.cxx
1 //===-- gcc_personality_test_helper.cxx -----------------------------------===//
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 //===----------------------------------------------------------------------===//
14 extern void foo_clean(void* x
);
15 extern void bar_clean(void* x
);
16 extern void register_foo_local(int* x
);
17 extern void register_bar_local(int* x
);
18 extern void done_foo();
19 extern void done_bar();
23 static int* foo_x
= NULL
;
24 void register_foo_local(int* x
)
29 static int* bar_x
= NULL
;
30 void register_bar_local(int* x
)
35 static bool foo_clean_called
= false;
36 void foo_clean(void* x
)
40 if ( foo_x
!= (int*)x
)
42 foo_clean_called
= true;
45 static bool bar_clean_called
= false;
46 void bar_clean(void* x
)
50 if ( bar_x
!= (int*)x
)
52 bar_clean_called
= true;
66 // foo() is in gcc_personality_test.c and calls bar() which
67 // calls done_bar() which throws an exception.
68 // main() will catch the exception and verify that the cleanup
69 // routines for foo() and bar() were called by the personality
78 if ( !foo_clean_called
)
80 if ( !bar_clean_called
)