diff options
| author | Haitao Li <lihaitao@gmail.com> | 2012-01-19 16:50:51 +0800 |
|---|---|---|
| committer | Haitao Li <lihaitao@gmail.com> | 2012-01-19 17:54:38 +0800 |
| commit | 7ffb2cb7e8d3f1845455a51f83fde3fd4759790c (patch) | |
| tree | c94f04c555ac77099b07f30862f6d6d7eae1dfea /src/comp/driver | |
| parent | 327a15d58c06136794621315388959b390511834 (diff) | |
| download | rust-7ffb2cb7e8d3f1845455a51f83fde3fd4759790c.tar.gz rust-7ffb2cb7e8d3f1845455a51f83fde3fd4759790c.zip | |
rustc: Name the lint-style check module `lint`
Issue #1543
Diffstat (limited to 'src/comp/driver')
| -rw-r--r-- | src/comp/driver/driver.rs | 17 | ||||
| -rw-r--r-- | src/comp/driver/rustc.rs | 2 | ||||
| -rw-r--r-- | src/comp/driver/session.rs | 3 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs index 54ca5db4294..6c2a646f35d 100644 --- a/src/comp/driver/driver.rs +++ b/src/comp/driver/driver.rs @@ -6,7 +6,7 @@ import syntax::parse::{parser}; import syntax::{ast, codemap}; import front::attr; import middle::{trans, resolve, freevars, kind, ty, typeck, fn_usage, - last_use, check_usage}; + last_use, lint}; import syntax::print::{pp, pprust}; import util::{ppaux, filesearch}; import back::link; @@ -203,9 +203,9 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, bind last_use::find_last_uses(crate, def_map, ref_map, ty_cx)); time(time_passes, "kind checking", bind kind::check_crate(ty_cx, method_map, last_uses, crate)); - if sess.opts.check_usage { - time(time_passes, "usage analyses", - bind check_usage::check_crate(ty_cx, crate)); + if vec::len(sess.opts.lint_opts) > 0u { + let timer = bind time(time_passes, _, _); + lint::check_crate(ty_cx, crate, sess.opts.lint_opts, timer) } if upto == cu_no_trans { ret {crate: crate, tcx: some(ty_cx), src: src}; } @@ -384,6 +384,10 @@ fn build_session_options(match: getopts::match, let parse_only = opt_present(match, "parse-only"); let no_trans = opt_present(match, "no-trans"); + let lint_opts : [lint::option] = []; + if !opt_present(match, "no-lint-ctypes") { + lint_opts += [lint::ctypes]; + } let output_type = if parse_only || no_trans { @@ -399,7 +403,6 @@ fn build_session_options(match: getopts::match, } else { link::output_type_exe }; let libcore = !opt_present(match, "no-core"); let verify = !opt_present(match, "no-verify"); - let check_usage = !opt_present(match, "no-usage-check"); let save_temps = opt_present(match, "save-temps"); let extra_debuginfo = opt_present(match, "xg"); let debuginfo = opt_present(match, "g") || extra_debuginfo; @@ -451,7 +454,7 @@ fn build_session_options(match: getopts::match, debuginfo: debuginfo, extra_debuginfo: extra_debuginfo, verify: verify, - check_usage: check_usage, + lint_opts: lint_opts, save_temps: save_temps, stats: stats, time_passes: time_passes, @@ -520,7 +523,7 @@ fn opts() -> [getopts::opt] { optopt("sysroot"), optopt("target"), optflag("stats"), optflag("time-passes"), optflag("time-llvm-passes"), optflag("no-verify"), - optflag("no-usage-check"), + optflag("no-lint-ctypes"), optmulti("cfg"), optflag("test"), optflag("no-core"), optflag("lib"), optflag("bin"), optflag("static"), optflag("gc"), diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index fcd5f1852ae..8ca9a3e6f72 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -38,7 +38,6 @@ options: --ls list the symbols defined by a crate file -L <path> add a directory to the library search path --no-verify suppress LLVM verification step (slight speedup) - --no-check-usage suppress various one-off usage analyses --parse-only parse only; do not compile, assemble, or link --no-trans run all passes except translation; no output -g produce debug info @@ -59,6 +58,7 @@ options: --gc garbage collect shared data (experimental/temporary) --warn-unused-imports warn about unnecessary imports + --no-lint-ctypes suppress lint-style ctypes usage check "); } diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index 4b7154a5a99..67a8268f5fd 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -8,6 +8,7 @@ import option::{some, none}; import syntax::parse::parser::parse_sess; import util::filesearch; import back::target_strs; +import middle::lint; tag os { os_win32; os_macos; os_linux; os_freebsd; } @@ -33,7 +34,7 @@ type options = debuginfo: bool, extra_debuginfo: bool, verify: bool, - check_usage: bool, + lint_opts: [lint::option], save_temps: bool, stats: bool, time_passes: bool, |
