Skip to content

Commit 254e35c

Browse files
committed
Capitalize debugging opts and make them u64
1 parent a880777 commit 254e35c

File tree

3 files changed

+91
-90
lines changed

3 files changed

+91
-90
lines changed

src/librustc/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub mod write {
126126
session::Default => lib::llvm::CodeGenLevelDefault,
127127
session::Aggressive => lib::llvm::CodeGenLevelAggressive,
128128
};
129-
let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;
129+
let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0;
130130

131131
let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
132132
sess.opts.target_cpu.with_c_str(|CPU| {
@@ -987,7 +987,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
987987
let mut cc_args = sess.targ_cfg.target_strs.cc_args.clone();
988988
cc_args.push_all_move(link_args(sess, dylib, tmpdir.path(),
989989
obj_filename, out_filename));
990-
if (sess.opts.debugging_opts & session::print_link_args) != 0 {
990+
if (sess.opts.debugging_opts & session::PRINT_LINK_ARGS) != 0 {
991991
println!("{} link args: '{}'", cc_prog, cc_args.connect("' '"));
992992
}
993993

src/librustc/driver/driver.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -759,22 +759,22 @@ pub fn build_session_options(binary: ~str,
759759
}
760760
}
761761

762-
let mut debugging_opts = 0u;
762+
let mut debugging_opts = 0;
763763
let debug_flags = matches.opt_strs("Z");
764764
let debug_map = session::debugging_opts_map();
765765
for debug_flag in debug_flags.iter() {
766-
let mut this_bit = 0u;
766+
let mut this_bit = 0;
767767
for tuple in debug_map.iter() {
768768
let (name, bit) = match *tuple { (ref a, _, b) => (a, b) };
769769
if *name == *debug_flag { this_bit = bit; break; }
770770
}
771-
if this_bit == 0u {
771+
if this_bit == 0 {
772772
early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
773773
}
774774
debugging_opts |= this_bit;
775775
}
776776

777-
if debugging_opts & session::debug_llvm != 0 {
777+
if debugging_opts & session::DEBUG_LLVM != 0 {
778778
unsafe { llvm::LLVMSetDebug(1); }
779779
}
780780

@@ -797,7 +797,7 @@ pub fn build_session_options(binary: ~str,
797797
let target_feature = matches.opt_str("target-feature").unwrap_or(~"");
798798
let save_temps = matches.opt_present("save-temps");
799799
let opt_level = {
800-
if (debugging_opts & session::no_opt) != 0 {
800+
if (debugging_opts & session::NO_OPT) != 0 {
801801
No
802802
} else if matches.opt_present("O") {
803803
if matches.opt_present("opt-level") {
@@ -816,9 +816,9 @@ pub fn build_session_options(binary: ~str,
816816
}
817817
} else { No }
818818
};
819-
let gc = debugging_opts & session::gc != 0;
820-
let extra_debuginfo = debugging_opts & session::extra_debug_info != 0;
821-
let debuginfo = debugging_opts & session::debug_info != 0 ||
819+
let gc = debugging_opts & session::GC != 0;
820+
let extra_debuginfo = debugging_opts & session::EXTRA_DEBUG_INFO != 0;
821+
let debuginfo = debugging_opts & session::DEBUG_INFO != 0 ||
822822
extra_debuginfo;
823823

824824
let addl_lib_search_paths = matches.opt_strs("L").map(|s| {

src/librustc/driver/session.rs

+81-80
Original file line numberDiff line numberDiff line change
@@ -41,88 +41,89 @@ pub struct Config {
4141

4242
macro_rules! debugging_opts(
4343
([ $opt:ident ] $cnt:expr ) => (
44-
pub static $opt: uint = 1 << $cnt;
44+
pub static $opt: u64 = 1 << $cnt;
4545
);
4646
([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
47-
pub static $opt: uint = 1 << $cnt;
47+
pub static $opt: u64 = 1 << $cnt;
4848
debugging_opts!([ $($rest),* ] $cnt + 1)
4949
)
5050
)
5151

5252
debugging_opts!(
5353
[
54-
verbose,
55-
time_passes,
56-
count_llvm_insns,
57-
time_llvm_passes,
58-
trans_stats,
59-
asm_comments,
60-
no_verify,
61-
borrowck_stats,
62-
no_landing_pads,
63-
debug_llvm,
64-
count_type_sizes,
65-
meta_stats,
66-
no_opt,
67-
gc,
68-
debug_info,
69-
extra_debug_info,
70-
print_link_args,
71-
print_llvm_passes,
72-
no_vectorize_loops,
73-
no_vectorize_slp,
74-
no_prepopulate_passes,
75-
use_softfp,
76-
gen_crate_map,
77-
prefer_dynamic,
78-
no_integrated_as,
79-
lto
54+
VERBOSE,
55+
TIME_PASSES,
56+
COUNT_LLVM_INSNS,
57+
TIME_LLVM_PASSES,
58+
TRANS_STATS,
59+
ASM_COMMENTS,
60+
NO_VERIFY,
61+
BORROWCK_STATS,
62+
NO_LANDING_PADS,
63+
DEBUG_LLVM,
64+
COUNT_TYPE_SIZES,
65+
META_STATS,
66+
NO_OPT,
67+
GC,
68+
DEBUG_INFO,
69+
EXTRA_DEBUG_INFO,
70+
PRINT_LINK_ARGS,
71+
PRINT_LLVM_PASSES,
72+
NO_VECTORIZE_LOOPS,
73+
NO_VECTORIZE_SLP,
74+
NO_PREPOPULATE_PASSES,
75+
USE_SOFTFP,
76+
GEN_CRATE_MAP,
77+
PREFER_DYNAMIC,
78+
NO_INTEGRATED_AS,
79+
LTO
8080
]
8181
0
8282
)
8383

84-
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
85-
~[("verbose", "in general, enable more debug printouts", verbose),
86-
("time-passes", "measure time of each rustc pass", time_passes),
84+
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, u64)] {
85+
~[("verbose", "in general, enable more debug printouts", VERBOSE),
86+
("time-passes", "measure time of each rustc pass", TIME_PASSES),
8787
("count-llvm-insns", "count where LLVM \
88-
instrs originate", count_llvm_insns),
88+
instrs originate", COUNT_LLVM_INSNS),
8989
("time-llvm-passes", "measure time of each LLVM pass",
90-
time_llvm_passes),
91-
("trans-stats", "gather trans statistics", trans_stats),
92-
("asm-comments", "generate comments into the assembly (may change behavior)", asm_comments),
93-
("no-verify", "skip LLVM verification", no_verify),
94-
("borrowck-stats", "gather borrowck statistics", borrowck_stats),
90+
TIME_LLVM_PASSES),
91+
("trans-stats", "gather trans statistics", TRANS_STATS),
92+
("asm-comments", "generate comments into the assembly (may change behavior)",
93+
ASM_COMMENTS),
94+
("no-verify", "skip LLVM verification", NO_VERIFY),
95+
("borrowck-stats", "gather borrowck statistics", BORROWCK_STATS),
9596
("no-landing-pads", "omit landing pads for unwinding",
96-
no_landing_pads),
97-
("debug-llvm", "enable debug output from LLVM", debug_llvm),
97+
NO_LANDING_PADS),
98+
("debug-llvm", "enable debug output from LLVM", DEBUG_LLVM),
9899
("count-type-sizes", "count the sizes of aggregate types",
99-
count_type_sizes),
100-
("meta-stats", "gather metadata statistics", meta_stats),
101-
("no-opt", "do not optimize, even if -O is passed", no_opt),
102-
("print-link-args", "Print the arguments passed to the linker", print_link_args),
103-
("gc", "Garbage collect shared data (experimental)", gc),
100+
COUNT_TYPE_SIZES),
101+
("meta-stats", "gather metadata statistics", META_STATS),
102+
("no-opt", "do not optimize, even if -O is passed", NO_OPT),
103+
("print-link-args", "Print the arguments passed to the linker",
104+
PRINT_LINK_ARGS),
105+
("gc", "Garbage collect shared data (experimental)", GC),
104106
("extra-debug-info", "Extra debugging info (experimental)",
105-
extra_debug_info),
106-
("debug-info", "Produce debug info (experimental)", debug_info),
107+
EXTRA_DEBUG_INFO),
108+
("debug-info", "Produce debug info (experimental)", DEBUG_INFO),
107109
("print-llvm-passes",
108110
"Prints the llvm optimization passes being run",
109-
print_llvm_passes),
111+
PRINT_LLVM_PASSES),
110112
("no-prepopulate-passes",
111113
"Don't pre-populate the pass managers with a list of passes, only use \
112114
the passes from --passes",
113-
no_prepopulate_passes),
115+
NO_PREPOPULATE_PASSES),
114116
("no-vectorize-loops",
115117
"Don't run the loop vectorization optimization passes",
116-
no_vectorize_loops),
117-
("no-vectorize-slp",
118-
"Don't run LLVM's SLP vectorization passes",
119-
no_vectorize_slp),
120-
("soft-float", "Generate software floating point library calls", use_softfp),
121-
("gen-crate-map", "Force generation of a toplevel crate map", gen_crate_map),
122-
("prefer-dynamic", "Prefer dynamic linking to static linking", prefer_dynamic),
118+
NO_VECTORIZE_LOOPS),
119+
("no-vectorize-slp", "Don't run LLVM's SLP vectorization passes",
120+
NO_VECTORIZE_SLP),
121+
("soft-float", "Generate software floating point library calls", USE_SOFTFP),
122+
("gen-crate-map", "Force generation of a toplevel crate map", GEN_CRATE_MAP),
123+
("prefer-dynamic", "Prefer dynamic linking to static linking", PREFER_DYNAMIC),
123124
("no-integrated-as",
124-
"Use external assembler rather than LLVM's integrated one", no_integrated_as),
125-
("lto", "Perform LLVM link-time optimizations", lto),
125+
"Use external assembler rather than LLVM's integrated one", NO_INTEGRATED_AS),
126+
("lto", "Perform LLVM link-time optimizations", LTO),
126127
]
127128
}
128129

@@ -169,7 +170,7 @@ pub struct Options {
169170
parse_only: bool,
170171
no_trans: bool,
171172
no_analysis: bool,
172-
debugging_opts: uint,
173+
debugging_opts: u64,
173174
android_cross_path: Option<~str>,
174175
/// Whether to write dependency files. It's (enabled, optional filename).
175176
write_dependency_info: (bool, Option<Path>),
@@ -292,56 +293,56 @@ impl Session_ {
292293
pub fn diagnostic(&self) -> @diagnostic::SpanHandler {
293294
self.span_diagnostic
294295
}
295-
pub fn debugging_opt(&self, opt: uint) -> bool {
296-
(self.opts.debugging_opts & opt) != 0u
296+
pub fn debugging_opt(&self, opt: u64) -> bool {
297+
(self.opts.debugging_opts & opt) != 0
297298
}
298299
// This exists to help with refactoring to eliminate impossible
299300
// cases later on
300301
pub fn impossible_case(&self, sp: Span, msg: &str) -> ! {
301302
self.span_bug(sp, format!("Impossible case reached: {}", msg));
302303
}
303-
pub fn verbose(&self) -> bool { self.debugging_opt(verbose) }
304-
pub fn time_passes(&self) -> bool { self.debugging_opt(time_passes) }
304+
pub fn verbose(&self) -> bool { self.debugging_opt(VERBOSE) }
305+
pub fn time_passes(&self) -> bool { self.debugging_opt(TIME_PASSES) }
305306
pub fn count_llvm_insns(&self) -> bool {
306-
self.debugging_opt(count_llvm_insns)
307+
self.debugging_opt(COUNT_LLVM_INSNS)
307308
}
308309
pub fn count_type_sizes(&self) -> bool {
309-
self.debugging_opt(count_type_sizes)
310+
self.debugging_opt(COUNT_TYPE_SIZES)
310311
}
311312
pub fn time_llvm_passes(&self) -> bool {
312-
self.debugging_opt(time_llvm_passes)
313+
self.debugging_opt(TIME_LLVM_PASSES)
313314
}
314-
pub fn trans_stats(&self) -> bool { self.debugging_opt(trans_stats) }
315-
pub fn meta_stats(&self) -> bool { self.debugging_opt(meta_stats) }
316-
pub fn asm_comments(&self) -> bool { self.debugging_opt(asm_comments) }
317-
pub fn no_verify(&self) -> bool { self.debugging_opt(no_verify) }
318-
pub fn borrowck_stats(&self) -> bool { self.debugging_opt(borrowck_stats) }
315+
pub fn trans_stats(&self) -> bool { self.debugging_opt(TRANS_STATS) }
316+
pub fn meta_stats(&self) -> bool { self.debugging_opt(META_STATS) }
317+
pub fn asm_comments(&self) -> bool { self.debugging_opt(ASM_COMMENTS) }
318+
pub fn no_verify(&self) -> bool { self.debugging_opt(NO_VERIFY) }
319+
pub fn borrowck_stats(&self) -> bool { self.debugging_opt(BORROWCK_STATS) }
319320
pub fn print_llvm_passes(&self) -> bool {
320-
self.debugging_opt(print_llvm_passes)
321+
self.debugging_opt(PRINT_LLVM_PASSES)
321322
}
322323
pub fn no_prepopulate_passes(&self) -> bool {
323-
self.debugging_opt(no_prepopulate_passes)
324+
self.debugging_opt(NO_PREPOPULATE_PASSES)
324325
}
325326
pub fn no_vectorize_loops(&self) -> bool {
326-
self.debugging_opt(no_vectorize_loops)
327+
self.debugging_opt(NO_VECTORIZE_LOOPS)
327328
}
328329
pub fn no_vectorize_slp(&self) -> bool {
329-
self.debugging_opt(no_vectorize_slp)
330+
self.debugging_opt(NO_VECTORIZE_SLP)
330331
}
331332
pub fn gen_crate_map(&self) -> bool {
332-
self.debugging_opt(gen_crate_map)
333+
self.debugging_opt(GEN_CRATE_MAP)
333334
}
334335
pub fn prefer_dynamic(&self) -> bool {
335-
self.debugging_opt(prefer_dynamic)
336+
self.debugging_opt(PREFER_DYNAMIC)
336337
}
337338
pub fn no_integrated_as(&self) -> bool {
338-
self.debugging_opt(no_integrated_as)
339+
self.debugging_opt(NO_INTEGRATED_AS)
339340
}
340341
pub fn lto(&self) -> bool {
341-
self.debugging_opt(lto)
342+
self.debugging_opt(LTO)
342343
}
343344
pub fn no_landing_pads(&self) -> bool {
344-
self.debugging_opt(no_landing_pads)
345+
self.debugging_opt(NO_LANDING_PADS)
345346
}
346347

347348
// pointless function, now...
@@ -387,7 +388,7 @@ pub fn basic_options() -> @Options {
387388
parse_only: false,
388389
no_trans: false,
389390
no_analysis: false,
390-
debugging_opts: 0u,
391+
debugging_opts: 0,
391392
android_cross_path: None,
392393
write_dependency_info: (false, None),
393394
print_metas: (false, false, false),

0 commit comments

Comments
 (0)