rustc: Temporarily add a switch and a corresponding makefile variable to disable typestate
This commit is contained in:
parent
648c4ae2ba
commit
9aeb67987c
2 changed files with 15 additions and 5 deletions
|
@ -27,6 +27,9 @@ endif
|
||||||
ifdef TIME_PASSES
|
ifdef TIME_PASSES
|
||||||
CFG_RUSTC_FLAGS += --time-passes
|
CFG_RUSTC_FLAGS += --time-passes
|
||||||
endif
|
endif
|
||||||
|
ifdef NO_TYPESTATE
|
||||||
|
CFG_RUSTC_FLAGS += --no-typestate
|
||||||
|
endif
|
||||||
|
|
||||||
# On Darwin, we need to run dsymutil so the debugging information ends
|
# On Darwin, we need to run dsymutil so the debugging information ends
|
||||||
# up in the right place. On other platforms, it automatically gets
|
# up in the right place. On other platforms, it automatically gets
|
||||||
|
|
|
@ -85,6 +85,7 @@ fn compile_input(session.session sess,
|
||||||
bool save_temps,
|
bool save_temps,
|
||||||
trans.output_type ot,
|
trans.output_type ot,
|
||||||
bool time_passes,
|
bool time_passes,
|
||||||
|
bool run_typestate,
|
||||||
vec[str] library_search_paths) {
|
vec[str] library_search_paths) {
|
||||||
auto def = tup(0, 0);
|
auto def = tup(0, 0);
|
||||||
auto p = parser.new_parser(sess, env, def, input, 0u);
|
auto p = parser.new_parser(sess, env, def, input, 0u);
|
||||||
|
@ -106,8 +107,10 @@ fn compile_input(session.session sess,
|
||||||
crate = typeck_result._0;
|
crate = typeck_result._0;
|
||||||
auto type_cache = typeck_result._1;
|
auto type_cache = typeck_result._1;
|
||||||
|
|
||||||
crate = time[@ast.crate](time_passes, "typestate checking",
|
if (run_typestate) {
|
||||||
bind typestate_check.check_crate(crate));
|
crate = time[@ast.crate](time_passes, "typestate checking",
|
||||||
|
bind typestate_check.check_crate(crate));
|
||||||
|
}
|
||||||
|
|
||||||
time[()](time_passes, "translation",
|
time[()](time_passes, "translation",
|
||||||
bind trans.trans_crate(sess, crate, ty_cx, type_cache, output, shared,
|
bind trans.trans_crate(sess, crate, ty_cx, type_cache, output, shared,
|
||||||
|
@ -140,6 +143,7 @@ options:
|
||||||
-c compile and assemble, but do not link
|
-c compile and assemble, but do not link
|
||||||
--save-temps write intermediate files in addition to normal output
|
--save-temps write intermediate files in addition to normal output
|
||||||
--time-passes time the individual phases of the compiler
|
--time-passes time the individual phases of the compiler
|
||||||
|
--no-typestate don't run the typestate pass (unsafe!)
|
||||||
-h display this message\n\n");
|
-h display this message\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +174,7 @@ fn main(vec[str] args) {
|
||||||
optflag("O"), optflag("shared"), optmulti("L"),
|
optflag("O"), optflag("shared"), optmulti("L"),
|
||||||
optflag("S"), optflag("c"), optopt("o"),
|
optflag("S"), optflag("c"), optopt("o"),
|
||||||
optflag("save-temps"), optflag("time-passes"),
|
optflag("save-temps"), optflag("time-passes"),
|
||||||
optflag("noverify"));
|
optflag("no-typestate"), optflag("noverify"));
|
||||||
auto binary = _vec.shift[str](args);
|
auto binary = _vec.shift[str](args);
|
||||||
auto match;
|
auto match;
|
||||||
alt (GetOpts.getopts(args, opts)) {
|
alt (GetOpts.getopts(args, opts)) {
|
||||||
|
@ -201,6 +205,7 @@ fn main(vec[str] args) {
|
||||||
// FIXME: Maybe we should support -O0, -O1, -Os, etc
|
// FIXME: Maybe we should support -O0, -O1, -Os, etc
|
||||||
auto optimize = opt_present(match, "O");
|
auto optimize = opt_present(match, "O");
|
||||||
auto time_passes = opt_present(match, "time-passes");
|
auto time_passes = opt_present(match, "time-passes");
|
||||||
|
auto run_typestate = !opt_present(match, "no-typestate");
|
||||||
auto n_inputs = _vec.len[str](match.free);
|
auto n_inputs = _vec.len[str](match.free);
|
||||||
|
|
||||||
if (glue) {
|
if (glue) {
|
||||||
|
@ -233,12 +238,14 @@ fn main(vec[str] args) {
|
||||||
auto ofile = _str.concat(parts);
|
auto ofile = _str.concat(parts);
|
||||||
compile_input(sess, env, ifile, ofile, shared,
|
compile_input(sess, env, ifile, ofile, shared,
|
||||||
optimize, verify, save_temps, ot,
|
optimize, verify, save_temps, ot,
|
||||||
time_passes, library_search_paths);
|
time_passes, run_typestate,
|
||||||
|
library_search_paths);
|
||||||
}
|
}
|
||||||
case (some[str](?ofile)) {
|
case (some[str](?ofile)) {
|
||||||
compile_input(sess, env, ifile, ofile, shared,
|
compile_input(sess, env, ifile, ofile, shared,
|
||||||
optimize, verify, save_temps, ot,
|
optimize, verify, save_temps, ot,
|
||||||
time_passes, library_search_paths);
|
time_passes, run_typestate,
|
||||||
|
library_search_paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue