Skip to content

Commit a09b94b

Browse files
authored
Rollup merge of rust-lang#37254 - srinivasreddy:master, r=alexcrichton
run rustfmt on libpanic_unwind
2 parents 3d57d42 + 1cc1dcc commit a09b94b

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

src/libpanic_unwind/dwarf/eh.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext) -> EHAction {
116116
// The "IP" is an index into the call-site table, with two exceptions:
117117
// -1 means 'no-action', and 0 means 'terminate'.
118118
match ip as isize {
119-
-1 => return EHAction::None,
119+
-1 => return EHAction::None,
120120
0 => return EHAction::Terminate,
121121
_ => (),
122122
}
@@ -182,12 +182,8 @@ unsafe fn read_encoded_pointer(reader: &mut DwarfReader,
182182
assert!(context.func_start != 0);
183183
context.func_start
184184
}
185-
DW_EH_PE_textrel => {
186-
(*context.get_text_start)()
187-
}
188-
DW_EH_PE_datarel => {
189-
(*context.get_data_start)()
190-
}
185+
DW_EH_PE_textrel => (*context.get_text_start)(),
186+
DW_EH_PE_datarel => (*context.get_data_start)(),
191187
_ => panic!(),
192188
};
193189

src/libpanic_unwind/emcc.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,10 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
5757
exception_object: *mut uw::_Unwind_Exception,
5858
context: *mut uw::_Unwind_Context)
5959
-> uw::_Unwind_Reason_Code {
60-
__gxx_personality_v0(version, actions,
61-
exception_class,
62-
exception_object,
63-
context)
60+
__gxx_personality_v0(version, actions, exception_class, exception_object, context)
6461
}
6562

66-
extern {
63+
extern "C" {
6764
fn __cxa_allocate_exception(thrown_size: libc::size_t) -> *mut libc::c_void;
6865
fn __cxa_free_exception(thrown_exception: *mut libc::c_void);
6966
fn __cxa_throw(thrown_exception: *mut libc::c_void,

src/libpanic_unwind/gcc.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,16 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
156156
let eh_action = find_eh_action(context);
157157
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
158158
match eh_action {
159-
EHAction::None | EHAction::Cleanup(_) => return uw::_URC_CONTINUE_UNWIND,
159+
EHAction::None |
160+
EHAction::Cleanup(_) => return uw::_URC_CONTINUE_UNWIND,
160161
EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND,
161162
EHAction::Terminate => return uw::_URC_FATAL_PHASE1_ERROR,
162163
}
163164
} else {
164165
match eh_action {
165166
EHAction::None => return uw::_URC_CONTINUE_UNWIND,
166-
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
167+
EHAction::Cleanup(lpad) |
168+
EHAction::Catch(lpad) => {
167169
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t);
168170
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0);
169171
uw::_Unwind_SetIP(context, lpad);
@@ -182,7 +184,7 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
182184
unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
183185
exception_object: *mut uw::_Unwind_Exception,
184186
context: *mut uw::_Unwind_Context)
185-
-> uw::_Unwind_Reason_Code {
187+
-> uw::_Unwind_Reason_Code {
186188
let state = state as c_int;
187189
let action = state & uw::_US_ACTION_MASK as c_int;
188190
let search_phase = if action == uw::_US_VIRTUAL_UNWIND_FRAME as c_int {
@@ -191,7 +193,7 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
191193
// we want to continue unwinding the stack, otherwise all our backtraces
192194
// would end at __rust_try
193195
if state & uw::_US_FORCE_UNWIND as c_int != 0 {
194-
return continue_unwind(exception_object, context)
196+
return continue_unwind(exception_object, context);
195197
}
196198
true
197199
} else if action == uw::_US_UNWIND_FRAME_STARTING as c_int {
@@ -207,7 +209,9 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
207209
// To preserve signatures of functions like _Unwind_GetLanguageSpecificData(), which
208210
// take only the context pointer, GCC personality routines stash a pointer to exception_object
209211
// in the context, using location reserved for ARM's "scratch register" (r12).
210-
uw::_Unwind_SetGR(context, uw::UNWIND_POINTER_REG, exception_object as uw::_Unwind_Ptr);
212+
uw::_Unwind_SetGR(context,
213+
uw::UNWIND_POINTER_REG,
214+
exception_object as uw::_Unwind_Ptr);
211215
// ...A more principled approach would be to provide the full definition of ARM's
212216
// _Unwind_Context in our libunwind bindings and fetch the required data from there directly,
213217
// bypassing DWARF compatibility functions.
@@ -223,7 +227,8 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
223227
} else {
224228
match eh_action {
225229
EHAction::None => return continue_unwind(exception_object, context),
226-
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
230+
EHAction::Cleanup(lpad) |
231+
EHAction::Catch(lpad) => {
227232
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t);
228233
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0);
229234
uw::_Unwind_SetIP(context, lpad);
@@ -247,8 +252,8 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
247252
// defined in libgcc
248253
extern "C" {
249254
fn __gnu_unwind_frame(exception_object: *mut uw::_Unwind_Exception,
250-
context: *mut uw::_Unwind_Context)
251-
-> uw::_Unwind_Reason_Code;
255+
context: *mut uw::_Unwind_Context)
256+
-> uw::_Unwind_Reason_Code;
252257
}
253258
}
254259

src/libpanic_unwind/seh64_gnu.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ unsafe fn find_landing_pad(dc: &c::DISPATCHER_CONTEXT) -> Option<usize> {
129129
};
130130
match find_eh_action(dc.HandlerData, &eh_ctx) {
131131
EHAction::None => None,
132-
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => Some(lpad),
132+
EHAction::Cleanup(lpad) |
133+
EHAction::Catch(lpad) => Some(lpad),
133134
EHAction::Terminate => intrinsics::abort(),
134135
}
135136
}

0 commit comments

Comments
 (0)