Skip to content

the target is named by mcpp, not borrowed from Cygwin - #41

Merged
Sunrisepeak merged 3 commits into
mainfrom
the-target-is-named-by-mcpp-not-borrowed
Sep 20, 2026
Merged

Sunrisepeak merged 3 commits into
mainfrom
the-target-is-named-by-mcpp-not-borrowed

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What changes

port/include/bits/setjmp.h sizes jmp_buf by whether the target is Windows — that decides the calling convention, and so the size of the register save area. It asked __CYGWIN__.

That name answered correctly only by accident. mcpp kept it defined because nothing else named the target, while upstream code reads it as "Win32 is available" — a 30-member measurement found four packages doing exactly that and reaching #include <windows.h>. A borrowed name means what the lender history made it mean.

mcpp 2026.9.21.1 states the fact under its own name, __mcpp_target_<os>__, for every target. This header now reads that first and still accepts __CYGWIN__, so it is correct on an engine from either side of that release. The second operand exists so this file has no flag day, not for redundancy, and goes once the withdrawal ships.

Verified by a criterion that fails on the old header

A translation unit asserting sizeof(jmp_buf) >= 32 * sizeof(unsigned long long), built for x86_64-windows-gnu with -U__CYGWIN__ -U__CYGWIN32__ to simulate the withdrawal:

graph result
published openkal-musl 0.18.0 static assertion failed: bits/setjmp.h did not take the Windows branch
this branch passes

The failing side is the point, and it is the silent kind. The old header falls to #include_next and produces a SHORT record — which this file own comment describes as "a mismatch nothing reports until the record overruns". An earlier run of the same simulation without the assertion reported success, because a short jmp_buf compiles and links perfectly well.

Sequence

  1. mcpp 2026.9.21.1 defines __mcpp_target_<os>__ (additive)
  2. this change — read it, keep accepting the old name
  3. a later mcpp release stops defining __CYGWIN__

Step 3 taken first would leave every published copy of this header falling to its #else.

`bits/setjmp.h` sizes `jmp_buf` by whether the target is Windows, because
that decides the calling convention. It asked `__CYGWIN__`, which answered
correctly only by accident: mcpp kept that name defined because nothing else
named the target, while upstream code reads it as "Win32 is available" --- a
30-member measurement found four packages doing exactly that and reaching
`#include <windows.h>`. A BORROWED NAME MEANS WHAT THE LENDER'S HISTORY MADE
IT MEAN.

mcpp 2026.9.21.1 states the fact under its own name,
`__mcpp_target_<os>__`, for every target. This header reads that first and
still accepts `__CYGWIN__`, so it is correct on an engine from either side of
that release --- the new name is absent before it, the old one is withdrawn
after a later one. The second operand is there so this file has no flag day,
not for redundancy, and goes once the withdrawal ships.

VERIFIED BY A CRITERION THAT FAILS ON THE OLD HEADER. A translation unit
asserting `sizeof(jmp_buf) >= 32 * sizeof(unsigned long long)`, built for
`x86_64-windows-gnu` with `-U__CYGWIN__ -U__CYGWIN32__` to simulate the
withdrawal:

    published 0.18.0   static assertion failed: did not take the Windows branch
    this branch        passes

The failing side is what this change is for, and it is the silent kind: the
old header falls to `#include_next` and produces a SHORT record, which this
file's own comment describes as "a mismatch nothing reports until the record
overruns". An earlier run of the same simulation without the assertion
reported success, because a short `jmp_buf` compiles and links perfectly well.
The header change in this branch is what the version names: `bits/setjmp.h`
reads mcpp's own name for the target and still accepts the borrowed one, so
that a later mcpp release may withdraw `__CYGWIN__` without this package
falling silently to a shorter record.

Backward compatible in both directions by construction. On the engine
published today the new name is absent and the old operand answers; on
2026.9.21.1 both are present. Neither ordering of the two releases breaks a
build, which is the property the three-step sequence exists to hold.
Project-owned macros are upper case --- `NDEBUG` and every other one are ---
while lower case belongs to the compiler's own predefines (`__linux__`), which
mcpp supplies but does not own. 2026.9.21.1 spelt it lower; the release that
withdraws `__CYGWIN__` renames it in the same change, so this header is
written against the spelling it will keep.

THE LOWER-CASE NAME IS NOT READ HERE AND DOES NOT NEED TO BE. It existed for
one release and nothing consumed it. Two operands cover every engine: one up
to and including 2026.9.21.1 defines `__CYGWIN__`, and the one that withdraws
it defines `__MCPP_TARGET_WINDOWS__`. No engine defines neither, so this
header has no flag day and the two releases may land in either order --- which
is the point of the second operand, not redundancy. It goes once the
withdrawal has shipped.
@Sunrisepeak
Sunrisepeak merged commit 8319956 into main Sep 20, 2026
10 checks passed
@Sunrisepeak
Sunrisepeak deleted the the-target-is-named-by-mcpp-not-borrowed branch September 20, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant