Skip to content

Commit ff2616e

Browse files
committed
auto merge of #17630 : sfackler/rust/cfg-warnings, r=brson
Closes #17490
2 parents 60e7317 + b4909f6 commit ff2616e

36 files changed

+322
-358
lines changed

src/etc/mklldeps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run(args):
6767
"target_os = \"" + os + "\"",
6868
]
6969

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

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

src/liballoc/heap.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
111111
// The minimum alignment guaranteed by the architecture. This value is used to
112112
// add fast paths for low alignment values. In practice, the alignment is a
113113
// constant at the call site and the branch will be optimized out.
114-
#[cfg(target_arch = "arm")]
115-
#[cfg(target_arch = "mips")]
116-
#[cfg(target_arch = "mipsel")]
114+
#[cfg(any(target_arch = "arm",
115+
target_arch = "mips",
116+
target_arch = "mipsel"))]
117117
static MIN_ALIGN: uint = 8;
118-
#[cfg(target_arch = "x86")]
119-
#[cfg(target_arch = "x86_64")]
118+
#[cfg(any(target_arch = "x86",
119+
target_arch = "x86_64"))]
120120
static MIN_ALIGN: uint = 16;
121121

122122
#[cfg(jemalloc)]
@@ -146,7 +146,7 @@ mod imp {
146146
}
147147

148148
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
149-
#[cfg(not(windows), not(target_os = "android"))]
149+
#[cfg(all(not(windows), not(target_os = "android")))]
150150
#[link(name = "pthread")]
151151
extern {}
152152

@@ -206,7 +206,7 @@ mod imp {
206206
}
207207
}
208208

209-
#[cfg(not(jemalloc), unix)]
209+
#[cfg(all(not(jemalloc), unix))]
210210
mod imp {
211211
use core::cmp;
212212
use core::ptr;
@@ -268,7 +268,7 @@ mod imp {
268268
pub fn stats_print() {}
269269
}
270270

271-
#[cfg(not(jemalloc), windows)]
271+
#[cfg(all(not(jemalloc), windows))]
272272
mod imp {
273273
use libc::{c_void, size_t};
274274
use libc;

src/libgreen/context.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -188,27 +188,27 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
188188

189189
// windows requires saving more registers (both general and XMM), so the windows
190190
// register context must be larger.
191-
#[cfg(windows, target_arch = "x86_64")]
191+
#[cfg(all(windows, target_arch = "x86_64"))]
192192
#[repr(C)]
193193
struct Registers {
194194
gpr:[libc::uintptr_t, ..14],
195195
_xmm:[simd::u32x4, ..10]
196196
}
197-
#[cfg(not(windows), target_arch = "x86_64")]
197+
#[cfg(all(not(windows), target_arch = "x86_64"))]
198198
#[repr(C)]
199199
struct Registers {
200200
gpr:[libc::uintptr_t, ..10],
201201
_xmm:[simd::u32x4, ..6]
202202
}
203203

204-
#[cfg(windows, target_arch = "x86_64")]
204+
#[cfg(all(windows, target_arch = "x86_64"))]
205205
fn new_regs() -> Box<Registers> {
206206
box() Registers {
207207
gpr:[0,..14],
208208
_xmm:[simd::u32x4(0,0,0,0),..10]
209209
}
210210
}
211-
#[cfg(not(windows), target_arch = "x86_64")]
211+
#[cfg(all(not(windows), target_arch = "x86_64"))]
212212
fn new_regs() -> Box<Registers> {
213213
box() Registers {
214214
gpr:[0,..10],
@@ -288,16 +288,13 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
288288
regs[14] = rust_bootstrap_green_task as libc::uintptr_t; // #56 pc, r14 --> lr
289289
}
290290

291-
#[cfg(target_arch = "mips")]
292-
#[cfg(target_arch = "mipsel")]
291+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
293292
type Registers = [libc::uintptr_t, ..32];
294293

295-
#[cfg(target_arch = "mips")]
296-
#[cfg(target_arch = "mipsel")]
294+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
297295
fn new_regs() -> Box<Registers> { box {[0, .. 32]} }
298296

299-
#[cfg(target_arch = "mips")]
300-
#[cfg(target_arch = "mipsel")]
297+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
301298
fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
302299
procedure: raw::Procedure, sp: *mut uint) {
303300
let sp = align_down(sp);

src/libgreen/stack.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ pub struct Stack {
2828
//
2929
// DragonFly BSD also seems to suffer from the same problem. When MAP_STACK is
3030
// used, it returns the same `ptr` multiple times.
31-
#[cfg(not(windows), not(target_os = "freebsd"), not(target_os = "dragonfly"))]
31+
#[cfg(not(any(windows, target_os = "freebsd", target_os = "dragonfly")))]
3232
static STACK_FLAGS: libc::c_int = libc::MAP_STACK | libc::MAP_PRIVATE |
3333
libc::MAP_ANON;
34-
#[cfg(target_os = "freebsd")]
35-
#[cfg(target_os = "dragonfly")]
34+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
3635
static STACK_FLAGS: libc::c_int = libc::MAP_PRIVATE | libc::MAP_ANON;
3736
#[cfg(windows)]
3837
static STACK_FLAGS: libc::c_int = 0;

0 commit comments

Comments
 (0)