replace error logging with log_err in stdlib and rustc

This commit is contained in:
Marijn Haverbeke 2011-04-19 12:02:06 +02:00
parent 6d3a423094
commit 6511d471ba
16 changed files with 132 additions and 132 deletions

View file

@ -18,6 +18,7 @@ import std.option.some;
import std.option.none;
import std._str;
import std._vec;
import std.io;
fn default_environment(session.session sess,
str argv0,
@ -88,26 +89,24 @@ impure fn pretty_print_input(session.session sess,
}
fn warn_wrong_compiler() {
log "This is the rust 'self-hosted' compiler.";
log "The one written in rust.";
log "It is currently incomplete.";
log "You may want rustboot instead, the compiler next door.";
io.stdout().write_str("This is the rust 'self-hosted' compiler.
The one written in rust.
It is currently incomplete.
You may want rustboot instead, the compiler next door.\n");
}
fn usage(session.session sess, str argv0) {
log #fmt("usage: %s [options] <input>", argv0);
log "options:";
log "";
log " -o <filename> write output to <filename>";
log " -nowarn suppress wrong-compiler warning";
log " -glue generate glue.bc file";
log " -shared compile a shared-library crate";
log " -pp pretty-print the input instead of compiling";
log " -ls list the symbols defined by a crate file";
log " -L <path> add a directory to the library search path";
log " -h display this message";
log "";
log "";
io.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
options:
-o <filename> write output to <filename>
-nowarn suppress wrong-compiler warning
-glue generate glue.bc file
-shared compile a shared-library crate
-pp pretty-print the input instead of compiling
-ls list the symbols defined by a crate file
-L <path> add a directory to the library search path
-h display this message\n\n");
}
fn get_os() -> session.os {

View file

@ -42,16 +42,16 @@ state obj session(ast.crate_num cnum, cfg targ,
fn span_err(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: error: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
fail;
}
fn err(str msg) {
log #fmt("error: %s", msg);
log_err #fmt("error: %s", msg);
fail;
}
@ -65,31 +65,31 @@ state obj session(ast.crate_num cnum, cfg targ,
fn span_warn(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: warning: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: warning: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
}
fn bug(str msg) {
log #fmt("error: internal compiler error %s", msg);
log_err #fmt("error: internal compiler error %s", msg);
fail;
}
fn span_unimpl(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
fail;
}
fn unimpl(str msg) {
log #fmt("error: unimplemented %s", msg);
log_err #fmt("error: unimplemented %s", msg);
fail;
}