Skip to content

Commit 60599df

Browse files
committed
[emscripten] Disable code paths that don't work on emscripten
1 parent ad91873 commit 60599df

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

src/libstd/sys/unix/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ pub fn init() {
8383
}
8484
}
8585

86-
#[cfg(not(target_os = "nacl"))]
86+
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
8787
unsafe fn reset_sigpipe() {
8888
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
8989
}
90-
#[cfg(target_os = "nacl")]
90+
#[cfg(any(target_os = "nacl", target_os = "emscripten"))]
9191
unsafe fn reset_sigpipe() {}
9292
}
9393

src/libstd/sys/unix/os.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,13 @@ pub fn home_dir() -> Option<PathBuf> {
551551

552552
#[cfg(any(target_os = "android",
553553
target_os = "ios",
554-
target_os = "nacl"))]
554+
target_os = "nacl",
555+
target_os = "emscripten"))]
555556
unsafe fn fallback() -> Option<OsString> { None }
556557
#[cfg(not(any(target_os = "android",
557558
target_os = "ios",
558-
target_os = "nacl")))]
559+
target_os = "nacl",
560+
target_os = "emscripten")))]
559561
unsafe fn fallback() -> Option<OsString> {
560562
#[cfg(not(target_os = "solaris"))]
561563
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,

src/libstd/sys/unix/thread.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ impl Thread {
8181
}
8282

8383
#[cfg(any(target_os = "linux",
84-
target_os = "android",
85-
target_os = "emscripten"))]
84+
target_os = "android"))]
8685
pub fn set_name(name: &CStr) {
8786
const PR_SET_NAME: libc::c_int = 15;
8887
// pthread wrapper only appeared in glibc 2.12, so we use syscall
@@ -118,9 +117,9 @@ impl Thread {
118117
name.as_ptr() as *mut libc::c_void);
119118
}
120119
}
121-
#[cfg(any(target_env = "newlib", target_os = "solaris"))]
120+
#[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))]
122121
pub fn set_name(_name: &CStr) {
123-
// Newlib and Illumos has no way to set a thread name.
122+
// Newlib, Illumos and Emscripten have no way to set a thread name.
124123
}
125124

126125
pub fn sleep(dur: Duration) {

src/libunwind/libunwind.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ pub const unwinder_private_data_size: usize = 2;
6060
pub const unwinder_private_data_size: usize = 2;
6161

6262
#[cfg(target_arch = "asmjs")]
63-
// FIXME: Copied from arm. Need to confirm.
6463
pub const unwinder_private_data_size: usize = 20;
6564

6665
#[repr(C)]

src/test/run-pass/intrinsic-alignment.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ mod rusti {
2424
target_os = "dragonfly",
2525
target_os = "netbsd",
2626
target_os = "openbsd",
27-
target_os = "solaris"))]
27+
target_os = "solaris",
28+
target_os = "emscripten"))]
2829
mod m {
2930
#[main]
3031
#[cfg(target_arch = "x86")]

src/test/run-pass/rec-align-u64.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ struct Outer {
4242
target_os = "dragonfly",
4343
target_os = "netbsd",
4444
target_os = "openbsd",
45-
target_os = "solaris"))]
45+
target_os = "solaris",
46+
target_os = "emscripten"))]
4647
mod m {
4748
#[cfg(target_arch = "x86")]
4849
pub mod m {

0 commit comments

Comments
 (0)