Skip to content

Commit c94234b

Browse files
authored
2026.10.5.1: mcpp run hands the terminal to the program, and the follow-ups of #766 (#767)
mcpp run, mcpp run -q --release and the named runners now give the program the terminal. On POSIX mcpp replaces itself with the program once the build is done; on Windows the program runs in mcpp's console and process group while mcpp ignores Ctrl-C. A death by signal reaches the caller as that signal, and closing notices precede the Running line. The follow-ups of #761, #763 and #765 recorded in #766: members and artifacts link the shared dependencies of the statics placed in their own image and not the objects of statics placed in another image; exports narrows discovered symbols on the MSVC ABI, with a warning beside source declarations and an error for an empty surface a program of the build links; auto_export is renamed windows_auto_export before its first release under SPEC-004 section 5.3; build-program glob inputs share the walk of sources globs, report unwatchable patterns, match absolute patterns and refuse patterns leaving a registry or git dependency; run_all.sh bounds each test where GNU timeout is absent. SPEC-004 v1.11 and SPEC-009 v0.2. Closes #766.
1 parent 68e7310 commit c94234b

45 files changed

Lines changed: 1976 additions & 334 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-10-05-run-terminal-handoff-and-766-follow-ups-design.md‎

Lines changed: 426 additions & 0 deletions
Large diffs are not rendered by default.

‎.agents/docs/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ superseded_by: 2026-09-07-....md # when status is superseded
1818
---
1919
```
2020

21-
324 records.
21+
325 records.
2222

2323
## By subject
2424

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

3131
### design
3232

33+
- [`mcpp run` hands the terminal to the program, and the follow-ups of #761, #763 and #765 (#766)](2026-10-05-run-terminal-handoff-and-766-follow-ups-design.md) — landed
3334
- [PR CI acceleration and the toolchain specification (#756, #757, #669)](2026-10-02-pr-ci-acceleration-and-the-toolchain-specification-design.md) — active
3435
- [工具与工具链的来源:声明、编程决定、可观察](2026-10-01-tool-and-toolchain-sources-design.md) — landed
3536
- [A pack's build reported as a build, and a unit's compile independent of the member selection: triage and design (#753, #751)](2026-10-01-pack-drive-and-selection-independent-compile-design.md) — landed
@@ -115,6 +116,7 @@ Records that declare one. Everything else is listed by date below.
115116

116117
### 2026-10
117118

119+
- [`mcpp run` hands the terminal to the program, and the follow-ups of #761, #763 and #765 (#766)](2026-10-05-run-terminal-handoff-and-766-follow-ups-design.md) — landed
118120
- [PR CI acceleration and the toolchain specification (#756, #757, #669)](2026-10-02-pr-ci-acceleration-and-the-toolchain-specification-design.md) — active
119121
- [工具与工具链的来源:声明、编程决定、可观察](2026-10-01-tool-and-toolchain-sources-design.md) — landed
120122
- [A pack's build reported as a build, and a unit's compile independent of the member selection: triage and design (#753, #751)](2026-10-01-pack-drive-and-selection-independent-compile-design.md) — landed

‎CHANGELOG.md‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,77 @@
44
> Each `## [<version>]` section is that release's notes. Entries are written in English
55
> from 2026.9.28.3 on; earlier entries remain as written.
66

7+
## [2026.10.5.1] - 2026-10-05
8+
9+
This release gives the program that `mcpp run` starts the terminal, and closes
10+
the follow-ups of 2026.10.3.1's three fixes (#761, #763, #765) recorded in
11+
mcpp#766: the shared dependencies of statics placed in a program's own image,
12+
`exports` on the MSVC ABI, and the walk and boundary of build-program glob
13+
inputs. The key added by #763 is renamed before its first release
14+
(`windows_auto_export`). No default toolchain changes.
15+
16+
### Fixed
17+
18+
- **`mcpp run` hands the terminal to the program.** The program started by
19+
`mcpp run`, `mcpp run -q --release` or a named runner ran in a process group
20+
of its own, which on a terminal is a background group: its first read of the
21+
terminal stopped it with `SIGTTIN`, and Ctrl-C reached mcpp, which killed the
22+
program instead of letting its handler run. On Linux and macOS mcpp now
23+
replaces itself with the program once the build is done (`execve`). The
24+
program reads the terminal, receives Ctrl-C, Ctrl-\ and Ctrl-Z, and runs with
25+
the process id the shell started, so a `timeout` or a closed terminal reaches
26+
it directly and nothing of mcpp remains. On Windows the program runs in mcpp's
27+
console and process group, and mcpp ignores Ctrl-C while it waits. A program
28+
that ends by a signal is seen by the caller as ending by that signal, as in a
29+
direct run; before, mcpp exited with `128+n`. Notices concerning the whole
30+
command (`tip:` lines) are printed before the `Running` line. E2E 883 drives
31+
`mcpp run` through a pseudo-terminal.
32+
- **A program links the shared dependencies of the statics placed in its own
33+
image.** A workspace member's executable, or an artifact, links the objects of
34+
a static package that is placed in its own package's shared image, and now
35+
also links that package's shared dependencies; before, the link failed with an
36+
undefined reference. A program does not link the objects of a static placed in
37+
another package's image, which that image's library supplies.
38+
- **`exports` takes effect on the MSVC ABI.** The `.def` of a DLL holds the
39+
discovered symbols that match a pattern; before, the patterns were ignored on
40+
PE. Source declarations (`__declspec(dllexport)`, `/EXPORT:`, the same in
41+
LLVM bitcode) still decide the export set when present, and `exports` beside
42+
them is reported as a warning. A DLL that exports nothing and is linked by a
43+
program of the same build fails at its `.def` step with a message naming it,
44+
rather than at the consumer as a missing import library.
45+
- **Build-program glob inputs use the walk of `sources` globs.** Directory
46+
symlinks are followed with the cycle guard, and the same directories are
47+
excluded. A pattern whose literal prefix passes through an excluded directory
48+
is reported as a warning, since it can never re-run the program.
49+
50+
### Changed
51+
52+
- **`[targets.<n>] auto_export` is renamed `windows_auto_export`.** The key
53+
added by #763 affects only MSVC-ABI DLLs, and SPEC-004 §5.3 now states that a
54+
key with an effect on one platform carries that platform's prefix. The key was
55+
not in a release, so no alias is kept. `windows_auto_export = false` together
56+
with `exports` is refused when an MSVC-ABI target is planned.
57+
- **Glob inputs that leave the package.** An absolute `rerun_if_changed_glob`
58+
pattern is matched against absolute paths. A pattern that leaves the package,
59+
by `..` or as an absolute path, is an error in a registry or git dependency,
60+
whose tree is the package store's; it is honoured for the project, a path
61+
dependency and a workspace member.
62+
- **The `.def` step runs its LLVM tools concurrently**, one compiler and one
63+
`llvm-nm` invocation per bitcode object, up to eight at a time.
64+
65+
### Specifications
66+
67+
- SPEC-004 v1.11: §5.3, platform-scoped keys carry the platform's prefix. The
68+
field admission criteria are referred to docs/90.
69+
- SPEC-009 v0.2: §10.5 gate G7, E2E 881 passes with a candidate LLVM release on
70+
the MSVC-ABI rows.
71+
72+
### Repository CI
73+
74+
- `tests/e2e/run_all.sh` bounds each test on hosts without GNU `timeout`
75+
(the macOS runners) with `tests/e2e/_timeout.py`, which ends the test's whole
76+
process tree. One hung test no longer consumes the shard's step budget.
77+
778
## [2026.10.3.1] - 2026-10-03
879

980
This release is identical to 2026.10.2.1 in code; the bump exists to publish a

‎docs/04-mcpp-toml.md‎

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ the loader opens and the import library the linker consumes, with the export
210210
list generated from the objects on the MSVC ABI (which exports nothing without
211211
`__declspec(dllexport)` or a `.def`). See `tests/e2e/08`, `257` and `259`.
212212

213+
A package with a `shared` target and `bin` targets links each executable from
214+
its own objects, as a separate program: the executable does not load the
215+
package's own shared library. A program that loads a package's shared library
216+
is a program of another package, for example another member of the same
217+
workspace ([07 — Workspaces](07-workspace.md)).
218+
213219
#### `kind = "app"` — the thing a user launches (mcpp 2026.9.12.3+)
214220

215221
```toml
@@ -265,8 +271,8 @@ exports = "abi/mydriver.exports" # or inline: exports = ["vk_icd*"]
265271

266272
Omitting `exports` leaves ELF and Mach-O's native visibility rules in effect.
267273
On the MSVC ABI, mcpp discovers exportable external definitions unless an input
268-
already declares exports or `auto_export = false` disables discovery. `exports`
269-
narrows the linker's published set.
274+
already declares exports or `windows_auto_export = false` disables discovery.
275+
`exports` narrows the linker's published set.
270276

271277
Two projects need the narrowing. A **runtime with a stable ABI** publishes a
272278
reviewed set and nothing else, so that what is not in the set stays free to
@@ -284,7 +290,7 @@ One statement, three renderings:
284290
|---|---|
285291
| ELF | a version script, `-Wl,--version-script=` |
286292
| Mach-O | `-Wl,-exported_symbols_list` (the leading underscore is supplied by the engine) |
287-
| PE | the `.def`, replacing the auto-generated all-exports one |
293+
| PE (MSVC ABI) | the `.def`: the discovered symbols that match a pattern |
288294

289295
**It does not change compile-time visibility, and that is deliberate.** The
290296
narrowing is a link-time property on all three formats, so one key has one
@@ -301,30 +307,45 @@ A `soname` is meaningful on `kind = "lib"` too — see
301307
[`dependency_linkage`](#dependency_linkage--static-or-shared-is-the-consumers-decision)
302308
below, where the form a library takes becomes the consumer's decision.
303309

304-
#### `auto_export` — native export control on the MSVC ABI (unreleased)
310+
On the MSVC ABI the three sources of a DLL's export set apply in this order:
311+
312+
1. **Declarations in the sources.** When any object declares exports
313+
(`__declspec(dllexport)`, `#pragma comment(linker, "/EXPORT:...")`, or the
314+
same in LLVM bitcode), the DLL publishes exactly those. `exports` beside such
315+
a declaration has no effect, and the build states this as a warning that
316+
names the object.
317+
2. **`exports`.** Otherwise the discovered symbols whose name matches a pattern
318+
are published. A pattern matches the linker's name of the symbol:
319+
undecorated on 32-bit x86, and MSVC-mangled for C++. A pattern written for a
320+
C name is therefore portable across the three formats; one written for a
321+
mangled C++ name is not.
322+
3. **Discovery.** Otherwise every exportable definition is published.
323+
324+
A DLL that publishes nothing has no import library. When a program of the same
325+
build links such a DLL, its `.def` step fails and names the DLL; a DLL that no
326+
program links, such as a resource-only DLL, builds.
305327

306-
The key and LLVM bitcode discovery require an unreleased source build; they are
307-
not available in mcpp 2026.10.3.1. A target that supplies its own export control
308-
can omit the automatic export-discovery step:
328+
#### `windows_auto_export` — export discovery on the MSVC ABI (mcpp 2026.10.5.1+)
309329

310330
```toml
311331
[targets.plugin]
312332
kind = "shared"
313-
auto_export = false
333+
windows_auto_export = false
314334
```
315335

316-
The boolean defaults to `true` and applies only to PE shared libraries on the
317-
MSVC ABI, including clang and clang-cl. It applies when a library target is
318-
built as a dependency too. It has no effect on static libraries, executables,
319-
ELF, Mach-O or MinGW. Native `__declspec(dllexport)`, linker flags and explicit
320-
`exports` lists remain effective when discovery is disabled.
321-
322-
With discovery enabled, any input's explicit export intent suppresses automatic
323-
exports for the whole DLL. COFF directives are checked first. LLVM bitcode is
324-
inspected with the selected LLVM compiler, including `dllexport` declarations
325-
and linker-option metadata. Only an unannotated DLL needs candidate enumeration;
326-
bitcode candidates come from `llvm-nm` beside that compiler. Both FullLTO and
327-
ThinLTO inputs can be mixed with ordinary COFF objects.
336+
The boolean defaults to `true`. `false` removes the discovery step, and the
337+
DLL publishes what its sources and `[build] ldflags` declare. It applies to PE
338+
shared libraries on the MSVC ABI, including clang and clang-cl, also when the
339+
target is built as a dependency, and renders nothing on static libraries,
340+
executables, ELF, Mach-O and MinGW.
341+
342+
`windows_auto_export = false` together with `exports` is refused when an
343+
MSVC-ABI target is planned, since `exports` narrows the discovered symbols; the
344+
same manifest builds on ELF and Mach-O.
345+
346+
Discovery reads COFF objects directly and LLVM bitcode (FullLTO and ThinLTO,
347+
alone or mixed with COFF objects) with the selected LLVM compiler and the
348+
`llvm-nm` beside it.
328349

329350
#### `windows_subsystem` and `windows_entry` — a Windows GUI executable (mcpp 2026.9.12.2+)
330351

‎docs/09-commands-by-scenario.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,34 @@ test` and `mcpp pack` keep their statuses. A program, or a runner
426426
failed build; [50 — Machine-Readable Output](50-machine-output.md) §6 gives the
427427
bands.
428428

429+
### The program and the terminal *(2026.10.5.1+)*
430+
431+
The program `mcpp run` starts owns the terminal as it would if the shell had
432+
started it: it reads the terminal's input, and Ctrl-C, Ctrl-\ and Ctrl-Z reach
433+
the program, which decides what they mean. The same holds for a runner and for
434+
the named runners (`--runner`).
435+
436+
- On Linux and macOS, `mcpp` is replaced by the program once the build is done.
437+
The program runs with the process id the shell started, and nothing of `mcpp`
438+
remains: a `timeout` or a closed terminal reaches the program directly.
439+
- A program that ends by a signal is seen by the caller as ending by that
440+
signal, as in a direct run: a shell reports `128+n`, and Python's
441+
`subprocess` reports `-n`.
442+
- On Windows, the program runs in the same console and process group, and
443+
`mcpp` returns its exit code.
444+
- A notice concerning the whole command (a `tip:` line, for example an index
445+
that requires a newer mcpp) is printed before the `Running` line, since no
446+
output of `mcpp` follows the program.
447+
448+
```console
449+
$ mcpp run -q
450+
> hello
451+
read: hello
452+
> ^C # the program's SIGINT handler runs
453+
$ echo $?
454+
3 # the status the handler returned
455+
```
456+
429457
## Validating a descriptor before publishing
430458

431459
`mcpp xpkg parse` reads a descriptor with the resolver's own grammar, so what

‎docs/12-binary-distribution.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,10 @@ makes mcpp write an empty `EXPORTS` section. Adding a list on top would export t
390390
same names twice (`LNK4197`) and export everything else besides, replacing a
391391
chosen public surface with all of it. Bitcode's `dllexport` storage class and
392392
linker-option metadata express the same intent. Export intent is checked before
393-
candidate enumeration. The per-target [`auto_export`](04-mcpp-toml.md#auto_export--native-export-control-on-the-msvc-abi-unreleased)
394-
key disables discovery entirely (unreleased source builds).
393+
candidate enumeration. The per-target
394+
[`windows_auto_export`](04-mcpp-toml.md#windows_auto_export--export-discovery-on-the-msvc-abi-mcpp-20261051)
395+
key disables discovery, and [`exports`](04-mcpp-toml.md#exports--the-artifacts-published-symbol-set-mcpp-2026965)
396+
narrows what it finds.
395397

396398
Past 65535 exportable symbols mcpp refuses rather than truncating. A truncated
397399
export table links cleanly and then fails at whichever consumer needed the symbol

‎docs/30-build-mcpp.md‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,10 @@ int main() {
560560
```
561561

562562
The pattern is relative to the manifest directory and uses the same `*` / `**`
563-
grammar as `sources = [...]`. A literal directory prefix can leave the package:
564-
`../inputs/**/*.in` watches a sibling directory, including its creation after
565-
the first build. Output and `.git` directories remain excluded, and directory
566-
symlinks are not followed. Its fingerprint is the **sorted set of matching
563+
grammar as `sources = [...]`, over the same walk: directory symlinks are
564+
followed, a symlink cycle is entered once, and directories named `.git`,
565+
`.mcpp` or `target`, the build's output directory and registered submodules
566+
are not entered (2026.10.5.1+). Its fingerprint is the **sorted set of matching
567567
paths** and nothing else:
568568

569569
- **not contents** — a file whose bytes matter is an ordinary
@@ -572,7 +572,23 @@ paths** and nothing else:
572572
builds and `rsync`, and size is a weaker signal than the hash above.
573573

574574
The build output tree and `.git` are never part of the set, so a wide pattern
575-
cannot make the program re-run forever against its own outputs.
575+
cannot make the program re-run forever against its own outputs. A pattern
576+
whose literal prefix passes through an excluded directory (`target/**/*.in`,
577+
`.git/HEAD`) can never match, and the build states this as a warning naming
578+
the pattern; one file's contents are watched with `rerun_if_changed`.
579+
580+
**Inputs outside the package** (2026.10.5.1+). A pattern may leave the package
581+
when the package is the project, a path dependency or a workspace member:
582+
583+
| Pattern | Watches |
584+
|---|---|
585+
| `../inputs/**/*.in` | a sibling directory, including its creation after the first build |
586+
| `/srv/data/**/*.csv` | an absolute directory, matched against absolute paths |
587+
588+
In a registry or git dependency, a pattern that leaves the package, by `..` or
589+
as an absolute path, is an error naming the package and the pattern. A wide
590+
literal prefix (`../../**`) walks its whole tree on every fast-path check, so a
591+
specific prefix keeps the check short.
576592

577593
**Every declared input is compared on the fast path too** (2026.9.5.4+). A
578594
project whose sources are all older than `build.ninja` takes a fast path that

‎docs/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ token in front of a reader to the chapter that owns it.
118118
| | chapter | | chapter |
119119
|---|---|---|---|
120120
| `[package]`, `[targets.<n>]`, `[build]`, `[lib]` | [04](04-mcpp-toml.md) | `[profile.<n>]`, `[resources]`, `[runtime]` | [04](04-mcpp-toml.md) |
121-
| `[targets.<n>] auto_export` | [04](04-mcpp-toml.md) | `[targets.<n>] exports` | [04](04-mcpp-toml.md) |
121+
| `[targets.<n>] windows_auto_export` | [04](04-mcpp-toml.md) | `[targets.<n>] exports` | [04](04-mcpp-toml.md) |
122122
| `[dependencies]`, `[dev-dependencies]`, `[build-dependencies]` | [05](05-dependencies.md) | `scan_overrides`, `module_extensions` | [04](04-mcpp-toml.md) |
123123
| `[features]`, `[feature-deps.<f>]`, `provides` / `requires` | [06](06-features-and-capabilities.md) | `[workspace]` | [07](07-workspace.md) |
124124
| `[toolchain]`, `cxx_runtime` | [20](20-toolchains.md) | `[target.<sel>]`, `cfg(…)` | [22](22-target-side.md) |

‎docs/specs/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
| [SPEC-001](package-identity.md) | 包身份(`package.namespace` / `package.name`)、`[dependencies]` 选择器与匹配机制 | 评审中 v1.1 | 2026-08-03 | mcpp >= 0.0.106 |
3434
| [SPEC-002](target-side.md) | 目标侧模型与能力声明(`mcpp:` 保留命名空间、五层、三条规则) | 评审中 v1.0 | 2026-08-24 | mcpp >= 2026.8.24.2 |
3535
| [SPEC-003](exit-codes.md) | 退出码契约(分类、语义、稳定性承诺) | 评审中 v1.0 | 2026-09-01 | mcpp >= 2026.9.1.1 |
36-
| [SPEC-004](manifest-semantics.md) | `mcpp.toml` 的平面划分、条件化形状、解析轴与命名规约 | 草案 v1.10 | 2026-09-28 | 条件化形状 mcpp >= 2026.8.29.1;目标轴 mcpp >= 2026.9.6.4;`linkage` 默认值 mcpp >= 2026.9.15.2;链接 flag 的词读法 mcpp >= 2026.9.26.2;条件化的 `dialect_cxxflags` 与 `-p` 的包身份 mcpp >= 2026.9.28.1;条件表按具体程度生效 mcpp >= 2026.9.28.2 |
36+
| [SPEC-004](manifest-semantics.md) | `mcpp.toml` 的平面划分、条件化形状、解析轴与命名规约 | 草案 v1.11 | 2026-10-05 | 条件化形状 mcpp >= 2026.8.29.1;目标轴 mcpp >= 2026.9.6.4;`linkage` 默认值 mcpp >= 2026.9.15.2;链接 flag 的词读法 mcpp >= 2026.9.26.2;条件化的 `dialect_cxxflags` 与 `-p` 的包身份 mcpp >= 2026.9.28.1;条件表按具体程度生效 mcpp >= 2026.9.28.2;平台前缀规约 mcpp >= 2026.10.5.1 |
3737
| [SPEC-005](build-database.md) | 构建数据库:`mcpp emit build-database` 的内容、取值规则与不写工程目录的保证 | 评审中 v1.6 | 2026-09-29 | mcpp >= 2026.9.15.1;v1.3 条款 mcpp >= 2026.9.26.2;v1.4 条款 mcpp >= 2026.9.27.1;v1.5 条款 mcpp >= 2026.9.28.1;v1.6 条款 mcpp >= 2026.9.29.5 |
3838
| [SPEC-006](toolchain-management.md) | 工具链管理:身份、来源、选择与载荷契约 | 草案 v0.6 | 2026-10-02 | 逐条标注;已实现条款 mcpp >= 2026.9.24.1;§3.7 mcpp >= 2026.9.28.1;§3.7.1 mcpp >= 2026.9.28.2;§2.2.1 与 §3.3 的非缺省来源 mcpp >= 2026.10.1.3 |
3939
| [SPEC-007](build-plugins.md) | 构建插件:配置、施工与校验的分工,运行时与规划期的义务 | 草案 v0.6 | 2026-09-28 | 逐条标注;mcpp >= 2026.9.26.2;v0.3 条款 mcpp >= 2026.9.27.1;v0.4 条款 mcpp >= 2026.9.28.1;v0.5 条款 mcpp >= 2026.9.28.2;v0.6(§9)mcpp >= 2026.9.28.3 |
4040
| [SPEC-008](library-interface.md) | 库的接口:公开模块、发布闭包与两种形态的一致 | 草案 v0.1 | 2026-09-28 | 第一阶段(只警告)mcpp >= 2026.9.28.3 |
41-
| [SPEC-009](toolchain-maintenance.md) | 工具链的支持与维护:版本线、默认值、来源、移动与退役 | 草案 v0.1 | 2026-10-02 | 逐条标注;本版只有规范,多数条款未实现 |
41+
| [SPEC-009](toolchain-maintenance.md) | 工具链的支持与维护:版本线、默认值、来源、移动与退役 | 草案 v0.2 | 2026-10-05 | 逐条标注;本版只有规范,多数条款未实现 |
4242

4343
## 文档约定
4444

0 commit comments

Comments
 (0)