Skip to content

Commit 95e59dc

Browse files
committed
---
yaml --- r: 63415 b: refs/heads/snap-stage3 c: 3495737 h: refs/heads/master i: 63413: 60460d1 63411: 1ad739a 63407: b0d3d9d v: v3
1 parent e4e5833 commit 95e59dc

File tree

3 files changed

+40
-62
lines changed

3 files changed

+40
-62
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bc6848d352dd234ffb9c6cb97e2fbcf6c878c8d8
4+
refs/heads/snap-stage3: 3495737291b6406237e23c2166c2d89a20224bd4
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,24 @@ pub fn source_name(input: &input) -> @str {
6565
6666
pub fn default_configuration(sess: Session, argv0: @str, input: &input) ->
6767
ast::crate_cfg {
68-
let libc = match sess.targ_cfg.os {
69-
session::os_win32 => @"msvcrt.dll",
70-
session::os_macos => @"libc.dylib",
71-
session::os_linux => @"libc.so.6",
72-
session::os_android => @"libc.so",
73-
session::os_freebsd => @"libc.so.7"
74-
// _ { "libc.so" }
68+
let (libc, tos) = match sess.targ_cfg.os {
69+
session::os_win32 => (@"msvcrt.dll", @"win32"),
70+
session::os_macos => (@"libc.dylib", @"macos"),
71+
session::os_linux => (@"libc.so.6", @"linux"),
72+
session::os_android => (@"libc.so", @"android"),
73+
session::os_freebsd => (@"libc.so.7", @"freebsd")
7574
};
76-
let tos = match sess.targ_cfg.os {
77-
session::os_win32 => @"win32",
78-
session::os_macos => @"macos",
79-
session::os_linux => @"linux",
80-
session::os_android => @"android",
81-
session::os_freebsd => @"freebsd"
82-
// _ { "libc.so" }
83-
};
84-
85-
let mk = attr::mk_name_value_item_str;
8675

8776
// ARM is bi-endian, however using NDK seems to default
8877
// to little-endian unless a flag is provided.
8978
let (end,arch,wordsz) = match sess.targ_cfg.arch {
90-
abi::X86 => (@"little",@"x86",@"32"),
91-
abi::X86_64 => (@"little",@"x86_64",@"64"),
92-
abi::Arm => (@"little",@"arm",@"32"),
93-
abi::Mips => (@"big",@"mips",@"32")
79+
abi::X86 => (@"little", @"x86", @"32"),
80+
abi::X86_64 => (@"little", @"x86_64", @"64"),
81+
abi::Arm => (@"little", @"arm", @"32"),
82+
abi::Mips => (@"big", @"mips", @"32")
9483
};
9584

85+
let mk = attr::mk_name_value_item_str;
9686
return ~[ // Target bindings.
9787
attr::mk_word_item(os::FAMILY.to_managed()),
9888
mk(@"target_os", tos),
@@ -463,36 +453,38 @@ pub fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: &input,
463453
}
464454
465455
pub fn get_os(triple: &str) -> Option<session::os> {
466-
if triple.contains("win32") ||
467-
triple.contains("mingw32") {
468-
Some(session::os_win32)
469-
} else if triple.contains("darwin") {
470-
Some(session::os_macos)
471-
} else if triple.contains("android") {
472-
Some(session::os_android)
473-
} else if triple.contains("linux") {
474-
Some(session::os_linux)
475-
} else if triple.contains("freebsd") {
476-
Some(session::os_freebsd)
477-
} else { None }
456+
for os_names.each |&(name, os)| {
457+
if triple.contains(name) { return Some(os) }
458+
}
459+
None
478460
}
461+
static os_names : &'static [(&'static str, session::os)] = &'static [
462+
("mingw32", session::os_win32),
463+
("win32", session::os_win32),
464+
("darwin", session::os_macos),
465+
("android", session::os_android),
466+
("linux", session::os_linux),
467+
("freebsd", session::os_freebsd)];
479468

480469
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
481-
if triple.contains("i386") ||
482-
triple.contains("i486") ||
483-
triple.contains("i586") ||
484-
triple.contains("i686") ||
485-
triple.contains("i786") {
486-
Some(abi::X86)
487-
} else if triple.contains("x86_64") {
488-
Some(abi::X86_64)
489-
} else if triple.contains("arm") ||
490-
triple.contains("xscale") {
491-
Some(abi::Arm)
492-
} else if triple.contains("mips") {
493-
Some(abi::Mips)
494-
} else { None }
470+
for architecture_abis.each |&(arch, abi)| {
471+
if triple.contains(arch) { return Some(abi) }
472+
}
473+
None
495474
}
475+
static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'static [
476+
("i386", abi::X86),
477+
("i486", abi::X86),
478+
("i586", abi::X86),
479+
("i686", abi::X86),
480+
("i786", abi::X86),
481+
482+
("x86_64", abi::X86_64),
483+
484+
("arm", abi::Arm),
485+
("xscale", abi::Arm),
486+
487+
("mips", abi::Mips)];
496488

497489
pub fn build_target_config(sopts: @session::options,
498490
demitter: diagnostic::Emitter)

branches/snap-stage3/src/libstd/unstable/intrinsics.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,3 @@ pub extern "rust-intrinsic" {
238238
pub fn bswap32(x: i32) -> i32;
239239
pub fn bswap64(x: i64) -> i64;
240240
}
241-
242-
#[cfg(target_endian = "little")] pub fn to_le16(x: i16) -> i16 { x }
243-
#[cfg(target_endian = "big")] pub fn to_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
244-
#[cfg(target_endian = "little")] pub fn to_le32(x: i32) -> i32 { x }
245-
#[cfg(target_endian = "big")] pub fn to_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
246-
#[cfg(target_endian = "little")] pub fn to_le64(x: i64) -> i64 { x }
247-
#[cfg(target_endian = "big")] pub fn to_le64(x: i64) -> i64 { unsafe { bswap64(x) } }
248-
249-
#[cfg(target_endian = "little")] pub fn to_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
250-
#[cfg(target_endian = "big")] pub fn to_be16(x: i16) -> i16 { x }
251-
#[cfg(target_endian = "little")] pub fn to_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
252-
#[cfg(target_endian = "big")] pub fn to_be32(x: i32) -> i32 { x }
253-
#[cfg(target_endian = "little")] pub fn to_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
254-
#[cfg(target_endian = "big")] pub fn to_be64(x: i64) -> i64 { x }

0 commit comments

Comments
 (0)