Skip to content

Commit 9d2ec40

Browse files
committed
Rollup merge of #33938 - srinivasreddy:rustfmt_libunwind, r=Manishearth
run rustfmt on libunwind
2 parents 21dc6c2 + 5ed45ef commit 9d2ec40

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

src/libunwind/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ extern crate libc;
2727
mod libunwind;
2828
#[cfg(not(target_env = "msvc"))]
2929
pub use libunwind::*;
30-

src/libunwind/libunwind.rs

+20-27
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub enum _Unwind_State {
3838
_US_UNWIND_FRAME_RESUME = 2,
3939
_US_ACTION_MASK = 3,
4040
_US_FORCE_UNWIND = 8,
41-
_US_END_OF_STACK = 16
41+
_US_END_OF_STACK = 16,
4242
}
4343

4444
#[repr(C)]
@@ -59,9 +59,8 @@ pub type _Unwind_Exception_Class = u64;
5959

6060
pub type _Unwind_Word = libc::uintptr_t;
6161

62-
pub type _Unwind_Trace_Fn =
63-
extern fn(ctx: *mut _Unwind_Context,
64-
arg: *mut libc::c_void) -> _Unwind_Reason_Code;
62+
pub type _Unwind_Trace_Fn = extern "C" fn(ctx: *mut _Unwind_Context, arg: *mut libc::c_void)
63+
-> _Unwind_Reason_Code;
6564

6665
#[cfg(target_arch = "x86")]
6766
pub const unwinder_private_data_size: usize = 5;
@@ -97,9 +96,8 @@ pub struct _Unwind_Exception {
9796

9897
pub enum _Unwind_Context {}
9998

100-
pub type _Unwind_Exception_Cleanup_Fn =
101-
extern "C" fn(unwind_code: _Unwind_Reason_Code,
102-
exception: *mut _Unwind_Exception);
99+
pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
100+
exception: *mut _Unwind_Exception);
103101

104102
#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")),
105103
target_os = "freebsd",
@@ -127,20 +125,18 @@ pub type _Unwind_Exception_Cleanup_Fn =
127125
#[cfg_attr(all(target_os = "windows", target_env = "gnu"),
128126
link(name = "gcc_eh"))]
129127
#[cfg(not(cargobuild))]
130-
extern {}
128+
extern "C" {}
131129

132-
extern {
130+
extern "C" {
133131
// iOS on armv7 uses SjLj exceptions and requires to link
134132
// against corresponding routine (..._SjLj_...)
135133
#[cfg(not(all(target_os = "ios", target_arch = "arm")))]
136134
#[unwind]
137-
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception)
138-
-> _Unwind_Reason_Code;
135+
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
139136

140137
#[cfg(all(target_os = "ios", target_arch = "arm"))]
141138
#[unwind]
142-
fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception)
143-
-> _Unwind_Reason_Code;
139+
fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
144140

145141
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
146142

@@ -151,28 +147,26 @@ extern {
151147
#[cfg(not(all(target_os = "ios", target_arch = "arm")))]
152148
pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
153149
trace_argument: *mut libc::c_void)
154-
-> _Unwind_Reason_Code;
150+
-> _Unwind_Reason_Code;
155151

156152
// available since GCC 4.2.0, should be fine for our purpose
157153
#[cfg(all(not(all(target_os = "android", target_arch = "arm")),
158154
not(all(target_os = "linux", target_arch = "arm"))))]
159155
pub fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
160156
ip_before_insn: *mut libc::c_int)
161-
-> libc::uintptr_t;
157+
-> libc::uintptr_t;
162158

163159
#[cfg(all(not(target_os = "android"),
164160
not(all(target_os = "linux", target_arch = "arm"))))]
165-
pub fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
166-
-> *mut libc::c_void;
161+
pub fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void) -> *mut libc::c_void;
167162
}
168163

169164
// ... and now we just providing access to SjLj counterspart
170165
// through a standard name to hide those details from others
171166
// (see also comment above regarding _Unwind_RaiseException)
172167
#[cfg(all(target_os = "ios", target_arch = "arm"))]
173168
#[inline]
174-
pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception)
175-
-> _Unwind_Reason_Code {
169+
pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) -> _Unwind_Reason_Code {
176170
_Unwind_SjLj_RaiseException(exc)
177171
}
178172

@@ -207,18 +201,20 @@ pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t {
207201
}
208202

209203
type _Unwind_Word = libc::c_uint;
210-
extern {
204+
extern "C" {
211205
fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
212206
klass: _Unwind_VRS_RegClass,
213207
word: _Unwind_Word,
214208
repr: _Unwind_VRS_DataRepresentation,
215209
data: *mut libc::c_void)
216-
-> _Unwind_VRS_Result;
210+
-> _Unwind_VRS_Result;
217211
}
218212

219213
let mut val: _Unwind_Word = 0;
220214
let ptr = &mut val as *mut _Unwind_Word;
221-
let _ = _Unwind_VRS_Get(ctx, _Unwind_VRS_RegClass::_UVRSC_CORE, 15,
215+
let _ = _Unwind_VRS_Get(ctx,
216+
_Unwind_VRS_RegClass::_UVRSC_CORE,
217+
15,
222218
_Unwind_VRS_DataRepresentation::_UVRSD_UINT32,
223219
ptr as *mut libc::c_void);
224220
(val & !1) as libc::uintptr_t
@@ -230,8 +226,7 @@ pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t {
230226
all(target_os = "linux", target_arch = "arm")))]
231227
pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
232228
ip_before_insn: *mut libc::c_int)
233-
-> libc::uintptr_t
234-
{
229+
-> libc::uintptr_t {
235230
*ip_before_insn = 0;
236231
_Unwind_GetIP(ctx)
237232
}
@@ -240,8 +235,6 @@ pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
240235
// a no-op
241236
#[cfg(any(target_os = "android",
242237
all(target_os = "linux", target_arch = "arm")))]
243-
pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
244-
-> *mut libc::c_void
245-
{
238+
pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void) -> *mut libc::c_void {
246239
pc
247240
}

0 commit comments

Comments
 (0)