Skip to content

SERVER-122483 Add std::to_chars compatibility for macOS < 10.15#6

Merged
aditya8061 merged 1 commit intospidermonkey-esr140.7-cpp-onlyfrom
aditya.deshpande/SERVER-122483
Mar 24, 2026
Merged

SERVER-122483 Add std::to_chars compatibility for macOS < 10.15#6
aditya8061 merged 1 commit intospidermonkey-esr140.7-cpp-onlyfrom
aditya.deshpande/SERVER-122483

Conversation

@aditya8061
Copy link
Copy Markdown
Collaborator

@aditya8061 aditya8061 commented Mar 24, 2026

Apple's libc++ marks std::to_chars as unavailable when the deployment target is below macOS 10.15. Backport branches (e.g. v7.0) that target older macOS versions fail to compile after the MozJS upgrade.

This PR includes below changes:

  • Add MONGO_MOZJS_TO_CHARS compat macro in js/src/util/ToCharsCompat.h
  • On macOS >= 10.15 / non-Apple: delegates to std::to_chars with assertion wrapper (no behavioral change)
  • On macOS < 10.15: portable fallback using the same backfill-from-end digit extraction algorithm SpiderMonkey used prior to adopting std::to_chars (see old Int32ToCStringWithBase in jsnum.cpp before ESR 140), adapted to be self-contained without mozilla::RangedPtr/mozilla::Abs dependencies
  • Replaces 10 std::to_chars call sites across 4 files (jsnum.cpp, JSAtomUtils.cpp, BigIntType.cpp, TypedArrayObject.cpp)

@aditya8061 aditya8061 force-pushed the aditya.deshpande/SERVER-122483 branch from 610a8fc to 4a2ef8c Compare March 24, 2026 07:23
@aditya8061 aditya8061 merged commit 138afb8 into spidermonkey-esr140.7-cpp-only Mar 24, 2026
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.

2 participants