about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-09-11 20:10:43 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-09-14 11:36:09 +0200
commit3ef75d5774cb9a7cf839a69341c620b98fa9c7df (patch)
tree390d168efade16f67b4651405d89a0884d51ee0a /src/test/codegen
parente4e67bd489934702e4958a03bb4c948919d38920 (diff)
downloadrust-3ef75d5774cb9a7cf839a69341c620b98fa9c7df.tar.gz
rust-3ef75d5774cb9a7cf839a69341c620b98fa9c7df.zip
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.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/extern-functions.rs23
1 files changed, 23 insertions, 0 deletions
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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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();
+}