Skip to content

Commit e8fc4b3

Browse files
committed
auto merge of #4834 : veddan/rust/zflags, r=graydon
Converted --static, --gc, --jit, -g and --xg to -Z flags.
2 parents bc1fb62 + fae8fc9 commit e8fc4b3

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/librustc/driver/driver.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,6 @@ pub fn build_session_options(+binary: ~str,
521521
} else {
522522
session::unknown_crate
523523
};
524-
let static = opt_present(matches, ~"static");
525-
let gc = opt_present(matches, ~"gc");
526-
527524
let parse_only = opt_present(matches, ~"parse-only");
528525
let no_trans = opt_present(matches, ~"no-trans");
529526
@@ -570,7 +567,6 @@ pub fn build_session_options(+binary: ~str,
570567
}
571568
}
572569
573-
let jit = opt_present(matches, ~"jit");
574570
let output_type =
575571
if parse_only || no_trans {
576572
link::output_type_none
@@ -584,8 +580,6 @@ pub fn build_session_options(+binary: ~str,
584580
} else if opt_present(matches, ~"emit-llvm") {
585581
link::output_type_bitcode
586582
} else { link::output_type_exe };
587-
let extra_debuginfo = opt_present(matches, ~"xg");
588-
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
589583
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
590584
let sysroot_opt = sysroot_opt.map(|m| Path(*m));
591585
let target_opt = getopts::opt_maybe_str(matches, ~"target");
@@ -616,6 +610,12 @@ pub fn build_session_options(+binary: ~str,
616610
}
617611
} else { No }
618612
};
613+
let gc = debugging_opts & session::gc != 0;
614+
let jit = debugging_opts & session::jit != 0;
615+
let extra_debuginfo = debugging_opts & session::extra_debug_info != 0;
616+
let debuginfo = debugging_opts & session::debug_info != 0 ||
617+
extra_debuginfo;
618+
let static = debugging_opts & session::static != 0;
619619
let target =
620620
match target_opt {
621621
None => host_triple(),
@@ -714,14 +714,11 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
714714
environment", ~"SPEC"),
715715
optflag(~"", ~"emit-llvm",
716716
~"Produce an LLVM bitcode file"),
717-
optflag(~"g", ~"", ~"Produce debug info (experimental)"),
718-
optflag(~"", ~"gc", ~"Garbage collect shared data (experimental)"),
719717
optflag(~"h", ~"help",~"Display this message"),
720718
optmulti(~"L", ~"", ~"Add a directory to the library search path",
721719
~"PATH"),
722720
optflag(~"", ~"lib", ~"Compile a library crate"),
723721
optflag(~"", ~"ls", ~"List the symbols defined by a library crate"),
724-
optflag(~"", ~"jit", ~"Execute using JIT (experimental)"),
725722
optflag(~"", ~"no-trans",
726723
~"Run all passes except translation; no output"),
727724
optflag(~"O", ~"", ~"Equivalent to --opt-level=2"),
@@ -741,13 +738,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
741738
or identified (fully parenthesized,
742739
AST nodes and blocks with IDs)", ~"TYPE"),
743740
optflag(~"S", ~"", ~"Compile only; do not assemble or link"),
744-
optflag(~"", ~"xg", ~"Extra debugging info (experimental)"),
745741
optflag(~"", ~"save-temps",
746742
~"Write intermediate files (.bc, .opt.bc, .o)
747743
in addition to normal output"),
748-
optflag(~"", ~"static",
749-
~"Use or produce static libraries or binaries
750-
(experimental)"),
751744
optopt(~"", ~"sysroot",
752745
~"Override the system root", ~"PATH"),
753746
optflag(~"", ~"test", ~"Build a test harness"),

src/librustc/driver/session.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ pub const count_type_sizes: uint = 1 << 14;
7575
pub const meta_stats: uint = 1 << 15;
7676
pub const no_opt: uint = 1 << 16;
7777
pub const no_monomorphic_collapse: uint = 1 << 17;
78+
pub const gc: uint = 1 << 18;
79+
pub const jit: uint = 1 << 19;
80+
pub const debug_info: uint = 1 << 20;
81+
pub const extra_debug_info: uint = 1 << 21;
82+
pub const static: uint = 1 << 22;
7883

7984
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8085
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -102,6 +107,13 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
102107
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
103108
(~"no-monomorphic-collapse", ~"do not collapse template instantiations",
104109
no_monomorphic_collapse),
110+
(~"gc", ~"Garbage collect shared data (experimental)", gc),
111+
(~"jit", ~"Execute using JIT (experimental)", jit),
112+
(~"extra-debug-info", ~"Extra debugging info (experimental)",
113+
extra_debug_info),
114+
(~"debug-info", ~"Produce debug info (experimental)", debug_info),
115+
(~"static", ~"Use or produce static libraries or binaries " +
116+
"(experimental)", static)
105117
]
106118
}
107119

0 commit comments

Comments
 (0)