Skip to content

Commit 6b5ec40

Browse files
committed
auto merge of #16435 : vadimcn/rust/windows, r=pcwalton
Using "win32" to mean "Windows" is confusing, especially now, that Rust supports win64 builds. Let's call spade a spade.
2 parents dbb0cee + 88c27e0 commit 6b5ec40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+132
-97
lines changed

src/compiletest/runtest.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use header::TestProps;
1616
use header;
1717
use procsrv;
1818
use util::logv;
19-
#[cfg(target_os = "win32")]
19+
#[cfg(target_os = "windows")]
20+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
2021
use util;
2122

2223
use std::io::File;
@@ -817,7 +818,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
817818
format!("{}:{}:", testfile.display(), ee.line)
818819
}).collect::<Vec<String> >();
819820

820-
#[cfg(target_os = "win32")]
821+
#[cfg(target_os = "windows")]
822+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
821823
fn to_lower( s : &str ) -> String {
822824
let i = s.chars();
823825
let c : Vec<char> = i.map( |c| {
@@ -830,7 +832,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
830832
String::from_chars(c.as_slice())
831833
}
832834

833-
#[cfg(target_os = "win32")]
835+
#[cfg(target_os = "windows")]
836+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
834837
fn prefix_matches( line : &str, prefix : &str ) -> bool {
835838
to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
836839
}
@@ -1247,14 +1250,16 @@ fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String {
12471250
format!("{} {}", prog, args.connect(" "))
12481251
}
12491252

1250-
#[cfg(target_os = "win32")]
1253+
#[cfg(target_os = "windows")]
1254+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12511255
fn make_cmdline(libpath: &str, prog: &str, args: &[String]) -> String {
12521256
format!("{} {} {}", lib_path_cmd_prefix(libpath), prog, args.connect(" "))
12531257
}
12541258

12551259
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
12561260
// for diagnostic purposes
1257-
#[cfg(target_os = "win32")]
1261+
#[cfg(target_os = "windows")]
1262+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
12581263
fn lib_path_cmd_prefix(path: &str) -> String {
12591264
format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
12601265
}

src/compiletest/util.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010

1111
use common::Config;
1212

13-
#[cfg(target_os = "win32")]
13+
#[cfg(target_os = "windows")]
14+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
1415
use std::os::getenv;
1516

1617
/// Conversion table from triple OS name to Rust SYSNAME
1718
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
18-
("mingw32", "win32"),
19-
("win32", "win32"),
19+
("mingw32", "windows"),
20+
("win32", "windows"),
21+
("windows", "windows"),
2022
("darwin", "macos"),
2123
("android", "android"),
2224
("linux", "linux"),
@@ -33,7 +35,8 @@ pub fn get_os(triple: &str) -> &'static str {
3335
fail!("Cannot determine OS from triple");
3436
}
3537

36-
#[cfg(target_os = "win32")]
38+
#[cfg(target_os = "windows")]
39+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
3740
pub fn make_new_path(path: &str) -> String {
3841

3942
// 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 {
4649
}
4750
}
4851

49-
#[cfg(target_os = "win32")]
52+
#[cfg(target_os = "windows")]
53+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
5054
pub fn lib_path_env_var() -> &'static str { "PATH" }
5155

52-
#[cfg(target_os = "win32")]
56+
#[cfg(target_os = "windows")]
57+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
5358
pub fn path_div() -> &'static str { ";" }
5459

5560
pub fn logv(config: &Config, s: String) {

src/etc/mklldeps.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ def run(args):
6161
elif 'android' in os:
6262
os = 'android'
6363
elif 'win' in os or 'mingw' in os:
64-
os = 'win32'
64+
os = 'windows'
6565
cfg = [
6666
"target_arch = \"" + arch + "\"",
6767
"target_os = \"" + os + "\"",
6868
]
6969

7070
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
71+
if os == "windows": # NOTE: Remove after snapshot
72+
f.write("#[cfg(stage0, target_arch = \"%s\", target_os = \"win32\")]\n" % (arch,))
7173

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

src/liblibc/lib.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,8 @@ pub mod types {
11381138
}
11391139
}
11401140

1141-
#[cfg(target_os = "win32")]
1141+
#[cfg(target_os = "windows")]
1142+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
11421143
pub mod os {
11431144
pub mod common {
11441145
pub mod posix01 {
@@ -1803,7 +1804,8 @@ pub mod consts {
18031804
// Consts tend to vary per OS so we pull their definitions out
18041805
// into this module.
18051806

1806-
#[cfg(target_os = "win32")]
1807+
#[cfg(target_os = "windows")]
1808+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
18071809
pub mod os {
18081810
pub mod c95 {
18091811
use types::os::arch::c95::{c_int, c_uint};
@@ -3887,7 +3889,8 @@ pub mod funcs {
38873889
// so be careful when trying to write portable code; it won't always work
38883890
// with the same POSIX functions and types as other platforms.
38893891

3890-
#[cfg(target_os = "win32")]
3892+
#[cfg(target_os = "windows")]
3893+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
38913894
pub mod posix88 {
38923895
pub mod stat_ {
38933896
use types::os::common::posix01::{stat, utimbuf};
@@ -4316,7 +4319,8 @@ pub mod funcs {
43164319
}
43174320
}
43184321

4319-
#[cfg(target_os = "win32")]
4322+
#[cfg(target_os = "windows")]
4323+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
43204324
pub mod posix01 {
43214325
pub mod stat_ {
43224326
}
@@ -4332,7 +4336,8 @@ pub mod funcs {
43324336
}
43334337

43344338

4335-
#[cfg(target_os = "win32")]
4339+
#[cfg(target_os = "windows")]
4340+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
43364341
#[cfg(target_os = "linux")]
43374342
#[cfg(target_os = "android")]
43384343
#[cfg(target_os = "macos")]
@@ -4470,7 +4475,8 @@ pub mod funcs {
44704475
}
44714476

44724477

4473-
#[cfg(target_os = "win32")]
4478+
#[cfg(target_os = "windows")]
4479+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
44744480
pub mod bsd44 {
44754481
}
44764482

@@ -4496,7 +4502,8 @@ pub mod funcs {
44964502
}
44974503

44984504

4499-
#[cfg(target_os = "win32")]
4505+
#[cfg(target_os = "windows")]
4506+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
45004507
pub mod extra {
45014508

45024509
pub mod kernel32 {

src/libnative/io/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ pub mod file;
5858
#[path = "timer_unix.rs"]
5959
pub mod timer;
6060

61-
#[cfg(target_os = "win32")]
61+
#[cfg(target_os = "windows")]
62+
#[cfg(stage0, target_os = "win32")] // NOTE: Remove after snapshot
6263
#[path = "timer_win32.rs"]
6364
pub mod timer;
6465

src/librustc/back/link.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub mod write {
200200
// OSX has -dead_strip, which doesn't rely on ffunction_sections
201201
// FIXME(#13846) this should be enabled for windows
202202
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
203-
sess.targ_cfg.os != abi::OsWin32;
203+
sess.targ_cfg.os != abi::OsWindows;
204204
let fdata_sections = ffunction_sections;
205205

206206
let reloc_model = match sess.opts.cg.relocation_model.as_slice() {
@@ -858,7 +858,7 @@ pub fn get_cc_prog(sess: &Session) -> String {
858858
// instead of hard-coded gcc.
859859
// For win32, there is no cc command, so we add a condition to make it use gcc.
860860
match sess.targ_cfg.os {
861-
abi::OsWin32 => "gcc",
861+
abi::OsWindows => "gcc",
862862
_ => "cc",
863863
}.to_string()
864864
}
@@ -954,7 +954,7 @@ pub fn filename_for_input(sess: &Session,
954954
}
955955
config::CrateTypeDylib => {
956956
let (prefix, suffix) = match sess.targ_cfg.os {
957-
abi::OsWin32 => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
957+
abi::OsWindows => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
958958
abi::OsMacos => (loader::MACOS_DLL_PREFIX, loader::MACOS_DLL_SUFFIX),
959959
abi::OsLinux => (loader::LINUX_DLL_PREFIX, loader::LINUX_DLL_SUFFIX),
960960
abi::OsAndroid => (loader::ANDROID_DLL_PREFIX, loader::ANDROID_DLL_SUFFIX),
@@ -972,7 +972,7 @@ pub fn filename_for_input(sess: &Session,
972972
}
973973
config::CrateTypeExecutable => {
974974
match sess.targ_cfg.os {
975-
abi::OsWin32 => out_filename.with_extension("exe"),
975+
abi::OsWindows => out_filename.with_extension("exe"),
976976
abi::OsMacos |
977977
abi::OsLinux |
978978
abi::OsAndroid |
@@ -1388,7 +1388,7 @@ fn link_args(cmd: &mut Command,
13881388
// subset we wanted.
13891389
//
13901390
// FIXME(#11937) we should invoke the system linker directly
1391-
if sess.targ_cfg.os != abi::OsWin32 {
1391+
if sess.targ_cfg.os != abi::OsWindows {
13921392
cmd.arg("-nodefaultlibs");
13931393
}
13941394

@@ -1440,7 +1440,7 @@ fn link_args(cmd: &mut Command,
14401440
cmd.arg("-Wl,-dead_strip");
14411441
}
14421442

1443-
if sess.targ_cfg.os == abi::OsWin32 {
1443+
if sess.targ_cfg.os == abi::OsWindows {
14441444
// Make sure that we link to the dynamic libgcc, otherwise cross-module
14451445
// DWARF stack unwinding will not work.
14461446
// This behavior may be overridden by --link-args "-static-libgcc"
@@ -1715,7 +1715,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
17151715

17161716
// Converts a library file-stem into a cc -l argument
17171717
fn unlib<'a>(config: &config::Config, stem: &'a [u8]) -> &'a [u8] {
1718-
if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWin32 {
1718+
if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWindows {
17191719
stem.tailn(3)
17201720
} else {
17211721
stem

src/librustc/driver/config.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ pub fn default_lib_output() -> CrateType {
390390

391391
pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
392392
let tos = match sess.targ_cfg.os {
393-
abi::OsWin32 => InternedString::new("win32"),
393+
abi::OsWindows => InternedString::new("windows"),
394394
abi::OsMacos => InternedString::new("macos"),
395395
abi::OsLinux => InternedString::new("linux"),
396396
abi::OsAndroid => InternedString::new("android"),
@@ -410,7 +410,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
410410
};
411411

412412
let fam = match sess.targ_cfg.os {
413-
abi::OsWin32 => InternedString::new("windows"),
413+
abi::OsWindows => InternedString::new("windows"),
414414
_ => InternedString::new("unix")
415415
};
416416

@@ -452,8 +452,9 @@ pub fn get_os(triple: &str) -> Option<abi::Os> {
452452
None
453453
}
454454
static os_names : &'static [(&'static str, abi::Os)] = &[
455-
("mingw32", abi::OsWin32),
456-
("win32", abi::OsWin32),
455+
("mingw32", abi::OsWindows),
456+
("win32", abi::OsWindows),
457+
("windows", abi::OsWindows),
457458
("darwin", abi::OsMacos),
458459
("android", abi::OsAndroid),
459460
("linux", abi::OsLinux),

src/librustc/metadata/loader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ impl<'a> Context<'a> {
615615
// dynamic libraries
616616
fn dylibname(&self) -> Option<(&'static str, &'static str)> {
617617
match self.os {
618-
abi::OsWin32 => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
618+
abi::OsWindows => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
619619
abi::OsMacos => Some((MACOS_DLL_PREFIX, MACOS_DLL_SUFFIX)),
620620
abi::OsLinux => Some((LINUX_DLL_PREFIX, LINUX_DLL_SUFFIX)),
621621
abi::OsAndroid => Some((ANDROID_DLL_PREFIX, ANDROID_DLL_SUFFIX)),
@@ -824,7 +824,7 @@ pub fn meta_section_name(os: abi::Os) -> Option<&'static str> {
824824
match os {
825825
abi::OsMacos => Some("__DATA,__note.rustc"),
826826
abi::OsiOS => Some("__DATA,__note.rustc"),
827-
abi::OsWin32 => Some(".note.rustc"),
827+
abi::OsWindows => Some(".note.rustc"),
828828
abi::OsLinux => Some(".note.rustc"),
829829
abi::OsAndroid => Some(".note.rustc"),
830830
abi::OsFreebsd => Some(".note.rustc"),
@@ -836,7 +836,7 @@ pub fn read_meta_section_name(os: abi::Os) -> &'static str {
836836
match os {
837837
abi::OsMacos => "__note.rustc",
838838
abi::OsiOS => unreachable!(),
839-
abi::OsWin32 => ".note.rustc",
839+
abi::OsWindows => ".note.rustc",
840840
abi::OsLinux => ".note.rustc",
841841
abi::OsAndroid => ".note.rustc",
842842
abi::OsFreebsd => ".note.rustc",

src/librustc/middle/trans/cabi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use middle::trans::cabi_arm;
1818
use middle::trans::cabi_mips;
1919
use middle::trans::type_::Type;
2020
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
21-
use syntax::abi::{OsWin32};
21+
use syntax::abi::{OsWindows};
2222

2323
#[deriving(Clone, PartialEq)]
2424
pub enum ArgKind {
@@ -110,7 +110,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
110110
match ccx.sess().targ_cfg.arch {
111111
X86 => cabi_x86::compute_abi_info(ccx, atys, rty, ret_def),
112112
X86_64 =>
113-
if ccx.sess().targ_cfg.os == OsWin32 {
113+
if ccx.sess().targ_cfg.os == OsWindows {
114114
cabi_x86_win64::compute_abi_info(ccx, atys, rty, ret_def)
115115
} else {
116116
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)

src/librustc/middle/trans/cabi_x86.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
use syntax::abi::{OsWin32, OsMacos, OsiOS};
12+
use syntax::abi::{OsWindows, OsMacos, OsiOS};
1313
use llvm::*;
1414
use super::cabi::*;
1515
use super::common::*;
@@ -36,7 +36,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
3636

3737
enum Strategy { RetValue(Type), RetPointer }
3838
let strategy = match ccx.sess().targ_cfg.os {
39-
OsWin32 | OsMacos | OsiOS => {
39+
OsWindows | OsMacos | OsiOS => {
4040
match llsize_of_alloc(ccx, rty) {
4141
1 => RetValue(Type::i8(ccx)),
4242
2 => RetValue(Type::i16(ccx)),

src/librustc_back/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
9898
pub fn find_library(name: &str, os: abi::Os, search_paths: &[Path],
9999
handler: &ErrorHandler) -> Path {
100100
let (osprefix, osext) = match os {
101-
abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
101+
abi::OsWindows => ("", "lib"), _ => ("lib", "a"),
102102
};
103103
// On Windows, static libraries sometimes show up as libfoo.a and other
104104
// times show up as foo.lib

src/librustc_back/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
3737
-a0:0:64-n32".to_string()
3838
}
3939

40-
abi::OsWin32 => {
40+
abi::OsWindows => {
4141
"e-p:32:32:32\
4242
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
4343
-f32:32:32-f64:64:64\

src/librustc_back/mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
3232
-a0:0:64-n32".to_string()
3333
}
3434

35-
abi::OsWin32 => {
35+
abi::OsWindows => {
3636
"E-p:32:32:32\
3737
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
3838
-f32:32:32-f64:64:64\

src/librustc_back/mipsel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
3232
-a0:0:64-n32".to_string()
3333
}
3434

35-
abi::OsWin32 => {
35+
abi::OsWindows => {
3636
"e-p:32:32:32\
3737
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
3838
-f32:32:32-f64:64:64\

0 commit comments

Comments
 (0)