From 3ef75d5774cb9a7cf839a69341c620b98fa9c7df Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Fri, 11 Sep 2015 20:10:43 +0200 Subject: Mark all extern functions as nounwind Unwinding across an FFI boundary is undefined behaviour, so we can mark all external function as nounwind. The obvious exception are those functions that actually perform the unwinding. --- src/test/codegen/extern-functions.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/codegen/extern-functions.rs (limited to 'src/test/codegen') diff --git a/src/test/codegen/extern-functions.rs b/src/test/codegen/extern-functions.rs new file mode 100644 index 00000000000..4c30b5ce02f --- /dev/null +++ b/src/test/codegen/extern-functions.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -C no-prepopulate-passes + +#![feature(unwind_attributes)] + +extern { +// CHECK: Function Attrs: nounwind +// CHECK-NEXT: declare void @extern_fn + fn extern_fn(); +// CHECK-NOT: Function Attrs: nounwind +// CHECK: declare void @unwinding_extern_fn + #[unwind] + fn unwinding_extern_fn(); +} -- cgit 1.4.1-3-g733a5