Skip to content

[bug] 模块 purview 内文本 #include 改动不触发重编(stale build;gen_exports/*.inc 模式) #235

Description

@Sunrisepeak

现象

模块 purview 内的文本 #include(如生成的导出清单 .inc)被修改后,mcpp build 判定 up-to-date(0.01s),产物 stale —— 依赖扫描没有把 purview 文本包含计入模块 TU 的输入。

最小复现(mcpp 0.0.95,linux-x86_64)

repro/
├── mcpp.toml            # kind="bin", main="src/main.cpp"
├── src/vals.inc         # export inline int answer() { return 41; }
├── src/m.cppm           # export module m;
│                        # #include "vals.inc"
└── src/main.cpp         # import m; printf("%d", answer());
$ mcpp run
41
$ sed -i 's/41/42/' src/vals.inc
$ mcpp run
41        # ← stale;期望 42(且构建输出 Finished in 0.01s,未重编 m.cppm)

真实场景

ffmpeg-m / opencv-m 的模块层把生成的 export using 清单放在
src/gen_exports/<mod>.inc,由模块接口文件在 purview 内 #include
(ffmpeg-m 978 函数、opencv-m ~2000 名字的导出面都走这个模式)。重新生成
清单后 mcpp build 不重编,拿到旧导出面 —— 开发期极易踩(需手动 touch
.cppm 或清 target)。

GMF(module; 段)里的 #include 是否同样漏跟踪未单独验证;修复时建议
两处一并覆盖(gcc 的 -MD 依赖输出/.ddi 应该都已含这些路径,疑似是
扫描结果没被并入 ninja 依赖边)。

期望

模块 TU 的任何文本包含(GMF 与 purview)都参与 up-to-date 判定。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions