|
| 1 | +#!/usr/bin/env bash |
| 2 | +# TEMPORARY PROBE (do not merge): `import std` on i686-windows-msvc with |
| 3 | +# clang 23.1.3 and 22.1.8, mcpp built from the #781 head. Answers G1/G2 of |
| 4 | +# .agents/reviews/2026-10-08-llvm-2313-part3-review-fixes-and-x86-msvc-coroutines-design.md. |
| 5 | +# Prints; asserts nothing. |
| 6 | +set -u |
| 7 | +M="${MCPP_BUILT:?}" |
| 8 | +W="$RUNNER_TEMP/x86-msvc-std"; mkdir -p "$W" |
| 9 | +"$M" --version |
| 10 | + |
| 11 | +# case <name> <target> <standard> <toolchain-table> <source-kind> |
| 12 | +case_run() { |
| 13 | + local name=$1 target=$2 std=$3 tc=$4 src=$5 |
| 14 | + local d="$W/$name"; rm -rf "$d"; mkdir -p "$d/src"; cd "$d" |
| 15 | + printf '[package]\nname = "p"\nversion = "0.1.0"\nstandard = "%s"\n\n%s\n' "$std" "$tc" > mcpp.toml |
| 16 | + case "$src" in |
| 17 | + std) printf 'import std;\nint main() { std::println("std ok {}", sizeof(void*)); }\n' > src/main.cpp ;; |
| 18 | + compat) printf 'import std.compat;\nint main() { std::printf("compat ok %%zu\\n", sizeof(void*)); }\n' > src/main.cpp ;; |
| 19 | + std20) printf 'import std;\nint main() { std::cout << "std ok " << sizeof(void*) << "\\n"; }\n' > src/main.cpp ;; |
| 20 | + coro) printf '#include <coroutine>\nstruct t { struct promise_type { t get_return_object() { return {}; } std::suspend_never initial_suspend() noexcept { return {}; } std::suspend_never final_suspend() noexcept { return {}; } void return_void() {} void unhandled_exception() {} }; };\nt f() { co_return; }\nint main() { f(); }\n' > src/main.cpp ;; |
| 21 | + esac |
| 22 | + echo; echo "################ $name target=$target standard=$std src=$src" |
| 23 | + echo "--- mcpp.toml"; cat mcpp.toml |
| 24 | + echo "--- build" |
| 25 | + "$M" build --verbose --target "$target" > build.log 2>&1; local rc=$? |
| 26 | + cat build.log; echo "build rc=$rc" |
| 27 | + echo "--- lines naming generator / coroutine / __cpp_impl_coroutine:" |
| 28 | + grep -nE 'generator|coroutine|__cpp_impl_coroutine' build.log | head -30 |
| 29 | + if [ $rc -eq 0 ]; then |
| 30 | + local exe; exe=$(find target -type f -name 'p.exe' | head -1) |
| 31 | + echo "--- run $exe"; "$exe"; echo "run rc=$?" |
| 32 | + command -v file >/dev/null && file "$exe" |
| 33 | + fi |
| 34 | +} |
| 35 | + |
| 36 | +T23='[toolchain] |
| 37 | +windows = "llvm@23.1.3"' |
| 38 | +T22i='[toolchain] |
| 39 | +windows = "llvm@23.1.3" |
| 40 | +
|
| 41 | +[target.i686-windows-msvc] |
| 42 | +toolchain = "llvm@22.1.8"' |
| 43 | +T22x='[toolchain] |
| 44 | +windows = "llvm@23.1.3" |
| 45 | +
|
| 46 | +[target.x86-windows-msvc] |
| 47 | +toolchain = "llvm@22.1.8"' |
| 48 | + |
| 49 | +# G1: the reported failure, and what the compiler says where. |
| 50 | +case_run g1-23-cxx23-i686 i686-windows-msvc c++23 "$T23" std |
| 51 | +# G2: C++20 on the same compiler and target. |
| 52 | +case_run g2-23-cxx20-i686 i686-windows-msvc c++20 "$T23" std20 |
| 53 | +case_run g2-23-cxx20-i686-compat i686-windows-msvc c++20 "$T23" compat |
| 54 | +# Using the coroutine library itself under C++20 (expected to be refused by the |
| 55 | +# STL or the compiler; recorded for the documentation). |
| 56 | +case_run g2-23-cxx20-i686-coro i686-windows-msvc c++20 "$T23" coro |
| 57 | +# Option (b): llvm 22.1.8 for this target only, in the spelling the note uses |
| 58 | +# and in MSVC's x86 spelling. |
| 59 | +case_run g1b-22-cxx23-i686 i686-windows-msvc c++23 "$T22i" std |
| 60 | +case_run g1b-22-cxx23-x86 x86-windows-msvc c++23 "$T22x" std |
| 61 | +# G3: the 64-bit row is unaffected. |
| 62 | +case_run g3-23-cxx23-x64 x86_64-windows-msvc c++23 "$T23" std |
0 commit comments