Commit ce8ff94
committed
fix(modgraph): partition import resolves to base module, not own partition
When a module-interface unit imports a sibling partition with `import :foo`,
the scanner prepended its own `provides->logicalName` as-is. For a primary
interface (`export module M;` → logicalName "M") that's correct: "M:foo".
But for a *partition* unit (`export module M:bar;` → logicalName "M:bar")
the same code produced "M:bar:foo" — which no other TU provides, so GCC's
dyndep step prints a benign-but-noisy
warning: <file>: module 'M:bar:foo' imported but not provided in this build
(the build itself still succeeds because GCC resolves the import via its
own scan; mcpp's warning comes from comparing scanner output to the
producer map).
Fix: strip our own `:partition` suffix from the base before prepending.
before: M:bar + ":foo" → "M:bar:foo" (wrong)
after: "M" + ":foo" → "M:foo" (correct sibling)
Reproduced under mcpplibs/tinyhttps where `http.cppm`'s
`export module mcpplibs.tinyhttps:http;` plus its `import :tls; import
:socket;` etc. produced 7 stale "imported but not provided" warnings on
every build. After this patch, `mcpp build` of tinyhttps is
warning-free.
Coverage: three new unit tests in `test_modgraph.cpp`:
- `Scanner.PartitionImportFromPrimaryInterface` (regression guard
for the working case)
- `Scanner.PartitionImportFromAnotherPartition` (the actual bug)
- `Scanner.PartitionImportWithDottedModuleName` (xpkg-style names)1 parent 6d40b97 commit ce8ff94
2 files changed
Lines changed: 58 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
290 | 295 | | |
291 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
292 | 301 | | |
293 | 302 | | |
294 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
47 | 94 | | |
48 | 95 | | |
49 | 96 | | |
| |||
0 commit comments