#1596

shader_library: parse JSON numbers without floating-point from_chars

Openbobcatchriswants to merge intofrom

BUILD-464: the runtime does not build on macOS with Xcode Command Line Tools 17 because runtime/src/shader_library.h calls the floating-point std::from_chars overload, which Apple's libc++ does not provide.

This keeps the JSON reader portable by parsing the already-delimited number token with std::strtod, then rejecting a partial parse or ERANGE. Existing behavior for malformed and out-of-range values is covered by shader_library_test ([-], [1e999], [1.2.3]).

Verification on Windows/MSVC 19.39:

cmake --build runtime/build --target shader_library_test
ctest --test-dir runtime/build -R ^shader_library$ --output-on-failure   # 1/1 passed
runtime/build/shader_library_test.exe                                    # OK

The macOS compile itself still needs a run on an Apple toolchain; this change removes the unavailable overload. No game files.

AI-assisted.

Activity

2
bobcatchris1h ago

Apple toolchain validation requested in the PR body: tested c96a3427f890ab9ba5e852651970a4df6dfa7709 on Apple M2 (Mac14,3), macOS 26.4 (25E246), AppleClang 17.0.0.17000013 / Xcode Command Line Tools SDK (default compiler, no Homebrew clang and no bundled libc++ flags).

  • cmake -S runtime -B runtime/build/linux -DVulkan_INCLUDE_DIR=/opt/homebrew/include and cmake --build runtime/build/linux --parallel: clean full build, exit 0, every target built. On current main with the same default toolchain the build fails at shader_library_test with runtime/src/shader_library.h:391:35: error: call to deleted function 'from_chars'.
  • ctest --test-dir runtime/build/linux -R '^shader_library$' --output-on-failure: 1/1 passed (0.15 s). Direct runtime/build/linux/shader_library_test: "SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction and index lookup OK", exit 0.
  • Full CPU suite ctest --test-dir runtime/build/linux --output-on-failure: 26/26 passed in 5.92 s.

Negative control is the unpatched main at 99f99890 / 41f44826 on this same Mac, which fails to build at the deleted from_chars overload; with this head it builds. No game files; synthetic tests and counts only. No code changes by me; PR head fetched read-only into a separate worktree.

AI-assisted.