diff --git a/Cargo.toml b/Cargo.toml index e23c666..69b9c03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,5 +27,9 @@ utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japa utest-macros = { git = "https://github.com/japaric/utest" } +[[example]] +name = "intrinsics" +required-features = ["c"] + [workspace] diff --git a/appveyor.yml b/appveyor.yml index f5a4c62..2bef109 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: install: - git submodule update --init - - curl -sSf -o rustup-init.exe https://win.rustup.rs + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain nightly -y - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - if "%TARGET%"=="i686-pc-windows-msvc" ( rustup target add %TARGET% ) @@ -18,4 +18,6 @@ test_script: - cargo build --target %TARGET% - cargo build --release --target %TARGET% - cargo test --no-default-features --features gen-tests --target %TARGET% + - cargo test --no-default-features --features "gen-tests c" --target %TARGET% - cargo test --no-default-features --features gen-tests --release --target %TARGET% + - cargo test --no-default-features --features "gen-tests c" --release --target %TARGET% diff --git a/ci/run.sh b/ci/run.sh index 4a28e8a..02b9bf1 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -34,7 +34,9 @@ case $1 in ;; *) cargo test --no-default-features --features gen-tests --target $1 + cargo test --no-default-features --features 'gen-tests c' --target $1 cargo test --no-default-features --features gen-tests --target $1 --release + cargo test --no-default-features --features 'gen-tests c' --target $1 --release ;; esac diff --git a/examples/intrinsics.rs b/examples/intrinsics.rs index 4c5c884..4015ac3 100644 --- a/examples/intrinsics.rs +++ b/examples/intrinsics.rs @@ -6,17 +6,17 @@ #![allow(unused_features)] #![cfg_attr(thumb, no_main)] #![deny(dead_code)] +#![feature(alloc_system)] #![feature(asm)] #![feature(compiler_builtins_lib)] #![feature(core_float)] #![feature(lang_items)] -#![feature(libc)] #![feature(start)] #![feature(i128_type)] #![no_std] #[cfg(not(thumb))] -extern crate libc; +extern crate alloc_system; extern crate compiler_builtins; // NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even @@ -27,7 +27,6 @@ extern crate compiler_builtins; // convention for its intrinsics that's different from other architectures; that's why some function // have an additional comment: the function name is the ARM name for the intrinsic and the comment // in the non-ARM name for the intrinsic. -#[cfg(feature = "c")] mod intrinsics { use core::num::Float; @@ -339,7 +338,6 @@ mod intrinsics { } } -#[cfg(feature = "c")] fn run() { use intrinsics::*; @@ -404,33 +402,20 @@ fn run() { bb(modti3(bb(2), bb(2))); } -#[cfg(all(feature = "c", not(thumb)))] +#[cfg(not(thumb))] #[start] fn main(_: isize, _: *const *const u8) -> isize { run(); - 0 } -#[cfg(all(not(feature = "c"), not(thumb)))] -#[start] -fn main(_: isize, _: *const *const u8) -> isize { - 0 -} - -#[cfg(all(feature = "c", thumb))] +#[cfg(thumb)] #[no_mangle] pub fn _start() -> ! { run(); loop {} } -#[cfg(all(not(feature = "c"), thumb))] -#[no_mangle] -pub fn _start() -> ! { - loop {} -} - // ARM targets need these symbols #[no_mangle] pub fn __aeabi_unwind_cpp_pr0() {} @@ -447,9 +432,11 @@ pub fn _Unwind_Resume() {} #[cfg(not(test))] #[lang = "eh_personality"] #[no_mangle] +#[allow(private_no_mangle_fns)] extern "C" fn eh_personality() {} #[cfg(not(test))] #[lang = "panic_fmt"] #[no_mangle] +#[allow(private_no_mangle_fns)] extern "C" fn panic_fmt() {}