Skip to content

Switch from extern "C" to extern "C-unwind" #718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/ark/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@ pub(crate) fn console_inputs() -> anyhow::Result<ConsoleInputs> {
// global `RMain` singleton.

#[no_mangle]
pub extern "C" fn r_read_console(
pub extern "C-unwind" fn r_read_console(
prompt: *const c_char,
buf: *mut c_uchar,
buflen: c_int,
Expand Down
6 changes: 3 additions & 3 deletions crates/harp/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ where
};
let payload = &mut callback_data as *mut _ as *mut c_void;

extern "C" fn callback<'env, F, T>(payload: *mut c_void) -> SEXP
extern "C-unwind" fn callback<'env, F, T>(payload: *mut c_void) -> SEXP
where
F: FnOnce() -> T,
F: 'env,
Expand All @@ -202,7 +202,7 @@ where
harp::r_null()
}

extern "C" fn handler<'env, F, T>(err: SEXP, payload: *mut c_void) -> SEXP
extern "C-unwind" fn handler<'env, F, T>(err: SEXP, payload: *mut c_void) -> SEXP
where
F: FnOnce() -> T,
F: 'env,
Expand Down Expand Up @@ -328,7 +328,7 @@ where
};
let payload = &mut callback_data as *mut _ as *mut c_void;

extern "C" fn callback<'env, F, T>(args: *mut c_void)
extern "C-unwind" fn callback<'env, F, T>(args: *mut c_void)
where
F: FnOnce() -> T,
F: 'env,
Expand Down
8 changes: 4 additions & 4 deletions crates/libr/src/r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ functions::generate! {
pub fn R_RunPendingFinalizers();

pub fn R_ToplevelExec(
fun: Option<unsafe extern "C" fn(arg1: *mut std::ffi::c_void)>,
fun: Option<unsafe extern "C-unwind" fn(arg1: *mut std::ffi::c_void)>,
data: *mut std::ffi::c_void
) -> Rboolean;

pub fn R_withCallingErrorHandler(
body: Option<unsafe extern "C" fn(args: *mut std::ffi::c_void) -> SEXP>,
body: Option<unsafe extern "C-unwind" fn(args: *mut std::ffi::c_void) -> SEXP>,
bdata: *mut std::ffi::c_void,
handler: Option<unsafe extern "C" fn(err: SEXP, args: *mut std::ffi::c_void) -> SEXP>,
handler: Option<unsafe extern "C-unwind" fn(err: SEXP, args: *mut std::ffi::c_void) -> SEXP>,
hdata: *mut std::ffi::c_void
) -> SEXP;

Expand Down Expand Up @@ -712,7 +712,7 @@ mutable_globals::generate! {

#[cfg(target_family = "unix")]
pub static mut ptr_R_ReadConsole: Option<
unsafe extern "C" fn(
unsafe extern "C-unwind" fn(
arg1: *const std::ffi::c_char,
arg2: *mut std::ffi::c_uchar,
arg3: std::ffi::c_int,
Expand Down
2 changes: 1 addition & 1 deletion crates/libr/src/sys/windows/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub struct structRstart {
#[doc = "HOME"]
pub home: *mut ::std::os::raw::c_char,
pub ReadConsole: ::std::option::Option<
unsafe extern "C" fn(
unsafe extern "C-unwind" fn(
arg1: *const ::std::os::raw::c_char,
arg2: *mut ::std::os::raw::c_uchar,
arg3: ::std::os::raw::c_int,
Expand Down
Loading