compiler: Accept -Cforce-frame-pointers=always

Also lands behind -Zunstable-options, for now.
Take the opportunity to do some mild cleanup.
This commit is contained in:
Jubilee Young 2024-05-14 12:26:01 -07:00
parent 7d160ae61a
commit 598e265d43
2 changed files with 10 additions and 11 deletions

View File

@ -2528,7 +2528,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
&& cg.force_frame_pointers == FramePointer::NonLeaf
{
early_dcx.early_fatal(
"`-Cforce-frame-pointers=non-leaf` also requires `-Zunstable-options` \
"`-Cforce-frame-pointers=non-leaf` or `always` also requires `-Zunstable-options` \
and a nightly compiler",
)
}

View File

@ -373,8 +373,7 @@ mod desc {
pub const parse_opt_comma_list: &str = parse_comma_list;
pub const parse_number: &str = "a number";
pub const parse_opt_number: &str = parse_number;
pub const parse_frame_pointer: &str =
"one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf`";
pub const parse_frame_pointer: &str = "one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf` or `always`";
pub const parse_threads: &str = parse_number;
pub const parse_time_passes_format: &str = "`text` (default) or `json`";
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
@ -674,15 +673,15 @@ mod parse {
}
pub(crate) fn parse_frame_pointer(slot: &mut FramePointer, v: Option<&str>) -> bool {
let mut boolish = false;
let mut is_parsed = parse_bool(&mut boolish, v);
if boolish & is_parsed {
*slot = FramePointer::Always;
} else if v == Some("non-leaf") {
is_parsed = true;
*slot = FramePointer::NonLeaf;
let mut yes = false;
match v {
Some(_) if parse_bool(&mut yes, v) && yes => slot.ratchet(FramePointer::Always),
Some(_) if parse_bool(&mut yes, v) => slot.ratchet(FramePointer::MayOmit),
Some("always") => slot.ratchet(FramePointer::Always),
Some("non-leaf") => slot.ratchet(FramePointer::NonLeaf),
_ => return false,
};
is_parsed
true
}
pub(crate) fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {