Skip to content

Commit c595e5c

Browse files
committed
refactor(manifest): the conditional runtime sweep prints the list it checks
The message spelled its two keys as prose while the check compared two separate literals. The `[build]` sweep a few hundred lines above carries the note saying why that matters: its message was once a third hand-written copy that had drifted from both others, so the only spelling that turned the feature on was the one being reported as unsupported.
1 parent 2113483 commit c595e5c

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

modules/manifest/src/toml.cppm

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,13 +2636,28 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
26362636
// `[target.<pred>]` above cannot reach here: it skips tables,
26372637
// because tables are its conditional channel — so this table's
26382638
// own keys were swept by nothing.
2639+
//
2640+
// ONE LIST, USED BY THE CHECK AND PRINTED BY THE MESSAGE. The
2641+
// `[build]` sweep a few hundred lines above carries the note
2642+
// explaining why: its message was once a third hand-written copy
2643+
// and had drifted from both others, so the only spelling that
2644+
// turned the feature on was the one reported as unsupported.
2645+
static constexpr std::string_view kKnownCondRuntimeKeys[] = {
2646+
"libraries", "link_library_dirs",
2647+
};
26392648
for (auto& [rk, _] : rt) {
2640-
if (rk == "link_library_dirs" || rk == "libraries") continue;
2649+
if (std::ranges::find(kKnownCondRuntimeKeys, rk)
2650+
!= std::ranges::end(kKnownCondRuntimeKeys)) continue;
2651+
std::string supported;
2652+
for (auto k : kKnownCondRuntimeKeys) {
2653+
if (!supported.empty()) supported += ", ";
2654+
supported += k;
2655+
}
26412656
m.schemaWarnings.push_back(std::format(
26422657
"[target.{}.runtime] has unsupported key '{}' (ignored). "
2643-
"Supported keys: libraries, link_library_dirs. This table "
2644-
"is the dialect-neutral link intent; other [runtime] keys "
2645-
"are not per-target.", triple, rk));
2658+
"Supported keys: {}. This table is the dialect-neutral "
2659+
"link intent; other [runtime] keys are not per-target.",
2660+
triple, rk, supported));
26462661
}
26472662
}
26482663
if (auto bit = body.find("build"); bit != body.end() && bit->second.is_table()) {

0 commit comments

Comments
 (0)