pub use self::OutputType::*;
pub use self::DebugInfoLevel::*;
-use session::{early_error, Session};
+use session::{early_error, early_warn, Session};
use session::search_paths::SearchPaths;
use rustc_back::target::Target;
pub uint_type: UintTy,
}
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum OptLevel {
No, // -O0
Less, // -O1
Aggressive // -O3
}
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum DebugInfoLevel {
NoDebugInfo,
LimitedDebugInfo,
FullDebugInfo,
}
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType {
OutputTypeBitcode,
OutputTypeAssembly,
OutputTypeDepInfo,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Options {
// The crate config requested for the session, which may be combined
// with additional crate configurations during the compile process
pub prints: Vec<PrintRequest>,
pub cg: CodegenOptions,
pub color: ColorConfig,
+ pub show_span: Option<String>,
pub externs: HashMap<String, Vec<String>>,
pub crate_name: Option<String>,
/// An optional name to use as the crate for std during std injection,
pub alt_std_name: Option<String>
}
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
#[allow(missing_copy_implementations)]
pub enum PrintRequest {
FileNames,
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct OutputFilenames {
pub out_directory: Path,
pub out_filestem: String,
prints: Vec::new(),
cg: basic_codegen_options(),
color: Auto,
+ show_span: None,
externs: HashMap::new(),
crate_name: None,
alt_std_name: None,
// users can have their own entry
// functions that don't start a
// scheduler
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum EntryFnType {
EntryMain,
EntryStart,
EntryNone,
}
-#[deriving(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
+#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
pub enum CrateType {
CrateTypeExecutable,
CrateTypeDylib,
BORROWCK_STATS,
NO_LANDING_PADS,
DEBUG_LLVM,
- SHOW_SPAN,
COUNT_TYPE_SIZES,
META_STATS,
GC,
("no-landing-pads", "omit landing pads for unwinding",
NO_LANDING_PADS),
("debug-llvm", "enable debug output from LLVM", DEBUG_LLVM),
- ("show-span", "show spans for compiler debugging", SHOW_SPAN),
("count-type-sizes", "count the sizes of aggregate types",
COUNT_TYPE_SIZES),
("meta-stats", "gather metadata statistics", META_STATS),
]
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Passes {
SomePasses(Vec<String>),
AllPasses,
macro_rules! cgoptions {
($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
(
- #[deriving(Clone)]
+ #[derive(Clone)]
pub struct CodegenOptions { $(pub $opt: $t),* }
pub fn basic_codegen_options() -> CodegenOptions {
}
fn parse_uint(slot: &mut uint, v: Option<&str>) -> bool {
- match v.and_then(from_str) {
+ match v.and_then(|s| s.parse()) {
Some(i) => { *slot = i; true },
None => false
}
fn parse_opt_uint(slot: &mut Option<uint>, v: Option<&str>) -> bool {
match v {
- Some(s) => { *slot = from_str(s); slot.is_some() }
+ Some(s) => { *slot = s.parse(); slot.is_some() }
None => { *slot = None; true }
}
}
.collect()
}
-#[deriving(Copy, Clone, PartialEq, Eq, Show)]
+#[derive(Copy, Clone, PartialEq, Eq, Show)]
pub enum OptionStability { Stable, Unstable }
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct RustcOptGroup {
pub opt_group: getopts::OptGroup,
pub stability: OptionStability,
opt::multi("l", "", "Link the generated crate(s) to the specified native
library NAME. The optional KIND can be one of,
static, dylib, or framework. If omitted, dylib is
- assumed.", "NAME[:KIND]"),
+ assumed.", "[KIND=]NAME"),
opt::multi("", "crate-type", "Comma separated list of types of crates
for the compiler to emit",
"[bin|lib|rlib|dylib|staticlib]"),
"[asm|llvm-bc|llvm-ir|obj|link|dep-info]"),
opt::multi("", "print", "Comma separated list of compiler information to \
print on stdout",
- "[crate-name|output-file-names|sysroot]"),
+ "[crate-name|file-names|sysroot]"),
opt::flag("g", "", "Equivalent to -C debuginfo=2"),
opt::flag("O", "", "Equivalent to -C opt-level=2"),
opt::opt("o", "", "Write output to <filename>", "FILENAME"),
`flowgraph=<nodeid>` (graphviz formatted flowgraph for node), or
`everybody_loops` (all function bodies replaced with `loop {}`).",
"TYPE"),
+ opt::opt_u("", "show-span", "Show spans for compiler debugging", "expr|pat|ty"),
opt::flagopt("", "dep-info",
"Output dependency info to <filename> after compiling, \
in a format suitable for use by Makefiles", "FILENAME"),
}
let parse_only = if matches.opt_present("parse-only") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--parse-only is deprecated in favor of -Z parse-only");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--parse-only is deprecated in favor of -Z parse-only");
true
} else {
debugging_opts & PARSE_ONLY != 0
};
let no_trans = if matches.opt_present("no-trans") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--no-trans is deprecated in favor of -Z no-trans");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--no-trans is deprecated in favor of -Z no-trans");
true
} else {
debugging_opts & NO_TRANS != 0
};
let no_analysis = if matches.opt_present("no-analysis") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--no-analysis is deprecated in favor of -Z no-analysis");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--no-analysis is deprecated in favor of -Z no-analysis");
true
} else {
debugging_opts & NO_ANALYSIS != 0
}
Default
} else if matches.opt_present("opt-level") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--opt-level=N is deprecated in favor of -C opt-level=N");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--opt-level=N is deprecated in favor of -C opt-level=N");
match matches.opt_str("opt-level").as_ref().map(|s| s.as_slice()) {
None |
Some("0") => No,
}
FullDebugInfo
} else if matches.opt_present("debuginfo") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--debuginfo=N is deprecated in favor of -C debuginfo=N");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--debuginfo=N is deprecated in favor of -C debuginfo=N");
match matches.opt_str("debuginfo").as_ref().map(|s| s.as_slice()) {
Some("0") => NoDebugInfo,
Some("1") => LimitedDebugInfo,
}
let libs = matches.opt_strs("l").into_iter().map(|s| {
+ let mut parts = s.splitn(1, '=');
+ let kind = parts.next().unwrap();
+ if let Some(name) = parts.next() {
+ let kind = match kind {
+ "dylib" => cstore::NativeUnknown,
+ "framework" => cstore::NativeFramework,
+ "static" => cstore::NativeStatic,
+ s => {
+ early_error(format!("unknown library kind `{}`, expected \
+ one of dylib, framework, or static",
+ s)[]);
+ }
+ };
+ return (name.to_string(), kind)
+ }
+
+ // FIXME(acrichto) remove this once crates have stopped using it, this
+ // is deprecated behavior now.
let mut parts = s.rsplitn(1, ':');
let kind = parts.next().unwrap();
let (name, kind) = match (parts.next(), kind) {
let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
let test = matches.opt_present("test");
let write_dependency_info = if matches.opt_present("dep-info") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--dep-info has been deprecated in favor of --emit");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--dep-info has been deprecated in favor of --emit");
(true, matches.opt_str("dep-info").map(|p| Path::new(p)))
} else {
(output_types.contains(&OutputTypeDepInfo), None)
}
}).collect::<Vec<_>>();
if matches.opt_present("print-crate-name") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--print-crate-name has been deprecated in favor of \
- // --print crate-name");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--print-crate-name has been deprecated in favor of \
+ --print crate-name");
prints.push(PrintRequest::CrateName);
}
if matches.opt_present("print-file-name") {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("--print-file-name has been deprecated in favor of \
- // --print file-names");
+ // FIXME(acrichto) remove this eventually
+ early_warn("--print-file-name has been deprecated in favor of \
+ --print file-names");
prints.push(PrintRequest::FileNames);
}
if !cg.remark.is_empty() && debuginfo == NoDebugInfo {
- // FIXME(acrichto) uncomment deprecation warning
- // early_warn("-C remark will not show source locations without \
- // --debuginfo");
+ early_warn("-C remark will not show source locations without \
+ --debuginfo");
}
let color = match matches.opt_str("color").as_ref().map(|s| s[]) {
None => early_error("--extern value must be of the format `foo=bar`"),
};
- match externs.entry(name.to_string()) {
- Vacant(entry) => { entry.set(vec![location.to_string()]); },
+ match externs.entry(&name.to_string()) {
+ Vacant(entry) => { entry.insert(vec![location.to_string()]); },
Occupied(mut entry) => { entry.get_mut().push(location.to_string()); },
}
}
prints: prints,
cg: cg,
color: color,
+ show_span: None,
externs: externs,
crate_name: crate_name,
alt_std_name: None,