Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")]

This commit is contained in:
Vadim Chugunov 2014-08-10 21:26:45 -07:00
parent 98332b1a06
commit 3dfd12967a
17 changed files with 72 additions and 37 deletions

View File

@ -16,7 +16,8 @@ use header::TestProps;
use header;
use procsrv;
use util::logv;
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
use util;
use std::io::File;
@ -816,7 +817,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
format!("{}:{}:", testfile.display(), ee.line)
}).collect::<Vec<String> >();
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
fn to_lower( s : &str ) -> String {
let i = s.chars();
let c : Vec<char> = i.map( |c| {
@ -829,7 +831,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
String::from_chars(c.as_slice())
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
fn prefix_matches( line : &str, prefix : &str ) -> bool {
to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
}
@ -1246,14 +1249,16 @@ fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String {
format!("{} {}", prog, args.connect(" "))
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
fn make_cmdline(libpath: &str, prog: &str, args: &[String]) -> String {
format!("{} {} {}", lib_path_cmd_prefix(libpath), prog, args.connect(" "))
}
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
// for diagnostic purposes
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
fn lib_path_cmd_prefix(path: &str) -> String {
format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
}

View File

@ -10,13 +10,15 @@
use common::Config;
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
use std::os::getenv;
/// Conversion table from triple OS name to Rust SYSNAME
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
("mingw32", "win32"),
("win32", "win32"),
("mingw32", "windows"),
("win32", "windows"),
("windows", "windows"),
("darwin", "macos"),
("android", "android"),
("linux", "linux"),
@ -33,7 +35,8 @@ pub fn get_os(triple: &str) -> &'static str {
fail!("Cannot determine OS from triple");
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub fn make_new_path(path: &str) -> String {
// Windows just uses PATH as the library search path, so we have to
@ -46,10 +49,12 @@ pub fn make_new_path(path: &str) -> String {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub fn lib_path_env_var() -> &'static str { "PATH" }
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub fn path_div() -> &'static str { ";" }
pub fn logv(config: &Config, s: String) {

View File

@ -61,13 +61,15 @@ for llconfig in sys.argv[4:]:
elif 'android' in os:
os = 'android'
elif 'win' in os or 'mingw' in os:
os = 'win32'
os = 'windows'
cfg = [
"target_arch = \"" + arch + "\"",
"target_os = \"" + os + "\"",
]
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
if os == "windows": # NOTE: Remove after snapshot
f.write("#[cfg(stage0, target_arch = \"%s\", target_os = \"win32\")]\n" % (arch,))
version = run([llconfig, '--version']).strip()

View File

@ -1138,7 +1138,8 @@ pub mod types {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod os {
pub mod common {
pub mod posix01 {
@ -1803,7 +1804,8 @@ pub mod consts {
// Consts tend to vary per OS so we pull their definitions out
// into this module.
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
@ -3887,7 +3889,8 @@ pub mod funcs {
// so be careful when trying to write portable code; it won't always work
// with the same POSIX functions and types as other platforms.
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod posix88 {
pub mod stat_ {
use types::os::common::posix01::{stat, utimbuf};
@ -4316,7 +4319,8 @@ pub mod funcs {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod posix01 {
pub mod stat_ {
}
@ -4332,7 +4336,8 @@ pub mod funcs {
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
#[cfg(target_os = "linux")]
#[cfg(target_os = "android")]
#[cfg(target_os = "macos")]
@ -4470,7 +4475,8 @@ pub mod funcs {
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod bsd44 {
}
@ -4496,7 +4502,8 @@ pub mod funcs {
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod extra {
pub mod kernel32 {

View File

@ -58,7 +58,8 @@ pub mod file;
#[path = "timer_unix.rs"]
pub mod timer;
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
#[path = "timer_win32.rs"]
pub mod timer;

View File

@ -390,7 +390,7 @@ pub fn default_lib_output() -> CrateType {
pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
let tos = match sess.targ_cfg.os {
abi::OsWindows => InternedString::new("win32"),
abi::OsWindows => InternedString::new("windows"),
abi::OsMacos => InternedString::new("macos"),
abi::OsLinux => InternedString::new("linux"),
abi::OsAndroid => InternedString::new("android"),
@ -454,6 +454,7 @@ pub fn get_os(triple: &str) -> Option<abi::Os> {
static os_names : &'static [(&'static str, abi::Os)] = &[
("mingw32", abi::OsWindows),
("win32", abi::OsWindows),
("windows", abi::OsWindows),
("darwin", abi::OsMacos),
("android", abi::OsAndroid),
("linux", abi::OsLinux),

View File

@ -73,7 +73,8 @@ impl PluginManager {
}
}
#[cfg(target_os="win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
fn libname(mut n: String) -> String {
n.push_str(".dll");
n
@ -85,7 +86,8 @@ fn libname(mut n: String) -> String {
n
}
#[cfg(not(target_os="win32"), not(target_os="macos"))]
#[cfg(not(stage0), not(target_os="windows"), not(target_os="macos"))]
#[cfg(stage0, not(target_os="win32"), not(target_os="macos"))] // NOTE: Remove after snapshot
fn libname(n: String) -> String {
let mut i = String::from_str("lib");
i.push_str(n.as_slice());

View File

@ -147,7 +147,8 @@ mod imp {
#[cfg(target_os = "macos")]
#[cfg(target_os = "ios")]
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
mod imp {
use core::prelude::*;
use collections::vec::Vec;

View File

@ -86,7 +86,8 @@ pub type _Unwind_Exception_Cleanup_Fn =
#[cfg(target_os = "linux")]
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
#[link(name = "gcc_s")]
extern {}

View File

@ -199,7 +199,8 @@ pub unsafe fn record_sp_limit(limit: uint) {
unsafe fn target_record_sp_limit(limit: uint) {
asm!("movq $0, %fs:112" :: "r"(limit) :: "volatile")
}
#[cfg(target_arch = "x86_64", target_os = "win32")] #[inline(always)]
#[cfg(target_arch = "x86_64", target_os = "windows")] #[inline(always)]
#[cfg(stage0, target_arch = "x86_64", target_os = "win32")] // NOTE: Remove after snapshot
unsafe fn target_record_sp_limit(limit: uint) {
// see: http://en.wikipedia.org/wiki/Win32_Thread_Information_Block
// store this inside of the "arbitrary data slot", but double the size
@ -227,7 +228,8 @@ pub unsafe fn record_sp_limit(limit: uint) {
unsafe fn target_record_sp_limit(limit: uint) {
asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile")
}
#[cfg(target_arch = "x86", target_os = "win32")] #[inline(always)]
#[cfg(target_arch = "x86", target_os = "windows")] #[inline(always)]
#[cfg(stage0, target_arch = "x86", target_os = "win32")] // NOTE: Remove after snapshot
unsafe fn target_record_sp_limit(limit: uint) {
// see: http://en.wikipedia.org/wiki/Win32_Thread_Information_Block
// store this inside of the "arbitrary data slot"
@ -280,7 +282,8 @@ pub unsafe fn get_sp_limit() -> uint {
asm!("movq %fs:112, $0" : "=r"(limit) ::: "volatile");
return limit;
}
#[cfg(target_arch = "x86_64", target_os = "win32")] #[inline(always)]
#[cfg(target_arch = "x86_64", target_os = "windows")] #[inline(always)]
#[cfg(stage0, target_arch = "x86_64", target_os = "win32")] // NOTE: Remove after snapshot
unsafe fn target_get_sp_limit() -> uint {
let limit;
asm!("movq %gs:0x28, $0" : "=r"(limit) ::: "volatile");
@ -316,7 +319,8 @@ pub unsafe fn get_sp_limit() -> uint {
asm!("movl %gs:48, $0" : "=r"(limit) ::: "volatile");
return limit;
}
#[cfg(target_arch = "x86", target_os = "win32")] #[inline(always)]
#[cfg(target_arch = "x86", target_os = "windows")] #[inline(always)]
#[cfg(stage0, target_arch = "x86", target_os = "win32")] // NOTE: Remove after snapshot
unsafe fn target_get_sp_limit() -> uint {
let limit;
asm!("movl %fs:0x14, $0" : "=r"(limit) ::: "volatile");

View File

@ -723,7 +723,8 @@ extern {}
#[link(name = "rt")]
extern {}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
#[link(name = "ws2_32")]
#[link(name = "psapi")]
#[link(name = "iphlpapi")]

View File

@ -278,7 +278,8 @@ pub mod dl {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod dl {
use c_str::ToCStr;
use iter::Iterator;

View File

@ -1842,7 +1842,8 @@ pub mod consts {
pub static EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
pub mod consts {
pub use os::arch_consts::ARCH;
@ -1850,7 +1851,7 @@ pub mod consts {
/// A string describing the specific operating system in use: in this
/// case, `win32`.
pub static SYSNAME: &'static str = "win32";
pub static SYSNAME: &'static str = "windows";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, the empty string.

View File

@ -147,7 +147,7 @@ impl fmt::Show for Os {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
OsLinux => "linux".fmt(f),
OsWindows => "win32".fmt(f),
OsWindows => "windows".fmt(f),
OsMacos => "macos".fmt(f),
OsiOS => "ios".fmt(f),
OsAndroid => "android".fmt(f),

View File

@ -17,7 +17,8 @@ mod hello;
#[cfg(target_os = "macos")]
mod hello;
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
mod hello;
#[cfg(target_os = "freebsd")]

View File

@ -42,7 +42,8 @@ mod m {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
mod m {
#[main]
#[cfg(target_arch = "x86")]

View File

@ -55,7 +55,8 @@ mod m {
}
}
#[cfg(target_os = "win32")]
#[cfg(target_os = "windows")]
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
mod m {
#[cfg(target_arch = "x86")]
pub mod m {