Skip to content

Commit e05caa1

Browse files
author
Jorge Aparicio
committed
fix warnings
1 parent 8f0847e commit e05caa1

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

ci/run.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
set -e
1+
set -ex
2+
3+
export RUST_BACKTRACE=1
24

35
# Test our implementation
46
case $1 in

src/bin/intrinsics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![cfg_attr(thumb, no_main)]
88
#![deny(dead_code)]
99
#![feature(asm)]
10+
#![feature(compiler_builtins_lib)]
1011
#![feature(core_float)]
1112
#![feature(lang_items)]
1213
#![feature(libc)]
@@ -15,7 +16,7 @@
1516

1617
#[cfg(not(thumb))]
1718
extern crate libc;
18-
extern crate rustc_builtins;
19+
extern crate compiler_builtins;
1920

2021
// NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
2122
// compiler-rt provides a C/assembly implementation.

src/int/sdiv.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ macro_rules! divmod {
4343
fn $div(a: $ty, b: $ty) -> $ty;
4444
}
4545

46-
let r = unsafe { $div(a, b) };
46+
let r = match () {
47+
#[cfg(not(all(feature = "c", any(target_arch = "x86"))))]
48+
() => $div(a, b),
49+
#[cfg(all(feature = "c", any(target_arch = "x86")))]
50+
() => unsafe { $div(a, b) },
51+
};
4752
*rem = a - (r * b);
4853
r
4954
}

src/int/udiv.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
6565
fn __udivsi3(n: u32, d: u32) -> u32;
6666
}
6767

68-
n - unsafe { __udivsi3(n, d) * d }
68+
let q = match () {
69+
#[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
70+
() => unsafe { __udivsi3(n, d) },
71+
#[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
72+
() => __udivsi3(n, d),
73+
};
74+
75+
n - q * d
6976
}
7077

7178
/// 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 {
7784
fn __udivsi3(n: u32, d: u32) -> u32;
7885
}
7986

80-
let q = unsafe { __udivsi3(n, d) };
87+
let q = match () {
88+
#[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
89+
() => unsafe { __udivsi3(n, d) },
90+
#[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
91+
() => __udivsi3(n, d),
92+
};
8193
if let Some(rem) = rem {
8294
*rem = n - (q * d);
8395
}

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![cfg_attr(not(stage0), deny(warnings))]
22
#![cfg_attr(not(test), no_std)]
3-
#![compiler_builtins]
3+
#![cfg_attr(rustbuild, compiler_builtins)]
44
#![crate_name = "compiler_builtins"]
55
#![crate_type = "rlib"]
66
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
@@ -15,7 +15,7 @@
1515
#![feature(naked_functions)]
1616
#![feature(staged_api)]
1717
#![no_builtins]
18-
#![unstable(feature = "compiler_builtins",
18+
#![unstable(feature = "compiler_builtins_lib",
1919
reason = "Compiler builtins. Will never become stable.",
2020
issue = "0")]
2121

0 commit comments

Comments
 (0)