|
19 | 19 | // Linux posix / arch-default the default triple already satisfies it |
20 | 20 | // macOS posix / arch-default the default triple already satisfies it |
21 | 21 | // Windows posix / arch-default Cygwin-flavoured: `--target=x86_64-pc-cygwin`, |
22 | | -// `-U__CYGWIN__ -U__CYGWIN32__` (those interfaces |
23 | | -// are not in the graph) |
| 22 | +// `__CYGWIN__`/`__CYGWIN32__` STAY DEFINED (see |
| 23 | +// the note below the table — this is a design |
| 24 | +// revision, not the original §3.3 text) |
24 | 25 | // * builtins = iso turn off the platform-C-library idioms the |
25 | 26 | // code generator assumes (§3.2.1) — Apple's |
26 | 27 | // `memset_pattern16` is the one measured case |
|
43 | 44 | // same Win64 argument placement — so an object compiled under the Cygwin |
44 | 45 | // identity links exactly like one compiled under the MinGW one. Only the |
45 | 46 | // preprocessor saw a different environment; the linker never has to know. |
| 47 | +// |
| 48 | +// `__CYGWIN__`/`__CYGWIN32__` ARE NOT REMOVED, AND THE FIRST VERSION OF THIS |
| 49 | +// MODULE GOT THAT WRONG. §3.3's original text called for `-U__CYGWIN__ |
| 50 | +// -U__CYGWIN32__` on the reasoning that a real Cygwin userland is not in the |
| 51 | +// graph. A first reading of the openkal-musl spike's libunwind build failure |
| 52 | +// blamed a missing `__CYGWIN__` branch in libunwind itself; reading the |
| 53 | +// vendored source shows that is wrong — upstream libunwind has no such |
| 54 | +// branch, so defining it there would have changed nothing (the actual break |
| 55 | +// was a downstream package selecting on `_WIN32` and is being fixed there). |
| 56 | +// The reason to keep them defined is narrower and still real: third-party |
| 57 | +// portable code that has to know the OBJECT FORMAT — as opposed to which C |
| 58 | +// environment or which platform API — has no name for "PE format with a |
| 59 | +// POSIX-presenting C environment" other than `__CYGWIN__`, and such code |
| 60 | +// cannot be patched the way this ecosystem's own packages can. The cost is |
| 61 | +// symmetric: a library that reaches for `__CYGWIN__` may also reach for a |
| 62 | +// real Cygwin interface (`sys/cygwin.h`, `cygwin_conv_path`) that does not |
| 63 | +// exist here. This is a TRADE-OFF for the 30-member measurement to settle — |
| 64 | +// if defining it produces more new failures than it fixes, the answer flips |
| 65 | +// — not a fact this module is asserting as closed. |
46 | 66 | export module mcpp.toolchain.cenv; |
47 | 67 |
|
48 | 68 | import std; |
@@ -203,18 +223,16 @@ inline std::expected<Realisation, std::string> realise( |
203 | 223 | "on x86_64 only; this arch has no verified " |
204 | 224 | "substitute triple"); |
205 | 225 | // `--target=x86_64-pc-cygwin`, on the COMPILE line only (module |
206 | | - // header above). `-U__CYGWIN__`/`-U__CYGWIN32__`: the Cygwin |
207 | | - // triple predefines them, and they are not withheld by the |
208 | | - // identity switch itself — they name a real Cygwin userland |
209 | | - // (`sys/cygwin.h`, `cygwin_conv_path`) that is not in this |
210 | | - // graph, so a library probing for them would be steered toward |
211 | | - // an interface openkal-musl does not implement (design §3.3). |
| 226 | + // header above). `__CYGWIN__`/`__CYGWIN32__` are LEFT AS THE |
| 227 | + // TRIPLE SUBSTITUTION DEFINES THEM — not undefined (see the |
| 228 | + // module header's note: portable third-party code that needs to |
| 229 | + // know the object format has no other name for "PE format, |
| 230 | + // POSIX-presenting environment", and this is a trade-off for the |
| 231 | + // 30-member measurement, not a settled fact). |
212 | 232 | r.tokens.push_back("--target=x86_64-pc-cygwin"); |
213 | | - r.tokens.push_back("-U__CYGWIN__"); |
214 | | - r.tokens.push_back("-U__CYGWIN32__"); |
215 | 233 | r.expectDefined.push_back("__unix__"); |
| 234 | + r.expectDefined.push_back("__CYGWIN__"); |
216 | 235 | r.expectUndefined.push_back("_WIN32"); |
217 | | - r.expectUndefined.push_back("__CYGWIN__"); |
218 | 236 | cygwinIdentity = true; |
219 | 237 | } else if (decl.presents == CAbiPresents::Windows) { |
220 | 238 | // Already the base triple's own identity — nothing to add. |
|
0 commit comments