From 7c25e8653103c4a0702f0ea94d8fa44ad6472a4d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 18 Jan 2026 18:12:45 +0100 Subject: [PATCH 1/2] Make libc_type!() check even outside test builds --- c-gull/src/use_libc.rs | 18 ++++++++---------- c-scape/src/use_libc.rs | 18 ++++++++---------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/c-gull/src/use_libc.rs b/c-gull/src/use_libc.rs index d370f5a..1f3d352 100644 --- a/c-gull/src/use_libc.rs +++ b/c-gull/src/use_libc.rs @@ -59,16 +59,14 @@ macro_rules! libc { #[cfg(all(feature = "take-charge", feature = "thread"))] macro_rules! libc_type { ($name:ident, $libc:ident) => { - #[cfg(test)] - static_assertions::const_assert_eq!( - core::mem::size_of::<$name>(), - core::mem::size_of::() - ); - #[cfg(test)] - static_assertions::const_assert_eq!( - core::mem::align_of::<$name>(), - core::mem::align_of::() - ); + const _: () = { + if core::mem::size_of::<$name>() != core::mem::size_of::() { + panic!(); + } + if core::mem::align_of::<$name>() != core::mem::align_of::() { + panic!(); + } + }; }; } diff --git a/c-scape/src/use_libc.rs b/c-scape/src/use_libc.rs index d370f5a..1f3d352 100644 --- a/c-scape/src/use_libc.rs +++ b/c-scape/src/use_libc.rs @@ -59,16 +59,14 @@ macro_rules! libc { #[cfg(all(feature = "take-charge", feature = "thread"))] macro_rules! libc_type { ($name:ident, $libc:ident) => { - #[cfg(test)] - static_assertions::const_assert_eq!( - core::mem::size_of::<$name>(), - core::mem::size_of::() - ); - #[cfg(test)] - static_assertions::const_assert_eq!( - core::mem::align_of::<$name>(), - core::mem::align_of::() - ); + const _: () = { + if core::mem::size_of::<$name>() != core::mem::size_of::() { + panic!(); + } + if core::mem::align_of::<$name>() != core::mem::align_of::() { + panic!(); + } + }; }; } From 1cb93eb02589c5f5d85917892515476750d8d715 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 20 Jan 2026 20:17:37 +0100 Subject: [PATCH 2/2] Add stubs for a couple of wide character functions Rustc needs these. Likely through its dependency LLVM. --- c-scape/src/todo.rs | 12 ++++++++++++ c-scape/src/todo/locale.rs | 8 ++++++++ c-scape/src/todo/wchar.rs | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/c-scape/src/todo.rs b/c-scape/src/todo.rs index 2f1af33..92656d0 100644 --- a/c-scape/src/todo.rs +++ b/c-scape/src/todo.rs @@ -293,6 +293,10 @@ unsafe extern "C" fn strftime() { todo!("strftime") } #[no_mangle] +unsafe extern "C" fn wcsftime() { + todo!("wcsftime") +} +#[no_mangle] unsafe extern "C" fn __isoc99_scanf() { todo!("__isoc99_scanf") } @@ -1169,3 +1173,11 @@ unsafe extern "C" fn backtrace() { unsafe extern "C" fn backtrace_symbols() { todo!("backtrace_symbols") } +#[no_mangle] +unsafe extern "C" fn getwc() { + todo!("getwc") +} +#[no_mangle] +unsafe extern "C" fn putwc() { + todo!("putwc") +} diff --git a/c-scape/src/todo/locale.rs b/c-scape/src/todo/locale.rs index bdcf6c5..0002f59 100644 --- a/c-scape/src/todo/locale.rs +++ b/c-scape/src/todo/locale.rs @@ -40,3 +40,11 @@ unsafe extern "C" fn strtoll_l() { unsafe extern "C" fn strtoull_l() { todo!("strtoull_l") } +#[no_mangle] +unsafe extern "C" fn wcsxfrm() { + todo!("wcsxfrm") +} +#[no_mangle] +unsafe extern "C" fn wcscoll() { + todo!("wcscoll") +} diff --git a/c-scape/src/todo/wchar.rs b/c-scape/src/todo/wchar.rs index 1b620c0..1cba1b5 100644 --- a/c-scape/src/todo/wchar.rs +++ b/c-scape/src/todo/wchar.rs @@ -280,3 +280,11 @@ unsafe extern "C" fn iswupper() { unsafe extern "C" fn iswxdigit() { todo!("iswxdigit") } +#[no_mangle] +unsafe extern "C" fn towupper() { + todo!("towupper") +} +#[no_mangle] +unsafe extern "C" fn towlower() { + todo!("towlower") +}