about summary refs log tree commit diff
path: root/library/unwind
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-03-09 02:03:22 +0000
committerChris Denton <chris@chrisdenton.dev>2024-04-14 07:11:51 +0000
commitb1f1039d8bd8ffdda6a58c37f248a247fd9a4e72 (patch)
tree01aa04e96eeecd051b475aab8fc2902dc382a123 /library/unwind
parentf3c66088610c1b80110297c2d9a8b5f9265b013f (diff)
downloadrust-b1f1039d8bd8ffdda6a58c37f248a247fd9a4e72.tar.gz
rust-b1f1039d8bd8ffdda6a58c37f248a247fd9a4e72.zip
Replace libc::c_int with core::ffi::c_int
And remove the libc crate when it isn't needed
Diffstat (limited to 'library/unwind')
-rw-r--r--library/unwind/Cargo.toml4
-rw-r--r--library/unwind/src/lib.rs4
-rw-r--r--library/unwind/src/libunwind.rs2
-rw-r--r--library/unwind/src/unwinding.rs2
4 files changed, 9 insertions, 3 deletions
diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml
index b7418d1189c..bbd1db8dfa5 100644
--- a/library/unwind/Cargo.toml
+++ b/library/unwind/Cargo.toml
@@ -15,10 +15,12 @@ doc = false
 
 [dependencies]
 core = { path = "../core" }
-libc = { version = "0.2.140", features = ['rustc-dep-of-std'], default-features = false }
 compiler_builtins = "0.1.0"
 cfg-if = "1.0"
 
+[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
+libc = { version = "0.2.140", features = ['rustc-dep-of-std'], default-features = false }
+
 [target.'cfg(target_os = "xous")'.dependencies]
 unwinding = { version = "0.2.1", features = ['rustc-dep-of-std', 'unwinder', 'fde-custom'], default-features = false }
 
diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs
index 51d31a00afe..544d9fbf1ae 100644
--- a/library/unwind/src/lib.rs
+++ b/library/unwind/src/lib.rs
@@ -12,6 +12,10 @@
 )]
 #![allow(internal_features)]
 
+// Force libc to be included even if unused. This is required by many platforms.
+#[cfg(not(all(windows, target_env = "msvc")))]
+extern crate libc as _;
+
 cfg_if::cfg_if! {
     if #[cfg(target_env = "msvc")] {
         // Windows MSVC no extra unwinder support needed
diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs
index 57ce3d0fa5c..e34e73a3516 100644
--- a/library/unwind/src/libunwind.rs
+++ b/library/unwind/src/libunwind.rs
@@ -1,6 +1,6 @@
 #![allow(nonstandard_style)]
 
-use libc::{c_int, c_void};
+use core::ffi::{c_int, c_void};
 
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq)]
diff --git a/library/unwind/src/unwinding.rs b/library/unwind/src/unwinding.rs
index 95e2eb000cc..083acaeb56a 100644
--- a/library/unwind/src/unwinding.rs
+++ b/library/unwind/src/unwinding.rs
@@ -1,6 +1,6 @@
 #![allow(nonstandard_style)]
 
-use libc::{c_int, c_void};
+use core::ffi::{c_int, c_void};
 
 #[repr(C)]
 #[derive(Copy, Clone, PartialEq)]