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