@@ -51,6 +51,18 @@ echo " .. this host resolves c-abi = '$CABI'"
5151NOTCABI=" not-${CABI} "
5252
5353# ── (1) + (2) a matching layer predicate applies; a non-matching one does not ──
54+ #
55+ # ⚠️ THE TRIPLE HALF OF THE COMBINED PREDICATE IS any(unix, windows), NOT unix.
56+ # The point of that leg is that a triple key and a layer key COMBINE, so its
57+ # triple half has to be true everywhere this test runs. Written as bare unix it
58+ # was true on Linux and macOS and false on Windows, where all(...) then
59+ # correctly evaluated false and the fixture's #error fired. CI caught it; the
60+ # feature was right and the test was not.
61+ #
62+ # ⚠️ AND THESE NOTES LIVE OUTSIDE THE HEREDOCS. The fixtures below interpolate
63+ # $CABI, so their heredocs are unquoted — which makes backticks in a comment
64+ # command substitution. The first version of this note sat inside one and the
65+ # suite printed `syntax error: unexpected end of file` while still passing.
5466mkdir -p layers/src
5567cat > layers/mcpp.toml << EOF
5668[package]
@@ -63,7 +75,7 @@ defines = ["PROBE_MATCHED=1"]
6375[target.'cfg(c-abi = "$NOTCABI ")'.build]
6476defines = ["PROBE_MUST_NOT_APPLY=1"]
6577
66- [target.'cfg(all(unix, c-abi = "$CABI "))'.build]
78+ [target.'cfg(all(any( unix, windows) , c-abi = "$CABI "))'.build]
6779defines = ["PROBE_COMBINED=1"]
6880EOF
6981cat > layers/src/main.cpp << 'EOF '
@@ -93,13 +105,14 @@ cat > once/mcpp.toml <<EOF
93105name = "once"
94106version = "0.1.0"
95107
96- [target.'cfg(any(unix, c-abi = "$CABI "))'.build]
108+ [target.'cfg(any(unix, windows, c-abi = "$CABI "))'.build]
97109defines = ["PROBE_ONCE=1"]
98110EOF
99111echo ' int main() { return 0; }' > once/src/main.cpp
100112( cd once && " $MCPP " build > b.log 2>&1 ) || {
101113 cat once/b.log; echo " FAIL: the mixed-predicate build errored" ; exit 1; }
102- n=$( grep -o ' \-DPROBE_ONCE=1' once/compile_commands.json | wc -l | tr -d ' ' )
114+ # Both spellings: a Windows self-host may drive MSVC, which takes `/D`.
115+ n=$( grep -oE ' [-/]DPROBE_ONCE=1' once/compile_commands.json | wc -l | tr -d ' ' )
103116[ " $n " -eq 1 ] || {
104117 echo " FAIL: a predicate with both a triple leg and a layer leg contributed $n times, expected 1"
105118 grep -o ' \-DPROBE_ONCE=1' once/compile_commands.json
0 commit comments