Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / builtins / Unit / gcc_personality_test.c
blob160b897879fdb86d8852cfcc39df1200d8005ff8
1 // FIXME: UNSUPPORTED as currently it cannot be built by lit properly.
2 // UNSUPPORTED: true
3 // RUN: %clangxx_builtins %s %librt -o %t && %run %t
5 #include <stdlib.h>
6 #include <stdio.h>
8 extern void foo_clean(void* x);
9 extern void bar_clean(void* x);
10 extern void register_foo_local(int* x);
11 extern void register_bar_local(int* x);
12 extern void done_foo();
13 extern void done_bar();
17 * foo() is called by main() in gcc_personality_test_helper.cxx.
18 * done_bar() is implemented in C++ and will throw an exception.
19 * main() will catch the exception and verify that the cleanup
20 * routines for foo() and bar() were called by the personality
21 * function.
24 void bar() {
25 int x __attribute__((cleanup(bar_clean))) = 0;
26 register_bar_local(&x);
27 done_bar();
30 void foo() {
31 int x __attribute__((cleanup(foo_clean))) = 0;
32 register_foo_local(&x);
33 bar();
34 done_foo();