Commit 3361902
committed
modules: the protocol wrappers cross the boundary, via the purview
clang rejected the first attempt and was right:
error: using declaration referring to 'wl_surface_attach' with internal
linkage cannot be exported
wayland-scanner emits the protocol wrappers `static inline`, and C++ forbids
exporting an entity with internal linkage. GCC accepted it, which is why the
first green was meaningless — mcpp-index's llvm leg caught it.
Same-name forwarders in module purview do not work either (they clash with the
global-module declarations), and neither does giving them external linkage while
the originals are still visible. What does work is not declaring the originals
at all in this translation unit: the global module fragment includes only
wayland-<side>-core.h, and a copy of the generated protocol header with
`static inline` -> `inline` is included INSIDE the module purview. Every
declaration in it is inside `extern "C"`, so it keeps C language linkage, is
not attached to the module, and still matches wayland-protocol.c's definitions.
What still cannot cross is now exact rather than approximate: the `static
inline` helpers in the GMF headers themselves — wl_fixed_* (4) and wl_signal_*
(5). A consumer needing those includes the header next to the import, which the
README states.
Both toolchains build all four members, and CI re-runs the generator and diffs
so the wrappers cannot drift from the headers.1 parent 327e511 commit 3361902
7 files changed
Lines changed: 13360 additions & 479 deletions
File tree
- .github/workflows
- mcpp
- client/src
- generated
- server/src
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
133 | 145 | | |
134 | 146 | | |
135 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
28 | 48 | | |
29 | 49 | | |
30 | 50 | | |
| |||
0 commit comments