Use unsupported args for espidf and vita

This commit is contained in:
Thalia Archibald 2025-04-12 02:37:24 -07:00
parent 6ffebb65d6
commit e014fd6b87
3 changed files with 3 additions and 14 deletions

View file

@ -3,7 +3,7 @@
#![forbid(unsafe_op_in_unsafe_fn)]
cfg_if::cfg_if! {
if #[cfg(target_family = "unix")] {
if #[cfg(all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))))] {
mod unix;
pub use unix::*;
} else if #[cfg(target_family = "windows")] {

View file

@ -226,16 +226,3 @@ mod imp {
(argc as isize, argv.cast())
}
}
#[cfg(any(target_os = "espidf", target_os = "vita"))]
mod imp {
use crate::ffi::c_char;
use crate::ptr;
#[inline(always)]
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
pub fn argc_argv() -> (isize, *const *const c_char) {
(0, ptr::null())
}
}

View file

@ -26,6 +26,7 @@ pub mod time;
pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
#[cfg(not(target_os = "espidf"))]
#[cfg_attr(target_os = "vita", allow(unused_variables))]
// SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
// See `fn init()` in `library/std/src/rt.rs` for docs on `sigpipe`.
@ -46,6 +47,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
reset_sigpipe(sigpipe);
stack_overflow::init();
#[cfg(not(target_os = "vita"))]
crate::sys::args::init(argc, argv);
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread