auto merge of #17963 : sfackler/rust/cfg-error, r=alexcrichton
All deprecation warnings have been converted to errors. This includes the warning for multiple cfgs on one item. We'll leave that as an error for some period of time to ensure that all uses are updated before the behavior changes from "or" to "and".
This commit is contained in:
commit
d670d76221
22 changed files with 82 additions and 173 deletions
|
|
@ -26,8 +26,7 @@ pub extern "win64" fn foo(a: int, b: int, c: int, d: int) {
|
|||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
pub extern fn foo(a: int, b: int, c: int, d: int) {
|
||||
assert!(a == 1);
|
||||
assert!(b == 2);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
#[test]
|
||||
#[ignore(cfg(ignorecfg))]
|
||||
#[cfg_attr(ignorecfg, ignore)]
|
||||
fn shouldignore() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore(cfg(noignorecfg))]
|
||||
#[cfg_attr(noignorecfg, ignore)]
|
||||
fn shouldnotignore() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
#![feature(asm)]
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
unsafe fn next_power_of_2(n: u32) -> u32 {
|
||||
let mut tmp = n;
|
||||
asm!("dec $0" : "+rm"(tmp) :: "cc");
|
||||
|
|
@ -28,8 +27,7 @@ unsafe fn next_power_of_2(n: u32) -> u32 {
|
|||
return tmp;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
assert_eq!(64, next_power_of_2(37));
|
||||
|
|
@ -62,5 +60,5 @@ pub fn main() {
|
|||
assert_eq!(x, 60);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "x86"), not(target_arch = "x86_64"))]
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
#![feature(asm)]
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub fn main() {
|
||||
let x: int;
|
||||
unsafe {
|
||||
|
|
@ -30,5 +29,5 @@ pub fn main() {
|
|||
assert_eq!(x, 13);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "x86"), not(target_arch = "x86_64"))]
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
fn target() {
|
||||
assert_eq!(-1000 as uint >> 3u, 536870787u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,24 +11,23 @@
|
|||
// compile-flags: --cfg fooA --cfg fooB
|
||||
|
||||
// fooA AND !bar
|
||||
#[cfg(fooA, not(bar))]
|
||||
#[cfg(all(fooA, not(bar)))]
|
||||
fn foo1() -> int { 1 }
|
||||
|
||||
// !fooA AND !bar
|
||||
#[cfg(not(fooA), not(bar))]
|
||||
#[cfg(all(not(fooA), not(bar)))]
|
||||
fn foo2() -> int { 2 }
|
||||
|
||||
// fooC OR (fooB AND !bar)
|
||||
#[cfg(fooC)]
|
||||
#[cfg(fooB, not(bar))]
|
||||
#[cfg(any(fooC, all(fooB, not(bar))))]
|
||||
fn foo2() -> int { 3 }
|
||||
|
||||
// fooA AND bar
|
||||
#[cfg(fooA, bar)]
|
||||
#[cfg(all(fooA, bar))]
|
||||
fn foo3() -> int { 2 }
|
||||
|
||||
// !(fooA AND bar)
|
||||
#[cfg(not(fooA, bar))]
|
||||
#[cfg(not(all(fooA, bar)))]
|
||||
fn foo3() -> int { 3 }
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ pub fn test_destroy_actually_kills(force: bool) {
|
|||
use libc;
|
||||
use std::str;
|
||||
|
||||
#[cfg(unix,not(target_os="android"))]
|
||||
#[cfg(all(unix,not(target_os="android")))]
|
||||
static BLOCK_COMMAND: &'static str = "cat";
|
||||
|
||||
#[cfg(unix,target_os="android")]
|
||||
#[cfg(all(unix,target_os="android"))]
|
||||
static BLOCK_COMMAND: &'static str = "/system/bin/cat";
|
||||
|
||||
#[cfg(windows)]
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ mod rusti {
|
|||
}
|
||||
}
|
||||
|
||||
#[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"))]
|
||||
mod m {
|
||||
#[main]
|
||||
#[cfg(target_arch = "x86")]
|
||||
|
|
@ -32,8 +32,7 @@ mod m {
|
|||
}
|
||||
|
||||
#[main]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "arm"))]
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ macro_rules! demo {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
fn main() {
|
||||
fn out_write_only_expr_then_in_expr() {
|
||||
demo!("=r")
|
||||
|
|
@ -51,5 +50,5 @@ fn main() {
|
|||
out_read_write_expr_then_in_expr();
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "x86"), not(target_arch = "x86_64"))]
|
||||
#[cfg(all(not(target_arch = "x86"), not(target_arch = "x86_64")))]
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ pub fn main() {
|
|||
assert_eq!(mem::size_of::<Kitty>(), 16 as uint);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
pub fn main() {
|
||||
assert_eq!(mem::size_of::<Cat>(), 4 as uint);
|
||||
assert_eq!(mem::size_of::<Kitty>(), 8 as uint);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ struct Outer {
|
|||
}
|
||||
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
mod m {
|
||||
pub fn align() -> uint { 4u }
|
||||
pub fn size() -> uint { 8u }
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ struct Outer {
|
|||
}
|
||||
|
||||
|
||||
#[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"))]
|
||||
mod m {
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub mod m {
|
||||
|
|
@ -47,8 +47,7 @@ mod m {
|
|||
pub fn size() -> uint { 12u }
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "arm"))]
|
||||
pub mod m {
|
||||
pub fn align() -> uint { 8u }
|
||||
pub fn size() -> uint { 16u }
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ fn test2() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
fn test2() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,17 +18,15 @@ pub fn main() {
|
|||
if ! cfg!(qux="foo") { fail!() }
|
||||
if cfg!(not(qux="foo")) { fail!() }
|
||||
|
||||
if ! cfg!(foo, qux="foo") { fail!() }
|
||||
if cfg!(not(foo, qux="foo")) { fail!() }
|
||||
if cfg!(all(not(foo, qux="foo"))) { fail!() }
|
||||
if ! cfg!(all(foo, qux="foo")) { fail!() }
|
||||
if cfg!(not(all(foo, qux="foo"))) { fail!() }
|
||||
if cfg!(all(not(all(foo, qux="foo")))) { fail!() }
|
||||
|
||||
if cfg!(not_a_cfg) { fail!() }
|
||||
if cfg!(not_a_cfg, foo, qux="foo") { fail!() }
|
||||
if cfg!(all(not_a_cfg, foo, qux="foo")) { fail!() }
|
||||
if cfg!(all(not_a_cfg, foo, qux="foo")) { fail!() }
|
||||
if ! cfg!(any(not_a_cfg, foo)) { fail!() }
|
||||
|
||||
if ! cfg!(not(not_a_cfg)) { fail!() }
|
||||
if ! cfg!(not(not_a_cfg), foo, qux="foo") { fail!() }
|
||||
|
||||
if cfg!(trailing_comma, ) { fail!() }
|
||||
if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { fail!() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ pub fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
#[cfg(target_os = "android")]
|
||||
#[cfg(any(target_os = "macos",
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "android"))]
|
||||
pub fn main() { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue