Skip to content

Commit 5bda1d3

Browse files
compiler: Support nightly -Cforce-frame-pointers=non-leaf
Requires -Zunstable-options as this is a -C flag already.
1 parent 3963b2e commit 5bda1d3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

compiler/rustc_session/src/config.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1919
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION};
2020
use rustc_span::source_map::FilePathMapping;
2121
use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm};
22-
use rustc_target::spec::{LinkSelfContainedComponents, LinkerFeatures};
22+
use rustc_target::spec::{FramePointer, LinkSelfContainedComponents, LinkerFeatures};
2323
use rustc_target::spec::{SplitDebuginfo, Target, TargetTriple};
2424
use std::collections::btree_map::{
2525
Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter,
@@ -2468,6 +2468,15 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
24682468
}
24692469
}
24702470

2471+
if !nightly_options::is_unstable_enabled(matches)
2472+
&& cg.force_frame_pointers == FramePointer::NonLeaf
2473+
{
2474+
early_dcx.early_fatal(
2475+
"`-Cforce-frame-pointers=non-leaf` also requires `-Zunstable-options` \
2476+
and a nightly compiler",
2477+
)
2478+
}
2479+
24712480
// For testing purposes, until we have more feedback about these options: ensure `-Z
24722481
// unstable-options` is required when using the unstable `-C link-self-contained` and `-C
24732482
// linker-flavor` options.

compiler/rustc_session/src/options.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ mod desc {
373373
pub const parse_opt_comma_list: &str = parse_comma_list;
374374
pub const parse_number: &str = "a number";
375375
pub const parse_opt_number: &str = parse_number;
376-
pub const parse_frame_pointer: &str = parse_bool;
376+
pub const parse_frame_pointer: &str =
377+
"one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf`";
377378
pub const parse_threads: &str = parse_number;
378379
pub const parse_time_passes_format: &str = "`text` (default) or `json`";
379380
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
@@ -675,9 +676,9 @@ mod parse {
675676
let mut is_parsed = parse_bool(&mut boolish, v);
676677
if boolish & is_parsed {
677678
*slot = FramePointer::Always;
678-
} else if false {
679-
/* TODO: add NonLeaf as an unstable opt */
679+
} else if v == Some("non-leaf") {
680680
is_parsed = true;
681+
*slot = FramePointer::NonLeaf;
681682
};
682683
is_parsed
683684
}

0 commit comments

Comments
 (0)