Skip to content

Commit 7cc82d1

Browse files
committed
docs: the READMEs were a fourth copy of the tier table, and nothing compared them
Both READMEs still said `wasm32-emscripten`, `aarch64-linux-android` and `x86_64-linux-android` were `planned`, with text about what they still needed, while the engine had built and RUN two of the three. The front page is where a reader looks first and it was the most wrong. I updated the copies I knew about -- docs/21 in both languages, and the design record -- and never enumerated the rest. This repository's own history says to enumerate: "the same decision written a second time without reading the first" is the defect it has recorded most often. So the fix is not four edits, it is the missing comparison. `.github/tools/check_target_tiers.py` reads every tier from `kKnownTargets`, reads every markdown row that names a target and carries a tier, and refuses when they disagree -- or when a document that has a tier column OMITS a row the engine has. The denominator is the engine's table, because a check that walked the documents would pass on a document listing nothing. IT FOUND A SECOND GAP ON ITS FIRST RUN, older than this work: `armv7a-none-eabi` and `armv7a-none-eabihf` are `verified` rows absent from docs/21's support table in both languages. Added, with the values the table gives them. The rows now read, and the Android pair had to be SPLIT because one ran and the other could not: wasm32-emscripten verified emsdk ships its own sysroot and libc++ module surface; `mcpp run` executes it x86_64-linux-android verified one NDK payload for both ABIs; ran on an API 24 x86_64 emulator image aarch64-linux-android preview same payload, same build, no execution path from an x86_64 host aarch64-ios, planned the iPhoneOS and iPhoneSimulator SDKs ship *-ios-sim inside Xcode and are not redistributable -- a licence blocker, not a payload one Verified in both directions: changing one documented tier turns the check red, naming the file, the target and both values.
1 parent d47d956 commit 7cc82d1

6 files changed

Lines changed: 104 additions & 6 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env python3
2+
"""Every documented tier agrees with the target table.
3+
4+
WHY THIS EXISTS. `kKnownTargets` in modules/toolchain-model/src/triple.cppm is
5+
the single source for a row's tier, and four documents restate it: both
6+
READMEs, both copies of docs/21. When `wasm32-emscripten` became `verified` and
7+
the Android rows gained tiers, docs/21 was updated and the READMEs were not --
8+
so the front page told a reader that three targets were `planned` while the
9+
engine had built and run two of them. Nothing compared the two, which is the
10+
whole reason it could drift.
11+
12+
THE DENOMINATOR IS THE ENGINE'S TABLE, not the documents'. A check that walked
13+
the documents would pass on a document that lists nothing; this one fails when
14+
a row the engine has is absent from a table that carries tiers at all, and when
15+
a tier disagrees.
16+
"""
17+
import re
18+
import sys
19+
from pathlib import Path
20+
21+
ROOT = Path(__file__).resolve().parents[2]
22+
TABLE = ROOT / "modules/toolchain-model/src/triple.cppm"
23+
TIERS = ("verified", "preview", "planned")
24+
25+
# The engine's answer.
26+
rows = {}
27+
for m in re.finditer(r'^\s*\{\s*"([a-z0-9_.+-]+)",\s*"(verified|preview|planned)"',
28+
TABLE.read_text(), re.M):
29+
rows[m.group(1)] = m.group(2)
30+
if len(rows) < 20:
31+
sys.exit(f"ERROR: only {len(rows)} rows parsed from {TABLE.name}; "
32+
"the pattern no longer matches the table")
33+
34+
# Documents that carry a tier column at all. A document without one is not in
35+
# scope -- prose that mentions a target is not a claim about its tier.
36+
docs = [
37+
ROOT / "README.md",
38+
ROOT / "README.zh-CN.md",
39+
ROOT / "docs/21-the-target-triple.md",
40+
ROOT / "docs/zh/21-the-target-triple.md",
41+
]
42+
43+
fail = False
44+
for doc in docs:
45+
if not doc.exists():
46+
print(f"ERROR: {doc.relative_to(ROOT)} is missing")
47+
fail = True
48+
continue
49+
seen = {}
50+
for line in doc.read_text().splitlines():
51+
if not line.startswith("|"):
52+
continue
53+
cells = [c.strip() for c in line.strip().strip("|").split("|")]
54+
tier = next((c for c in cells if c in TIERS), None)
55+
if tier is None:
56+
continue
57+
# Every target named in the row's FIRST cell takes the row's tier.
58+
for name in re.findall(r"`([a-z0-9_.+-]+)`", cells[0]):
59+
if name in rows:
60+
seen[name] = tier
61+
if not seen:
62+
print(f"ERROR: {doc.relative_to(ROOT)} is listed here but names no "
63+
f"target with a tier; either it lost its table or this list is stale")
64+
fail = True
65+
continue
66+
for name, tier in sorted(seen.items()):
67+
if rows[name] != tier:
68+
print(f"ERROR: {doc.relative_to(ROOT)}: {name} documented as "
69+
f"'{tier}', the table says '{rows[name]}'")
70+
fail = True
71+
missing = sorted(set(rows) - set(seen))
72+
if missing:
73+
print(f"ERROR: {doc.relative_to(ROOT)} carries tiers but omits "
74+
f"{len(missing)} row(s): {', '.join(missing)}")
75+
fail = True
76+
print(f" {doc.relative_to(ROOT)}: {len(seen)} of {len(rows)} rows")
77+
78+
if fail:
79+
sys.exit(1)
80+
print(f"OK: {len(rows)} target tiers agree across {len(docs)} documents")

.github/workflows/ci-linux.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ jobs:
108108
- name: Check documentation structure
109109
run: bash .github/tools/check_docs_structure.sh
110110

111+
# Every documented tier agrees with kKnownTargets.
112+
#
113+
# Four documents restate a row's tier and nothing compared them to
114+
# the table. When wasm32-emscripten became `verified` and the
115+
# Android rows gained tiers, docs/21 was updated and both READMEs
116+
# were not -- so the front page said three targets were `planned`
117+
# while the engine had built and run two of them. On its first run
118+
# this check also found two Cortex-A rows missing from docs/21
119+
# entirely, which predates that work.
120+
- name: Documented target tiers agree with the table
121+
run: python3 .github/tools/check_target_tiers.py
122+
111123
- uses: ./.github/actions/bootstrap-mcpp
112124

113125
- name: Configure mirror + Build mcpp from source (self-host)

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,10 @@ list` reports for this machine):
419419
| `aarch64-none-elf` · `x86_64-none-elf` | llvm 22 — bare metal, no C library by default ² | preview |
420420
| `thumbv7em-none-eabi` · `thumbv8m.base-none-eabi` · `thumbv8m.main-none-eabihf` | llvm 22 — Cortex-M4/M7 soft float, M23, M33F/M55F ² | preview |
421421
| `riscv64-linux-musl` · `aarch64-linux-gnu` · `x86_64-macos` || planned |
422-
| `aarch64-linux-android` · `x86_64-linux-android` | needs `xim:android-ndk`; `import std` measured working on the NDK's clang | planned |
423-
| `aarch64-ios` | needs the iPhoneOS SDK, which is a licence question before it is a packaging one | planned |
424-
| `wasm32-emscripten` | needs `xim:emsdk`; `import std` measured working on `em++`, and the target model is [#597](https://github.com/mcpp-community/mcpp/issues/597) | planned |
422+
| `wasm32-emscripten` | `emsdk@6.0.9` — Emscripten ships its own sysroot and its own libc++ module surface; `mcpp run` executes the module with `node` | verified |
423+
| `x86_64-linux-android` | `android-ndk@30.0.16248370` — bionic from the NDK, one payload for both ABIs; ran on an API 24 x86_64 emulator image | verified |
424+
| `aarch64-linux-android` | the same payload and the same build; no execution path from an x86_64 host, because Google's emulator refuses a foreign guest | preview |
425+
| `aarch64-ios` · `aarch64-ios-sim` · `x86_64-ios-sim` | the iPhoneOS and iPhoneSimulator SDKs ship inside Xcode and are not redistributable, so the blocker is a licence rather than a payload | planned |
425426

426427
`verified` an image has been built **and run** for the row, qemu and wine
427428
included · `preview` it builds and links, and no emulator run has been recorded

README.zh-CN.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ mcpp 的身份模型是两条正交轴:**工具链** = `family@version`(family
406406
| `aarch64-none-elf` · `x86_64-none-elf` | llvm 22——裸机,默认不带 C 库 ² | preview |
407407
| `thumbv7em-none-eabi` · `thumbv8m.base-none-eabi` · `thumbv8m.main-none-eabihf` | llvm 22——Cortex-M4/M7 软浮点、M23、M33F/M55F ² | preview |
408408
| `riscv64-linux-musl` · `aarch64-linux-gnu` · `x86_64-macos` || planned |
409-
| `aarch64-linux-android` · `x86_64-linux-android` |`xim:android-ndk`;`import std` 在 NDK 自带的 clang 上已实测可用 | planned |
410-
| `aarch64-ios` | 待 iPhoneOS SDK,而它先是一个许可问题再是一个打包问题 | planned |
411-
| `wasm32-emscripten` |`xim:emsdk`;`import std``em++` 上已实测可用,目标模型见 [#597](https://github.com/mcpp-community/mcpp/issues/597) | planned |
409+
| `wasm32-emscripten` | `emsdk@6.0.9` —— Emscripten 自带 sysroot 和它自己的 libc++ 模块面;`mcpp run``node` 把模块跑起来 | verified |
410+
| `x86_64-linux-android` | `android-ndk@30.0.16248370` —— bionic 来自 NDK,一个载荷服务两个 ABI;在 API 24 的 x86_64 模拟器镜像上跑过 | verified |
411+
| `aarch64-linux-android` | 同一个载荷、同样的构建;从 x86_64 宿主没有执行路径,因为 Google 的模拟器直接拒绝异构 guest | preview |
412+
| `aarch64-ios` · `aarch64-ios-sim` · `x86_64-ios-sim` | iPhoneOS 与 iPhoneSimulator 的 SDK 在 Xcode 里且不可再分发,所以阻塞项是许可而不是载荷 | planned |
412413

413414
`verified` 该行的镜像已被构建**并运行**过,qemu 与 wine 都算 · `preview` 可构建
414415
可链接,未记录过模拟器运行 · `planned` 已登记在词表中,尚未接线 —— 面向这类目标

docs/21-the-target-triple.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ other's rows.
483483
| `thumbv8m.base-none-eabi` | preview | `llvm@22.1.8` | payload | payload | payload | payload |
484484
| `thumbv8m.main-none-eabi` | verified | `llvm@22.1.8` | payload | payload | payload | payload |
485485
| `thumbv8m.main-none-eabihf` | preview | `llvm@22.1.8` | payload | payload | payload | payload |
486+
| `armv7a-none-eabi` | verified | `llvm@22.1.8` | payload | payload | payload | payload |
487+
| `armv7a-none-eabihf` | verified | `llvm@22.1.8` | payload | payload | payload | payload |
486488
| `aarch64-linux-android` | preview | `android-ndk@30.0.16248370` | payload | payload | payload ||
487489
| `x86_64-linux-android` | verified | `android-ndk@30.0.16248370` | payload | payload | payload ||
488490
| `aarch64-ios` | planned || planned | planned | planned | planned |

docs/zh/21-the-target-triple.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ CRT;图供给时是 `musl`。一个目标字符串,两个不同的 C 库 ——
433433
| `thumbv8m.base-none-eabi` | preview | `llvm@22.1.8` | 载荷 | 载荷 | 载荷 | 载荷 |
434434
| `thumbv8m.main-none-eabi` | verified | `llvm@22.1.8` | 载荷 | 载荷 | 载荷 | 载荷 |
435435
| `thumbv8m.main-none-eabihf` | preview | `llvm@22.1.8` | 载荷 | 载荷 | 载荷 | 载荷 |
436+
| `armv7a-none-eabi` | verified | `llvm@22.1.8` | 载荷 | 载荷 | 载荷 | 载荷 |
437+
| `armv7a-none-eabihf` | verified | `llvm@22.1.8` | 载荷 | 载荷 | 载荷 | 载荷 |
436438
| `aarch64-linux-android` | preview | `android-ndk@30.0.16248370` | payload | payload | payload ||
437439
| `x86_64-linux-android` | verified | `android-ndk@30.0.16248370` | payload | payload | payload ||
438440
| `aarch64-ios` | planned || planned | planned | planned | planned |

0 commit comments

Comments
 (0)