Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ff2616e8
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff2616e8
编写于
10月 01, 2014
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
auto merge of #17630 : sfackler/rust/cfg-warnings, r=brson
Closes #17490
上级
60e73173
b4909f6e
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
322 addition
and
358 deletion
+322
-358
src/etc/mklldeps.py
src/etc/mklldeps.py
+1
-1
src/liballoc/heap.rs
src/liballoc/heap.rs
+8
-8
src/libgreen/context.rs
src/libgreen/context.rs
+7
-10
src/libgreen/stack.rs
src/libgreen/stack.rs
+2
-3
src/liblibc/lib.rs
src/liblibc/lib.rs
+93
-108
src/libnative/io/c_unix.rs
src/libnative/io/c_unix.rs
+43
-42
src/libnative/io/file_unix.rs
src/libnative/io/file_unix.rs
+6
-7
src/libnative/io/mod.rs
src/libnative/io/mod.rs
+6
-6
src/libnative/io/net.rs
src/libnative/io/net.rs
+6
-6
src/libnative/io/process.rs
src/libnative/io/process.rs
+5
-6
src/libnative/lib.rs
src/libnative/lib.rs
+2
-3
src/librustc/middle/trans/asm.rs
src/librustc/middle/trans/asm.rs
+4
-5
src/librustc_back/fs.rs
src/librustc_back/fs.rs
+1
-1
src/librustc_back/rpath.rs
src/librustc_back/rpath.rs
+1
-1
src/librustdoc/flock.rs
src/librustdoc/flock.rs
+1
-2
src/librustdoc/plugins.rs
src/librustdoc/plugins.rs
+1
-1
src/librustrt/args.rs
src/librustrt/args.rs
+7
-7
src/librustrt/lib.rs
src/librustrt/lib.rs
+1
-1
src/librustrt/libunwind.rs
src/librustrt/libunwind.rs
+8
-11
src/librustrt/local_ptr.rs
src/librustrt/local_ptr.rs
+5
-5
src/librustrt/mutex.rs
src/librustrt/mutex.rs
+2
-4
src/librustrt/stack.rs
src/librustrt/stack.rs
+40
-32
src/librustrt/thread_local_storage.rs
src/librustrt/thread_local_storage.rs
+5
-5
src/librustrt/unwind.rs
src/librustrt/unwind.rs
+6
-4
src/librustuv/uvll.rs
src/librustuv/uvll.rs
+3
-5
src/libstd/dynamic_lib.rs
src/libstd/dynamic_lib.rs
+11
-11
src/libstd/io/net/addrinfo.rs
src/libstd/io/net/addrinfo.rs
+1
-1
src/libstd/io/process.rs
src/libstd/io/process.rs
+7
-7
src/libstd/io/signal.rs
src/libstd/io/signal.rs
+2
-2
src/libstd/os.rs
src/libstd/os.rs
+16
-20
src/libstd/rand/os.rs
src/libstd/rand/os.rs
+1
-1
src/libstd/rt/backtrace.rs
src/libstd/rt/backtrace.rs
+14
-14
src/libsyntax/attr.rs
src/libsyntax/attr.rs
+0
-3
src/libsyntax/config.rs
src/libsyntax/config.rs
+0
-3
src/libsyntax/ext/cfg.rs
src/libsyntax/ext/cfg.rs
+0
-3
src/libtime/lib.rs
src/libtime/lib.rs
+6
-9
未找到文件。
src/etc/mklldeps.py
浏览文件 @
ff2616e8
...
...
@@ -67,7 +67,7 @@ for llconfig in sys.argv[4:]:
"target_os =
\"
"
+
os
+
"
\"
"
,
]
f
.
write
(
"#[cfg(
"
+
', '
.
join
(
cfg
)
+
"
)]
\n
"
)
f
.
write
(
"#[cfg(
all("
+
', '
.
join
(
cfg
)
+
")
)]
\n
"
)
version
=
run
([
llconfig
,
'--version'
]).
strip
()
...
...
src/liballoc/heap.rs
浏览文件 @
ff2616e8
...
...
@@ -111,12 +111,12 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
// The minimum alignment guaranteed by the architecture. This value is used to
// add fast paths for low alignment values. In practice, the alignment is a
// constant at the call site and the branch will be optimized out.
#[cfg(
target_arch
=
"arm"
)]
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(
any(target_arch
=
"arm"
,
target_arch
=
"mips"
,
target_arch
=
"mipsel"
)
)]
static
MIN_ALIGN
:
uint
=
8
;
#[cfg(
target_arch
=
"x86"
)]
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
)
)]
static
MIN_ALIGN
:
uint
=
16
;
#[cfg(jemalloc)]
...
...
@@ -146,7 +146,7 @@ fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,
}
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
#[cfg(
not(windows),
not(target_os
=
"android"
))]
#[cfg(
all(not(windows),
not(target_os
=
"android"
)
))]
#[link(name
=
"pthread"
)]
extern
{}
...
...
@@ -206,7 +206,7 @@ pub fn stats_print() {
}
}
#[cfg(
not(jemalloc),
unix
)]
#[cfg(
all(not(jemalloc),
unix)
)]
mod
imp
{
use
core
::
cmp
;
use
core
::
ptr
;
...
...
@@ -268,7 +268,7 @@ pub fn usable_size(size: uint, _align: uint) -> uint {
pub
fn
stats_print
()
{}
}
#[cfg(
not(jemalloc),
windows
)]
#[cfg(
all(not(jemalloc),
windows)
)]
mod
imp
{
use
libc
::{
c_void
,
size_t
};
use
libc
;
...
...
src/libgreen/context.rs
浏览文件 @
ff2616e8
...
...
@@ -188,27 +188,27 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
// windows requires saving more registers (both general and XMM), so the windows
// register context must be larger.
#[cfg(
windows,
target_arch
=
"x86_64"
)]
#[cfg(
all(windows,
target_arch
=
"x86_64"
)
)]
#[repr(C)]
struct
Registers
{
gpr
:[
libc
::
uintptr_t
,
..
14
],
_
xmm
:[
simd
::
u32x4
,
..
10
]
}
#[cfg(
not(windows),
target_arch
=
"x86_64"
)]
#[cfg(
all(not(windows),
target_arch
=
"x86_64"
)
)]
#[repr(C)]
struct
Registers
{
gpr
:[
libc
::
uintptr_t
,
..
10
],
_
xmm
:[
simd
::
u32x4
,
..
6
]
}
#[cfg(
windows,
target_arch
=
"x86_64"
)]
#[cfg(
all(windows,
target_arch
=
"x86_64"
)
)]
fn
new_regs
()
->
Box
<
Registers
>
{
box
()
Registers
{
gpr
:[
0
,
..
14
],
_
xmm
:[
simd
::
u32x4
(
0
,
0
,
0
,
0
),
..
10
]
}
}
#[cfg(
not(windows),
target_arch
=
"x86_64"
)]
#[cfg(
all(not(windows),
target_arch
=
"x86_64"
)
)]
fn
new_regs
()
->
Box
<
Registers
>
{
box
()
Registers
{
gpr
:[
0
,
..
10
],
...
...
@@ -288,16 +288,13 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
regs
[
14
]
=
rust_bootstrap_green_task
as
libc
::
uintptr_t
;
// #56 pc, r14 --> lr
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
type
Registers
=
[
libc
::
uintptr_t
,
..
32
];
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
fn
new_regs
()
->
Box
<
Registers
>
{
box
{[
0
,
..
32
]}
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
fn
initialize_call_frame
(
regs
:
&
mut
Registers
,
fptr
:
InitFn
,
arg
:
uint
,
procedure
:
raw
::
Procedure
,
sp
:
*
mut
uint
)
{
let
sp
=
align_down
(
sp
);
...
...
src/libgreen/stack.rs
浏览文件 @
ff2616e8
...
...
@@ -28,11 +28,10 @@ pub struct Stack {
//
// DragonFly BSD also seems to suffer from the same problem. When MAP_STACK is
// used, it returns the same `ptr` multiple times.
#[cfg(not(
windows),
not(target_os
=
"freebsd"
),
not(target_os
=
"dragonfly"
))]
#[cfg(not(
any(windows,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
))]
static
STACK_FLAGS
:
libc
::
c_int
=
libc
::
MAP_STACK
|
libc
::
MAP_PRIVATE
|
libc
::
MAP_ANON
;
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
static
STACK_FLAGS
:
libc
::
c_int
=
libc
::
MAP_PRIVATE
|
libc
::
MAP_ANON
;
#[cfg(windows)]
static
STACK_FLAGS
:
libc
::
c_int
=
0
;
...
...
src/liblibc/lib.rs
浏览文件 @
ff2616e8
...
...
@@ -278,32 +278,31 @@
#[cfg(windows)]
pub
use
funcs
::
extra
::
msvcrt
::{
get_osfhandle
,
open_osfhandle
};
#[cfg(windows)]
pub
use
funcs
::
extra
::
winsock
::{
ioctlsocket
};
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
pub
use
consts
::
os
::
posix01
::{
CLOCK_REALTIME
,
CLOCK_MONOTONIC
};
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
)
)]
pub
use
funcs
::
posix01
::
unistd
::{
fdatasync
};
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
)
)]
pub
use
types
::
os
::
arch
::
extra
::{
sockaddr_ll
};
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
)
)]
pub
use
consts
::
os
::
extra
::{
AF_PACKET
};
#[cfg(
unix,
not(target_os
=
"freebsd"
))]
#[cfg(
all(unix,
not(target_os
=
"freebsd"
)
))]
pub
use
consts
::
os
::
extra
::{
MAP_STACK
};
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
pub
use
consts
::
os
::
bsd44
::{
TCP_KEEPIDLE
};
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
pub
use
consts
::
os
::
bsd44
::{
TCP_KEEPALIVE
};
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
pub
use
consts
::
os
::
extra
::{
F_FULLFSYNC
};
#[cfg(target_os
=
"macos"
)]
#[cfg(
target_os
=
"ios"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
)
)]
pub
use
types
::
os
::
arch
::
extra
::{
mach_timebase_info
};
...
...
@@ -372,8 +371,7 @@ pub mod bsd44 {}
// Standard types that are scalar but vary by OS and arch.
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
mod
os
{
pub
mod
common
{
pub
mod
posix01
{
...
...
@@ -506,10 +504,10 @@ pub struct ifaddrs {
}
}
#[cfg(
target_arch
=
"x86"
)]
#[cfg(target_arch
=
"arm"
)]
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(
any(target_arch
=
"x86"
,
target_arch
=
"arm"
,
target_arch
=
"mips"
,
target_arch
=
"mipsel"
)
)]
pub
mod
arch
{
pub
mod
c95
{
pub
type
c_char
=
i8
;
...
...
@@ -536,9 +534,9 @@ pub mod c99 {
pub
type
intptr_t
=
i32
;
pub
type
uintptr_t
=
u32
;
}
#[cfg(
target_arch
=
"x86"
)]
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(
any(target_arch
=
"x86"
,
target_arch
=
"mips"
,
target_arch
=
"mipsel"
)
)]
pub
mod
posix88
{
pub
type
off_t
=
i32
;
pub
type
dev_t
=
u64
;
...
...
@@ -652,8 +650,7 @@ pub struct pthread_attr_t {
pub
__
size
:
[
u32
,
..
9
]
}
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
pub
mod
posix01
{
use
types
::
os
::
arch
::
c95
::{
c_long
,
c_ulong
,
time_t
};
use
types
::
os
::
arch
::
posix88
::{
gid_t
,
ino_t
};
...
...
@@ -1660,8 +1657,7 @@ pub struct WIN32_FIND_DATAW {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
pub
mod
os
{
pub
mod
common
{
pub
mod
posix01
{
...
...
@@ -1793,8 +1789,7 @@ pub struct ifaddrs {
}
}
#[cfg(target_arch
=
"arm"
)]
#[cfg(target_arch
=
"x86"
)]
#[cfg(any(target_arch
=
"arm"
,
target_arch
=
"x86"
))]
pub
mod
arch
{
pub
mod
c95
{
pub
type
c_char
=
i8
;
...
...
@@ -2383,8 +2378,7 @@ pub mod sysconf {
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
mod
os
{
pub
mod
c95
{
use
types
::
os
::
arch
::
c95
::{
c_int
,
c_uint
};
...
...
@@ -2407,9 +2401,9 @@ pub mod c95 {
}
pub
mod
c99
{
}
#[cfg(
target_arch
=
"x86"
)]
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(target_arch
=
"arm"
)]
#[cfg(
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"arm"
)
)]
pub
mod
posix88
{
use
types
::
os
::
arch
::
c95
::
c_int
;
use
types
::
common
::
c95
::
c_void
;
...
...
@@ -2621,8 +2615,7 @@ pub mod posix88 {
pub
static
EHWPOISON
:
c_int
=
133
;
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
pub
mod
posix88
{
use
types
::
os
::
arch
::
c95
::
c_int
;
use
types
::
common
::
c95
::
c_void
;
...
...
@@ -2898,13 +2891,14 @@ pub mod posix01 {
#[cfg(target_os
=
"android"
)]
pub
static
PTHREAD_STACK_MIN
:
size_t
=
8192
;
#[cfg(target_arch
=
"arm"
,
target_os
=
"linux"
)]
#[cfg(target_arch
=
"x86"
,
target_os
=
"linux"
)]
#[cfg(target_arch
=
"x86_64"
,
target_os
=
"linux"
)]
#[cfg(all(target_os
=
"linux"
,
any(target_arch
=
"arm"
,
target_arch
=
"x86"
,
target_arch
=
"x86_64"
)))]
pub
static
PTHREAD_STACK_MIN
:
size_t
=
16384
;
#[cfg(
target_arch
=
"mips"
,
target_os
=
"linux"
)]
#[cfg(target_arch
=
"mipsel"
,
target_os
=
"linux"
)]
#[cfg(
all(target_os
=
"linux"
,
any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))
)]
pub
static
PTHREAD_STACK_MIN
:
size_t
=
131072
;
pub
static
CLOCK_REALTIME
:
c_int
=
0
;
...
...
@@ -2912,9 +2906,9 @@ pub mod posix01 {
}
pub
mod
posix08
{
}
#[cfg(
target_arch
=
"arm"
)]
#[cfg(target_arch
=
"x86"
)]
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(
any(target_arch
=
"arm"
,
target_arch
=
"x86"
,
target_arch
=
"x86_64"
)
)]
pub
mod
bsd44
{
use
types
::
os
::
arch
::
c95
::
c_int
;
...
...
@@ -2961,8 +2955,7 @@ pub mod bsd44 {
pub
static
SHUT_WR
:
c_int
=
1
;
pub
static
SHUT_RDWR
:
c_int
=
2
;
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
pub
mod
bsd44
{
use
types
::
os
::
arch
::
c95
::
c_int
;
...
...
@@ -3007,9 +3000,9 @@ pub mod bsd44 {
pub
static
SHUT_WR
:
c_int
=
1
;
pub
static
SHUT_RDWR
:
c_int
=
2
;
}
#[cfg(
target_arch
=
"x86"
)]
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(target_arch
=
"arm"
)]
#[cfg(
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"arm"
)
)]
pub
mod
extra
{
use
types
::
os
::
arch
::
c95
::
c_int
;
...
...
@@ -3036,8 +3029,7 @@ pub mod extra {
pub
static
MAP_NONBLOCK
:
c_int
=
0x010000
;
pub
static
MAP_STACK
:
c_int
=
0x020000
;
}
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
pub
mod
extra
{
use
types
::
os
::
arch
::
c95
::
c_int
;
...
...
@@ -3160,8 +3152,7 @@ pub mod sysconf {
}
}
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
pub
mod
os
{
pub
mod
c95
{
use
types
::
os
::
arch
::
c95
::{
c_int
,
c_uint
};
...
...
@@ -3421,10 +3412,11 @@ pub mod posix01 {
#[cfg(target_arch
=
"arm"
)]
pub
static
PTHREAD_STACK_MIN
:
size_t
=
4096
;
#[cfg(target_os
=
"freebsd"
,
target_arch
=
"mips"
)]
#[cfg(target_os
=
"freebsd"
,
target_arch
=
"mipsel"
)]
#[cfg(target_os
=
"freebsd"
,
target_arch
=
"x86"
)]
#[cfg(target_os
=
"freebsd"
,
target_arch
=
"x86_64"
)]
#[cfg(all(target_os
=
"freebsd"
,
any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
,
target_arch
=
"x86"
,
target_arch
=
"x86_64"
)))]
pub
static
PTHREAD_STACK_MIN
:
size_t
=
2048
;
#[cfg(target_os
=
"dragonfly"
)]
...
...
@@ -3569,8 +3561,7 @@ pub mod sysconf {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
pub
mod
os
{
pub
mod
c95
{
use
types
::
os
::
arch
::
c95
::{
c_int
,
c_uint
};
...
...
@@ -4261,13 +4252,12 @@ pub mod mman {
}
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
pub
mod
posix88
{
pub
mod
stat_
{
use
types
::
os
::
arch
::
c95
::{
c_char
,
c_int
};
...
...
@@ -4278,11 +4268,11 @@ pub mod stat_ {
pub
fn
chmod
(
path
:
*
const
c_char
,
mode
:
mode_t
)
->
c_int
;
pub
fn
fchmod
(
fd
:
c_int
,
mode
:
mode_t
)
->
c_int
;
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
,
target_os
=
"android"
,
target_os
=
"ios"
)
)]
pub
fn
fstat
(
fildes
:
c_int
,
buf
:
*
mut
stat
)
->
c_int
;
#[cfg(target_os
=
"macos"
)]
...
...
@@ -4292,11 +4282,11 @@ pub mod stat_ {
pub
fn
mkdir
(
path
:
*
const
c_char
,
mode
:
mode_t
)
->
c_int
;
pub
fn
mkfifo
(
path
:
*
const
c_char
,
mode
:
mode_t
)
->
c_int
;
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
,
target_os
=
"android"
,
target_os
=
"ios"
)
)]
pub
fn
stat
(
path
:
*
const
c_char
,
buf
:
*
mut
stat
)
->
c_int
;
#[cfg(target_os
=
"macos"
)]
...
...
@@ -4481,23 +4471,23 @@ pub mod net {
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
mod
posix01
{
pub
mod
stat_
{
use
types
::
os
::
arch
::
c95
::{
c_char
,
c_int
};
use
types
::
os
::
arch
::
posix01
::
stat
;
extern
{
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
,
target_os
=
"android"
,
target_os
=
"ios"
)
)]
pub
fn
lstat
(
path
:
*
const
c_char
,
buf
:
*
mut
stat
)
->
c_int
;
#[cfg(target_os
=
"macos"
)]
...
...
@@ -4518,8 +4508,7 @@ pub fn readlink(path: *const c_char,
pub
fn
fsync
(
fd
:
c_int
)
->
c_int
;
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
fn
fdatasync
(
fd
:
c_int
)
->
c_int
;
pub
fn
setenv
(
name
:
*
const
c_char
,
val
:
*
const
c_char
,
...
...
@@ -4598,13 +4587,13 @@ pub mod net {
}
#[cfg(
target_os
=
"windows"
)]
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"windows"
,
target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
mod
posix08
{
pub
mod
unistd
{
}
...
...
@@ -4687,10 +4676,10 @@ pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
}
}
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
mod
bsd44
{
use
types
::
common
::
c95
::{
c_void
};
use
types
::
os
::
arch
::
c95
::{
c_char
,
c_uchar
,
c_int
,
c_uint
,
c_ulong
,
size_t
};
...
...
@@ -4723,8 +4712,7 @@ pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
mod
bsd44
{
use
types
::
common
::
c95
::{
c_void
};
use
types
::
os
::
arch
::
c95
::{
c_uchar
,
c_int
,
size_t
};
...
...
@@ -4744,8 +4732,7 @@ pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
pub
mod
bsd44
{
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
pub
mod
extra
{
use
types
::
os
::
arch
::
c95
::{
c_char
,
c_int
};
...
...
@@ -4755,13 +4742,11 @@ pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
}
}
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
pub
mod
extra
{
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
mod
extra
{
}
...
...
src/libnative/io/c_unix.rs
浏览文件 @
ff2616e8
...
...
@@ -19,41 +19,42 @@
use
libc
;
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
static
FIONBIO
:
libc
::
c_ulong
=
0x8004667e
;
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86_64"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"arm"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(all(target_os
=
"linux"
,
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"arm"
)),
target_os
=
"android"
))]
pub
static
FIONBIO
:
libc
::
c_ulong
=
0x5421
;
#[cfg(
target_os
=
"linux"
,
target_arch
=
"mips"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"mipsel"
)]
#[cfg(
all(target_os
=
"linux"
,
any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))
)]
pub
static
FIONBIO
:
libc
::
c_ulong
=
0x667e
;
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
static
FIOCLEX
:
libc
::
c_ulong
=
0x20006601
;
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86_64"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"arm"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(all(target_os
=
"linux"
,
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"arm"
)),
target_os
=
"android"
))]
pub
static
FIOCLEX
:
libc
::
c_ulong
=
0x5451
;
#[cfg(
target_os
=
"linux"
,
target_arch
=
"mips"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"mipsel"
)]
#[cfg(
all(target_os
=
"linux"
,
any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))
)]
pub
static
FIOCLEX
:
libc
::
c_ulong
=
0x6601
;
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
static
MSG_DONTWAIT
:
libc
::
c_int
=
0x80
;
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
pub
static
MSG_DONTWAIT
:
libc
::
c_int
=
0x40
;
pub
static
WNOHANG
:
libc
::
c_int
=
1
;
...
...
@@ -86,8 +87,7 @@ pub fn sigaction(signum: libc::c_int,
pub
fn
sigemptyset
(
set
:
*
mut
sigset_t
)
->
libc
::
c_int
;
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
mod
select
{
pub
static
FD_SETSIZE
:
uint
=
1024
;
...
...
@@ -101,10 +101,10 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
}
}
#[cfg(
target_os
=
"android"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(target_os
=
"linux"
)]
#[cfg(
any(target_os
=
"android"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
,
target_os
=
"linux"
)
)]
mod
select
{
use
std
::
uint
;
use
libc
;
...
...
@@ -123,10 +123,11 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
}
}
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"x86_64"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"arm"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(all(target_os
=
"linux"
,
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"arm"
)),
target_os
=
"android"
))]
mod
signal
{
use
libc
;
...
...
@@ -173,8 +174,8 @@ pub struct sigset_t {
}
}
#[cfg(
target_os
=
"linux"
,
target_arch
=
"mips"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"mipsel"
)]
#[cfg(
all(target_os
=
"linux"
,
any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))
)]
mod
signal
{
use
libc
;
...
...
@@ -215,10 +216,10 @@ pub struct sigset_t {
}
}
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
mod
signal
{
use
libc
;
...
...
src/libnative/io/file_unix.rs
浏览文件 @
ff2616e8
...
...
@@ -130,8 +130,7 @@ fn fsync(&mut self) -> IoResult<()> {
fn
datasync
(
&
mut
self
)
->
IoResult
<
()
>
{
return
super
::
mkerr_libc
(
os_datasync
(
self
.fd
()));
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
fn
os_datasync
(
fd
:
c_int
)
->
c_int
{
unsafe
{
libc
::
fcntl
(
fd
,
libc
::
F_FULLFSYNC
)
}
}
...
...
@@ -139,7 +138,7 @@ fn os_datasync(fd: c_int) -> c_int {
fn
os_datasync
(
fd
:
c_int
)
->
c_int
{
retry
(||
unsafe
{
libc
::
fdatasync
(
fd
)
})
}
#[cfg(not(
target_os
=
"macos"
),
not(target_os
=
"ios"
),
not(target_os
=
"linux"
))]
#[cfg(not(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"linux"
)
))]
fn
os_datasync
(
fd
:
c_int
)
->
c_int
{
retry
(||
unsafe
{
libc
::
fsync
(
fd
)
})
}
...
...
@@ -445,14 +444,14 @@ fn mkstat(stat: &libc::stat) -> rtio::FileStat {
// FileStat times are in milliseconds
fn
mktime
(
secs
:
u64
,
nsecs
:
u64
)
->
u64
{
secs
*
1000
+
nsecs
/
1000000
}
#[cfg(not(
target_os
=
"linux"
),
not(target_os
=
"android"
))]
#[cfg(not(
any(target_os
=
"linux"
,
target_os
=
"android"
)
))]
fn
flags
(
stat
:
&
libc
::
stat
)
->
u64
{
stat
.st_flags
as
u64
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
)
)]
fn
flags
(
_
stat
:
&
libc
::
stat
)
->
u64
{
0
}
#[cfg(not(
target_os
=
"linux"
),
not(target_os
=
"android"
))]
#[cfg(not(
any(target_os
=
"linux"
,
target_os
=
"android"
)
))]
fn
gen
(
stat
:
&
libc
::
stat
)
->
u64
{
stat
.st_gen
as
u64
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
)
)]
fn
gen
(
_
stat
:
&
libc
::
stat
)
->
u64
{
0
}
rtio
::
FileStat
{
...
...
src/libnative/io/mod.rs
浏览文件 @
ff2616e8
...
...
@@ -48,12 +48,12 @@
#[path
=
"file_windows.rs"
]
pub
mod
file
;
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"linux"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
,
target_os
=
"android"
,
target_os
=
"linux"
)
)]
#[path
=
"timer_unix.rs"
]
pub
mod
timer
;
...
...
src/libnative/io/net.rs
浏览文件 @
ff2616e8
...
...
@@ -282,20 +282,20 @@ fn set_keepalive(&mut self, seconds: Option<uint>) -> IoResult<()> {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
fn
set_tcp_keepalive
(
&
mut
self
,
seconds
:
uint
)
->
IoResult
<
()
>
{
setsockopt
(
self
.fd
(),
libc
::
IPPROTO_TCP
,
libc
::
TCP_KEEPALIVE
,
seconds
as
libc
::
c_int
)
}
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
fn
set_tcp_keepalive
(
&
mut
self
,
seconds
:
uint
)
->
IoResult
<
()
>
{
setsockopt
(
self
.fd
(),
libc
::
IPPROTO_TCP
,
libc
::
TCP_KEEPIDLE
,
seconds
as
libc
::
c_int
)
}
#[cfg(not(target_os
=
"macos"
),
not(target_os
=
"ios"
),
not(target_os
=
"freebsd"
),
not(target_os
=
"dragonfly"
))]
#[cfg(not(any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)))]
fn
set_tcp_keepalive
(
&
mut
self
,
_
seconds
:
uint
)
->
IoResult
<
()
>
{
Ok
(())
}
...
...
src/libnative/io/process.rs
浏览文件 @
ff2616e8
...
...
@@ -840,18 +840,17 @@ fn free_handle(_handle: *mut ()) {
#[cfg(unix)]
fn
translate_status
(
status
:
c_int
)
->
rtio
::
ProcessExit
{
#![allow(non_snake_case)]
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
mod
imp
{
pub
fn
WIFEXITED
(
status
:
i32
)
->
bool
{
(
status
&
0xff
)
==
0
}
pub
fn
WEXITSTATUS
(
status
:
i32
)
->
i32
{
(
status
>>
8
)
&
0xff
}
pub
fn
WTERMSIG
(
status
:
i32
)
->
i32
{
status
&
0x7f
}
}
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
mod
imp
{
pub
fn
WIFEXITED
(
status
:
i32
)
->
bool
{
(
status
&
0x7f
)
==
0
}
pub
fn
WEXITSTATUS
(
status
:
i32
)
->
i32
{
status
>>
8
}
...
...
src/libnative/lib.rs
浏览文件 @
ff2616e8
...
...
@@ -77,10 +77,9 @@
pub
mod
io
;
pub
mod
task
;
#[cfg(windows)]
#[cfg(android)]
#[cfg(any(windows,
android))]
static
OS_DEFAULT_STACK_ESTIMATE
:
uint
=
1
<<
20
;
#[cfg(
unix,
not(android
))]
#[cfg(
all(unix,
not(android)
))]
static
OS_DEFAULT_STACK_ESTIMATE
:
uint
=
2
*
(
1
<<
20
);
#[lang
=
"start"
]
...
...
src/librustc/middle/trans/asm.rs
浏览文件 @
ff2616e8
...
...
@@ -162,15 +162,14 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
// Default per-arch clobbers
// Basically what clang does
#[cfg(
target_arch
=
"arm"
)]
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(
any(target_arch
=
"arm"
,
target_arch
=
"mips"
,
target_arch
=
"mipsel"
)
)]
fn
get_clobbers
()
->
String
{
""
.to_string
()
}
#[cfg(target_arch
=
"x86"
)]
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
))]
fn
get_clobbers
()
->
String
{
"~{dirflag},~{fpsr},~{flags}"
.to_string
()
}
src/librustc_back/fs.rs
浏览文件 @
ff2616e8
...
...
@@ -51,7 +51,7 @@ pub fn realpath(original: &Path) -> io::IoResult<Path> {
return
Ok
(
result
);
}
#[cfg(
not(windows),
test
)]
#[cfg(
all(not(windows),
test)
)]
mod
test
{
use
std
::
io
;
use
std
::
io
::
fs
::{
File
,
symlink
,
mkdir
,
mkdir_recursive
};
...
...
src/librustc_back/rpath.rs
浏览文件 @
ff2616e8
...
...
@@ -147,7 +147,7 @@ fn minimize_rpaths(rpaths: &[String]) -> Vec<String> {
minimized
}
#[cfg(
unix,
test
)]
#[cfg(
all(unix,
test)
)]
mod
test
{
use
super
::{
RPathConfig
};
use
super
::{
minimize_rpaths
,
rpaths_to_flags
,
get_rpath_relative_to_output
};
...
...
src/librustdoc/flock.rs
浏览文件 @
ff2616e8
...
...
@@ -84,8 +84,7 @@ pub struct flock {
pub
static
F_SETLKW
:
libc
::
c_int
=
9
;
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
mod
os
{
use
libc
;
...
...
src/librustdoc/plugins.rs
浏览文件 @
ff2616e8
...
...
@@ -85,7 +85,7 @@ fn libname(mut n: String) -> String {
n
}
#[cfg(
not(target_os=
"windows"
),
not(target_os=
"macos"
))]
#[cfg(
all(not(target_os=
"windows"
),
not(target_os=
"macos"
)
))]
fn
libname
(
n
:
String
)
->
String
{
let
mut
i
=
String
::
from_str
(
"lib"
);
i
.push_str
(
n
.as_slice
());
...
...
src/librustrt/args.rs
浏览文件 @
ff2616e8
...
...
@@ -39,10 +39,10 @@ pub fn put(args: Vec<Vec<u8>>) { imp::put(args) }
/// Make a clone of the global arguments.
pub
fn
clone
()
->
Option
<
Vec
<
Vec
<
u8
>>>
{
imp
::
clone
()
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
mod
imp
{
use
core
::
prelude
::
*
;
...
...
@@ -146,9 +146,9 @@ fn smoke_test() {
}
}
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"windows"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"windows"
)
)]
mod
imp
{
use
core
::
prelude
::
*
;
use
collections
::
vec
::
Vec
;
...
...
src/librustrt/lib.rs
浏览文件 @
ff2616e8
...
...
@@ -160,7 +160,7 @@ pub unsafe fn cleanup() {
pub
mod
shouldnt_be_public
{
#[cfg(not(test))]
pub
use
super
::
local_ptr
::
native
::
maybe_tls_key
;
#[cfg(
not(windows),
not(target_os
=
"android"
),
not(target_os
=
"ios"
))]
#[cfg(
all(not(windows),
not(target_os
=
"android"
),
not(target_os
=
"ios"
)
))]
pub
use
super
::
local_ptr
::
compiled
::
RT_TLS_PTR
;
}
...
...
src/librustrt/libunwind.rs
浏览文件 @
ff2616e8
...
...
@@ -16,8 +16,7 @@
use
libc
;
#[cfg(not(target_arch
=
"arm"
))]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(not(target_arch
=
"arm"
),
target_os
=
"ios"
))]
#[repr(C)]
pub
enum
_
Unwind_Action
{
_
UA_SEARCH_PHASE
=
1
,
...
...
@@ -62,14 +61,13 @@ pub enum _Unwind_Reason_Code {
#[cfg(target_arch
=
"x86_64"
)]
pub
static
unwinder_private_data_size
:
uint
=
6
;
#[cfg(
target_arch
=
"arm"
,
not(target_os
=
"ios"
))]
#[cfg(
all(target_arch
=
"arm"
,
not(target_os
=
"ios"
)
))]
pub
static
unwinder_private_data_size
:
uint
=
20
;
#[cfg(
target_arch
=
"arm"
,
target_os
=
"ios"
)]
#[cfg(
all(target_arch
=
"arm"
,
target_os
=
"ios"
)
)]
pub
static
unwinder_private_data_size
:
uint
=
5
;
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
))]
pub
static
unwinder_private_data_size
:
uint
=
2
;
#[repr(C)]
...
...
@@ -85,8 +83,7 @@ pub enum _Unwind_Context {}
extern
"C"
fn
(
unwind_code
:
_
Unwind_Reason_Code
,
exception
:
*
mut
_
Unwind_Exception
);
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"freebsd"
))]
#[link(name
=
"gcc_s"
)]
extern
{}
...
...
@@ -101,11 +98,11 @@ pub enum _Unwind_Context {}
extern
"C"
{
// iOS on armv7 uses SjLj exceptions and requires to link
// against corresponding routine (..._SjLj_...)
#[cfg(not(
target_os
=
"ios"
,
target_arch
=
"arm"
))]
#[cfg(not(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
))]
pub
fn
_
Unwind_RaiseException
(
exception
:
*
mut
_
Unwind_Exception
)
->
_
Unwind_Reason_Code
;
#[cfg(
target_os
=
"ios"
,
target_arch
=
"arm"
)]
#[cfg(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
)]
fn
_
Unwind_SjLj_RaiseException
(
e
:
*
mut
_
Unwind_Exception
)
->
_
Unwind_Reason_Code
;
...
...
@@ -115,7 +112,7 @@ fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception)
// ... and now we just providing access to SjLj counterspart
// through a standard name to hide those details from others
// (see also comment above regarding _Unwind_RaiseException)
#[cfg(
target_os
=
"ios"
,
target_arch
=
"arm"
)]
#[cfg(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
)]
#[inline(always)]
pub
unsafe
fn
_
Unwind_RaiseException
(
exc
:
*
mut
_
Unwind_Exception
)
->
_
Unwind_Reason_Code
{
...
...
src/librustrt/local_ptr.rs
浏览文件 @
ff2616e8
...
...
@@ -22,13 +22,13 @@
use
core
::
mem
;
use
alloc
::
boxed
::
Box
;
#[cfg(
windows)]
// mingw-w32 doesn't like thread_local things
#[cfg(target_os
=
"android"
)]
// see #10686
#[cfg(target_os
=
"ios"
)]
#[cfg(
any(windows,
// mingw-w32 doesn't like thread_local things
target_os
=
"android"
,
// see #10686
target_os
=
"ios"
)
)]
pub
use
self
::
native
::{
init
,
cleanup
,
put
,
take
,
try_take
,
unsafe_take
,
exists
,
unsafe_borrow
,
try_unsafe_borrow
};
#[cfg(not(
windows),
not(target_os
=
"android"
),
not(target_os
=
"ios"
))]
#[cfg(not(
any(windows,
target_os
=
"android"
,
target_os
=
"ios"
)
))]
pub
use
self
::
compiled
::{
init
,
cleanup
,
put
,
take
,
try_take
,
unsafe_take
,
exists
,
unsafe_borrow
,
try_unsafe_borrow
};
...
...
@@ -82,7 +82,7 @@ pub unsafe fn borrow<T>() -> Borrowed<T> {
/// implemented using LLVM's thread_local attribute which isn't necessarily
/// working on all platforms. This implementation is faster, however, so we use
/// it wherever possible.
#[cfg(not(
windows),
not(target_os
=
"android"
),
not(target_os
=
"ios"
))]
#[cfg(not(
any(windows,
target_os
=
"android"
,
target_os
=
"ios"
)
))]
pub
mod
compiled
{
use
core
::
prelude
::
*
;
...
...
src/librustrt/mutex.rs
浏览文件 @
ff2616e8
...
...
@@ -346,8 +346,7 @@ mod imp {
type
pthread_mutexattr_t
=
libc
::
c_void
;
type
pthread_condattr_t
=
libc
::
c_void
;
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
mod
os
{
use
libc
;
...
...
@@ -360,8 +359,7 @@ mod os {
0
as
pthread_cond_t
;
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
mod
os
{
use
libc
;
...
...
src/librustrt/stack.rs
浏览文件 @
ff2616e8
...
...
@@ -156,13 +156,13 @@ pub unsafe fn record_rust_managed_stack_bounds(stack_lo: uint, stack_hi: uint) {
#[cfg(not(windows))]
#[inline(always)]
unsafe
fn
target_record_stack_bounds
(
_
stack_lo
:
uint
,
_
stack_hi
:
uint
)
{}
#[cfg(
windows,
target_arch
=
"x86"
)]
#[inline(always)]
#[cfg(
all(windows,
target_arch
=
"x86"
)
)]
#[inline(always)]
unsafe
fn
target_record_stack_bounds
(
stack_lo
:
uint
,
stack_hi
:
uint
)
{
// stack range is at TIB: %fs:0x04 (top) and %fs:0x08 (bottom)
asm!
(
"mov $0, %fs:0x04"
::
"r"
(
stack_hi
)
::
"volatile"
);
asm!
(
"mov $0, %fs:0x08"
::
"r"
(
stack_lo
)
::
"volatile"
);
}
#[cfg(
windows,
target_arch
=
"x86_64"
)]
#[inline(always)]
#[cfg(
all(windows,
target_arch
=
"x86_64"
)
)]
#[inline(always)]
unsafe
fn
target_record_stack_bounds
(
stack_lo
:
uint
,
stack_hi
:
uint
)
{
// stack range is at TIB: %gs:0x08 (top) and %gs:0x10 (bottom)
asm!
(
"mov $0, %gs:0x08"
::
"r"
(
stack_hi
)
::
"volatile"
);
...
...
@@ -189,49 +189,53 @@ pub unsafe fn record_sp_limit(limit: uint) {
return
target_record_sp_limit
(
limit
);
// x86-64
#[cfg(target_arch
=
"x86_64"
,
target_os
=
"macos"
)]
#[cfg(target_arch
=
"x86_64"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86_64"
,
any(target_os
=
"macos"
,
target_os
=
"ios"
)))]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movq $$0x60+90*8, %rsi
movq $0, %gs:(%rsi)"
::
"r"
(
limit
)
:
"rsi"
:
"volatile"
)
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"linux"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"linux"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movq $0, %fs:112"
::
"r"
(
limit
)
::
"volatile"
)
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"windows"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"windows"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
_
:
uint
)
{
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"freebsd"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"freebsd"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movq $0, %fs:24"
::
"r"
(
limit
)
::
"volatile"
)
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"dragonfly"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"dragonfly"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movq $0, %fs:32"
::
"r"
(
limit
)
::
"volatile"
)
}
// x86
#[cfg(target_arch
=
"x86"
,
target_os
=
"macos"
)]
#[cfg(target_arch
=
"x86"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86"
,
any(target_os
=
"macos"
,
target_os
=
"ios"
)))]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movl $$0x48+90*4, %eax
movl $0, %gs:(%eax)"
::
"r"
(
limit
)
:
"eax"
:
"volatile"
)
}
#[cfg(target_arch
=
"x86"
,
target_os
=
"linux"
)]
#[cfg(target_arch
=
"x86"
,
target_os
=
"freebsd"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86"
,
any(target_os
=
"linux"
,
target_os
=
"freebsd"
)))]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
asm!
(
"movl $0, %gs:48"
::
"r"
(
limit
)
::
"volatile"
)
}
#[cfg(
target_arch
=
"x86"
,
target_os
=
"windows"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86"
,
target_os
=
"windows"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
_
:
uint
)
{
}
// mips, arm - Some brave soul can port these to inline asm, but it's over
// my head personally
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(target_arch
=
"arm"
,
not(target_os
=
"ios"
))]
#[inline(always)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
,
all(target_arch
=
"arm"
,
not(target_os
=
"ios"
))))]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
limit
:
uint
)
{
use
libc
::
c_void
;
return
record_sp_limit
(
limit
as
*
const
c_void
);
...
...
@@ -241,7 +245,7 @@ unsafe fn target_record_sp_limit(limit: uint) {
}
// iOS segmented stack is disabled for now, see related notes
#[cfg(
target_arch
=
"arm"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"arm"
,
target_os
=
"ios"
)
)]
#[inline(always)]
unsafe
fn
target_record_sp_limit
(
_
:
uint
)
{
}
}
...
...
@@ -259,31 +263,32 @@ pub unsafe fn get_sp_limit() -> uint {
return
target_get_sp_limit
();
// x86-64
#[cfg(target_arch
=
"x86_64"
,
target_os
=
"macos"
)]
#[cfg(target_arch
=
"x86_64"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86_64"
,
any(target_os
=
"macos"
,
target_os
=
"ios"
)))]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movq $$0x60+90*8, %rsi
movq %gs:(%rsi), $0"
:
"=r"
(
limit
)
::
"rsi"
:
"volatile"
);
return
limit
;
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"linux"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"linux"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movq %fs:112, $0"
:
"=r"
(
limit
)
:::
"volatile"
);
return
limit
;
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"windows"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"windows"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
return
1024
;
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"freebsd"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"freebsd"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movq %fs:24, $0"
:
"=r"
(
limit
)
:::
"volatile"
);
return
limit
;
}
#[cfg(
target_arch
=
"x86_64"
,
target_os
=
"dragonfly"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86_64"
,
target_os
=
"dragonfly"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movq %fs:32, $0"
:
"=r"
(
limit
)
:::
"volatile"
);
...
...
@@ -292,31 +297,34 @@ unsafe fn target_get_sp_limit() -> uint {
// x86
#[cfg(target_arch
=
"x86"
,
target_os
=
"macos"
)]
#[cfg(target_arch
=
"x86"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86"
,
any(target_os
=
"macos"
,
target_os
=
"ios"
)))]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movl $$0x48+90*4, %eax
movl %gs:(%eax), $0"
:
"=r"
(
limit
)
::
"eax"
:
"volatile"
);
return
limit
;
}
#[cfg(target_arch
=
"x86"
,
target_os
=
"linux"
)]
#[cfg(target_arch
=
"x86"
,
target_os
=
"freebsd"
)]
#[inline(always)]
#[cfg(all(target_arch
=
"x86"
,
any(target_os
=
"linux"
,
target_os
=
"freebsd"
)))]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
let
limit
;
asm!
(
"movl %gs:48, $0"
:
"=r"
(
limit
)
:::
"volatile"
);
return
limit
;
}
#[cfg(
target_arch
=
"x86"
,
target_os
=
"windows"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"x86"
,
target_os
=
"windows"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
return
1024
;
}
// mips, arm - Some brave soul can port these to inline asm, but it's over
// my head personally
#[cfg(target_arch
=
"mips"
)]
#[cfg(target_arch
=
"mipsel"
)]
#[cfg(target_arch
=
"arm"
,
not(target_os
=
"ios"
))]
#[inline(always)]
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mipsel"
,
all(target_arch
=
"arm"
,
not(target_os
=
"ios"
))))]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
use
libc
::
c_void
;
return
get_sp_limit
()
as
uint
;
...
...
@@ -328,7 +336,7 @@ unsafe fn target_get_sp_limit() -> uint {
// iOS doesn't support segmented stacks yet. This function might
// be called by runtime though so it is unsafe to mark it as
// unreachable, let's return a fixed constant.
#[cfg(
target_arch
=
"arm"
,
target_os
=
"ios"
)]
#[inline(always)]
#[cfg(
all(target_arch
=
"arm"
,
target_os
=
"ios"
)
)]
#[inline(always)]
unsafe
fn
target_get_sp_limit
()
->
uint
{
1024
}
...
...
src/librustrt/thread_local_storage.rs
浏览文件 @
ff2616e8
...
...
@@ -41,11 +41,11 @@ pub unsafe fn destroy(key: Key) {
#[allow(non_camel_case_types)]
// foreign type
type
pthread_key_t
=
::
libc
::
c_ulong
;
#[cfg(
target_os=
"linux"
)]
#[cfg(target_os=
"freebsd"
)]
#[cfg(target_os=
"dragonfly"
)]
#[cfg(target_os=
"android"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(
any(target_os=
"linux"
,
target_os=
"freebsd"
,
target_os=
"dragonfly"
,
target_os=
"android"
,
target_os
=
"ios"
)
)]
#[allow(non_camel_case_types)]
// foreign type
type
pthread_key_t
=
::
libc
::
c_uint
;
...
...
src/librustrt/unwind.rs
浏览文件 @
ff2616e8
...
...
@@ -235,7 +235,9 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
//
// See also: rt/rust_try.ll
#[cfg(not(target_arch
=
"arm"
),
not(windows,
target_arch
=
"x86_64"
),
not(test))]
#[cfg(all(not(target_arch
=
"arm"
),
not(all(windows,
target_arch
=
"x86_64"
)),
not(test)))]
#[doc(hidden)]
pub
mod
eabi
{
use
libunwind
as
uw
;
...
...
@@ -288,7 +290,7 @@ pub extern "C" fn rust_eh_personality_catch(
// iOS on armv7 is using SjLj exceptions and therefore requires to use
// a specialized personality routine: __gcc_personality_sj0
#[cfg(
target_os
=
"ios"
,
target_arch
=
"arm"
,
not(test
))]
#[cfg(
all(target_os
=
"ios"
,
target_arch
=
"arm"
,
not(test)
))]
#[doc(hidden)]
pub
mod
eabi
{
use
libunwind
as
uw
;
...
...
@@ -343,7 +345,7 @@ pub extern "C" fn rust_eh_personality_catch(
// ARM EHABI uses a slightly different personality routine signature,
// but otherwise works the same.
#[cfg(
target_arch
=
"arm"
,
not(target_os
=
"ios"
),
not(test
))]
#[cfg(
all(target_arch
=
"arm"
,
not(target_os
=
"ios"
),
not(test)
))]
#[doc(hidden)]
pub
mod
eabi
{
use
libunwind
as
uw
;
...
...
@@ -392,7 +394,7 @@ pub extern "C" fn rust_eh_personality_catch(
// GCC reuses the same personality routine as for the other architectures by wrapping it
// with an "API translator" layer (_GCC_specific_handler).
#[cfg(
windows,
target_arch
=
"x86_64"
,
not(test
))]
#[cfg(
all(windows,
target_arch
=
"x86_64"
,
not(test)
))]
#[doc(hidden)]
#[allow(non_camel_case_types,
non_snake_case)]
pub
mod
eabi
{
...
...
src/librustuv/uvll.rs
浏览文件 @
ff2616e8
...
...
@@ -723,12 +723,11 @@ pub fn uv_signal_start(h: *mut uv_signal_t, cb: uv_signal_cb,
// libuv doesn't use pthread on windows
// android libc (bionic) provides pthread, so no additional link is required
#[cfg(not(
windows),
not(target_os
=
"android"
))]
#[cfg(not(
any(windows,
target_os
=
"android"
)
))]
#[link(name
=
"pthread"
)]
extern
{}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"dragonfly"
))]
#[link(name
=
"rt"
)]
extern
{}
...
...
@@ -738,7 +737,6 @@ pub fn uv_signal_start(h: *mut uv_signal_t, cb: uv_signal_cb,
#[link(name
=
"iphlpapi"
)]
extern
{}
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
#[link(name
=
"kvm"
)]
extern
{}
src/libstd/dynamic_lib.rs
浏览文件 @
ff2616e8
...
...
@@ -154,7 +154,7 @@ pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> {
}
}
#[cfg(
test,
not(target_os
=
"ios"
))]
#[cfg(
all(test,
not(target_os
=
"ios"
)
))]
mod
test
{
use
super
::
*
;
use
prelude
::
*
;
...
...
@@ -189,10 +189,10 @@ fn test_loading_cosine() {
}
#[test]
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"macos"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
fn
test_errors_do_not_crash
()
{
// Open /dev/null as a library to get an error, and make sure
// that only causes an error, and not a crash.
...
...
@@ -204,12 +204,12 @@ fn test_errors_do_not_crash() {
}
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
pub
mod
dl
{
use
c_str
::{
CString
,
ToCStr
};
...
...
src/libstd/io/net/addrinfo.rs
浏览文件 @
ff2616e8
...
...
@@ -123,7 +123,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
// Ignored on android since we cannot give tcp/ip
// permission without help of apk
#[cfg(
test,
not(target_os
=
"android"
))]
#[cfg(
all(test,
not(target_os
=
"android"
)
))]
mod
test
{
iotest!
(
fn
dns_smoke_test
()
{
let
ipaddrs
=
get_host_addresses
(
"localhost"
)
.unwrap
();
...
...
src/libstd/io/process.rs
浏览文件 @
ff2616e8
...
...
@@ -693,7 +693,7 @@ mod tests {
drop
(
p
.wait
()
.clone
());
})
#[cfg(
unix,
not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
iotest!
(
fn
signal_reported_right
()
{
let
p
=
Command
::
new
(
"/bin/sh"
)
.arg
(
"-c"
)
.arg
(
"kill -1 $$"
)
.spawn
();
assert!
(
p
.is_ok
());
...
...
@@ -725,7 +725,7 @@ pub fn run_output(cmd: Command) -> String {
assert_eq!
(
run_output
(
cmd
),
"foobar
\n
"
.to_string
());
})
#[cfg(
unix,
not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
iotest!
(
fn
set_cwd_works
()
{
let
mut
cmd
=
Command
::
new
(
"/bin/sh"
);
cmd
.arg
(
"-c"
)
.arg
(
"pwd"
)
...
...
@@ -734,7 +734,7 @@ pub fn run_output(cmd: Command) -> String {
assert_eq!
(
run_output
(
cmd
),
"/
\n
"
.to_string
());
})
#[cfg(
unix,
not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
iotest!
(
fn
stdin_works
()
{
let
mut
p
=
Command
::
new
(
"/bin/sh"
)
.arg
(
"-c"
)
.arg
(
"read line; echo $line"
)
...
...
@@ -759,7 +759,7 @@ pub fn run_output(cmd: Command) -> String {
assert!
(
Command
::
new
(
"test"
)
.uid
(
10
)
.spawn
()
.is_err
());
})
#[cfg(
unix,
not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
iotest!
(
fn
uid_works
()
{
use
libc
;
let
mut
p
=
Command
::
new
(
"/bin/sh"
)
...
...
@@ -770,7 +770,7 @@ pub fn run_output(cmd: Command) -> String {
assert!
(
p
.wait
()
.unwrap
()
.success
());
})
#[cfg(
unix,
not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
iotest!
(
fn
uid_to_root_fails
()
{
use
libc
;
...
...
@@ -847,7 +847,7 @@ pub fn run_output(cmd: Command) -> String {
}
})
#[cfg(
unix,not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
pub
fn
pwd_cmd
()
->
Command
{
Command
::
new
(
"pwd"
)
}
...
...
@@ -897,7 +897,7 @@ pub fn pwd_cmd() -> Command {
assert_eq!
(
parent_stat
.unstable.inode
,
child_stat
.unstable.inode
);
})
#[cfg(
unix,not(target_os=
"android"
))]
#[cfg(
all(unix,
not(target_os=
"android"
)
))]
pub
fn
env_cmd
()
->
Command
{
Command
::
new
(
"env"
)
}
...
...
src/libstd/io/signal.rs
浏览文件 @
ff2616e8
...
...
@@ -160,7 +160,7 @@ pub fn unregister(&mut self, signum: Signum) {
}
}
#[cfg(
test,
unix
)]
#[cfg(
all(test,
unix)
)]
mod
test_unix
{
use
prelude
::
*
;
use
libc
;
...
...
@@ -218,7 +218,7 @@ fn test_io_signal_unregister() {
}
}
#[cfg(
test,
windows
)]
#[cfg(
all(test,
windows)
)]
mod
test_windows
{
use
super
::{
User1
,
Listener
};
use
result
::{
Ok
,
Err
};
...
...
src/libstd/os.rs
浏览文件 @
ff2616e8
...
...
@@ -653,8 +653,7 @@ pub fn dll_filename(base: &str) -> String {
/// ```
pub
fn
self_exe_name
()
->
Option
<
Path
>
{
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(any(target_os
=
"freebsd"
,
target_os
=
"dragonfly"
))]
fn
load_self
()
->
Option
<
Vec
<
u8
>>
{
unsafe
{
use
libc
::
funcs
::
bsd44
::
*
;
...
...
@@ -680,8 +679,7 @@ fn load_self() -> Option<Vec<u8>> {
}
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
fn
load_self
()
->
Option
<
Vec
<
u8
>>
{
use
std
::
io
;
...
...
@@ -691,8 +689,7 @@ fn load_self() -> Option<Vec<u8>> {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
fn
load_self
()
->
Option
<
Vec
<
u8
>>
{
unsafe
{
use
libc
::
funcs
::
extra
::
_
NSGetExecutablePath
;
...
...
@@ -909,9 +906,9 @@ fn chdir(p: &Path) -> bool {
#[cfg(unix)]
/// Returns the platform-specific value of errno
pub
fn
errno
()
->
int
{
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"freebsd"
)
)]
fn
errno_location
()
->
*
const
c_int
{
extern
{
fn
__
error
()
->
*
const
c_int
;
...
...
@@ -931,8 +928,7 @@ fn errno_location() -> *const c_int {
}
}
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
fn
errno_location
()
->
*
const
c_int
{
extern
{
fn
__
errno_location
()
->
*
const
c_int
;
...
...
@@ -975,11 +971,11 @@ pub fn error_string(errnum: uint) -> String {
#[cfg(unix)]
fn
strerror
(
errnum
:
uint
)
->
String
{
#[cfg(
target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
target_os
=
"android"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
fn
strerror_r
(
errnum
:
c_int
,
buf
:
*
mut
c_char
,
buflen
:
libc
::
size_t
)
->
c_int
{
extern
{
...
...
@@ -1180,10 +1176,10 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
res
}
#[cfg(
target_os
=
"linux"
)]
#[cfg(target_os
=
"android"
)]
#[cfg(target_os
=
"freebsd"
)]
#[cfg(target_os
=
"dragonfly"
)]
#[cfg(
any(target_os
=
"linux"
,
target_os
=
"android"
,
target_os
=
"freebsd"
,
target_os
=
"dragonfly"
)
)]
fn
real_args_as_bytes
()
->
Vec
<
Vec
<
u8
>>
{
use
rt
;
...
...
src/libstd/rand/os.rs
浏览文件 @
ff2616e8
...
...
@@ -13,7 +13,7 @@
pub
use
self
::
imp
::
OsRng
;
#[cfg(
unix,
not(target_os
=
"ios"
))]
#[cfg(
all(unix,
not(target_os
=
"ios"
)
))]
mod
imp
{
use
io
::{
IoResult
,
File
};
use
path
::
Path
;
...
...
src/libstd/rt/backtrace.rs
浏览文件 @
ff2616e8
...
...
@@ -253,7 +253,7 @@ mod imp {
/// play well with green threads, so while it is extremely nice
/// and simple to use it should be used only on iOS devices as the
/// only viable option.
#[cfg(
target_os
=
"ios"
,
target_arch
=
"arm"
)]
#[cfg(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
)]
#[inline(never)]
pub
fn
write
(
w
:
&
mut
Writer
)
->
IoResult
<
()
>
{
use
iter
::{
Iterator
,
range
};
...
...
@@ -284,7 +284,7 @@ fn backtrace(buf: *mut *mut libc::c_void,
result
::
fold
(
iter
,
(),
|
_
,
_
|
())
}
#[cfg(not(
target_os
=
"ios"
,
target_arch
=
"arm"
))]
#[cfg(not(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
))]
#[inline(never)]
// if we know this is a function call, we can skip it when
// tracing
pub
fn
write
(
w
:
&
mut
Writer
)
->
IoResult
<
()
>
{
...
...
@@ -365,8 +365,7 @@ struct Context<'a> {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
fn
print
(
w
:
&
mut
Writer
,
idx
:
int
,
addr
:
*
mut
libc
::
c_void
)
->
IoResult
<
()
>
{
use
intrinsics
;
#[repr(C)]
...
...
@@ -391,7 +390,7 @@ fn dladdr(addr: *const libc::c_void,
}
}
#[cfg(not(
target_os
=
"macos"
),
not(target_os
=
"ios"
))]
#[cfg(not(
any(target_os
=
"macos"
,
target_os
=
"ios"
)
))]
fn
print
(
w
:
&
mut
Writer
,
idx
:
int
,
addr
:
*
mut
libc
::
c_void
)
->
IoResult
<
()
>
{
use
collections
::
Collection
;
use
iter
::
Iterator
;
...
...
@@ -571,16 +570,17 @@ pub enum _Unwind_Context {}
extern
{
// No native _Unwind_Backtrace on iOS
#[cfg(not(
target_os
=
"ios"
,
target_arch
=
"arm"
))]
#[cfg(not(
all(target_os
=
"ios"
,
target_arch
=
"arm"
)
))]
pub
fn
_
Unwind_Backtrace
(
trace
:
_
Unwind_Trace_Fn
,
trace_argument
:
*
mut
libc
::
c_void
)
->
_
Unwind_Reason_Code
;
#[cfg(not(target_os
=
"android"
),
not(target_os
=
"linux"
,
target_arch
=
"arm"
))]
#[cfg(
all(
not(target_os
=
"android"
),
not(all(target_os
=
"linux"
,
target_arch
=
"arm"
))
))]
pub
fn
_
Unwind_GetIP
(
ctx
:
*
mut
_
Unwind_Context
)
->
libc
::
uintptr_t
;
#[cfg(not(target_os
=
"android"
),
not(target_os
=
"linux"
,
target_arch
=
"arm"
))]
#[cfg(all(not(target_os
=
"android"
),
not(all(target_os
=
"linux"
,
target_arch
=
"arm"
))))]
pub
fn
_
Unwind_FindEnclosingFunction
(
pc
:
*
mut
libc
::
c_void
)
->
*
mut
libc
::
c_void
;
}
...
...
@@ -588,8 +588,8 @@ pub fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
// On android, the function _Unwind_GetIP is a macro, and this is the
// expansion of the macro. This is all copy/pasted directly from the
// header file with the definition of _Unwind_GetIP.
#[cfg(
target_os
=
"android"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"arm"
)]
#[cfg(
any(target_os
=
"android"
,
all(target_os
=
"linux"
,
target_arch
=
"arm"
))
)]
pub
unsafe
fn
_
Unwind_GetIP
(
ctx
:
*
mut
_
Unwind_Context
)
->
libc
::
uintptr_t
{
#[repr(C)]
enum
_
Unwind_VRS_Result
{
...
...
@@ -634,8 +634,8 @@ fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
// This function also doesn't exist on Android or ARM/Linux, so make it
// a no-op
#[cfg(
target_os
=
"android"
)]
#[cfg(target_os
=
"linux"
,
target_arch
=
"arm"
)]
#[cfg(
any(target_os
=
"android"
,
all(target_os
=
"linux"
,
target_arch
=
"arm"
))
)]
pub
unsafe
fn
_
Unwind_FindEnclosingFunction
(
pc
:
*
mut
libc
::
c_void
)
->
*
mut
libc
::
c_void
{
...
...
src/libsyntax/attr.rs
浏览文件 @
ff2616e8
...
...
@@ -315,14 +315,11 @@ pub fn cfg_matches(diagnostic: &SpanHandler, cfgs: &[P<MetaItem>], cfg: &ast::Me
ast
::
MetaList
(
ref
pred
,
ref
mis
)
if
pred
.get
()
==
"all"
=>
mis
.iter
()
.all
(|
mi
|
cfg_matches
(
diagnostic
,
cfgs
,
&**
mi
)),
ast
::
MetaList
(
ref
pred
,
ref
mis
)
if
pred
.get
()
==
"not"
=>
{
// NOTE: turn on after snapshot
/*
if
mis
.len
()
!=
1
{
diagnostic
.span_warn
(
cfg
.span
,
"the use of multiple cfgs in the same `not`
\
statement is deprecated. Change `not(a, b)` to
\
`not(all(a, b))`."
);
}
*/
!
mis
.iter
()
.all
(|
mi
|
cfg_matches
(
diagnostic
,
cfgs
,
&**
mi
))
}
ast
::
MetaList
(
ref
pred
,
_
)
=>
{
...
...
src/libsyntax/config.rs
浏览文件 @
ff2616e8
...
...
@@ -260,8 +260,6 @@ fn in_cfg(diagnostic: &SpanHandler, cfg: &[P<ast::MetaItem>], attrs: &[ast::Attr
_
=>
continue
};
// NOTE: turn on after snapshot
/*
if
mis
.len
()
!=
1
{
diagnostic
.span_warn
(
attr
.span
,
"The use of multiple cfgs in the top level of
\
`#[cfg(..)]` is deprecated. Change `#[cfg(a, b)]` to
\
...
...
@@ -274,7 +272,6 @@ fn in_cfg(diagnostic: &SpanHandler, cfg: &[P<ast::MetaItem>], attrs: &[ast::Attr
the intersection of the cfgs. Change `#[cfg(a)]
\
#[cfg(b)]` to `#[cfg(any(a, b))]`."
);
}
*/
seen_cfg
=
true
;
in_cfg
|
=
mis
.iter
()
.all
(|
mi
|
attr
::
cfg_matches
(
diagnostic
,
cfg
,
&**
mi
));
...
...
src/libsyntax/ext/cfg.rs
浏览文件 @
ff2616e8
...
...
@@ -38,14 +38,11 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
p
.expect
(
&
token
::
COMMA
);
}
// NOTE: turn on after snapshot
/*
if
cfgs
.len
()
!=
1
{
cx
.span_warn
(
sp
,
"The use of multiple cfgs at the top level of `cfg!`
\
is deprecated. Change `cfg!(a, b)` to
\
`cfg!(all(a, b))`."
);
}
*/
let
matches_cfg
=
cfgs
.iter
()
.all
(|
cfg
|
attr
::
cfg_matches
(
&
cx
.parse_sess.span_diagnostic
,
cx
.cfg
.as_slice
(),
&**
cfg
));
...
...
src/libtime/lib.rs
浏览文件 @
ff2616e8
...
...
@@ -47,7 +47,7 @@ mod rustrt {
}
}
#[cfg(
unix,
not(target_os
=
"macos"
),
not(target_os
=
"ios"
))]
#[cfg(
all(unix,
not(target_os
=
"macos"
),
not(target_os
=
"ios"
)
))]
mod
imp
{
use
libc
::{
c_int
,
timespec
};
...
...
@@ -61,8 +61,7 @@ mod imp {
}
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
mod
imp
{
use
libc
::{
timeval
,
timezone
,
c_int
,
mach_timebase_info
};
...
...
@@ -150,8 +149,7 @@ unsafe fn os_get_time() -> (i64, i32) {
((
ns_since_1970
%
1000000
)
*
1000
)
as
i32
)
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
unsafe
fn
os_get_time
()
->
(
i64
,
i32
)
{
use
std
::
ptr
;
let
mut
tv
=
libc
::
timeval
{
tv_sec
:
0
,
tv_usec
:
0
};
...
...
@@ -159,7 +157,7 @@ unsafe fn os_get_time() -> (i64, i32) {
(
tv
.tv_sec
as
i64
,
tv
.tv_usec
*
1000
)
}
#[cfg(not(
target_os
=
"macos"
),
not(target_os
=
"ios"
),
not(windows
))]
#[cfg(not(
any(target_os
=
"macos"
,
target_os
=
"ios"
,
windows)
))]
unsafe
fn
os_get_time
()
->
(
i64
,
i32
)
{
let
mut
tv
=
libc
::
timespec
{
tv_sec
:
0
,
tv_nsec
:
0
};
imp
::
clock_gettime
(
libc
::
CLOCK_REALTIME
,
&
mut
tv
);
...
...
@@ -190,8 +188,7 @@ fn os_precise_time_ns() -> u64 {
return
(
ticks
as
u64
*
1000000000
)
/
(
ticks_per_s
as
u64
);
}
#[cfg(target_os
=
"macos"
)]
#[cfg(target_os
=
"ios"
)]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
fn
os_precise_time_ns
()
->
u64
{
static
mut
TIMEBASE
:
libc
::
mach_timebase_info
=
libc
::
mach_timebase_info
{
numer
:
0
,
denom
:
0
};
...
...
@@ -205,7 +202,7 @@ fn os_precise_time_ns() -> u64 {
}
}
#[cfg(not(
windows),
not(target_os
=
"macos"
),
not(target_os
=
"ios"
))]
#[cfg(not(
any(windows,
target_os
=
"macos"
,
target_os
=
"ios"
)
))]
fn
os_precise_time_ns
()
->
u64
{
let
mut
ts
=
libc
::
timespec
{
tv_sec
:
0
,
tv_nsec
:
0
};
unsafe
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录