Skip to content

Commit

Permalink
Accept -Cforce-frame-pointers=always
Browse files Browse the repository at this point in the history
Also lands behind -Zunstable-options, for now.
Take the opportunity to do some mild cleanup.
  • Loading branch information
workingjubilee committed May 14, 2024
1 parent 5bda1d3 commit f5ad116
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,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",
)
}
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ mod desc {
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`";
"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`";
Expand Down Expand Up @@ -672,15 +672,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 {
Expand Down

0 comments on commit f5ad116

Please sign in to comment.