]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/unwind-abis/system-unwind-abi.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / codegen / unwind-abis / system-unwind-abi.rs
CommitLineData
6a06907d
XL
1// compile-flags: -C opt-level=0
2
f2b60f7d 3// Test that `nounwind` attributes are correctly applied to exported `system` and `system-unwind`
6a06907d
XL
4// extern functions. `system-unwind` functions MUST NOT have this attribute. We disable
5// optimizations above to prevent LLVM from inferring the attribute.
6
7#![crate_type = "lib"]
8#![feature(c_unwind)]
9
10// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
11#[no_mangle]
12pub extern "system" fn rust_item_that_cannot_unwind() {
13}
14
15// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
16#[no_mangle]
17pub extern "system-unwind" fn rust_item_that_can_unwind() {
18}
19
20// Now, make some assertions that the LLVM attributes for these functions are correct. First, make
21// sure that the first item is correctly marked with the `nounwind` attribute:
22//
23// CHECK: attributes #0 = { {{.*}}nounwind{{.*}} }
24//
25// Next, let's assert that the second item, which CAN unwind, does not have this attribute.
26//
27// CHECK: attributes #1 = {
28// CHECK-NOT: nounwind
29// CHECK: }