Skip to content

Commit

Permalink
Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")]
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimcn committed Aug 12, 2014
1 parent 98332b1 commit 3dfd129
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 37 deletions.
15 changes: 10 additions & 5 deletions src/compiletest/runtest.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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| {
Expand All @@ -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())
}
Expand Down Expand Up @@ -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))
}
Expand Down
17 changes: 11 additions & 6 deletions src/compiletest/util.rs
Expand Up @@ -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"),
Expand All @@ -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
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/etc/mklldeps.py
Expand Up @@ -61,13 +61,15 @@ def run(args):
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()

Expand Down
21 changes: 14 additions & 7 deletions src/liblibc/lib.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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_ {
}
Expand All @@ -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")]
Expand Down Expand Up @@ -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 {
}

Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/libnative/io/mod.rs
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/driver/config.rs
Expand Up @@ -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"),
Expand Down Expand Up @@ -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),
Expand Down
6 changes: 4 additions & 2 deletions src/librustdoc/plugins.rs
Expand Up @@ -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
Expand All @@ -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());
Expand Down
3 changes: 2 additions & 1 deletion src/librustrt/args.rs
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/librustrt/libunwind.rs
Expand Up @@ -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 {}

Expand Down
12 changes: 8 additions & 4 deletions src/librustrt/stack.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion src/librustuv/uvll.rs
Expand Up @@ -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")]
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/dynamic_lib.rs
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/os.rs
Expand Up @@ -1842,15 +1842,16 @@ 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;

pub static FAMILY: &'static str = "windows";

/// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/abi.rs
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/test/run-pass/dupe-first-attr.rc
Expand Up @@ -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")]
Expand Down
3 changes: 2 additions & 1 deletion src/test/run-pass/intrinsic-alignment.rs
Expand Up @@ -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")]
Expand Down
3 changes: 2 additions & 1 deletion src/test/run-pass/rec-align-u64.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 3dfd129

Please sign in to comment.