Skip to content

Commit fb3b0a1

Browse files
committed
---
yaml --- r: 82602 b: refs/heads/auto c: 90e009f h: refs/heads/master v: v3
1 parent 2874504 commit fb3b0a1

File tree

9 files changed

+61
-66
lines changed

9 files changed

+61
-66
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 6d03897376f8737e28a93693f90bd651e9d08e92
16+
refs/heads/auto: 90e009f9b6aae3b3a9f500f07bca07b531e54507
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libextra/test.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use treemap::TreeMap;
3030

3131
use std::clone::Clone;
3232
use std::comm::{stream, SharedChan, GenericPort, GenericChan};
33+
use std::libc;
3334
use std::io;
3435
use std::result;
3536
use std::task;
@@ -124,9 +125,8 @@ pub type MetricDiff = TreeMap<~str,MetricChange>;
124125
pub fn test_main(args: &[~str], tests: ~[TestDescAndFn]) {
125126
let opts =
126127
match parse_opts(args) {
127-
Some(Ok(o)) => o,
128-
Some(Err(msg)) => fail!(msg),
129-
None => return
128+
Ok(o) => o,
129+
Err(msg) => fail!(msg)
130130
};
131131
if !run_tests_console(&opts, tests) { fail!("Some tests failed"); }
132132
}
@@ -189,7 +189,7 @@ fn optgroups() -> ~[getopts::groups::OptGroup] {
189189
"A.B")]
190190
}
191191

192-
fn usage(binary: &str, helpstr: &str) {
192+
fn usage(binary: &str, helpstr: &str) -> ! {
193193
#[fixed_stack_segment]; #[inline(never)];
194194

195195
let message = fmt!("Usage: %s [OPTIONS] [FILTER]", binary);
@@ -217,19 +217,20 @@ Test Attributes:
217217
tests. This may also be written as #[ignore(cfg(...))] to
218218
ignore the test on certain configurations.");
219219
}
220+
unsafe { libc::exit(0) }
220221
}
221222

222223
// Parses command line arguments into test options
223-
pub fn parse_opts(args: &[~str]) -> Option<OptRes> {
224+
pub fn parse_opts(args: &[~str]) -> OptRes {
224225
let args_ = args.tail();
225226
let matches =
226227
match groups::getopts(args_, optgroups()) {
227228
Ok(m) => m,
228-
Err(f) => return Some(Err(f.to_err_msg()))
229+
Err(f) => return Err(f.to_err_msg())
229230
};
230231

231-
if matches.opt_present("h") { usage(args[0], "h"); return None; }
232-
if matches.opt_present("help") { usage(args[0], "help"); return None; }
232+
if matches.opt_present("h") { usage(args[0], "h"); }
233+
if matches.opt_present("help") { usage(args[0], "help"); }
233234

234235
let filter =
235236
if matches.free.len() > 0 {
@@ -271,7 +272,7 @@ pub fn parse_opts(args: &[~str]) -> Option<OptRes> {
271272
logfile: logfile
272273
};
273274

274-
Some(Ok(test_opts))
275+
Ok(test_opts)
275276
}
276277

277278
pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
@@ -1227,7 +1228,7 @@ mod tests {
12271228
fn first_free_arg_should_be_a_filter() {
12281229
let args = ~[~"progname", ~"filter"];
12291230
let opts = match parse_opts(args) {
1230-
Some(Ok(o)) => o,
1231+
Ok(o) => o,
12311232
_ => fail!("Malformed arg in first_free_arg_should_be_a_filter")
12321233
};
12331234
assert!("filter" == opts.filter.clone().unwrap());
@@ -1237,7 +1238,7 @@ mod tests {
12371238
fn parse_ignored_flag() {
12381239
let args = ~[~"progname", ~"filter", ~"--ignored"];
12391240
let opts = match parse_opts(args) {
1240-
Some(Ok(o)) => o,
1241+
Ok(o) => o,
12411242
_ => fail!("Malformed arg in parse_ignored_flag")
12421243
};
12431244
assert!((opts.run_ignored));

branches/auto/src/librust/rust.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl ValidUsage {
4545

4646
enum Action {
4747
Call(extern "Rust" fn(args: &[~str]) -> ValidUsage),
48-
CallMain(&'static str, extern "Rust" fn(&[~str]) -> int),
48+
CallMain(&'static str, extern "Rust" fn(&[~str])),
4949
}
5050

5151
enum UsageSource<'self> {
@@ -186,17 +186,18 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
186186
}
187187
}
188188

189-
fn invoke(prog: &str, args: &[~str], f: &fn(&[~str]) -> int) -> int {
189+
fn invoke(prog: &str, args: &[~str], f: &fn(&[~str])) {
190190
let mut osargs = ~[prog.to_owned()];
191191
osargs.push_all_move(args.to_owned());
192-
f(osargs)
192+
f(osargs);
193193
}
194194

195195
fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
196196
match command.action {
197197
Call(f) => f(args),
198198
CallMain(prog, f) => {
199-
Valid(invoke(prog, args, f))
199+
invoke(prog, args, f);
200+
Valid(0)
200201
}
201202
}
202203
}

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,7 +2949,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29492949
};
29502950
let sym_name = ~"_rust_crate_map_" + mapname;
29512951
let arrtype = Type::array(&int_type, n_subcrates as u64);
2952-
let maptype = Type::struct_([Type::i32(), Type::i8p(), int_type, arrtype], false);
2952+
let maptype = Type::struct_([Type::i32(), int_type, arrtype], false);
29532953
let map = do sym_name.with_c_str |buf| {
29542954
unsafe {
29552955
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
@@ -2990,8 +2990,6 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
29902990
let mod_map = create_module_map(ccx);
29912991
llvm::LLVMSetInitializer(map, C_struct(
29922992
[C_i32(1),
2993-
// FIXME #8431 This used to be the annihilate function, now it's nothing
2994-
C_null(Type::i8p()),
29952993
p2i(ccx, mod_map),
29962994
C_array(ccx.int_type, subcrates)]));
29972995
}

branches/auto/src/librustc/rustc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,13 @@ pub fn monitor(f: ~fn(@diagnostic::Emitter)) {
394394
}
395395

396396
pub fn main() {
397-
std::os::set_exit_status(main_args(std::os::args()));
397+
let args = os::args();
398+
main_args(args);
398399
}
399400

400-
pub fn main_args(args: &[~str]) -> int {
401+
pub fn main_args(args: &[~str]) {
401402
let owned_args = args.to_owned();
402403
do monitor |demitter| {
403404
run_compiler(owned_args, demitter);
404405
}
405-
406-
return 0;
407406
}

branches/auto/src/librustdoc/rustdoc.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum OutputFormat {
5252
}
5353

5454
pub fn main() {
55-
std::os::set_exit_status(main_args(std::os::args()));
55+
main_args(std::os::args());
5656
}
5757

5858
pub fn opts() -> ~[groups::OptGroup] {
@@ -76,14 +76,14 @@ pub fn usage(argv0: &str) {
7676
argv0), opts()));
7777
}
7878

79-
pub fn main_args(args: &[~str]) -> int {
79+
pub fn main_args(args: &[~str]) {
8080
//use extra::getopts::groups::*;
8181

8282
let matches = groups::getopts(args.tail(), opts()).unwrap();
8383

8484
if matches.opt_present("h") || matches.opt_present("help") {
8585
usage(args[0]);
86-
return 0;
86+
return;
8787
}
8888

8989
let (format, cratefile) = match matches.free.clone() {
@@ -92,17 +92,17 @@ pub fn main_args(args: &[~str]) -> int {
9292
[s, _] => {
9393
println!("Unknown output format: `{}`", s);
9494
usage(args[0]);
95-
return 1;
95+
exit(1);
9696
}
9797
[_, .._] => {
9898
println!("Expected exactly one crate to process");
9999
usage(args[0]);
100-
return 1;
100+
exit(1);
101101
}
102102
_ => {
103103
println!("Expected an output format and then one crate");
104104
usage(args[0]);
105-
return 1;
105+
exit(1);
106106
}
107107
};
108108

@@ -179,8 +179,6 @@ pub fn main_args(args: &[~str]) -> int {
179179
}
180180
let ended = time::precise_time_ns();
181181
info2!("Took {:.03f}s", (ended as f64 - started as f64) / 1000000000f64);
182-
183-
return 0;
184182
}
185183

186184
fn jsonify(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) {
@@ -210,3 +208,9 @@ fn jsonify(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) {
210208
let output = extra::json::Object(json).to_str();
211209
file.write(output.as_bytes());
212210
}
211+
212+
fn exit(status: int) -> ! {
213+
#[fixed_stack_segment]; #[inline(never)];
214+
use std::libc;
215+
unsafe { libc::exit(status as libc::c_int) }
216+
}

branches/auto/src/librusti/rusti.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ pub fn run_line(repl: &mut Repl, input: @io::Reader, out: @io::Writer, line: ~st
517517
}
518518

519519
pub fn main() {
520-
os::set_exit_status(main_args(os::args()));
520+
let args = os::args();
521+
main_args(args);
521522
}
522523

523524
struct Completer;
@@ -533,7 +534,7 @@ impl CompletionCb for Completer {
533534
}
534535
}
535536

536-
pub fn main_args(args: &[~str]) -> int {
537+
pub fn main_args(args: &[~str]) {
537538
#[fixed_stack_segment]; #[inline(never)];
538539

539540
let input = io::stdin();
@@ -575,8 +576,6 @@ pub fn main_args(args: &[~str]) -> int {
575576
}
576577
}
577578
}
578-
579-
return 0;
580579
}
581580

582581
#[cfg(test)]

branches/auto/src/librustpkg/rustpkg.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,11 @@ impl CtxMethods for BuildContext {
615615

616616
pub fn main() {
617617
io::println("WARNING: The Rust package manager is experimental and may be unstable");
618-
os::set_exit_status(main_args(os::args()));
618+
let args = os::args();
619+
main_args(args);
619620
}
620621

621-
pub fn main_args(args: &[~str]) -> int {
622+
pub fn main_args(args: &[~str]) {
622623
let opts = ~[getopts::optflag("h"), getopts::optflag("help"),
623624
getopts::optflag("no-link"),
624625
getopts::optflag("no-trans"),
@@ -644,7 +645,7 @@ pub fn main_args(args: &[~str]) -> int {
644645
result::Err(f) => {
645646
error(fmt!("%s", f.to_err_msg()));
646647

647-
return 1;
648+
return;
648649
}
649650
};
650651
let mut help = matches.opt_present("h") ||
@@ -661,7 +662,7 @@ pub fn main_args(args: &[~str]) -> int {
661662
if matches.opt_present("v") ||
662663
matches.opt_present("version") {
663664
rustc::version(args[0]);
664-
return 0;
665+
return;
665666
}
666667

667668
let use_rust_path_hack = matches.opt_present("r") ||
@@ -700,8 +701,7 @@ pub fn main_args(args: &[~str]) -> int {
700701
args.shift();
701702

702703
if (args.len() < 1) {
703-
usage::general();
704-
return 1;
704+
return usage::general();
705705
}
706706

707707
let rustc_flags = RustcFlags {
@@ -739,14 +739,11 @@ pub fn main_args(args: &[~str]) -> int {
739739
}
740740
}
741741
let cmd = match cmd_opt {
742-
None => {
743-
usage::general();
744-
return 0;
745-
}
742+
None => return usage::general(),
746743
Some(cmd) => {
747744
help |= context::flags_ok_for_cmd(&rustc_flags, cfgs, *cmd, user_supplied_opt_level);
748745
if help {
749-
match *cmd {
746+
return match *cmd {
750747
~"build" => usage::build(),
751748
~"clean" => usage::clean(),
752749
~"do" => usage::do_cmd(),
@@ -760,7 +757,6 @@ pub fn main_args(args: &[~str]) -> int {
760757
~"unprefer" => usage::unprefer(),
761758
_ => usage::general()
762759
};
763-
return 0;
764760
} else {
765761
cmd
766762
}
@@ -798,8 +794,8 @@ pub fn main_args(args: &[~str]) -> int {
798794
// and at least one test case succeeds if rustpkg returns COPY_FAILED_CODE,
799795
// when actually, it might set the exit code for that even if a different
800796
// unhandled condition got raised.
801-
if result.is_err() { return COPY_FAILED_CODE; }
802-
return 0;
797+
if result.is_err() { os::set_exit_status(COPY_FAILED_CODE); }
798+
803799
}
804800

805801
/**

0 commit comments

Comments
 (0)