Skip to content

Commit

Permalink
android: Remove libstd hacks for unsupported Android APIs
Browse files Browse the repository at this point in the history
Our minimum supported API version is 21, remove hacks to support older
Android APIs.
  • Loading branch information
maurer committed Jul 30, 2024
1 parent f8060d2 commit 6586619
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 106 deletions.
2 changes: 1 addition & 1 deletion library/std/src/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log2(self) -> f32 {
crate::sys::log2f32(self)
intrinsics::log2f32(self)
}

/// Returns the base 10 logarithm of the number.
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log2(self) -> f64 {
crate::sys::log2f64(self)
intrinsics::log2f64(self)
}

/// Returns the base 10 logarithm of the number.
Expand Down
18 changes: 0 additions & 18 deletions library/std/src/sys/pal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,5 @@ cfg_if::cfg_if! {
}
}

#[cfg(not(test))]
cfg_if::cfg_if! {
if #[cfg(target_os = "android")] {
pub use self::android::log2f32;
pub use self::android::log2f64;
} else {
#[inline]
pub fn log2f32(n: f32) -> f32 {
unsafe { crate::intrinsics::log2f32(n) }
}

#[inline]
pub fn log2f64(n: f64) -> f64 {
unsafe { crate::intrinsics::log2f64(n) }
}
}
}

#[cfg(not(target_os = "uefi"))]
pub type RawOsError = i32;
81 changes: 0 additions & 81 deletions library/std/src/sys/pal/unix/android.rs

This file was deleted.

5 changes: 0 additions & 5 deletions library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::io::ErrorKind;
pub mod weak;

pub mod alloc;
pub mod android;
pub mod args;
pub mod env;
pub mod fd;
Expand Down Expand Up @@ -237,12 +236,8 @@ pub unsafe fn cleanup() {
}

#[allow(unused_imports)]
#[cfg(not(target_os = "android"))]
pub use libc::signal;

#[cfg(target_os = "android")]
pub use crate::sys::android::signal;

#[inline]
pub(crate) fn is_interrupted(errno: i32) -> bool {
errno == libc::EINTR
Expand Down

0 comments on commit 6586619

Please sign in to comment.