mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 19:55:07 +01:00
cleanup
This commit is contained in:
parent
b795ee80c9
commit
d03d027a54
6 changed files with 11 additions and 8 deletions
|
|
@ -7,3 +7,4 @@ panic = "abort"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
lto = "thin"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["staticlib", "rlib"]
|
crate-type = ["staticlib", "rlib", "cdylib"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
#![feature(panic_info_message)]
|
#![feature(panic_info_message)]
|
||||||
#![deny(clippy::no_mangle_with_rust_abi)]
|
#![deny(clippy::no_mangle_with_rust_abi)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
|
|
||||||
mod rt;
|
mod rt;
|
||||||
mod stdio;
|
mod stdio;
|
||||||
|
|
@ -19,7 +20,7 @@ fn rust_eh_personality() {
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
fn handler(arg: &core::panic::PanicInfo) -> ! {
|
fn handler(arg: &core::panic::PanicInfo<'_>) -> ! {
|
||||||
let args = format_args!("<no message>");
|
let args = format_args!("<no message>");
|
||||||
let payload = arg.message().unwrap_or(&args);
|
let payload = arg.message().unwrap_or(&args);
|
||||||
libuwuc::io::println!("panicked: {payload}");
|
libuwuc::io::println!("panicked: {payload}");
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub unsafe extern "C" fn puts(s: *const c_char) -> i32 {
|
||||||
// RAW FD:
|
// RAW FD:
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn open(path: SharedThinCstr, flags: i32) -> Fd {
|
pub unsafe extern "C" fn open(path: SharedThinCstr<'_>, flags: i32) -> Fd {
|
||||||
libuwuc::io::fd::open(path, flags).into_ok_or_errno()
|
libuwuc::io::fd::open(path, flags).into_ok_or_errno()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,8 +88,8 @@ pub static stderr: &FileStream = &FileStream::from_raw_fd(STDERR);
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn fopen<'a>(
|
pub unsafe extern "C" fn fopen<'a>(
|
||||||
pathname: SharedThinCstr,
|
pathname: SharedThinCstr<'_>,
|
||||||
mode: SharedThinCstr,
|
mode: SharedThinCstr<'_>,
|
||||||
) -> Option<&'a FileStream> {
|
) -> Option<&'a FileStream> {
|
||||||
libuwuc::io::stream::fopen(pathname, mode)
|
libuwuc::io::stream::fopen(pathname, mode)
|
||||||
.map_err(|err| libuwuc::error::set_errno(err.0))
|
.map_err(|err| libuwuc::error::set_errno(err.0))
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,6 @@
|
||||||
packages = (with pkgs; [
|
packages = (with pkgs; [
|
||||||
gef
|
gef
|
||||||
rust-bindgen
|
rust-bindgen
|
||||||
|
shellcheck
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ clean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for test in "$SCRIPT_DIR"/tests/c/*; do
|
for test in "$SCRIPT_DIR"/tests/c/*; do
|
||||||
name=$(basename $test .c)
|
name=$(basename "$test" .c)
|
||||||
printf "test $name "
|
printf "test %s " "$test"
|
||||||
|
|
||||||
flags=$(grep "//@flags: " "$test" | sed 's#//@flags: ##')
|
flags=$(grep "//@flags: " "$test" | sed 's#//@flags: ##')
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ for test in "$SCRIPT_DIR"/tests/c/*; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$SCRIPT_DIR/tests"
|
cd "$SCRIPT_DIR/tests" || exit 1
|
||||||
OUTPUT=$("$test_dir/$name")
|
OUTPUT=$("$test_dir/$name")
|
||||||
code="$?"
|
code="$?"
|
||||||
if [ "$code" -ne "0" ]; then
|
if [ "$code" -ne "0" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue