Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .agents/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ superseded_by: 2026-09-07-....md # when status is superseded
---
```

373 records.
374 records.

## By subject

Expand All @@ -30,6 +30,7 @@ Records that declare one. Everything else is listed by date below.

### build

- [clang BMI 的截断与私有模块片段判定的收窄](2026-11-26-clang-bmi-cutoff-and-private-fragment-refinement-design.md) — active
- [第二部分之后的补充方案:带修正的 ninja、模块重编译的级联、工作区发布与本轮遗留项](2026-11-17-ninja-cascade-publish-supplement-design.md) — active
- [大型工作区的构建空间与复用(mcpp#874)](2026-10-31-workspace-space-and-reuse-design.md) — active
- [依赖 image 的资源归属、模块扫描边界与锁文件稳定写入](2026-10-21-resource-ownership-module-scan-and-lock-write-design.md) — active
Expand Down Expand Up @@ -215,6 +216,7 @@ Records that declare one. Everything else is listed by date below.

### 2026-11

- [clang BMI 的截断与私有模块片段判定的收窄](2026-11-26-clang-bmi-cutoff-and-private-fragment-refinement-design.md) — active
- [测试与 CI 一轮的收尾:平台列未命中的刷新条件(mcpp#996)、`i686-windows-msvc` 行、工作区索引与引号键的迁移、索引的全量验证](2026-11-22-test-round-wrap-up-plan.md) — active
- [生态级方案:内核接口的供给与能力,派生状态的核对,存储的引用](2026-11-22-kernel-interface-and-derived-state-ecosystem-design.md) — active
- [包的特性作为机器可读的回答:一个目录项,两种来源,三种状态(mcpp#992)](2026-11-21-package-features-query-design.md) — active
Expand Down
93 changes: 18 additions & 75 deletions .github/workflows/cross-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ jobs:
- uses: actions/checkout@v4

# Restored here and saved by this job alone, on main, after its last
# step (rule R3). The Wine packages were evicted with everything else
# while the repository's caches exceeded their limit, and `apt` then
# took 26 to 50 minutes (2026-10-01); with one writer per key they stay.
# step (rule R3).
- name: Restore mcpp sandbox
id: sandbox
uses: actions/cache/restore@v4
Expand All @@ -252,72 +250,9 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.xlings
key: xlings-${{ runner.os }}-mingw-cross-v3-${{ hashFiles('.xlings.json') }}
key: xlings-${{ runner.os }}-mingw-cross-v4-${{ hashFiles('.xlings.json') }}
restore-keys: |
xlings-${{ runner.os }}-mingw-cross-v3-

# THE KEY NAMES THE RUNNER IMAGE, because the image is what the cached
# packages have to agree with. Wine's i386 closure is Multi-Arch: same
# with the amd64 libraries the image ships, and the two must be one
# version. Under the old fixed key (`-v1`) the cache was saved once and
# never again, the image moved on, and on 2026-10-15 (run 38695300904,
# a cache HIT) the cached libxml2:i386 3.9 met the image's
# libxml2:amd64 3.10: dpkg installed the stale i386 package, apt then
# upgraded it, and the upgrade's shared changelog was refused. A new
# image is a new key; until main has saved it, `restore-keys` hands back
# the previous image's packages, which the step below only uses where
# their version is still the one apt asks for.
- name: Runner image version
id: image
run: echo "version=${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"

- name: Restore wine debs
id: wine
uses: actions/cache/restore@v4
with:
path: ~/wine-debs
key: wine-debs-${{ runner.os }}-ubuntu24.04-${{ steps.image.outputs.version }}
restore-keys: |
wine-debs-${{ runner.os }}-ubuntu24.04-

# APT INSTALLS, ALWAYS; THE CACHE ONLY SPARES IT THE DOWNLOAD. The cached
# packages are put where apt keeps what it downloaded, and apt then
# resolves wine against the image as it is today: a cached package whose
# version is still current is used as is, anything newer is fetched.
# Nothing older than the image is ever installed, which is what
# `dpkg -i` of the cached set did whenever the image had moved on. Cold
# (no cache at all), this is the plain install it always was.
- name: Install wine
timeout-minutes: 20
run: |
sudo dpkg --add-architecture i386 || true
# The runner image carries third-party apt lists (Google Chrome
# among them) that this job does not use, and a transient
# `Hash Sum mismatch` on one of them fails the whole update -- which
# killed two cross-build jobs in setup, before a single byte was
# compiled. Dropping the lists this job has no use for is what makes
# the step's failure mean something about this job.
#
# BY CONTENT, NOT BY FILENAME. The first attempt removed
# `google-chrome.list` and the update failed on the same URL: on
# ubuntu-24.04 the runner writes deb822 `.sources` files, so the
# name was a guess and the guess was wrong.
sudo grep -rlE 'dl[.]google[.]com|packages[.]microsoft[.]com' \
/etc/apt/sources.list.d/ 2>/dev/null | xargs -r sudo rm -f
if ls ~/wine-debs/*.deb >/dev/null 2>&1; then
sudo cp ~/wine-debs/*.deb /var/cache/apt/archives/
fi
sudo apt-get update -qq
sudo apt-get install -y --download-only wine64 wine \
|| sudo apt-get install -y --download-only wine
# What main saves is what this image installs: packages no longer
# in any index (the previous image's, carried in by restore-keys)
# are dropped first, so the cache does not grow with every image.
sudo apt-get autoclean -qq
rm -rf ~/wine-debs && mkdir -p ~/wine-debs
cp /var/cache/apt/archives/*.deb ~/wine-debs/ 2>/dev/null || true
sudo apt-get install -y wine64 wine || sudo apt-get install -y wine
wine --version
xlings-${{ runner.os }}-mingw-cross-v4-

- name: Bootstrap mcpp via xlings
env:
Expand All @@ -344,6 +279,21 @@ jobs:
echo "XLINGS_BIN=$HOME/.xlings/subos/default/bin/xlings" >> "$GITHUB_ENV"
echo "MCPP_BOOT=$MCPP_BOOT" >> "$GITHUB_ENV"

# Wine is the package the engine's Windows-on-Linux runner names
# (`xim:wine@11.0`, builtin.toml): one portable WoW64 tree, which runs
# 32- and 64-bit PE programs without the host's i386 architecture. Taken
# from apt, Wine was a closure of about 200 packages whose download
# depended on the runner's mirror and on a cache the repository's limit
# evicts; on 2026-11-24 it exceeded the step's 20 minutes three times in
# a row. The package is one archive, kept with the xlings cache.
- name: Install wine
run: |
"$XLINGS_BIN" install wine@11.0 -y
bin="$HOME/.xlings/data/xpkgs/xim-x-wine/11.0/bin"
test -x "$bin/wine" || { echo "::error::wine 11.0 is not at $bin"; exit 1; }
echo "$bin" >> "$GITHUB_PATH"
"$bin/wine" --version

- uses: ./.github/actions/use-built-mcpp
with:
host: linux-x86_64
Expand Down Expand Up @@ -466,13 +416,6 @@ jobs:
path: ~/.xlings
key: ${{ steps.xlings.outputs.cache-primary-key }}

- name: Save wine debs
if: ${{ github.event_name == 'push' && steps.wine.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ~/wine-debs
key: ${{ steps.wine.outputs.cache-primary-key }}

# ── windows → linux ───────────────────────────────────────────────────────
# The mirror of mingw-cross-wine. Two jobs because a Windows runner cannot
# execute the ELF it produces; the artefact is handed to a Linux job and
Expand Down
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@
> Each `## [<version>]` section is that release's notes. Entries are written in English
> from 2026.9.28.3 on; earlier entries remain as written.

## [2026.11.26.1] - 2026-11-26

### Changed

- A private module fragment is still a unit of its own when the purview before it holds
conditions (`#if`, `#ifdef`, `#ifndef`, `#elif`, `#else`, `#endif`) or `#error` and
`#warning`: a condition only decides which declarations exist, and the implementation unit
receives them from the interface. Before, any directive refused. A directive that changes what
the fragment means (`#define`, `#undef`, `#include`, `#pragma`, `#line`, `_Pragma`), and a
condition still open at the module declaration or at the fragment, still leave the source as
written, and `--verbose` names the line (SPEC-019 §5).
- The text before a fragment is read as C++ tokens. A digit separator (`1'000`) no longer hides
the rest of its line, a raw string literal may run over lines and hold `module :private;`, a
`static` inside `extern "C" { … }` is a `static` at namespace scope, and a line continuation
between the module declaration and the fragment leaves the source as written. Each of these
only makes more sources built as written (SPEC-019 §5 items 4 and 8).
- `MCPP_BUILDOPT`, `MCPP_PRIVATE_FRAGMENT` and `MCPP_BMI_SCHEDULE` are part of the request a
recorded build is replayed for: the first build after one of them changes writes the graph
again. Before, a build with no edit replayed the graph the other value had written.

### Added

- `[build] private_fragment = "conservative"` (and `MCPP_PRIVATE_FRAGMENT=conservative`): the
fragment is a unit of its own, and any directive in the purview before it leaves the source as
written, as before conditions were let through. It is the way to check the entry on GCC, which
cannot build a fragment as written.
- A build that fails at a step an optimization acted on ends with a `tip:` that names the entry
and the one invocation that checks it: a source built as two units that failed, a unit that
imports a BMI kept with the lines of an earlier source that failed, a link that failed where
either is in the graph. A failure of another step says nothing; `--quiet` gives none. The
register states, for each entry that is on and has a key, the value that checks it
(`check`), and the text is made of it (SPEC-019 §9, docs/26).

### Recorded

- A reader for clang's `.pcm`, which would keep a BMI when only the function hashes, offsets and
locations differ, is not implemented. Measured with clang 20.1.7 to 23.1.6: the operand that
holds a function's hash is at an index that varies with the declaration and the version, and a
third of the edits change the width of that 32-bit value in the stream, which moves the bit
offsets and three offset tables. Without a model of the declaration records, a reader cannot
tell the field from an interface change (SPEC-019 §8, SPEC-018 §2.2).

## [2026.11.24.1] - 2026-11-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/04-mcpp-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ dependency_linkage = "static" # How dependencies arrive: static (default) |
cache = "global" # Global dependency cache: global (default) | local | off (§2.10)
jobs = "auto" # Concurrent compiles: a positive number, or "auto" (§ below)
bmi_schedule = "auto" # Module-edge scheduling: auto (= off) | on | off (§ below)
private_fragment = "unit" # A private module fragment: unit (built as a unit of its own, default) | as-written (chapter 26)
private_fragment = "unit" # A private module fragment: unit (default) | conservative (a unit; any purview directive refuses) | as-written (chapter 26)
```

A file a word of `[build] ldflags` names by absolute path is an input of every
Expand Down
46 changes: 41 additions & 5 deletions docs/26-build-optimizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ by default; the others are stated by a parameter.
| `gcm-locations` | on | `[profile.<name>] bmi_cutoff`, `MCPP_BMI_CUTOFF` | GCC: a BMI whose line maps alone moved is kept; importers name the earlier lines |
| `scan-pass` | on | — | The scans of a graph run before its compiles, as a pass of their own |
| `split-schedule` | off | `[build] bmi_schedule`, `MCPP_BMI_SCHEDULE` | Importers start when a BMI exists, not when its compiler exits |
| `private-fragment` | on | `[build] private_fragment`, `MCPP_PRIVATE_FRAGMENT` | A private module fragment is built as a unit of its own |
| `private-fragment` | on | `[build] private_fragment` (`unit`, `conservative`, `as-written`), `MCPP_PRIVATE_FRAGMENT` | A private module fragment is built as a unit of its own |

`MCPP_BUILDOPT=off mcpp build` is the standard build for one invocation: every entry
off. An entry with no parameter produces the bytes the standard build produces, so
Expand Down Expand Up @@ -68,10 +68,20 @@ links; an edit above it reaches the importers, as it must.
- GCC does not implement `module :private;`. Built as a unit of its own, the file builds
with GCC as well.
- A fragment that reads what is local to the interface's translation unit — a macro
defined in the module's purview, an unnamed namespace, a `static` at namespace scope,
a using-directive at namespace scope — is built as written, and `--verbose` says which
line decided it. With a compiler that builds no fragment as written, that is a warning.
defined in the module's purview (`#define`, `#undef`, `#include`, `#pragma`, `#line`), an
unnamed namespace, a `static` at namespace scope (`extern "C" { … }` is namespace scope), a
using-directive at namespace scope, a line continuation between the module declaration and
the fragment — is built as written, and `--verbose` says which line decided it. With a
compiler that builds no fragment as written, that is a warning.
- A condition (`#if`, `#ifdef`, `#ifndef`, `#elif`, `#else`, `#endif`) and `#error` or
`#warning` before the fragment do not keep it from being a unit: a condition only decides
which declarations exist, and the implementation unit receives them from the interface. A
condition still open at the module declaration or at the fragment does.
- The text is read as C++ tokens: comments and the contents of string, character and raw
string literals are not code, and a digit separator (`1'000`) is part of a number.
- `[build] private_fragment = "as-written"` hands the file to the compiler unchanged.
`"conservative"` builds the fragment as a unit of its own and refuses any directive in the
purview, as before conditions were let through; it is the check available on GCC.

## The notes of a build

Expand All @@ -86,6 +96,32 @@ The note is given when the rebuild started at a module of one file with at least
importing units, once a build directory. Beside it, a build that replaced or kept BMIs
states which ([04](04-mcpp-toml.md), `bmi_cutoff`).

## Checking whether an optimization is the cause

Every entry is on because most projects build the same with it and sooner. When a build
fails at a step an entry acted on, it ends with a `tip:` that names the entry and the one
invocation that checks it:

```
tip: src/c.cppm was built as two units (private-fragment), and one of them failed.
To check whether that is the cause: MCPP_PRIVATE_FRAGMENT=as-written mcpp build ([build] private_fragment = "as-written" keeps it)
If it builds, report the file; MCPP_BUILDOPT=off turns every optimization off for one run.
```

The tip is given for the step that failed, so a failure of another file says nothing. The
ladder is the same for every entry:

1. Turn off the one entry for one invocation: `MCPP_PRIVATE_FRAGMENT=as-written mcpp build`
(`conservative` on GCC), `MCPP_BMI_CUTOFF=exact mcpp build` (it removes the BMIs kept with
earlier lines first, so the products are those of a build from nothing).
2. Turn off every entry: `MCPP_BUILDOPT=off mcpp build`.
3. A failure that remains after both is not an entry's. A failure that goes with one is worth
a report naming the file, and the manifest keys above keep the statement.

Three tips exist: a source built as two units that failed, a unit that imports a BMI kept
with earlier lines that failed, and a failed link where either is in the graph (which cannot
say which unit). A test program that fails when it runs gives none.

## What the home's cache places (2026.11.21.1+)

Beside the entries, the home's build cache (`build-cache/v1/`, [25](25-home-indices-and-store.md))
Expand Down Expand Up @@ -125,7 +161,7 @@ run for a minute is named once on a `Running` line, with the package and source

```toml
[build]
private_fragment = "as-written" # "unit" (default) | "as-written"
private_fragment = "as-written" # "unit" (default) | "conservative" | "as-written"
bmi_schedule = "on" # "auto" (default, = off) | "on" | "off"

[profile.dev]
Expand Down
4 changes: 2 additions & 2 deletions docs/specs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
| [SPEC-015](target-sets.md) | 目标集合与腿:集合的写法与展开,命令对多条腿的语义,串行规划与一起构建,测试归档,机器输出 | 评审中 v1.0 | 2026-10-30 | mcpp >= 2026.10.30.1 |
| [SPEC-016](targets-and-providers.md) | 目标与提供者:行、提供者、选择规则、平台定义的行、C 环境与执行、报告、机器输出与锁 | 评审中 v1.9 | 2026-11-23 | mcpp >= 2026.11.9.1;v1.1 条款 mcpp >= 2026.11.10.1;v1.9 条款 mcpp >= 2026.11.23.1 |
| [SPEC-017](test.md) | mcpp 测试规范:测试程序、测试协议、记录、存储、启动描述与框架声明;基础能力 B1–B6 与可选能力 O1–O12 | 评审中 v2.6 | 2026-11-21 | mcpp >= 2026.11.8.1;逐条标注;B5、B6 的新键、O3 的运行器一侧、O8 mcpp >= 2026.11.10.1;O9 mtest >= 0.6.0;O10 mcpp >= 2026.11.13.1;O11、O12 与 P5.6 mcpp >= 2026.11.21.1 |
| [SPEC-018](module-rebuilds.md) | 模块的重编译:按 BMI 内容截断,GCC 的时间戳与行映射,`bmi_cutoff`,构建目录的记录 | 评审中 v1.0 | 2026-11-17 | mcpp >= 2026.11.17.2 |
| [SPEC-019](build-optimizations.md) | 构建优化:登记表、级别、接缝、总开关,私有模块片段作为独立单元,构建后的建议 | 评审中 v1.0 | 2026-11-17 | mcpp >= 2026.11.17.2 |
| [SPEC-018](module-rebuilds.md) | 模块的重编译:按 BMI 内容截断,GCC 的时间戳与行映射,`bmi_cutoff`,构建目录的记录 | 评审中 v1.1 | 2026-11-26 | mcpp >= 2026.11.17.2 |
| [SPEC-019](build-optimizations.md) | 构建优化:登记表、级别、接缝、总开关,私有模块片段作为独立单元,构建后的建议,失败时的提示 | 评审中 v1.1 | 2026-11-26 | mcpp >= 2026.11.17.2;§5、§9 的新增自 2026.11.26.1 |

## 文档约定

Expand Down
Loading
Loading