Skip to content

Commit

Permalink
Replace all references to "Win32" with "Windows".
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
vadimcn committed Aug 12, 2014
1 parent 48ee816 commit 98332b1
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
14 changes: 7 additions & 7 deletions src/librustc/back/link.rs
Expand Up @@ -200,7 +200,7 @@ pub mod write {
// OSX has -dead_strip, which doesn't rely on ffunction_sections
// FIXME(#13846) this should be enabled for windows
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
sess.targ_cfg.os != abi::OsWin32;
sess.targ_cfg.os != abi::OsWindows;
let fdata_sections = ffunction_sections;

let reloc_model = match sess.opts.cg.relocation_model.as_slice() {
Expand Down Expand Up @@ -858,7 +858,7 @@ pub fn get_cc_prog(sess: &Session) -> String {
// instead of hard-coded gcc.
// For win32, there is no cc command, so we add a condition to make it use gcc.
match sess.targ_cfg.os {
abi::OsWin32 => "gcc",
abi::OsWindows => "gcc",
_ => "cc",
}.to_string()
}
Expand Down Expand Up @@ -954,7 +954,7 @@ pub fn filename_for_input(sess: &Session,
}
config::CrateTypeDylib => {
let (prefix, suffix) = match sess.targ_cfg.os {
abi::OsWin32 => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
abi::OsWindows => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
abi::OsMacos => (loader::MACOS_DLL_PREFIX, loader::MACOS_DLL_SUFFIX),
abi::OsLinux => (loader::LINUX_DLL_PREFIX, loader::LINUX_DLL_SUFFIX),
abi::OsAndroid => (loader::ANDROID_DLL_PREFIX, loader::ANDROID_DLL_SUFFIX),
Expand All @@ -972,7 +972,7 @@ pub fn filename_for_input(sess: &Session,
}
config::CrateTypeExecutable => {
match sess.targ_cfg.os {
abi::OsWin32 => out_filename.with_extension("exe"),
abi::OsWindows => out_filename.with_extension("exe"),
abi::OsMacos |
abi::OsLinux |
abi::OsAndroid |
Expand Down Expand Up @@ -1388,7 +1388,7 @@ fn link_args(cmd: &mut Command,
// subset we wanted.
//
// FIXME(#11937) we should invoke the system linker directly
if sess.targ_cfg.os != abi::OsWin32 {
if sess.targ_cfg.os != abi::OsWindows {
cmd.arg("-nodefaultlibs");
}

Expand Down Expand Up @@ -1440,7 +1440,7 @@ fn link_args(cmd: &mut Command,
cmd.arg("-Wl,-dead_strip");
}

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

// Converts a library file-stem into a cc -l argument
fn unlib<'a>(config: &config::Config, stem: &'a [u8]) -> &'a [u8] {
if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWin32 {
if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWindows {
stem.tailn(3)
} else {
stem
Expand Down
8 changes: 4 additions & 4 deletions 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::OsWin32 => InternedString::new("win32"),
abi::OsWindows => InternedString::new("win32"),
abi::OsMacos => InternedString::new("macos"),
abi::OsLinux => InternedString::new("linux"),
abi::OsAndroid => InternedString::new("android"),
Expand All @@ -410,7 +410,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
};

let fam = match sess.targ_cfg.os {
abi::OsWin32 => InternedString::new("windows"),
abi::OsWindows => InternedString::new("windows"),
_ => InternedString::new("unix")
};

Expand Down Expand Up @@ -452,8 +452,8 @@ pub fn get_os(triple: &str) -> Option<abi::Os> {
None
}
static os_names : &'static [(&'static str, abi::Os)] = &[
("mingw32", abi::OsWin32),
("win32", abi::OsWin32),
("mingw32", abi::OsWindows),
("win32", abi::OsWindows),
("darwin", abi::OsMacos),
("android", abi::OsAndroid),
("linux", abi::OsLinux),
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/loader.rs
Expand Up @@ -615,7 +615,7 @@ impl<'a> Context<'a> {
// dynamic libraries
fn dylibname(&self) -> Option<(&'static str, &'static str)> {
match self.os {
abi::OsWin32 => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
abi::OsWindows => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
abi::OsMacos => Some((MACOS_DLL_PREFIX, MACOS_DLL_SUFFIX)),
abi::OsLinux => Some((LINUX_DLL_PREFIX, LINUX_DLL_SUFFIX)),
abi::OsAndroid => Some((ANDROID_DLL_PREFIX, ANDROID_DLL_SUFFIX)),
Expand Down Expand Up @@ -824,7 +824,7 @@ pub fn meta_section_name(os: abi::Os) -> Option<&'static str> {
match os {
abi::OsMacos => Some("__DATA,__note.rustc"),
abi::OsiOS => Some("__DATA,__note.rustc"),
abi::OsWin32 => Some(".note.rustc"),
abi::OsWindows => Some(".note.rustc"),
abi::OsLinux => Some(".note.rustc"),
abi::OsAndroid => Some(".note.rustc"),
abi::OsFreebsd => Some(".note.rustc"),
Expand All @@ -836,7 +836,7 @@ pub fn read_meta_section_name(os: abi::Os) -> &'static str {
match os {
abi::OsMacos => "__note.rustc",
abi::OsiOS => unreachable!(),
abi::OsWin32 => ".note.rustc",
abi::OsWindows => ".note.rustc",
abi::OsLinux => ".note.rustc",
abi::OsAndroid => ".note.rustc",
abi::OsFreebsd => ".note.rustc",
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/cabi.rs
Expand Up @@ -18,7 +18,7 @@ use middle::trans::cabi_arm;
use middle::trans::cabi_mips;
use middle::trans::type_::Type;
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
use syntax::abi::{OsWin32};
use syntax::abi::{OsWindows};

#[deriving(Clone, PartialEq)]
pub enum ArgKind {
Expand Down Expand Up @@ -110,7 +110,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
match ccx.sess().targ_cfg.arch {
X86 => cabi_x86::compute_abi_info(ccx, atys, rty, ret_def),
X86_64 =>
if ccx.sess().targ_cfg.os == OsWin32 {
if ccx.sess().targ_cfg.os == OsWindows {
cabi_x86_win64::compute_abi_info(ccx, atys, rty, ret_def)
} else {
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/cabi_x86.rs
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.


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

enum Strategy { RetValue(Type), RetPointer }
let strategy = match ccx.sess().targ_cfg.os {
OsWin32 | OsMacos | OsiOS => {
OsWindows | OsMacos | OsiOS => {
match llsize_of_alloc(ccx, rty) {
1 => RetValue(Type::i8(ccx)),
2 => RetValue(Type::i16(ccx)),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/archive.rs
Expand Up @@ -98,7 +98,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
pub fn find_library(name: &str, os: abi::Os, search_paths: &[Path],
handler: &ErrorHandler) -> Path {
let (osprefix, osext) = match os {
abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
abi::OsWindows => ("", "lib"), _ => ("lib", "a"),
};
// On Windows, static libraries sometimes show up as libfoo.a and other
// times show up as foo.lib
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/arm.rs
Expand Up @@ -37,7 +37,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a0:0:64-n32".to_string()
}

abi::OsWin32 => {
abi::OsWindows => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/mips.rs
Expand Up @@ -32,7 +32,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a0:0:64-n32".to_string()
}

abi::OsWin32 => {
abi::OsWindows => {
"E-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/mipsel.rs
Expand Up @@ -32,7 +32,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a0:0:64-n32".to_string()
}

abi::OsWin32 => {
abi::OsWindows => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_back/rpath.rs
Expand Up @@ -26,7 +26,7 @@ pub struct RPathConfig<'a> {
pub fn get_rpath_flags(config: RPathConfig) -> Vec<String> {

// No rpath on windows
if config.os == abi::OsWin32 {
if config.os == abi::OsWindows {
return Vec::new();
}

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

assert!(config.os != abi::OsWin32);
assert!(config.os != abi::OsWindows);

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

let mut lib = (config.realpath)(&os::make_absolute(lib)).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/x86.rs
Expand Up @@ -34,7 +34,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os)
-n8:16:32".to_string()
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/x86_64.rs
Expand Up @@ -29,7 +29,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
s0:64:64-f80:128:128-n8:16:32:64".to_string()
}

abi::OsWin32 => {
abi::OsWindows => {
// FIXME: Test this. Copied from linux (#2398)
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
Expand Down
16 changes: 8 additions & 8 deletions src/libsyntax/abi.rs
Expand Up @@ -11,7 +11,7 @@
use std::fmt;

#[deriving(PartialEq)]
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
pub enum Os { OsWindows, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
OsDragonfly }

#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
Expand Down Expand Up @@ -124,7 +124,7 @@ impl Abi {
// Transform this ABI as appropriate for the requested os/arch
// combination.
Some(match (*self, os, arch) {
(System, OsWin32, X86) => Stdcall,
(System, OsWindows, X86) => Stdcall,
(System, _, _) => C,
(me, _, _) => me,
})
Expand All @@ -147,7 +147,7 @@ impl fmt::Show for Os {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
OsLinux => "linux".fmt(f),
OsWin32 => "win32".fmt(f),
OsWindows => "win32".fmt(f),
OsMacos => "macos".fmt(f),
OsiOS => "ios".fmt(f),
OsAndroid => "android".fmt(f),
Expand Down Expand Up @@ -195,9 +195,9 @@ fn pick_uniplatform() {
assert_eq!(Stdcall.for_target(OsLinux, X86), Some(Stdcall));
assert_eq!(Stdcall.for_target(OsLinux, Arm), None);
assert_eq!(System.for_target(OsLinux, X86), Some(C));
assert_eq!(System.for_target(OsWin32, X86), Some(Stdcall));
assert_eq!(System.for_target(OsWin32, X86_64), Some(C));
assert_eq!(System.for_target(OsWin32, Arm), Some(C));
assert_eq!(Stdcall.for_target(OsWin32, X86), Some(Stdcall));
assert_eq!(Stdcall.for_target(OsWin32, X86_64), Some(Stdcall));
assert_eq!(System.for_target(OsWindows, X86), Some(Stdcall));
assert_eq!(System.for_target(OsWindows, X86_64), Some(C));
assert_eq!(System.for_target(OsWindows, Arm), Some(C));
assert_eq!(Stdcall.for_target(OsWindows, X86), Some(Stdcall));
assert_eq!(Stdcall.for_target(OsWindows, X86_64), Some(Stdcall));
}

0 comments on commit 98332b1

Please sign in to comment.