@@ -6,7 +6,7 @@ import syntax::parse::{parser};
66import syntax :: { ast, codemap} ;
77import front:: attr;
88import middle :: { trans, resolve, freevars, kind, ty, typeck, fn_usage,
9- last_use, check_usage } ;
9+ last_use, lint } ;
1010import syntax:: print:: { pp, pprust} ;
1111import util :: { ppaux, filesearch} ;
1212import back:: link;
@@ -203,9 +203,9 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
203203 bind last_use:: find_last_uses ( crate , def_map, ref_map, ty_cx) ) ;
204204 time ( time_passes, "kind checking" ,
205205 bind kind:: check_crate ( ty_cx, method_map, last_uses, crate ) ) ;
206- if sess. opts . check_usage {
207- time ( time_passes, "usage analyses" ,
208- bind check_usage :: check_crate ( ty_cx, crate ) ) ;
206+ if vec :: len ( sess. opts . lint_opts ) > 0 u {
207+ let timer = bind time ( time_passes, _ , _ ) ;
208+ lint :: check_crate ( ty_cx, crate , sess . opts . lint_opts , timer )
209209 }
210210
211211 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,
384384
385385 let parse_only = opt_present ( match , "parse-only" ) ;
386386 let no_trans = opt_present ( match , "no-trans" ) ;
387+ let lint_opts : [ lint:: option ] = [ ] ;
388+ if !opt_present ( match , "no-lint-ctypes" ) {
389+ lint_opts += [ lint:: ctypes] ;
390+ }
387391
388392 let output_type =
389393 if parse_only || no_trans {
@@ -399,7 +403,6 @@ fn build_session_options(match: getopts::match,
399403 } else { link : : output_type_exe } ;
400404 let libcore = !opt_present( match , "no-core" ) ;
401405 let verify = !opt_present( match , "no-verify" ) ;
402- let check_usage = !opt_present( match , "no-usage-check" ) ;
403406 let save_temps = opt_present( match , "save-temps" ) ;
404407 let extra_debuginfo = opt_present( match , "xg" ) ;
405408 let debuginfo = opt_present( match , "g" ) || extra_debuginfo;
@@ -451,7 +454,7 @@ fn build_session_options(match: getopts::match,
451454 debuginfo : debuginfo ,
452455 extra_debuginfo : extra_debuginfo ,
453456 verify : verify ,
454- check_usage : check_usage ,
457+ lint_opts : lint_opts ,
455458 save_temps : save_temps ,
456459 stats : stats ,
457460 time_passes : time_passes ,
@@ -520,7 +523,7 @@ fn opts() -> [getopts::opt] {
520523 optopt ( "sysroot" ) , optopt ( "target" ) , optflag ( "stats" ) ,
521524 optflag ( "time-passes" ) , optflag ( "time-llvm-passes" ) ,
522525 optflag ( "no-verify" ) ,
523- optflag ( "no-usage-check " ) ,
526+ optflag ( "no-lint-ctypes " ) ,
524527 optmulti ( "cfg" ) , optflag ( "test" ) ,
525528 optflag ( "no-core" ) ,
526529 optflag ( "lib" ) , optflag ( "bin" ) , optflag ( "static" ) , optflag ( "gc" ) ,
0 commit comments