@@ -257,108 +257,6 @@ pub enum CrateType {
257257 CrateTypeStaticlib ,
258258}
259259
260- macro_rules! debugging_opts {
261- ( [ $opt: ident ] $cnt: expr ) => (
262- pub const $opt: u64 = 1 << $cnt;
263- ) ;
264- ( [ $opt: ident, $( $rest: ident) ,* ] $cnt: expr ) => (
265- pub const $opt: u64 = 1 << $cnt;
266- debugging_opts! { [ $( $rest) ,* ] $cnt + 1 }
267- )
268- }
269-
270- debugging_opts ! {
271- [
272- VERBOSE ,
273- TIME_PASSES ,
274- COUNT_LLVM_INSNS ,
275- TIME_LLVM_PASSES ,
276- TRANS_STATS ,
277- ASM_COMMENTS ,
278- NO_VERIFY ,
279- BORROWCK_STATS ,
280- NO_LANDING_PADS ,
281- DEBUG_LLVM ,
282- COUNT_TYPE_SIZES ,
283- META_STATS ,
284- GC ,
285- PRINT_LINK_ARGS ,
286- PRINT_LLVM_PASSES ,
287- AST_JSON ,
288- AST_JSON_NOEXPAND ,
289- LS ,
290- SAVE_ANALYSIS ,
291- PRINT_MOVE_FRAGMENTS ,
292- FLOWGRAPH_PRINT_LOANS ,
293- FLOWGRAPH_PRINT_MOVES ,
294- FLOWGRAPH_PRINT_ASSIGNS ,
295- FLOWGRAPH_PRINT_ALL ,
296- PRINT_REGION_GRAPH ,
297- PARSE_ONLY ,
298- NO_TRANS ,
299- NO_ANALYSIS ,
300- UNSTABLE_OPTIONS ,
301- PRINT_ENUM_SIZES ,
302- FORCE_OVERFLOW_CHECKS ,
303- FORCE_NO_OVERFLOW_CHECKS
304- ]
305- 0
306- }
307-
308- pub fn debugging_opts_map ( ) -> Vec < ( & ' static str , & ' static str , u64 ) > {
309- vec ! [ ( "verbose" , "in general, enable more debug printouts" , VERBOSE ) ,
310- ( "time-passes" , "measure time of each rustc pass" , TIME_PASSES ) ,
311- ( "count-llvm-insns" , "count where LLVM \
312- instrs originate", COUNT_LLVM_INSNS ) ,
313- ( "time-llvm-passes" , "measure time of each LLVM pass" ,
314- TIME_LLVM_PASSES ) ,
315- ( "trans-stats" , "gather trans statistics" , TRANS_STATS ) ,
316- ( "asm-comments" , "generate comments into the assembly (may change behavior)" ,
317- ASM_COMMENTS ) ,
318- ( "no-verify" , "skip LLVM verification" , NO_VERIFY ) ,
319- ( "borrowck-stats" , "gather borrowck statistics" , BORROWCK_STATS ) ,
320- ( "no-landing-pads" , "omit landing pads for unwinding" ,
321- NO_LANDING_PADS ) ,
322- ( "debug-llvm" , "enable debug output from LLVM" , DEBUG_LLVM ) ,
323- ( "count-type-sizes" , "count the sizes of aggregate types" ,
324- COUNT_TYPE_SIZES ) ,
325- ( "meta-stats" , "gather metadata statistics" , META_STATS ) ,
326- ( "print-link-args" , "Print the arguments passed to the linker" ,
327- PRINT_LINK_ARGS ) ,
328- ( "gc" , "Garbage collect shared data (experimental)" , GC ) ,
329- ( "print-llvm-passes" ,
330- "Prints the llvm optimization passes being run" ,
331- PRINT_LLVM_PASSES ) ,
332- ( "ast-json" , "Print the AST as JSON and halt" , AST_JSON ) ,
333- ( "ast-json-noexpand" , "Print the pre-expansion AST as JSON and halt" , AST_JSON_NOEXPAND ) ,
334- ( "ls" , "List the symbols defined by a library crate" , LS ) ,
335- ( "save-analysis" , "Write syntax and type analysis information \
336- in addition to normal output", SAVE_ANALYSIS ) ,
337- ( "print-move-fragments" , "Print out move-fragment data for every fn" ,
338- PRINT_MOVE_FRAGMENTS ) ,
339- ( "flowgraph-print-loans" , "Include loan analysis data in \
340- --pretty flowgraph output", FLOWGRAPH_PRINT_LOANS ) ,
341- ( "flowgraph-print-moves" , "Include move analysis data in \
342- --pretty flowgraph output", FLOWGRAPH_PRINT_MOVES ) ,
343- ( "flowgraph-print-assigns" , "Include assignment analysis data in \
344- --pretty flowgraph output", FLOWGRAPH_PRINT_ASSIGNS ) ,
345- ( "flowgraph-print-all" , "Include all dataflow analysis data in \
346- --pretty flowgraph output", FLOWGRAPH_PRINT_ALL ) ,
347- ( "print-region-graph" , "Prints region inference graph. \
348- Use with RUST_REGION_GRAPH=help for more info",
349- PRINT_REGION_GRAPH ) ,
350- ( "parse-only" , "Parse only; do not compile, assemble, or link" , PARSE_ONLY ) ,
351- ( "no-trans" , "Run all passes except translation; no output" , NO_TRANS ) ,
352- ( "no-analysis" , "Parse and expand the source, but run no analysis and" ,
353- NO_TRANS ) ,
354- ( "unstable-options" , "Adds unstable command line options to rustc interface" ,
355- UNSTABLE_OPTIONS ) ,
356- ( "print-enum-sizes" , "Print the size of enums and their variants" , PRINT_ENUM_SIZES ) ,
357- ( "force-overflow-checks" , "Force arithmetic overflow checking on" , FORCE_OVERFLOW_CHECKS ) ,
358- ( "force-no-overflow-checks" , "Force arithmetic overflow checking off" , FORCE_NO_OVERFLOW_CHECKS ) ,
359- ]
360- }
361-
362260#[ derive( Clone ) ]
363261pub enum Passes {
364262 SomePasses ( Vec < String > ) ,
@@ -449,7 +347,8 @@ macro_rules! options {
449347 #[ allow( non_upper_case_globals, dead_code) ]
450348 mod $mod_desc {
451349 pub const parse_bool: Option <& ' static str > = None ;
452- pub const parse_opt_bool: Option <& ' static str > = None ;
350+ pub const parse_opt_bool: Option <& ' static str > =
351+ Some ( "one of: `y`, `yes`, `on`, `n`, `no`, or `off`" ) ;
453352 pub const parse_string: Option <& ' static str > = Some ( "a string" ) ;
454353 pub const parse_opt_string: Option <& ' static str > = Some ( "a string" ) ;
455354 pub const parse_list: Option <& ' static str > = Some ( "a space-separated list of strings" ) ;
@@ -480,7 +379,19 @@ macro_rules! options {
480379
481380 fn parse_opt_bool( slot: & mut Option <bool >, v: Option <& str >) -> bool {
482381 match v {
483- Some ( ..) => false ,
382+ Some ( s) => {
383+ match s {
384+ "n" | "no" | "off" => {
385+ * slot = Some ( false ) ;
386+ }
387+ "y" | "yes" | "on" => {
388+ * slot = Some ( true ) ;
389+ }
390+ _ => { return false ; }
391+ }
392+
393+ true
394+ } ,
484395 None => { * slot = Some ( true ) ; true }
485396 }
486397 }
@@ -683,6 +594,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
683594 "Adds unstable command line options to rustc interface" ) ,
684595 print_enum_sizes: bool = ( false , parse_bool,
685596 "Print the size of enums and their variants" ) ,
597+ force_overflow_checks: Option <bool > = ( None , parse_opt_bool,
598+ "Force overflow checks on or off" ) ,
686599}
687600
688601pub fn default_lib_output ( ) -> CrateType {
0 commit comments