Skip to content

Commit 9bfe0d7

Browse files
committed
fix(features): 保留键的诊断指向一个存在的拼写
自审读出:`deps` 的那条消息提供了 `optional = true`,而 mcpp 从来没有这个键。 一条把读者送去一个解析器不认识的键的诊断,与本次发布正在移除的那些警告是同一个 缺陷,只是外了一层。文档化的机制是 `[feature-deps.<name>]`(docs/05 §2.8.2)。 同步中英两份 docs/05。
1 parent fc5bee8 commit 9bfe0d7

4 files changed

Lines changed: 22 additions & 8 deletions

File tree

.agents/docs/2026-08-31-issue540-seven-audit-findings.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,13 @@ pass that always fires both produce a green single-leg test.
532532

533533
### 6.9 D16 — the third option: finish the channel that already exists
534534

535+
> **Not taken.** D9 shipped instead, for the cost-floor reason argued at the end
536+
> of this section: a package wanting one conditional flag should not have to
537+
> ship and run a C++ program. **D16a was taken anyway**, because it is a defect
538+
> rather than an option — `docs/05` described `target_libc()` as the resolved C
539+
> library when it names the payload, and that misleads authors under any of the
540+
> three answers. D16b and D16c were not needed once the declarative axis worked.
541+
535542
Do not build a predicate axis. Close the three gaps in §6.7 instead:
536543

537544
- **D16a.** Make the resolved `c-abi` reachable from a build program — either by
@@ -689,7 +696,7 @@ The #531 path does neither. §12 is what that costs.
689696
| 5 | D1 + D3 + D2a + D4 — the text corrections and the `[features]` check | mechanical; no interaction with anything above |
690697
| 6 | D11 — `docs/13` and `docs/17`, four files | after 2, so the documents describe the gated behaviour |
691698
| 7 | **D16a**`target_libc()` reports the payload ref while `docs/05` calls it the resolved C library (§6.7 item 2) | a defect on its own terms, required under all three options below, and it misleads package authors today |
692-
| 8 | D9 / D16 / D10 — the declarative axis, the imperative channel, or withdrawal | the only item needing a decision rather than an implementation |
699+
| 8 | D9 / D16 / D10 — the declarative axis, the imperative channel, or withdrawal | the only item needing a decision rather than an implementation. **Decided: D9**, plus D16a because it is a defect either way (§6.9) |
693700
| 9 | D15 — the tests §12.4 names | after the behaviour they assert exists |
694701

695702
Items 1 through 7 are unambiguous. Item 8 wants a maintainer's answer, and D8

docs/05-mcpp-toml.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,8 @@ simd = { sources = ["src/simd/**"], flags = [
13311331

13321332
- **The table form accepts exactly** `implies`, `forward`, `defines`, `sources`,
13331333
`flags`, `requires`, `provides`. Anything else is reported as a schema warning
1334-
and ignored (mcpp 2026.9.1.1+); `deps` is reported separately as reserved,
1335-
because it is planned rather than wrong. Before that release `[features]` was
1334+
and ignored (mcpp 2026.9.1.1+); `deps` is reported separately as reserved and
1335+
points at `[feature-deps.<name>]`. Before that release `[features]` was
13361336
the one structured section with no schema check at all, so a misplaced
13371337
`include_dirs` inside a feature built successfully with no diagnostic while
13381338
the identical mistake in `[build]` was reported.

docs/zh/05-mcpp-toml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ simd = { sources = ["src/simd/**"], flags = [
11501150

11511151
- **表形式恰好接受** `implies``forward``defines``sources``flags`
11521152
`requires``provides`。其余键会被报成一条 schema 警告并忽略(mcpp 2026.9.1.1+);
1153-
`deps` 单独报为「保留」,因为它是计划中的而不是写错的。在该版本之前,`[features]`
1153+
`deps` 单独报为「保留」(它是计划中的而不是写错的),并指向 `[feature-deps.<name>]`。在该版本之前,`[features]`
11541154
是唯一一个完全没有 schema 检查的结构化段落 —— 把 `include_dirs` 误写进 feature 里
11551155
会零诊断地构建成功,而同样的错误写在 `[build]` 里会被报出来。
11561156
- `defines`****宏名(不带 `-D`);feature 激活时每个脱糖为 `-D<x>`,加到该包

modules/manifest/src/toml.cppm

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,18 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
530530
// "unsupported" would deny a documented plan; saying nothing
531531
// is what let it look implemented.
532532
if (fkey == "deps") {
533+
// ⚠️ THE SPELLING NAMED HERE HAS TO EXIST. The first
534+
// draft of this message offered `optional = true`,
535+
// which mcpp has never had — a diagnostic that sends
536+
// its reader to a key the parser does not know is the
537+
// same defect as the warnings this release removes,
538+
// just one layer out. `[feature-deps.<name>]` is the
539+
// documented mechanism (docs/05 §2.8.2).
533540
m.schemaWarnings.push_back(std::format(
534-
"[features].{}.deps is reserved for a later stage and "
535-
"is not read yet (ignored). Declare dependencies in "
536-
"[dependencies] and gate them with "
537-
"`optional = true` + `implies`.", fname));
541+
"[features].{}.deps is reserved for a later stage "
542+
"and is not read yet (ignored). To pull in a "
543+
"dependency when this feature is active, declare it "
544+
"under [feature-deps.{}].", fname, fname));
538545
continue;
539546
}
540547
std::string supported;

0 commit comments

Comments
 (0)