]>
Commit | Line | Data |
---|---|---|
6a06907d XL |
1 | // compile-flags: -C opt-level=0 |
2 | // ignore-arm stdcall isn't supported | |
3 | // ignore-aarch64 stdcall isn't supported | |
4 | // ignore-riscv64 stdcall isn't supported | |
5 | ||
6 | // Test that `nounwind` atributes are correctly applied to exported `stdcall` and `stdcall-unwind` | |
7 | // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable | |
8 | // optimizations above to prevent LLVM from inferring the attribute. | |
9 | ||
10 | #![crate_type = "lib"] | |
11 | #![feature(c_unwind)] | |
12 | ||
13 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { | |
14 | #[no_mangle] | |
15 | pub extern "stdcall" fn rust_item_that_cannot_unwind() { | |
16 | } | |
17 | ||
18 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { | |
19 | #[no_mangle] | |
20 | pub extern "stdcall-unwind" fn rust_item_that_can_unwind() { | |
21 | } | |
22 | ||
23 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make | |
24 | // sure that the first item is correctly marked with the `nounwind` attribute: | |
25 | // | |
26 | // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } | |
27 | // | |
28 | // Next, let's assert that the second item, which CAN unwind, does not have this attribute. | |
29 | // | |
30 | // CHECK: attributes #1 = { | |
31 | // CHECK-NOT: nounwind | |
32 | // CHECK: } |