Skip to content

Commit b8bbbe3

Browse files
committed
Remove cfg-if dependency
1 parent 55d4afd commit b8bbbe3

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ object = { version = "0.21.1", default-features = false, features = ["read", "st
2020

2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.0.2"
23-
cfg-if = "0.1.10"
2423
libloading = { version = "0.6.0", optional = true }
2524

2625
# Uncomment to use local checkout of cranelift

src/debuginfo/unwind.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,34 @@ impl<'tcx> UnwindContext<'tcx> {
9494
// =======================================================================
9595
// Everything after this line up to the end of the file is loosly based on
9696
// https://github.com/bytecodealliance/wasmtime/blob/4471a82b0c540ff48960eca6757ccce5b1b5c3e4/crates/jit/src/unwind/systemv.rs
97-
cfg_if::cfg_if! {
98-
if #[cfg(target_os = "macos")] {
99-
// On macOS, `__register_frame` takes a pointer to a single FDE
100-
let start = eh_frame.as_ptr();
101-
let end = start.add(eh_frame.len());
102-
let mut current = start;
103-
104-
// Walk all of the entries in the frame table and register them
105-
while current < end {
106-
let len = std::ptr::read::<u32>(current as *const u32) as usize;
107-
108-
// Skip over the CIE
109-
if current != start {
110-
__register_frame(current);
111-
registrations.push(current as usize);
112-
}
113-
114-
// Move to the next table entry (+4 because the length itself is not inclusive)
115-
current = current.add(len + 4);
97+
#[cfg(target_os = "macos")]
98+
{
99+
// On macOS, `__register_frame` takes a pointer to a single FDE
100+
let start = eh_frame.as_ptr();
101+
let end = start.add(eh_frame.len());
102+
let mut current = start;
103+
104+
// Walk all of the entries in the frame table and register them
105+
while current < end {
106+
let len = std::ptr::read::<u32>(current as *const u32) as usize;
107+
108+
// Skip over the CIE
109+
if current != start {
110+
__register_frame(current);
111+
registrations.push(current as usize);
116112
}
117-
} else {
118-
// On other platforms, `__register_frame` will walk the FDEs until an entry of length 0
119-
let ptr = eh_frame.as_ptr();
120-
__register_frame(ptr);
121-
registrations.push(ptr as usize);
113+
114+
// Move to the next table entry (+4 because the length itself is not inclusive)
115+
current = current.add(len + 4);
122116
}
123117
}
118+
#[cfg(not(target_os = "macos"))]
119+
{
120+
// On other platforms, `__register_frame` will walk the FDEs until an entry of length 0
121+
let ptr = eh_frame.as_ptr();
122+
__register_frame(ptr);
123+
registrations.push(ptr as usize);
124+
}
124125

125126
Some(UnwindRegistry {
126127
_frame_table: eh_frame,

0 commit comments

Comments
 (0)