Skip to content

Commit eca980b

Browse files
committed
Stop using hardcoded numbers for -Z options
Instead use a macro and generate them!
1 parent d4640f9 commit eca980b

File tree

1 file changed

+45
-30
lines changed

1 file changed

+45
-30
lines changed

src/librustc/driver/session.rs

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,51 @@ pub struct Config {
3939
uint_type: UintTy,
4040
}
4141

42-
pub static verbose: uint = 1 << 0;
43-
pub static time_passes: uint = 1 << 1;
44-
pub static count_llvm_insns: uint = 1 << 2;
45-
pub static time_llvm_passes: uint = 1 << 3;
46-
pub static trans_stats: uint = 1 << 4;
47-
pub static asm_comments: uint = 1 << 5;
48-
pub static no_verify: uint = 1 << 6;
49-
pub static borrowck_stats: uint = 1 << 7;
50-
pub static borrowck_note_pure: uint = 1 << 8;
51-
pub static borrowck_note_loan: uint = 1 << 9;
52-
pub static no_landing_pads: uint = 1 << 10;
53-
pub static debug_llvm: uint = 1 << 11;
54-
pub static count_type_sizes: uint = 1 << 12;
55-
pub static meta_stats: uint = 1 << 13;
56-
pub static no_opt: uint = 1 << 14;
57-
pub static gc: uint = 1 << 15;
58-
pub static debug_info: uint = 1 << 16;
59-
pub static extra_debug_info: uint = 1 << 17;
60-
pub static print_link_args: uint = 1 << 18;
61-
pub static no_debug_borrows: uint = 1 << 19;
62-
pub static lint_llvm: uint = 1 << 20;
63-
pub static print_llvm_passes: uint = 1 << 21;
64-
pub static no_vectorize_loops: uint = 1 << 22;
65-
pub static no_vectorize_slp: uint = 1 << 23;
66-
pub static no_prepopulate_passes: uint = 1 << 24;
67-
pub static use_softfp: uint = 1 << 25;
68-
pub static gen_crate_map: uint = 1 << 26;
69-
pub static prefer_dynamic: uint = 1 << 27;
70-
pub static no_integrated_as: uint = 1 << 28;
71-
pub static lto: uint = 1 << 29;
42+
macro_rules! debugging_opts(
43+
([ $opt:ident ] $cnt:expr ) => (
44+
pub static $opt: uint = 1 << $cnt;
45+
);
46+
([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
47+
pub static $opt: uint = 1 << $cnt;
48+
debugging_opts!([ $($rest),* ] $cnt + 1)
49+
)
50+
)
51+
52+
debugging_opts!(
53+
[
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+
borrowck_note_pure,
63+
borrowck_note_loan,
64+
no_landing_pads,
65+
debug_llvm,
66+
count_type_sizes,
67+
meta_stats,
68+
no_opt,
69+
gc,
70+
debug_info,
71+
extra_debug_info,
72+
print_link_args,
73+
no_debug_borrows,
74+
lint_llvm,
75+
print_llvm_passes,
76+
no_vectorize_loops,
77+
no_vectorize_slp,
78+
no_prepopulate_passes,
79+
use_softfp,
80+
gen_crate_map,
81+
prefer_dynamic,
82+
no_integrated_as,
83+
lto
84+
]
85+
0
86+
)
7287

7388
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
7489
~[("verbose", "in general, enable more debug printouts", verbose),

0 commit comments

Comments
 (0)