Fix get_os and get_arch
get_os and get_arch were failing to return a value in the error case; they were also assuming that strings are indexed from 1. No idea how they ever worked, but anyway, fixed.
This commit is contained in:
parent
b42bb2cff2
commit
387a8888ee
1 changed files with 17 additions and 12 deletions
|
|
@ -166,26 +166,31 @@ options:
|
|||
}
|
||||
|
||||
fn get_os(str triple) -> session::os {
|
||||
if (_str::find(triple, "win32") > 0 ||
|
||||
_str::find(triple, "mingw32") > 0 ) {
|
||||
if (_str::find(triple, "win32") >= 0 ||
|
||||
_str::find(triple, "mingw32") >= 0 ) {
|
||||
ret session::os_win32;
|
||||
} else if (_str::find(triple, "darwin") > 0) { ret session::os_macos; }
|
||||
else if (_str::find(triple, "linux") > 0) { ret session::os_linux; }
|
||||
} else if (_str::find(triple, "darwin") >= 0) { ret session::os_macos; }
|
||||
else if (_str::find(triple, "linux") >= 0) { ret session::os_linux; }
|
||||
else { log_err "Unknown operating system!"; fail; }
|
||||
}
|
||||
|
||||
fn get_arch(str triple) -> session::arch {
|
||||
if (_str::find(triple, "i386") > 0 ||
|
||||
_str::find(triple, "i486") > 0 ||
|
||||
_str::find(triple, "i586") > 0 ||
|
||||
_str::find(triple, "i686") > 0 ||
|
||||
_str::find(triple, "i786") > 0 ) {
|
||||
if (_str::find(triple, "i386") >= 0 ||
|
||||
_str::find(triple, "i486") >= 0 ||
|
||||
_str::find(triple, "i586") >= 0 ||
|
||||
_str::find(triple, "i686") >= 0 ||
|
||||
_str::find(triple, "i786") >= 0 ) {
|
||||
ret session::arch_x86;
|
||||
} else if (_str::find(triple, "x86_64") > 0) {
|
||||
} else if (_str::find(triple, "x86_64") >= 0) {
|
||||
ret session::arch_x64;
|
||||
} else if (_str::find(triple, "arm") > 0 ||
|
||||
_str::find(triple, "xscale") > 0 ) {
|
||||
} else if (_str::find(triple, "arm") >= 0 ||
|
||||
_str::find(triple, "xscale") >= 0 ) {
|
||||
ret session::arch_arm;
|
||||
}
|
||||
else {
|
||||
log_err ("Unknown architecture! " + triple);
|
||||
fail;
|
||||
}
|
||||
}
|
||||
|
||||
fn get_default_sysroot(str binary) -> str {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue