|
| 1 | +#!/usr/bin/env bash |
| 2 | +# macOS 27: why libc++ 22's std.cppm loses INFINITY/NAN. One READING per fact. |
| 3 | +set +e |
| 4 | +r() { echo "READING $*"; } |
| 5 | +r "os $(sw_vers -productVersion) $(sw_vers -buildVersion) xcode=$(xcodebuild -version | tr '\n' ' ')" |
| 6 | +r "xcrun sdk=$(xcrun --show-sdk-path) ver=$(xcrun --show-sdk-version)" |
| 7 | +CLT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk |
| 8 | +r "clt sdk link=$(readlink $CLT) exists=$([ -d $CLT ] && echo y || echo n) settings=$(plutil -extract Version raw $CLT/SDKSettings.plist 2>/dev/null)" |
| 9 | +ls -la /Library/Developer/CommandLineTools/SDKs/ 2>&1 | sed 's/^/READING clt-sdks /' |
| 10 | +XSDK=$(xcrun --show-sdk-path) |
| 11 | +for s in $CLT $XSDK; do |
| 12 | + r "math.h in $s: INFINITY defs: $(grep -rn 'define[[:space:]]*INFINITY' $s/usr/include/math.h $s/usr/include/_math.h $s/usr/include/math 2>/dev/null | head -3 | tr '\n' ' ')" |
| 13 | + r "math.h head in $s: $(grep -n 'include\|__MATH' $s/usr/include/math.h 2>/dev/null | head -12 | tr '\n' ' ')" |
| 14 | +done |
| 15 | +# xlings llvm |
| 16 | +curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s v2026.9.16.1 >/dev/null 2>&1 |
| 17 | +export PATH="$HOME/.xlings/subos/current/bin:$PATH" |
| 18 | +xlings install llvm@22.1.8 -y >/dev/null 2>&1 |
| 19 | +L=$(ls -d $HOME/.xlings/data/xpkgs/xim-x-llvm/22.1.8) |
| 20 | +r "llvm cfg: $(cat $L/bin/clang++.cfg | tr '\n' ' ')" |
| 21 | +S=$L/share/libc++/v1/std.cppm |
| 22 | +W=$(mktemp -d); cd $W |
| 23 | +try() { name=$1; shift; out=$("$@" 2>&1); rc=$?; r "$name rc=$rc $(printf '%s' "$out" | grep -m2 'error' | tr '\n' ' ')"; } |
| 24 | +try cfg-clt $L/bin/clang++ -std=c++23 -Wno-reserved-module-identifier --precompile $S -o a.pcm |
| 25 | +try isysroot-xc $L/bin/clang++ -std=c++23 -Wno-reserved-module-identifier --precompile $S -o b.pcm --sysroot=$XSDK |
| 26 | +try no-cfg-xc $L/bin/clang++ --no-default-config -std=c++23 -nostdinc++ -isystem $L/include/c++/v1 -isysroot $XSDK -Wno-reserved-module-identifier --precompile $S -o c.pcm |
| 27 | +printf '#include <cmath>\n#ifndef INFINITY\n#error no INFINITY after cmath\n#endif\n#include <complex>\nint main(){}\n' > t.cpp |
| 28 | +try hdr-clt $L/bin/clang++ -std=c++23 -fsyntax-only t.cpp |
| 29 | +try hdr-xc $L/bin/clang++ -std=c++23 -fsyntax-only t.cpp --sysroot=$XSDK |
| 30 | +printf '#include <math.h>\n#ifndef INFINITY\n#error no INFINITY after math.h\n#endif\nint main(){}\n' > m.c |
| 31 | +try c-math-clt $L/bin/clang -fsyntax-only m.c |
| 32 | +try c-math-apple /usr/bin/clang -fsyntax-only m.c |
| 33 | +try cxx-apple /usr/bin/clang++ -std=c++23 -fsyntax-only t.cpp |
| 34 | +$L/bin/clang++ -std=c++23 -E -dD t.cpp 2>/dev/null | grep -n 'INFINITY\|# 1 ".*math' | head -10 | sed 's/^/READING pp-clt /' |
| 35 | +$L/bin/clang++ -std=c++23 -H -fsyntax-only t.cpp 2>&1 | grep -i 'math' | head -12 | sed 's/^/READING includes-clt /' |
| 36 | +# the released mcpp |
| 37 | +xlings install mcpp@2026.9.16.2 -y >/dev/null 2>&1 |
| 38 | +M=$(ls $HOME/.xlings/data/xpkgs/xim-x-mcpp/2026.9.16.2/bin/mcpp) |
| 39 | +cd $(mktemp -d); "$M" new h >/dev/null 2>&1; cd h |
| 40 | +out=$("$M" run 2>&1); rc=$? |
| 41 | +r "mcpp-2026.9.16.2 new+run rc=$rc $(printf '%s' "$out" | grep -m3 -E 'error|Hello|sysroot' | tr '\n' ' ')" |
| 42 | +exit 0 |
0 commit comments