fix warnings

master
Jorge Aparicio 2016-10-10 19:45:34 -05:00
parent 8f0847eb94
commit e05caa1227
5 changed files with 27 additions and 7 deletions

View File

@ -1,4 +1,6 @@
set -e
set -ex
export RUST_BACKTRACE=1
# Test our implementation
case $1 in

View File

@ -7,6 +7,7 @@
#![cfg_attr(thumb, no_main)]
#![deny(dead_code)]
#![feature(asm)]
#![feature(compiler_builtins_lib)]
#![feature(core_float)]
#![feature(lang_items)]
#![feature(libc)]
@ -15,7 +16,7 @@
#[cfg(not(thumb))]
extern crate libc;
extern crate rustc_builtins;
extern crate compiler_builtins;
// NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
// compiler-rt provides a C/assembly implementation.

View File

@ -43,7 +43,12 @@ macro_rules! divmod {
fn $div(a: $ty, b: $ty) -> $ty;
}
let r = unsafe { $div(a, b) };
let r = match () {
#[cfg(not(all(feature = "c", any(target_arch = "x86"))))]
() => $div(a, b),
#[cfg(all(feature = "c", any(target_arch = "x86")))]
() => unsafe { $div(a, b) },
};
*rem = a - (r * b);
r
}

View File

@ -65,7 +65,14 @@ pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
fn __udivsi3(n: u32, d: u32) -> u32;
}
n - unsafe { __udivsi3(n, d) * d }
let q = match () {
#[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
() => unsafe { __udivsi3(n, d) },
#[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
() => __udivsi3(n, d),
};
n - q * d
}
/// Returns `n / d` and sets `*rem = n % d`
@ -77,7 +84,12 @@ pub extern "C" fn __udivmodsi4(n: u32, d: u32, rem: Option<&mut u32>) -> u32 {
fn __udivsi3(n: u32, d: u32) -> u32;
}
let q = unsafe { __udivsi3(n, d) };
let q = match () {
#[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
() => unsafe { __udivsi3(n, d) },
#[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
() => __udivsi3(n, d),
};
if let Some(rem) = rem {
*rem = n - (q * d);
}

View File

@ -1,6 +1,6 @@
#![cfg_attr(not(stage0), deny(warnings))]
#![cfg_attr(not(test), no_std)]
#![compiler_builtins]
#![cfg_attr(rustbuild, compiler_builtins)]
#![crate_name = "compiler_builtins"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
@ -15,7 +15,7 @@
#![feature(naked_functions)]
#![feature(staged_api)]
#![no_builtins]
#![unstable(feature = "compiler_builtins",
#![unstable(feature = "compiler_builtins_lib",
reason = "Compiler builtins. Will never become stable.",
issue = "0")]