Skip to content

Turn on warnings for legacy cfg syntax and convert the stdlib #17630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 1, 2014
2 changes: 1 addition & 1 deletion src/etc/mklldeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def run(args):
"target_os = \"" + os + "\"",
]

f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
f.write("#[cfg(all(" + ', '.join(cfg) + "))]\n")

version = run([llconfig, '--version']).strip()

Expand Down
16 changes: 8 additions & 8 deletions src/liballoc/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -146,7 +146,7 @@ mod imp {
}

// -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 {}

Expand Down Expand Up @@ -206,7 +206,7 @@ mod imp {
}
}

#[cfg(not(jemalloc), unix)]
#[cfg(all(not(jemalloc), unix))]
mod imp {
use core::cmp;
use core::ptr;
Expand Down Expand Up @@ -268,7 +268,7 @@ mod imp {
pub fn stats_print() {}
}

#[cfg(not(jemalloc), windows)]
#[cfg(all(not(jemalloc), windows))]
mod imp {
use libc::{c_void, size_t};
use libc;
Expand Down
17 changes: 7 additions & 10 deletions src/libgreen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/libgreen/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading