Skip to content

Commit 98332b1

Browse files
committed
Replace all references to "Win32" with "Windows".
For historical reasons, "Win32" has been used in Rust codebase to mean "Windows OS in general". This is confusing, especially now, that Rust supports Win64 builds. [breaking-change]
1 parent 48ee816 commit 98332b1

File tree

13 files changed

+35
-35
lines changed

13 files changed

+35
-35
lines changed

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: 4 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("win32"),
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,8 @@ 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),
457457
("darwin", abi::OsMacos),
458458
("android", abi::OsAndroid),
459459
("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\

src/librustc_back/rpath.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct RPathConfig<'a> {
2626
pub fn get_rpath_flags(config: RPathConfig) -> Vec<String> {
2727

2828
// No rpath on windows
29-
if config.os == abi::OsWin32 {
29+
if config.os == abi::OsWindows {
3030
return Vec::new();
3131
}
3232

@@ -107,14 +107,14 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig,
107107
lib: &Path) -> String {
108108
use std::os;
109109

110-
assert!(config.os != abi::OsWin32);
110+
assert!(config.os != abi::OsWindows);
111111

112112
// Mac doesn't appear to support $ORIGIN
113113
let prefix = match config.os {
114114
abi::OsAndroid | abi::OsLinux | abi::OsFreebsd | abi::OsDragonfly
115115
=> "$ORIGIN",
116116
abi::OsMacos => "@loader_path",
117-
abi::OsWin32 | abi::OsiOS => unreachable!()
117+
abi::OsWindows | abi::OsiOS => unreachable!()
118118
};
119119

120120
let mut lib = (config.realpath)(&os::make_absolute(lib)).unwrap();

src/librustc_back/x86.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os)
3434
-n8:16:32".to_string()
3535
}
3636

37-
abi::OsWin32 => {
37+
abi::OsWindows => {
3838
"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string()
3939
}
4040

src/librustc_back/x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
2929
s0:64:64-f80:128:128-n8:16:32:64".to_string()
3030
}
3131

32-
abi::OsWin32 => {
32+
abi::OsWindows => {
3333
// FIXME: Test this. Copied from linux (#2398)
3434
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
3535
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\

src/libsyntax/abi.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use std::fmt;
1212

1313
#[deriving(PartialEq)]
14-
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
14+
pub enum Os { OsWindows, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
1515
OsDragonfly }
1616

1717
#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
@@ -124,7 +124,7 @@ impl Abi {
124124
// Transform this ABI as appropriate for the requested os/arch
125125
// combination.
126126
Some(match (*self, os, arch) {
127-
(System, OsWin32, X86) => Stdcall,
127+
(System, OsWindows, X86) => Stdcall,
128128
(System, _, _) => C,
129129
(me, _, _) => me,
130130
})
@@ -147,7 +147,7 @@ impl fmt::Show for Os {
147147
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
148148
match *self {
149149
OsLinux => "linux".fmt(f),
150-
OsWin32 => "win32".fmt(f),
150+
OsWindows => "win32".fmt(f),
151151
OsMacos => "macos".fmt(f),
152152
OsiOS => "ios".fmt(f),
153153
OsAndroid => "android".fmt(f),
@@ -195,9 +195,9 @@ fn pick_uniplatform() {
195195
assert_eq!(Stdcall.for_target(OsLinux, X86), Some(Stdcall));
196196
assert_eq!(Stdcall.for_target(OsLinux, Arm), None);
197197
assert_eq!(System.for_target(OsLinux, X86), Some(C));
198-
assert_eq!(System.for_target(OsWin32, X86), Some(Stdcall));
199-
assert_eq!(System.for_target(OsWin32, X86_64), Some(C));
200-
assert_eq!(System.for_target(OsWin32, Arm), Some(C));
201-
assert_eq!(Stdcall.for_target(OsWin32, X86), Some(Stdcall));
202-
assert_eq!(Stdcall.for_target(OsWin32, X86_64), Some(Stdcall));
198+
assert_eq!(System.for_target(OsWindows, X86), Some(Stdcall));
199+
assert_eq!(System.for_target(OsWindows, X86_64), Some(C));
200+
assert_eq!(System.for_target(OsWindows, Arm), Some(C));
201+
assert_eq!(Stdcall.for_target(OsWindows, X86), Some(Stdcall));
202+
assert_eq!(Stdcall.for_target(OsWindows, X86_64), Some(Stdcall));
203203
}

0 commit comments

Comments
 (0)