From 3d5c59f2c9e6b1885f6496c2e9c68414a4941366 Mon Sep 17 00:00:00 2001 From: Itms Date: Wed, 3 Sep 2025 12:03:19 +0200 Subject: [PATCH] Update SpiderMonkey to ESR 140.1 --- .../jenkins/dockerfiles/debian-12.Dockerfile | 6 +- build/premake/extern_libs5.lua | 12 +- build/premake/premake5.lua | 4 +- libraries/source/spidermonkey/build.sh | 20 +- .../patches/FixExtraGCTracing.diff | 38 - .../spidermonkey/patches/FixLibNames.diff | 34 +- .../StashVendoredLibfmt-FixIncludes.patch | 26 + .../patches/StashVendoredLibfmt.patch | 7626 +++++++++++++++++ .../SuppressDanglingPointerWarning.patch | 46 - .../source/spidermonkey/patches/patch.sh | 17 +- 10 files changed, 7707 insertions(+), 122 deletions(-) delete mode 100644 libraries/source/spidermonkey/patches/FixExtraGCTracing.diff create mode 100644 libraries/source/spidermonkey/patches/StashVendoredLibfmt-FixIncludes.patch create mode 100644 libraries/source/spidermonkey/patches/StashVendoredLibfmt.patch delete mode 100644 libraries/source/spidermonkey/patches/SuppressDanglingPointerWarning.patch diff --git a/build/jenkins/dockerfiles/debian-12.Dockerfile b/build/jenkins/dockerfiles/debian-12.Dockerfile index 97eeb8561d..0d50253b42 100644 --- a/build/jenkins/dockerfiles/debian-12.Dockerfile +++ b/build/jenkins/dockerfiles/debian-12.Dockerfile @@ -51,12 +51,12 @@ RUN apt-get -qqy update \ zlib1g-dev \ && apt-get clean -# Install rust and Cargo via rustup, available in Debian12 1.63, need 1.76 +# Install rust and Cargo via rustup, available in Debian12 1.63, need 1.82 ENV RUSTUP_HOME=/usr/local/rust ENV CARGO_HOME=/usr/local/rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.76.0 -y +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.82.0 -y # Install cbindgen for building SpiderMonkey -RUN /usr/local/rust/bin/cargo install --locked cbindgen@0.29.0 +RUN /usr/local/rust/bin/cargo install --locked cbindgen@0.29.4 ENV PATH="${RUSTUP_HOME}/bin:${PATH}" ENV SHELL=/bin/bash diff --git a/build/premake/extern_libs5.lua b/build/premake/extern_libs5.lua index e99a37a961..b0e0c20530 100644 --- a/build/premake/extern_libs5.lua +++ b/build/premake/extern_libs5.lua @@ -660,7 +660,7 @@ extern_lib_defs = { if _OPTIONS["with-system-mozjs"] then if not _OPTIONS["android"] then - pkgconfig.add_includes_after("mozjs-128") + pkgconfig.add_includes_after("mozjs-140") end else filter "Debug" @@ -674,17 +674,17 @@ extern_lib_defs = { link_settings = function() if _OPTIONS["with-system-mozjs"] then if _OPTIONS["android"] then - links { "mozjs-128" } + links { "mozjs-140" } else - pkgconfig.add_links("mozjs-128") + pkgconfig.add_links("mozjs-140") end else filter { "Debug" } - links { "mozjs128-debug" } + links { "mozjs-140-debug" } filter { "Release" } - links { "mozjs128-release" } + links { "mozjs-140-release" } filter { } - links { "mozjs128-rust" } + links { "mozjs-140-rust" } add_source_lib_paths("spidermonkey") end end, diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index ce78240a44..065fe86dc9 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -51,7 +51,7 @@ newoption { category = "Pyrogenesis", trigger = "strip-binaries", description = newoption { category = "Pyrogenesis", trigger = "with-system-cpp-httplib", description = "Search standard paths for cpp-httplib, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-cxxtest", description = "Search standard paths for cxxtest, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-lto", description = "Enable Link Time Optimization (LTO)" } -newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs128, instead of using bundled copy" } +newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs140, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" } newoption { category = "Pyrogenesis", trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } @@ -170,7 +170,7 @@ end -- The pc file doesn't specify the required -DDEBUG needed in that case local mozjs_is_debug_build = false if _OPTIONS["with-system-mozjs"] then - local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-128 --cflags) ./tests/mozdebug.c -o /dev/null") + local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-140 --cflags) ./tests/mozdebug.c -o /dev/null") if errorCode ~= 0 then mozjs_is_debug_build = true end diff --git a/libraries/source/spidermonkey/build.sh b/libraries/source/spidermonkey/build.sh index 8e00a4214a..2bcfc383dc 100755 --- a/libraries/source/spidermonkey/build.sh +++ b/libraries/source/spidermonkey/build.sh @@ -6,11 +6,11 @@ set -e cd "$(dirname "$0")" # This should match the version in config/milestone.txt -PV=128.13.0 +PV=140.13.0 FOLDER="mozjs-${PV}" # If same-version changes are needed, increment this. -LIB_VERSION="${PV}+wfg5" -LIB_NAME="mozjs128" +LIB_VERSION="${PV}+wfg0" +LIB_NAME="mozjs-140" build_archive() { @@ -196,6 +196,20 @@ else fi fi +# Bug #1987410 +# SpiderMonkey vendors a patched fmtlib, and it copies it to include dirs, so we have to rename it +# to not have it conflicting with the regular fmtlib +( + cd "${FOLDER}"/build-debug/dist/include + mv fmt/ mozfmt/ + patch -p1 <../../../../patches/StashVendoredLibfmt-FixIncludes.patch +) +( + cd "${FOLDER}"/build-release/dist/include + mv fmt/ mozfmt/ + patch -p1 <../../../../patches/StashVendoredLibfmt-FixIncludes.patch +) + if [ "${OS}" = "Windows_NT" ]; then # Bug #776126 # SpiderMonkey uses a tweaked zlib when building, and it wrongly copies its own files to include dirs diff --git a/libraries/source/spidermonkey/patches/FixExtraGCTracing.diff b/libraries/source/spidermonkey/patches/FixExtraGCTracing.diff deleted file mode 100644 index 3b3b683b96..0000000000 --- a/libraries/source/spidermonkey/patches/FixExtraGCTracing.diff +++ /dev/null @@ -1,38 +0,0 @@ - -# HG changeset patch -# User Itms -# Date 1754863729 0 -# Node ID 45a4336df6a83fbb6a448fe5ec14b703b38313d9 -# Parent 1ecdcb55f42515c6542d4f9d4580899d55a6a790 -Bug 1982134 - Choose specific callback in removeBlackRootsTracer. a=RyanVM - -This fixes a regression introduced in the refactoring at Bug 1846835 / D185307 - -Original Revision: https://phabricator.services.mozilla.com/D260541 - -Differential Revision: https://phabricator.services.mozilla.com/D260608 - - -diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp ---- a/js/src/gc/GC.cpp -+++ b/js/src/gc/GC.cpp -@@ -1559,17 +1559,17 @@ static bool EraseCallback(CallbackVector - - bool GCRuntime::addBlackRootsTracer(JSTraceDataOp traceOp, void* data) { - AssertHeapIsIdle(); - return blackRootTracers.ref().append(Callback(traceOp, data)); - } - - void GCRuntime::removeBlackRootsTracer(JSTraceDataOp traceOp, void* data) { - // Can be called from finalizers -- MOZ_ALWAYS_TRUE(EraseCallback(blackRootTracers.ref(), traceOp)); -+ MOZ_ALWAYS_TRUE(EraseCallback(blackRootTracers.ref(), traceOp, data)); - } - - void GCRuntime::setGrayRootsTracer(JSGrayRootsTracer traceOp, void* data) { - AssertHeapIsIdle(); - grayRootTracer.ref() = {traceOp, data}; - } - - void GCRuntime::clearBlackAndGrayRootTracers() { - diff --git a/libraries/source/spidermonkey/patches/FixLibNames.diff b/libraries/source/spidermonkey/patches/FixLibNames.diff index 1f9d77f52d..973595d263 100644 --- a/libraries/source/spidermonkey/patches/FixLibNames.diff +++ b/libraries/source/spidermonkey/patches/FixLibNames.diff @@ -1,16 +1,18 @@ ---- a/js/src/old-configure -+++ b/js/src/old-configure -@@ -2595,10 +2595,10 @@ - fi - - --if test -n "$JS_STANDALONE"; then --JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION" -+if test -n "$MOZ_DEBUG"; then -+JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-debug" - else --JS_LIBRARY_NAME="mozjs" -+JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-release" - fi - JS_CONFIG_LIBS="$NSPR_LIBS $LIBS" - if test "$CC_TYPE" != clang-cl ; then +--- a/js/moz.configure ++++ b/js/moz.configure +@@ -1425,10 +1425,13 @@ + + # JavaScript shell + # ============================================================== +-@depends(milestone.symbolversion, js_standalone) +-def js_library_name(symbolversion, js_standalone): ++@depends(milestone.symbolversion, js_standalone, moz_debug) ++def js_library_name(symbolversion, js_standalone, moz_debug): + if js_standalone: +- return f"mozjs-{symbolversion}" ++ if moz_debug: ++ return f"mozjs-{symbolversion}-debug" ++ else: ++ return f"mozjs-{symbolversion}-release" + else: + return "mozjs" diff --git a/libraries/source/spidermonkey/patches/StashVendoredLibfmt-FixIncludes.patch b/libraries/source/spidermonkey/patches/StashVendoredLibfmt-FixIncludes.patch new file mode 100644 index 0000000000..943789df34 --- /dev/null +++ b/libraries/source/spidermonkey/patches/StashVendoredLibfmt-FixIncludes.patch @@ -0,0 +1,26 @@ +diff --git a/js/experimental/LoggingInterface.h b/js/experimental/LoggingInterface.h +index 6774755..f1039c1 100644 +--- a/js/experimental/LoggingInterface.h ++++ b/js/experimental/LoggingInterface.h +@@ -13,7 +13,7 @@ + #include "mozilla/LoggingCore.h" + + #include "jstypes.h" +-#include "fmt/format.h" ++#include "mozfmt/format.h" + #include "js/GCAPI.h" + + struct JSContext; +diff --git a/mozilla/Casting.h b/mozilla/Casting.h +index e6b1206..d07d2a8 100644 +--- a/mozilla/Casting.h ++++ b/mozilla/Casting.h +@@ -12,7 +12,7 @@ + #include "mozilla/Assertions.h" + #include "mozilla/Sprintf.h" + +-#include "fmt/format.h" ++#include "mozfmt/format.h" + + #include + #include diff --git a/libraries/source/spidermonkey/patches/StashVendoredLibfmt.patch b/libraries/source/spidermonkey/patches/StashVendoredLibfmt.patch new file mode 100644 index 0000000000..080dfbd46c --- /dev/null +++ b/libraries/source/spidermonkey/patches/StashVendoredLibfmt.patch @@ -0,0 +1,7626 @@ +From: Itms +Date: Thu, 30 Jul 2026 09:51:45 +0200 +Subject: [PATCH] Stash vendored libfmt into the mozilla:: namespace + +Deduplicate all macros to avoid conflicts and use the namespace to avoid +linking errors. + +This is a hack against https://bugzilla.mozilla.org/show_bug.cgi?id=1987410 + +This should be dropped when upgrading to ESR153, which still contains +fmtlib, but also depends on C++20, hence allowing us to use std::format. +--- + js/public/experimental/LoggingInterface.h | 6 +- + js/src/intgemm/IntegerGemmIntrinsic.cpp | 22 +- + mfbt/Casting.h | 4 +- + third_party/fmt/include/fmt/args.h | 34 +- + third_party/fmt/include/fmt/base.h | 912 ++++++++++----------- + third_party/fmt/include/fmt/chrono.h | 412 +++++----- + third_party/fmt/include/fmt/color.h | 114 +-- + third_party/fmt/include/fmt/format-inl.h | 164 ++-- + third_party/fmt/include/fmt/format.h | 916 +++++++++++----------- + third_party/fmt/include/fmt/ostream.h | 32 +- + third_party/fmt/include/fmt/ranges.h | 106 +-- + third_party/fmt/include/fmt/xchar.h | 104 +-- + third_party/fmt/src/format.cc | 28 +- + 13 files changed, 1427 insertions(+), 1427 deletions(-) + +diff --git a/js/public/experimental/LoggingInterface.h b/js/public/experimental/LoggingInterface.h +index 4ee3c13..6774755 100644 +--- a/js/public/experimental/LoggingInterface.h ++++ b/js/public/experimental/LoggingInterface.h +@@ -57,7 +57,7 @@ struct LoggingInterface { + MOZ_FORMAT_PRINTF(3, 0) = nullptr; + + void (*logPrintFMT)(const OpaqueLogger aModule, mozilla::LogLevel aLevel, +- fmt::string_view, fmt::format_args); ++ mozilla::fmt::string_view, mozilla::fmt::format_args); + + // Return a reference to the provided OpaqueLogger's level ref; Implementation + // wise this can be a small violation of encapsulation but is intended to help +@@ -77,9 +77,9 @@ struct LoggingInterface { + + template + void logPrintFmt(const OpaqueLogger aModule, mozilla::LogLevel aLevel, +- fmt::format_string aFmt, T&&... aArgs) { ++ mozilla::fmt::format_string aFmt, T&&... aArgs) { + JS::AutoSuppressGCAnalysis suppress; +- this->logPrintFMT(aModule, aLevel, aFmt, fmt::make_format_args(aArgs...)); ++ this->logPrintFMT(aModule, aLevel, aFmt, mozilla::fmt::make_format_args(aArgs...)); + } + + // Used to ensure that before we use an interface, it's successfully been +diff --git a/js/src/intgemm/IntegerGemmIntrinsic.cpp b/js/src/intgemm/IntegerGemmIntrinsic.cpp +index 5039e62..e5287c9 100644 +--- a/js/src/intgemm/IntegerGemmIntrinsic.cpp ++++ b/js/src/intgemm/IntegerGemmIntrinsic.cpp +@@ -85,13 +85,13 @@ struct AutoProfilerMarker { + + template + AutoProfilerMarker(js::GeckoProfilerRuntime& profiler, const CharT* name, +- fmt::format_string aFormatStr, Args&&... aArgs) ++ mozilla::fmt::format_string aFormatStr, Args&&... aArgs) + : profiler(profiler), name(name) { + if (profiler.enabled()) { + startTime = mozilla::TimeStamp::Now(); +- auto [out, size] = fmt::vformat_to_n( ++ auto [out, size] = mozilla::fmt::vformat_to_n( + text, sizeof(text) - 1, aFormatStr, +- fmt::make_format_args>(aArgs...)); ++ mozilla::fmt::make_format_args>(aArgs...)); + + MOZ_ASSERT(size > sizeof(text) - 1, + "Truncated marker, consider increasing the buffer"); +@@ -209,7 +209,7 @@ int32_t js::intgemm::IntrI8PrepareB(wasm::Instance* instance, + reinterpret_cast(&memBase[inputMatrixB]); + int8_t* outputMatrixBPtr = reinterpret_cast(&memBase[outputMatrixB]); + AutoProfilerMarker marker(cx->runtime()->geckoProfiler(), "integemm::PreparB", +- FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, ++ MOZ_FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, + colsB, sizeB); + GEMMOLOGY_DISPATCH(PrepareB) + (inputMatrixBPtr, outputMatrixBPtr, +@@ -256,7 +256,7 @@ int32_t js::intgemm::IntrI8PrepareBFromTransposed( + int8_t* outputMatrixBPtr = reinterpret_cast(&memBase[outputMatrixB]); + AutoProfilerMarker marker( + cx->runtime()->geckoProfiler(), "intgemm::PreparBTransposed", +- FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); ++ MOZ_FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); + GEMMOLOGY_DISPATCH(PrepareBTransposed) + (inputMatrixBTransposedPtr, outputMatrixBPtr, + scale, // Quant Mult +@@ -302,7 +302,7 @@ int32_t js::intgemm::IntrI8PrepareBFromQuantizedTransposed( + int8_t* outputMatrixBPtr = reinterpret_cast(&memBase[outputMatrixB]); + AutoProfilerMarker marker(cx->runtime()->geckoProfiler(), + "intgemm::PrepareBQuantizedTransposed", +- FMT_STRING("rowsB: {}, colsB: {}"), rowsB, colsB); ++ MOZ_FMT_STRING("rowsB: {}, colsB: {}"), rowsB, colsB); + GEMMOLOGY_DISPATCH(PrepareBQuantizedTransposed) + (inputMatrixBQuantizedTransposedPtr, outputMatrixBPtr, rowsB, colsB); + return 0; +@@ -344,7 +344,7 @@ int32_t js::intgemm::IntrI8PrepareA(wasm::Instance* instance, + reinterpret_cast(&memBase[inputMatrixA]); + uint8_t* outputMatrixAPtr = &memBase[outputMatrixA]; + AutoProfilerMarker marker(cx->runtime()->geckoProfiler(), "intgemm::PrepareA", +- FMT_STRING("rowsA: {}, colsA: {}"), rowsA, colsA); ++ MOZ_FMT_STRING("rowsA: {}, colsA: {}"), rowsA, colsA); + GEMMOLOGY_DISPATCH(Shift::PrepareA) + (inputMatrixAPtr, outputMatrixAPtr, scale, rowsA, colsA); + return 0; +@@ -401,7 +401,7 @@ int32_t js::intgemm::IntrI8PrepareBias( + + AutoProfilerMarker marker( + cx->runtime()->geckoProfiler(), "intgemm::PrepareBias w/ input bias", +- FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); ++ MOZ_FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); + GEMMOLOGY_DISPATCH(Shift::PrepareBias) + (inputMatrixBPreparedPtr, rowsB, colsB, + gemmology::callbacks::UnquantizeAndAddBiasAndWrite( +@@ -409,7 +409,7 @@ int32_t js::intgemm::IntrI8PrepareBias( + } else { + AutoProfilerMarker marker( + cx->runtime()->geckoProfiler(), "intgemm::PrepareBias", +- FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); ++ MOZ_FMT_STRING("rowsB: {} colsB: {} sizeB: {}"), rowsB, colsB, sizeB); + GEMMOLOGY_DISPATCH(Shift::PrepareBias) + (inputMatrixBPreparedPtr, rowsB, colsB, + gemmology::callbacks::UnquantizeAndWrite(unquantFactor, outputPtr)); +@@ -472,7 +472,7 @@ int32_t js::intgemm::IntrI8MultiplyAndAddBias( + + AutoProfilerMarker marker( + cx->runtime()->geckoProfiler(), "intgemm::Shift::Multiply", +- FMT_STRING("rowsA: {}, width: {}, colsA: {}"), rowsA, width, colsB); ++ MOZ_FMT_STRING("rowsA: {}, width: {}, colsA: {}"), rowsA, width, colsB); + GEMMOLOGY_DISPATCH(Shift::Multiply) + (inputMatrixAPreparedPtr, inputMatrixBPreparedPtr, rowsA, width, colsB, + gemmology::callbacks::UnquantizeAndAddBiasAndWrite( +@@ -529,7 +529,7 @@ int32_t js::intgemm::IntrI8SelectColumnsOfB(wasm::Instance* instance, + int8_t* outputPtr = reinterpret_cast(&memBase[output]); + AutoProfilerMarker marker( + cx->runtime()->geckoProfiler(), "integemm::SelectColumnsB", +- FMT_STRING("rowsB: {} colsB: {} sizecolList: {}, sizeB: {}"), rowsB, ++ MOZ_FMT_STRING("rowsB: {} colsB: {} sizecolList: {}, sizeB: {}"), rowsB, + colsB, sizeColIndexList, sizeB); + GEMMOLOGY_DISPATCH(SelectColumnsB) + (inputMatrixBPreparedPtr, outputPtr, rowsB, colIndexListPtr, +diff --git a/mfbt/Casting.h b/mfbt/Casting.h +index 87cf9c9..e6b1206 100644 +--- a/mfbt/Casting.h ++++ b/mfbt/Casting.h +@@ -134,13 +134,13 @@ inline void DiagnosticMessage(In aIn, char aDiagnostic[1024]) { + // value. + auto [out, size] = fmt::format_to_n( + aDiagnostic, 1023, +- FMT_STRING("Cannot cast {:x} from {} to {}: out of range"), ++ MOZ_FMT_STRING("Cannot cast {:x} from {} to {}: out of range"), + static_cast(aIn), TypeToString(), TypeToString()); + *out = 0; + } else { + auto [out, size] = fmt::format_to_n( + aDiagnostic, 1023, +- FMT_STRING("Cannot cast {} from {} to {}: out of range"), aIn, ++ MOZ_FMT_STRING("Cannot cast {} from {} to {}: out of range"), aIn, + TypeToString(), TypeToString()); + *out = 0; + } +diff --git a/third_party/fmt/include/fmt/args.h b/third_party/fmt/include/fmt/args.h +index 6ed30c0..e56f2ec 100644 +--- a/third_party/fmt/include/fmt/args.h ++++ b/third_party/fmt/include/fmt/args.h +@@ -5,10 +5,10 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_ARGS_H_ +-#define FMT_ARGS_H_ ++#ifndef MOZ_FMT_ARGS_H_ ++#define MOZ_FMT_ARGS_H_ + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include // std::reference_wrapper + # include // std::unique_ptr + # include +@@ -16,7 +16,7 @@ + + #include "format.h" // std_string_view + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + + template struct is_reference_wrapper : std::false_type {}; +@@ -45,10 +45,10 @@ class dynamic_arg_list { + T value; + + template +- FMT_CONSTEXPR typed_node(const Arg& arg) : value(arg) {} ++ MOZ_FMT_CONSTEXPR typed_node(const Arg& arg) : value(arg) {} + + template +- FMT_CONSTEXPR typed_node(const basic_string_view& arg) ++ MOZ_FMT_CONSTEXPR typed_node(const basic_string_view& arg) + : value(arg.data(), arg.size()) {} + }; + +@@ -68,8 +68,8 @@ class dynamic_arg_list { + /** + * A dynamic list of formatting arguments with storage. + * +- * It can be implicitly converted into `fmt::basic_format_args` for passing +- * into type-erased formatting functions such as `fmt::vformat`. ++ * It can be implicitly converted into `mozilla::fmt::basic_format_args` for passing ++ * into type-erased formatting functions such as `mozilla::fmt::vformat`. + */ + template class dynamic_format_arg_store { + private: +@@ -145,11 +145,11 @@ template class dynamic_format_arg_store { + * + * **Example**: + * +- * fmt::dynamic_format_arg_store store; ++ * mozilla::fmt::dynamic_format_arg_store store; + * store.push_back(42); + * store.push_back("abc"); + * store.push_back(1.5f); +- * std::string result = fmt::vformat("{} and {} and {}", store); ++ * std::string result = mozilla::fmt::vformat("{} and {} and {}", store); + */ + template void push_back(const T& arg) { + if (detail::const_check(need_copy::value)) +@@ -164,11 +164,11 @@ template class dynamic_format_arg_store { + * + * **Example**: + * +- * fmt::dynamic_format_arg_store store; ++ * mozilla::fmt::dynamic_format_arg_store store; + * char band[] = "Rolling Stones"; + * store.push_back(std::cref(band)); + * band[9] = 'c'; // Changing str affects the output. +- * std::string result = fmt::vformat("{}", store); ++ * std::string result = mozilla::fmt::vformat("{}", store); + * // result == "Rolling Scones" + */ + template void push_back(std::reference_wrapper arg) { +@@ -189,9 +189,9 @@ template class dynamic_format_arg_store { + dynamic_args_.push>(arg.name).c_str(); + if (detail::const_check(need_copy::value)) { + emplace_arg( +- fmt::arg(arg_name, dynamic_args_.push>(arg.value))); ++ mozilla::fmt::arg(arg_name, dynamic_args_.push>(arg.value))); + } else { +- emplace_arg(fmt::arg(arg_name, arg.value)); ++ emplace_arg(mozilla::fmt::arg(arg_name, arg.value)); + } + } + +@@ -205,13 +205,13 @@ template class dynamic_format_arg_store { + /// Reserves space to store at least `new_cap` arguments including + /// `new_cap_named` named arguments. + void reserve(size_t new_cap, size_t new_cap_named) { +- FMT_ASSERT(new_cap >= new_cap_named, ++ MOZ_FMT_ASSERT(new_cap >= new_cap_named, + "set of arguments includes set of named arguments"); + data_.reserve(new_cap); + named_info_.reserve(new_cap_named); + } + }; + +-FMT_END_NAMESPACE ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_ARGS_H_ ++#endif // MOZ_FMT_ARGS_H_ +diff --git a/third_party/fmt/include/fmt/base.h b/third_party/fmt/include/fmt/base.h +index 2144417..42bcd0c 100644 +--- a/third_party/fmt/include/fmt/base.h ++++ b/third_party/fmt/include/fmt/base.h +@@ -5,14 +5,14 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_BASE_H_ +-#define FMT_BASE_H_ ++#ifndef MOZ_FMT_BASE_H_ ++#define MOZ_FMT_BASE_H_ + +-#if defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) +-# define FMT_MODULE ++#if defined(MOZ_FMT_IMPORT_STD) && !defined(MOZ_FMT_MODULE) ++# define MOZ_FMT_MODULE + #endif + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include // CHAR_BIT + # include // FILE + # include // memcmp +@@ -21,274 +21,274 @@ + #endif + + // The fmt library version in the form major * 10000 + minor * 100 + patch. +-#define FMT_VERSION 110002 ++#define MOZ_FMT_VERSION 110002 + + // Detect compiler versions. + #if defined(__clang__) && !defined(__ibmxl__) +-# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) ++# define MOZ_FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) + #else +-# define FMT_CLANG_VERSION 0 ++# define MOZ_FMT_CLANG_VERSION 0 + #endif + #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) +-# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) ++# define MOZ_FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + #else +-# define FMT_GCC_VERSION 0 ++# define MOZ_FMT_GCC_VERSION 0 + #endif + #if defined(__ICL) +-# define FMT_ICC_VERSION __ICL ++# define MOZ_FMT_ICC_VERSION __ICL + #elif defined(__INTEL_COMPILER) +-# define FMT_ICC_VERSION __INTEL_COMPILER ++# define MOZ_FMT_ICC_VERSION __INTEL_COMPILER + #else +-# define FMT_ICC_VERSION 0 ++# define MOZ_FMT_ICC_VERSION 0 + #endif + #if defined(_MSC_VER) +-# define FMT_MSC_VERSION _MSC_VER ++# define MOZ_FMT_MSC_VERSION _MSC_VER + #else +-# define FMT_MSC_VERSION 0 ++# define MOZ_FMT_MSC_VERSION 0 + #endif + + // Detect standard library versions. + #ifdef _GLIBCXX_RELEASE +-# define FMT_GLIBCXX_RELEASE _GLIBCXX_RELEASE ++# define MOZ_FMT_GLIBCXX_RELEASE _GLIBCXX_RELEASE + #else +-# define FMT_GLIBCXX_RELEASE 0 ++# define MOZ_FMT_GLIBCXX_RELEASE 0 + #endif + #ifdef _LIBCPP_VERSION +-# define FMT_LIBCPP_VERSION _LIBCPP_VERSION ++# define MOZ_FMT_LIBCPP_VERSION _LIBCPP_VERSION + #else +-# define FMT_LIBCPP_VERSION 0 ++# define MOZ_FMT_LIBCPP_VERSION 0 + #endif + + #ifdef _MSVC_LANG +-# define FMT_CPLUSPLUS _MSVC_LANG ++# define MOZ_FMT_CPLUSPLUS _MSVC_LANG + #else +-# define FMT_CPLUSPLUS __cplusplus ++# define MOZ_FMT_CPLUSPLUS __cplusplus + #endif + + // Detect __has_*. + #ifdef __has_feature +-# define FMT_HAS_FEATURE(x) __has_feature(x) ++# define MOZ_FMT_HAS_FEATURE(x) __has_feature(x) + #else +-# define FMT_HAS_FEATURE(x) 0 ++# define MOZ_FMT_HAS_FEATURE(x) 0 + #endif + #ifdef __has_include +-# define FMT_HAS_INCLUDE(x) __has_include(x) ++# define MOZ_FMT_HAS_INCLUDE(x) __has_include(x) + #else +-# define FMT_HAS_INCLUDE(x) 0 ++# define MOZ_FMT_HAS_INCLUDE(x) 0 + #endif + #ifdef __has_builtin +-# define FMT_HAS_BUILTIN(x) __has_builtin(x) ++# define MOZ_FMT_HAS_BUILTIN(x) __has_builtin(x) + #else +-# define FMT_HAS_BUILTIN(x) 0 ++# define MOZ_FMT_HAS_BUILTIN(x) 0 + #endif + #ifdef __has_cpp_attribute +-# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) ++# define MOZ_FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) + #else +-# define FMT_HAS_CPP_ATTRIBUTE(x) 0 ++# define MOZ_FMT_HAS_CPP_ATTRIBUTE(x) 0 + #endif + +-#define FMT_HAS_CPP14_ATTRIBUTE(attribute) \ +- (FMT_CPLUSPLUS >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute)) ++#define MOZ_FMT_HAS_CPP14_ATTRIBUTE(attribute) \ ++ (MOZ_FMT_CPLUSPLUS >= 201402L && MOZ_FMT_HAS_CPP_ATTRIBUTE(attribute)) + +-#define FMT_HAS_CPP17_ATTRIBUTE(attribute) \ +- (FMT_CPLUSPLUS >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute)) ++#define MOZ_FMT_HAS_CPP17_ATTRIBUTE(attribute) \ ++ (MOZ_FMT_CPLUSPLUS >= 201703L && MOZ_FMT_HAS_CPP_ATTRIBUTE(attribute)) + + // Detect C++14 relaxed constexpr. +-#ifdef FMT_USE_CONSTEXPR ++#ifdef MOZ_FMT_USE_CONSTEXPR + // Use the provided definition. +-#elif FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L ++#elif MOZ_FMT_GCC_VERSION >= 600 && MOZ_FMT_CPLUSPLUS >= 201402L + // GCC only allows throw in constexpr since version 6: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371. +-# define FMT_USE_CONSTEXPR 1 +-#elif FMT_ICC_VERSION +-# define FMT_USE_CONSTEXPR 0 // https://github.com/fmtlib/fmt/issues/1628 +-#elif FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VERSION >= 1912 +-# define FMT_USE_CONSTEXPR 1 ++# define MOZ_FMT_USE_CONSTEXPR 1 ++#elif MOZ_FMT_ICC_VERSION ++# define MOZ_FMT_USE_CONSTEXPR 0 // https://github.com/fmtlib/fmt/issues/1628 ++#elif MOZ_FMT_HAS_FEATURE(cxx_relaxed_constexpr) || MOZ_FMT_MSC_VERSION >= 1912 ++# define MOZ_FMT_USE_CONSTEXPR 1 + #else +-# define FMT_USE_CONSTEXPR 0 ++# define MOZ_FMT_USE_CONSTEXPR 0 + #endif +-#if FMT_USE_CONSTEXPR +-# define FMT_CONSTEXPR constexpr ++#if MOZ_FMT_USE_CONSTEXPR ++# define MOZ_FMT_CONSTEXPR constexpr + #else +-# define FMT_CONSTEXPR ++# define MOZ_FMT_CONSTEXPR + #endif + + // Detect consteval, C++20 constexpr extensions and std::is_constant_evaluated. + #if !defined(__cpp_lib_is_constant_evaluated) +-# define FMT_USE_CONSTEVAL 0 +-#elif FMT_CPLUSPLUS < 201709L +-# define FMT_USE_CONSTEVAL 0 +-#elif FMT_GLIBCXX_RELEASE && FMT_GLIBCXX_RELEASE < 10 +-# define FMT_USE_CONSTEVAL 0 +-#elif FMT_LIBCPP_VERSION && FMT_LIBCPP_VERSION < 10000 +-# define FMT_USE_CONSTEVAL 0 ++# define MOZ_FMT_USE_CONSTEVAL 0 ++#elif MOZ_FMT_CPLUSPLUS < 201709L ++# define MOZ_FMT_USE_CONSTEVAL 0 ++#elif MOZ_FMT_GLIBCXX_RELEASE && MOZ_FMT_GLIBCXX_RELEASE < 10 ++# define MOZ_FMT_USE_CONSTEVAL 0 ++#elif MOZ_FMT_LIBCPP_VERSION && MOZ_FMT_LIBCPP_VERSION < 10000 ++# define MOZ_FMT_USE_CONSTEVAL 0 + #elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L +-# define FMT_USE_CONSTEVAL 0 // consteval is broken in Apple clang < 14. +-#elif FMT_MSC_VERSION && FMT_MSC_VERSION < 1929 +-# define FMT_USE_CONSTEVAL 0 // consteval is broken in MSVC VS2019 < 16.10. ++# define MOZ_FMT_USE_CONSTEVAL 0 // consteval is broken in Apple clang < 14. ++#elif MOZ_FMT_MSC_VERSION && MOZ_FMT_MSC_VERSION < 1929 ++# define MOZ_FMT_USE_CONSTEVAL 0 // consteval is broken in MSVC VS2019 < 16.10. + #elif defined(__cpp_consteval) +-# define FMT_USE_CONSTEVAL 1 +-#elif FMT_GCC_VERSION >= 1002 || FMT_CLANG_VERSION >= 1101 +-# define FMT_USE_CONSTEVAL 1 ++# define MOZ_FMT_USE_CONSTEVAL 1 ++#elif MOZ_FMT_GCC_VERSION >= 1002 || MOZ_FMT_CLANG_VERSION >= 1101 ++# define MOZ_FMT_USE_CONSTEVAL 1 + #else +-# define FMT_USE_CONSTEVAL 0 ++# define MOZ_FMT_USE_CONSTEVAL 0 + #endif +-#if FMT_USE_CONSTEVAL +-# define FMT_CONSTEVAL consteval +-# define FMT_CONSTEXPR20 constexpr ++#if MOZ_FMT_USE_CONSTEVAL ++# define MOZ_FMT_CONSTEVAL consteval ++# define MOZ_FMT_CONSTEXPR20 constexpr + #else +-# define FMT_CONSTEVAL +-# define FMT_CONSTEXPR20 ++# define MOZ_FMT_CONSTEVAL ++# define MOZ_FMT_CONSTEXPR20 + #endif + + // Check if exceptions are disabled. +-#ifdef FMT_USE_EXCEPTIONS ++#ifdef MOZ_FMT_USE_EXCEPTIONS + // Use the provided definition. + #elif defined(__GNUC__) && !defined(__EXCEPTIONS) +-# define FMT_USE_EXCEPTIONS 0 +-#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS +-# define FMT_USE_EXCEPTIONS 0 ++# define MOZ_FMT_USE_EXCEPTIONS 0 ++#elif MOZ_FMT_MSC_VERSION && !_HAS_EXCEPTIONS ++# define MOZ_FMT_USE_EXCEPTIONS 0 + #else +-# define FMT_USE_EXCEPTIONS 1 ++# define MOZ_FMT_USE_EXCEPTIONS 1 + #endif +-#if FMT_USE_EXCEPTIONS +-# define FMT_TRY try +-# define FMT_CATCH(x) catch (x) ++#if MOZ_FMT_USE_EXCEPTIONS ++# define MOZ_FMT_TRY try ++# define MOZ_FMT_CATCH(x) catch (x) + #else +-# define FMT_TRY if (true) +-# define FMT_CATCH(x) if (false) ++# define MOZ_FMT_TRY if (true) ++# define MOZ_FMT_CATCH(x) if (false) + #endif + +-#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough) +-# define FMT_FALLTHROUGH [[fallthrough]] ++#if MOZ_FMT_HAS_CPP17_ATTRIBUTE(fallthrough) ++# define MOZ_FMT_FALLTHROUGH [[fallthrough]] + #elif defined(__clang__) +-# define FMT_FALLTHROUGH [[clang::fallthrough]] +-#elif FMT_GCC_VERSION >= 700 && \ ++# define MOZ_FMT_FALLTHROUGH [[clang::fallthrough]] ++#elif MOZ_FMT_GCC_VERSION >= 700 && \ + (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520) +-# define FMT_FALLTHROUGH [[gnu::fallthrough]] ++# define MOZ_FMT_FALLTHROUGH [[gnu::fallthrough]] + #else +-# define FMT_FALLTHROUGH ++# define MOZ_FMT_FALLTHROUGH + #endif + + // Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings. +-#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__) +-# define FMT_NORETURN [[noreturn]] ++#if MOZ_FMT_HAS_CPP_ATTRIBUTE(noreturn) && !MOZ_FMT_MSC_VERSION && !defined(__NVCC__) ++# define MOZ_FMT_NORETURN [[noreturn]] + #else +-# define FMT_NORETURN ++# define MOZ_FMT_NORETURN + #endif + +-#ifdef FMT_NODISCARD ++#ifdef MOZ_FMT_NODISCARD + // Use the provided definition. +-#elif FMT_HAS_CPP17_ATTRIBUTE(nodiscard) +-# define FMT_NODISCARD [[nodiscard]] ++#elif MOZ_FMT_HAS_CPP17_ATTRIBUTE(nodiscard) ++# define MOZ_FMT_NODISCARD [[nodiscard]] + #else +-# define FMT_NODISCARD ++# define MOZ_FMT_NODISCARD + #endif + +-#ifdef FMT_DEPRECATED ++#ifdef MOZ_FMT_DEPRECATED + // Use the provided definition. +-#elif FMT_HAS_CPP14_ATTRIBUTE(deprecated) +-# define FMT_DEPRECATED [[deprecated]] ++#elif MOZ_FMT_HAS_CPP14_ATTRIBUTE(deprecated) ++# define MOZ_FMT_DEPRECATED [[deprecated]] + #else +-# define FMT_DEPRECATED /* deprecated */ ++# define MOZ_FMT_DEPRECATED /* deprecated */ + #endif + +-#ifdef FMT_ALWAYS_INLINE ++#ifdef MOZ_FMT_ALWAYS_INLINE + // Use the provided definition. +-#elif FMT_GCC_VERSION || FMT_CLANG_VERSION +-# define FMT_ALWAYS_INLINE inline __attribute__((always_inline)) ++#elif MOZ_FMT_GCC_VERSION || MOZ_FMT_CLANG_VERSION ++# define MOZ_FMT_ALWAYS_INLINE inline __attribute__((always_inline)) + #else +-# define FMT_ALWAYS_INLINE inline ++# define MOZ_FMT_ALWAYS_INLINE inline + #endif +-// A version of FMT_ALWAYS_INLINE to prevent code bloat in debug mode. ++// A version of MOZ_FMT_ALWAYS_INLINE to prevent code bloat in debug mode. + #ifdef NDEBUG +-# define FMT_INLINE FMT_ALWAYS_INLINE ++# define MOZ_FMT_INLINE MOZ_FMT_ALWAYS_INLINE + #else +-# define FMT_INLINE inline ++# define MOZ_FMT_INLINE inline + #endif + +-#if FMT_GCC_VERSION || FMT_CLANG_VERSION +-# define FMT_VISIBILITY(value) __attribute__((visibility(value))) ++#if MOZ_FMT_GCC_VERSION || MOZ_FMT_CLANG_VERSION ++# define MOZ_FMT_VISIBILITY(value) __attribute__((visibility(value))) + #else +-# define FMT_VISIBILITY(value) ++# define MOZ_FMT_VISIBILITY(value) + #endif + + // Detect pragmas. +-#define FMT_PRAGMA_IMPL(x) _Pragma(#x) +-#if FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER) ++#define MOZ_FMT_PRAGMA_IMPL(x) _Pragma(#x) ++#if MOZ_FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER) + // Workaround a _Pragma bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884 + // and an nvhpc warning: https://github.com/fmtlib/fmt/pull/2582. +-# define FMT_PRAGMA_GCC(x) FMT_PRAGMA_IMPL(GCC x) ++# define MOZ_FMT_PRAGMA_GCC(x) MOZ_FMT_PRAGMA_IMPL(GCC x) + #else +-# define FMT_PRAGMA_GCC(x) ++# define MOZ_FMT_PRAGMA_GCC(x) + #endif +-#if FMT_CLANG_VERSION +-# define FMT_PRAGMA_CLANG(x) FMT_PRAGMA_IMPL(clang x) ++#if MOZ_FMT_CLANG_VERSION ++# define MOZ_FMT_PRAGMA_CLANG(x) MOZ_FMT_PRAGMA_IMPL(clang x) + #else +-# define FMT_PRAGMA_CLANG(x) ++# define MOZ_FMT_PRAGMA_CLANG(x) + #endif +-#if FMT_MSC_VERSION +-# define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__)) ++#if MOZ_FMT_MSC_VERSION ++# define MOZ_FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__)) + #else +-# define FMT_MSC_WARNING(...) ++# define MOZ_FMT_MSC_WARNING(...) + #endif + +-#ifndef FMT_BEGIN_NAMESPACE +-# define FMT_BEGIN_NAMESPACE \ +- namespace fmt { \ ++#ifndef MOZ_FMT_BEGIN_NAMESPACE ++# define MOZ_FMT_BEGIN_NAMESPACE \ ++ namespace mozilla::fmt { \ + inline namespace v11 { +-# define FMT_END_NAMESPACE \ ++# define MOZ_FMT_END_NAMESPACE \ + } \ + } + #endif + +-#ifndef FMT_EXPORT +-# define FMT_EXPORT +-# define FMT_BEGIN_EXPORT +-# define FMT_END_EXPORT ++#ifndef MOZ_FMT_EXPORT ++# define MOZ_FMT_EXPORT ++# define MOZ_FMT_BEGIN_EXPORT ++# define MOZ_FMT_END_EXPORT + #endif + + #ifdef _WIN32 +-# define FMT_WIN32 1 ++# define MOZ_FMT_WIN32 1 + #else +-# define FMT_WIN32 0 ++# define MOZ_FMT_WIN32 0 + #endif + +-#if !defined(FMT_HEADER_ONLY) && FMT_WIN32 +-# if defined(FMT_LIB_EXPORT) +-# define FMT_API __declspec(dllexport) +-# elif defined(FMT_SHARED) +-# define FMT_API __declspec(dllimport) ++#if !defined(MOZ_FMT_HEADER_ONLY) && MOZ_FMT_WIN32 ++# if defined(MOZ_FMT_LIB_EXPORT) ++# define MOZ_FMT_API __declspec(dllexport) ++# elif defined(MOZ_FMT_SHARED) ++# define MOZ_FMT_API __declspec(dllimport) + # endif +-#elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) +-# define FMT_API FMT_VISIBILITY("default") ++#elif defined(MOZ_FMT_LIB_EXPORT) || defined(MOZ_FMT_SHARED) ++# define MOZ_FMT_API MOZ_FMT_VISIBILITY("default") + #endif +-#ifndef FMT_API +-# define FMT_API ++#ifndef MOZ_FMT_API ++# define MOZ_FMT_API + #endif + +-#ifndef FMT_OPTIMIZE_SIZE +-# define FMT_OPTIMIZE_SIZE 0 ++#ifndef MOZ_FMT_OPTIMIZE_SIZE ++# define MOZ_FMT_OPTIMIZE_SIZE 0 + #endif + +-// FMT_BUILTIN_TYPE=0 may result in smaller library size at the cost of higher ++// MOZ_FMT_BUILTIN_TYPE=0 may result in smaller library size at the cost of higher + // per-call binary size by passing built-in types through the extension API. +-#ifndef FMT_BUILTIN_TYPES +-# define FMT_BUILTIN_TYPES 1 ++#ifndef MOZ_FMT_BUILTIN_TYPES ++# define MOZ_FMT_BUILTIN_TYPES 1 + #endif + +-#define FMT_APPLY_VARIADIC(expr) \ ++#define MOZ_FMT_APPLY_VARIADIC(expr) \ + using ignore = int[]; \ + (void)ignore { 0, (expr, 0)... } + + // Enable minimal optimizations for more compact code in debug mode. +-FMT_PRAGMA_GCC(push_options) ++MOZ_FMT_PRAGMA_GCC(push_options) + #if !defined(__OPTIMIZE__) && !defined(__CUDACC__) +-FMT_PRAGMA_GCC(optimize("Og")) ++MOZ_FMT_PRAGMA_GCC(optimize("Og")) + #endif +-FMT_PRAGMA_CLANG(diagnostic push) ++MOZ_FMT_PRAGMA_CLANG(diagnostic push) + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + + // Implementations of enable_if_t and other metafunctions for older systems. + template +@@ -309,7 +309,7 @@ using underlying_t = typename std::underlying_type::type; + template using decay_t = typename std::decay::type; + using nullptr_t = decltype(nullptr); + +-#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 ++#if MOZ_FMT_GCC_VERSION && MOZ_FMT_GCC_VERSION < 500 + // A workaround for gcc 4.9 to make void_t work in a SFINAE context. + template struct void_t_impl { + using type = void; +@@ -326,10 +326,10 @@ struct monostate { + // An enable_if helper to be used in template parameters which results in much + // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed + // to workaround a bug in MSVC 2019 (see #1140 and #1186). +-#ifdef FMT_DOC +-# define FMT_ENABLE_IF(...) ++#ifdef MOZ_FMT_DOC ++# define MOZ_FMT_ENABLE_IF(...) + #else +-# define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0 ++# define MOZ_FMT_ENABLE_IF(...) mozilla::fmt::enable_if_t<(__VA_ARGS__), int> = 0 + #endif + + template constexpr auto min_of(T a, T b) -> T { +@@ -343,14 +343,14 @@ namespace detail { + // Suppresses "unused variable" warnings with the method described in + // https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/. + // (void)var does not work on many Intel compilers. +-template FMT_CONSTEXPR void ignore_unused(const T&...) {} ++template MOZ_FMT_CONSTEXPR void ignore_unused(const T&...) {} + + constexpr auto is_constant_evaluated(bool default_value = false) noexcept + -> bool { + // Workaround for incompatibility between clang 14 and libstdc++ consteval-based + // std::is_constant_evaluated: https://github.com/fmtlib/fmt/issues/3247. +-#if FMT_CPLUSPLUS >= 202002L && FMT_GLIBCXX_RELEASE >= 12 && \ +- (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500) ++#if MOZ_FMT_CPLUSPLUS >= 202002L && MOZ_FMT_GLIBCXX_RELEASE >= 12 && \ ++ (MOZ_FMT_CLANG_VERSION >= 1400 && MOZ_FMT_CLANG_VERSION < 1500) + ignore_unused(default_value); + return __builtin_is_constant_evaluated(); + #elif defined(__cpp_lib_is_constant_evaluated) +@@ -364,35 +364,35 @@ constexpr auto is_constant_evaluated(bool default_value = false) noexcept + // Suppresses "conditional expression is constant" warnings. + template constexpr auto const_check(T value) -> T { return value; } + +-FMT_NORETURN FMT_API void assert_fail(const char* file, int line, ++MOZ_FMT_NORETURN MOZ_FMT_API void assert_fail(const char* file, int line, + const char* message); + +-#if defined(FMT_ASSERT) ++#if defined(MOZ_FMT_ASSERT) + // Use the provided definition. + #elif defined(NDEBUG) +-// FMT_ASSERT is not empty to avoid -Wempty-body. +-# define FMT_ASSERT(condition, message) \ +- fmt::detail::ignore_unused((condition), (message)) ++// MOZ_FMT_ASSERT is not empty to avoid -Wempty-body. ++# define MOZ_FMT_ASSERT(condition, message) \ ++ mozilla::fmt::detail::ignore_unused((condition), (message)) + #else +-# define FMT_ASSERT(condition, message) \ ++# define MOZ_FMT_ASSERT(condition, message) \ + ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ + ? (void)0 \ +- : fmt::detail::assert_fail(__FILE__, __LINE__, (message))) ++ : mozilla::fmt::detail::assert_fail(__FILE__, __LINE__, (message))) + #endif + +-#ifdef FMT_USE_INT128 ++#ifdef MOZ_FMT_USE_INT128 + // Use the provided definition. + #elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \ +- !(FMT_CLANG_VERSION && FMT_MSC_VERSION) +-# define FMT_USE_INT128 1 ++ !(MOZ_FMT_CLANG_VERSION && MOZ_FMT_MSC_VERSION) ++# define MOZ_FMT_USE_INT128 1 + using int128_opt = __int128_t; // An optional native 128-bit integer. + using uint128_opt = __uint128_t; + inline auto map(int128_opt x) -> int128_opt { return x; } + inline auto map(uint128_opt x) -> uint128_opt { return x; } + #else +-# define FMT_USE_INT128 0 ++# define MOZ_FMT_USE_INT128 0 + #endif +-#if !FMT_USE_INT128 ++#if !MOZ_FMT_USE_INT128 + enum class int128_opt {}; + enum class uint128_opt {}; + // Reduce template instantiations. +@@ -400,23 +400,23 @@ inline auto map(int128_opt) -> monostate { return {}; } + inline auto map(uint128_opt) -> monostate { return {}; } + #endif + +-#ifndef FMT_USE_BITINT +-# define FMT_USE_BITINT (FMT_CLANG_VERSION >= 1500) ++#ifndef MOZ_FMT_USE_BITINT ++# define MOZ_FMT_USE_BITINT (MOZ_FMT_CLANG_VERSION >= 1500) + #endif + +-#if FMT_USE_BITINT +-FMT_PRAGMA_CLANG(diagnostic ignored "-Wbit-int-extension") ++#if MOZ_FMT_USE_BITINT ++MOZ_FMT_PRAGMA_CLANG(diagnostic ignored "-Wbit-int-extension") + template using bitint = _BitInt(N); + template using ubitint = unsigned _BitInt(N); + #else + template struct bitint {}; + template struct ubitint {}; +-#endif // FMT_USE_BITINT ++#endif // MOZ_FMT_USE_BITINT + + // Casts a nonnegative integer to unsigned. + template +-FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t { +- FMT_ASSERT(std::is_unsigned::value || value >= 0, "negative value"); ++MOZ_FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t { ++ MOZ_FMT_ASSERT(std::is_unsigned::value || value >= 0, "negative value"); + return static_cast>(value); + } + +@@ -435,20 +435,20 @@ struct is_std_string_like().find_first_of( + + // Check if the literal encoding is UTF-8. + enum { is_utf8_enabled = "\u00A7"[1] == '\xA7' }; +-enum { use_utf8 = !FMT_WIN32 || is_utf8_enabled }; ++enum { use_utf8 = !MOZ_FMT_WIN32 || is_utf8_enabled }; + +-#ifndef FMT_UNICODE +-# define FMT_UNICODE 1 ++#ifndef MOZ_FMT_UNICODE ++# define MOZ_FMT_UNICODE 1 + #endif + +-static_assert(!FMT_UNICODE || use_utf8, ++static_assert(!MOZ_FMT_UNICODE || use_utf8, + "Unicode support requires compiling with /utf-8"); + + template constexpr const char* narrow(const T*) { return nullptr; } +-constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; } ++constexpr MOZ_FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; } + + template +-FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n) ++MOZ_FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n) + -> int { + if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n); + for (; n != 0; ++s1, ++s2, --n) { +@@ -477,10 +477,10 @@ struct is_back_insert_iterator< + + // Extracts a reference to the container from *insert_iterator. + template +-inline FMT_CONSTEXPR20 auto get_container(OutputIt it) -> ++inline MOZ_FMT_CONSTEXPR20 auto get_container(OutputIt it) -> + typename OutputIt::container_type& { + struct accessor : OutputIt { +- FMT_CONSTEXPR20 accessor(OutputIt base) : OutputIt(base) {} ++ MOZ_FMT_CONSTEXPR20 accessor(OutputIt base) : OutputIt(base) {} + using OutputIt::container; + }; + return *accessor(it).container; +@@ -488,11 +488,11 @@ inline FMT_CONSTEXPR20 auto get_container(OutputIt it) -> + } // namespace detail + + // Parsing-related public API and forward declarations. +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + /** + * An implementation of `std::basic_string_view` for pre-C++17. It provides a +- * subset of the API. `fmt::basic_string_view` is used for format strings even ++ * subset of the API. `mozilla::fmt::basic_string_view` is used for format strings even + * if `std::basic_string_view` is available to prevent issues when a library is + * compiled with a different `-std` option than the client code (which is not + * recommended). +@@ -515,11 +515,11 @@ template class basic_string_view { + constexpr basic_string_view(nullptr_t) = delete; + + /// Constructs a string reference object from a C string. +-#if FMT_GCC_VERSION +- FMT_ALWAYS_INLINE ++#if MOZ_FMT_GCC_VERSION ++ MOZ_FMT_ALWAYS_INLINE + #endif +- FMT_CONSTEXPR20 basic_string_view(const Char* s) : data_(s) { +-#if FMT_HAS_BUILTIN(__buitin_strlen) || FMT_GCC_VERSION || FMT_CLANG_VERSION ++ MOZ_FMT_CONSTEXPR20 basic_string_view(const Char* s) : data_(s) { ++#if MOZ_FMT_HAS_BUILTIN(__buitin_strlen) || MOZ_FMT_GCC_VERSION || MOZ_FMT_CLANG_VERSION + if (std::is_same::value) { + size_ = __builtin_strlen(detail::narrow(s)); + return; +@@ -533,9 +533,9 @@ template class basic_string_view { + /// Constructs a string reference from a `std::basic_string` or a + /// `std::basic_string_view` object. + template ::value&& std::is_same< ++ MOZ_FMT_ENABLE_IF(detail::is_std_string_like::value&& std::is_same< + typename S::value_type, Char>::value)> +- FMT_CONSTEXPR basic_string_view(const S& s) noexcept ++ MOZ_FMT_CONSTEXPR basic_string_view(const S& s) noexcept + : data_(s.data()), size_(s.size()) {} + + /// Returns a pointer to the string data. +@@ -551,31 +551,31 @@ template class basic_string_view { + return data_[pos]; + } + +- FMT_CONSTEXPR void remove_prefix(size_t n) noexcept { ++ MOZ_FMT_CONSTEXPR void remove_prefix(size_t n) noexcept { + data_ += n; + size_ -= n; + } + +- FMT_CONSTEXPR auto starts_with(basic_string_view sv) const noexcept ++ MOZ_FMT_CONSTEXPR auto starts_with(basic_string_view sv) const noexcept + -> bool { + return size_ >= sv.size_ && detail::compare(data_, sv.data_, sv.size_) == 0; + } +- FMT_CONSTEXPR auto starts_with(Char c) const noexcept -> bool { ++ MOZ_FMT_CONSTEXPR auto starts_with(Char c) const noexcept -> bool { + return size_ >= 1 && *data_ == c; + } +- FMT_CONSTEXPR auto starts_with(const Char* s) const -> bool { ++ MOZ_FMT_CONSTEXPR auto starts_with(const Char* s) const -> bool { + return starts_with(basic_string_view(s)); + } + + // Lexicographically compare this string reference to other. +- FMT_CONSTEXPR auto compare(basic_string_view other) const -> int { ++ MOZ_FMT_CONSTEXPR auto compare(basic_string_view other) const -> int { + int result = + detail::compare(data_, other.data_, min_of(size_, other.size_)); + if (result != 0) return result; + return size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1); + } + +- FMT_CONSTEXPR friend auto operator==(basic_string_view lhs, ++ MOZ_FMT_CONSTEXPR friend auto operator==(basic_string_view lhs, + basic_string_view rhs) -> bool { + return lhs.compare(rhs) == 0; + } +@@ -652,7 +652,7 @@ struct formatter { + /// Reports a format error at compile time or, via a `format_error` exception, + /// at runtime. + // This function is intentionally not constexpr to give a compile-time error. +-FMT_NORETURN FMT_API void report_error(const char* message); ++MOZ_FMT_NORETURN MOZ_FMT_API void report_error(const char* message); + + enum class presentation_type : unsigned char { + // Common specifiers: +@@ -726,7 +726,7 @@ class basic_specs { + // Character (code unit) type is erased to prevent template bloat. + char fill_data_[max_fill_size] = {' '}; + +- FMT_CONSTEXPR void set_fill_size(size_t size) { ++ MOZ_FMT_CONSTEXPR void set_fill_size(size_t size) { + data_ = (data_ & ~fill_size_mask) | (size << fill_size_shift); + } + +@@ -734,29 +734,29 @@ class basic_specs { + constexpr auto type() const -> presentation_type { + return static_cast(data_ & type_mask); + } +- FMT_CONSTEXPR void set_type(presentation_type t) { ++ MOZ_FMT_CONSTEXPR void set_type(presentation_type t) { + data_ = (data_ & ~type_mask) | static_cast(t); + } + + constexpr auto align() const -> align { +- return static_cast((data_ & align_mask) >> align_shift); ++ return static_cast((data_ & align_mask) >> align_shift); + } +- FMT_CONSTEXPR void set_align(fmt::align a) { ++ MOZ_FMT_CONSTEXPR void set_align(mozilla::fmt::align a) { + data_ = (data_ & ~align_mask) | (static_cast(a) << align_shift); + } + + constexpr auto dynamic_width() const -> arg_id_kind { + return static_cast((data_ & width_mask) >> width_shift); + } +- FMT_CONSTEXPR void set_dynamic_width(arg_id_kind w) { ++ MOZ_FMT_CONSTEXPR void set_dynamic_width(arg_id_kind w) { + data_ = (data_ & ~width_mask) | (static_cast(w) << width_shift); + } + +- FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind { ++ MOZ_FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind { + return static_cast((data_ & precision_mask) >> + precision_shift); + } +- FMT_CONSTEXPR void set_dynamic_precision(arg_id_kind p) { ++ MOZ_FMT_CONSTEXPR void set_dynamic_precision(arg_id_kind p) { + data_ = (data_ & ~precision_mask) | + (static_cast(p) << precision_shift); + } +@@ -766,33 +766,33 @@ class basic_specs { + } + + constexpr auto sign() const -> sign { +- return static_cast((data_ & sign_mask) >> sign_shift); ++ return static_cast((data_ & sign_mask) >> sign_shift); + } +- FMT_CONSTEXPR void set_sign(fmt::sign s) { ++ MOZ_FMT_CONSTEXPR void set_sign(mozilla::fmt::sign s) { + data_ = (data_ & ~sign_mask) | (static_cast(s) << sign_shift); + } + + constexpr auto upper() const -> bool { return (data_ & uppercase_mask) != 0; } +- FMT_CONSTEXPR void set_upper() { data_ |= uppercase_mask; } ++ MOZ_FMT_CONSTEXPR void set_upper() { data_ |= uppercase_mask; } + + constexpr auto alt() const -> bool { return (data_ & alternate_mask) != 0; } +- FMT_CONSTEXPR void set_alt() { data_ |= alternate_mask; } +- FMT_CONSTEXPR void clear_alt() { data_ &= ~alternate_mask; } ++ MOZ_FMT_CONSTEXPR void set_alt() { data_ |= alternate_mask; } ++ MOZ_FMT_CONSTEXPR void clear_alt() { data_ &= ~alternate_mask; } + + constexpr auto localized() const -> bool { + return (data_ & localized_mask) != 0; + } +- FMT_CONSTEXPR void set_localized() { data_ |= localized_mask; } ++ MOZ_FMT_CONSTEXPR void set_localized() { data_ |= localized_mask; } + + constexpr auto fill_size() const -> size_t { + return (data_ & fill_size_mask) >> fill_size_shift; + } + +- template ::value)> ++ template ::value)> + constexpr auto fill() const -> const Char* { + return fill_data_; + } +- template ::value)> ++ template ::value)> + constexpr auto fill() const -> const Char* { + return nullptr; + } +@@ -803,13 +803,13 @@ class basic_specs { + (static_cast(fill_data_[1]) << 8)); + } + +- FMT_CONSTEXPR void set_fill(char c) { ++ MOZ_FMT_CONSTEXPR void set_fill(char c) { + fill_data_[0] = c; + set_fill_size(1); + } + + template +- FMT_CONSTEXPR void set_fill(basic_string_view s) { ++ MOZ_FMT_CONSTEXPR void set_fill(basic_string_view s) { + auto size = s.size(); + set_fill_size(size); + if (size == 1) { +@@ -818,7 +818,7 @@ class basic_specs { + fill_data_[1] = static_cast(uchar >> 8); + return; + } +- FMT_ASSERT(size <= max_fill_size, "invalid fill"); ++ MOZ_FMT_ASSERT(size <= max_fill_size, "invalid fill"); + for (size_t i = 0; i < size; ++i) + fill_data_[i & 3] = static_cast(s[i]); + } +@@ -841,9 +841,9 @@ template class parse_context { + basic_string_view fmt_; + int next_arg_id_; + +- enum { use_constexpr_cast = !FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200 }; ++ enum { use_constexpr_cast = !MOZ_FMT_GCC_VERSION || MOZ_FMT_GCC_VERSION >= 1200 }; + +- FMT_CONSTEXPR void do_check_arg_id(int arg_id); ++ MOZ_FMT_CONSTEXPR void do_check_arg_id(int arg_id); + + public: + using char_type = Char; +@@ -861,13 +861,13 @@ template class parse_context { + constexpr auto end() const noexcept -> iterator { return fmt_.end(); } + + /// Advances the begin iterator to `it`. +- FMT_CONSTEXPR void advance_to(iterator it) { ++ MOZ_FMT_CONSTEXPR void advance_to(iterator it) { + fmt_.remove_prefix(detail::to_unsigned(it - begin())); + } + + /// Reports an error if using the manual argument indexing; otherwise returns + /// the next argument index and switches to the automatic indexing. +- FMT_CONSTEXPR auto next_arg_id() -> int { ++ MOZ_FMT_CONSTEXPR auto next_arg_id() -> int { + if (next_arg_id_ < 0) { + report_error("cannot switch from manual to automatic argument indexing"); + return 0; +@@ -879,7 +879,7 @@ template class parse_context { + + /// Reports an error if using the automatic argument indexing; otherwise + /// switches to the manual indexing. +- FMT_CONSTEXPR void check_arg_id(int id) { ++ MOZ_FMT_CONSTEXPR void check_arg_id(int id) { + if (next_arg_id_ > 0) { + report_error("cannot switch from automatic to manual argument indexing"); + return; +@@ -887,24 +887,24 @@ template class parse_context { + next_arg_id_ = -1; + do_check_arg_id(id); + } +- FMT_CONSTEXPR void check_arg_id(basic_string_view) { ++ MOZ_FMT_CONSTEXPR void check_arg_id(basic_string_view) { + next_arg_id_ = -1; + } +- FMT_CONSTEXPR void check_dynamic_spec(int arg_id); ++ MOZ_FMT_CONSTEXPR void check_dynamic_spec(int arg_id); + }; + +-FMT_END_EXPORT ++MOZ_FMT_END_EXPORT + + namespace detail { + +-// Constructs fmt::basic_string_view from types implicitly convertible ++// Constructs mozilla::fmt::basic_string_view from types implicitly convertible + // to it, deducing Char. Explicitly convertible types such as the ones returned +-// from FMT_STRING are intentionally excluded. +-template ::value)> ++// from MOZ_FMT_STRING are intentionally excluded. ++template ::value)> + constexpr auto to_string_view(const Char* s) -> basic_string_view { + return s; + } +-template ::value)> ++template ::value)> + constexpr auto to_string_view(const T& s) + -> basic_string_view { + return s; +@@ -955,25 +955,25 @@ enum class type { + template + struct type_constant : std::integral_constant {}; + +-#define FMT_TYPE_CONSTANT(Type, constant) \ ++#define MOZ_FMT_TYPE_CONSTANT(Type, constant) \ + template \ + struct type_constant \ + : std::integral_constant {} + +-FMT_TYPE_CONSTANT(int, int_type); +-FMT_TYPE_CONSTANT(unsigned, uint_type); +-FMT_TYPE_CONSTANT(long long, long_long_type); +-FMT_TYPE_CONSTANT(unsigned long long, ulong_long_type); +-FMT_TYPE_CONSTANT(int128_opt, int128_type); +-FMT_TYPE_CONSTANT(uint128_opt, uint128_type); +-FMT_TYPE_CONSTANT(bool, bool_type); +-FMT_TYPE_CONSTANT(Char, char_type); +-FMT_TYPE_CONSTANT(float, float_type); +-FMT_TYPE_CONSTANT(double, double_type); +-FMT_TYPE_CONSTANT(long double, long_double_type); +-FMT_TYPE_CONSTANT(const Char*, cstring_type); +-FMT_TYPE_CONSTANT(basic_string_view, string_type); +-FMT_TYPE_CONSTANT(const void*, pointer_type); ++MOZ_FMT_TYPE_CONSTANT(int, int_type); ++MOZ_FMT_TYPE_CONSTANT(unsigned, uint_type); ++MOZ_FMT_TYPE_CONSTANT(long long, long_long_type); ++MOZ_FMT_TYPE_CONSTANT(unsigned long long, ulong_long_type); ++MOZ_FMT_TYPE_CONSTANT(int128_opt, int128_type); ++MOZ_FMT_TYPE_CONSTANT(uint128_opt, uint128_type); ++MOZ_FMT_TYPE_CONSTANT(bool, bool_type); ++MOZ_FMT_TYPE_CONSTANT(Char, char_type); ++MOZ_FMT_TYPE_CONSTANT(float, float_type); ++MOZ_FMT_TYPE_CONSTANT(double, double_type); ++MOZ_FMT_TYPE_CONSTANT(long double, long_double_type); ++MOZ_FMT_TYPE_CONSTANT(const Char*, cstring_type); ++MOZ_FMT_TYPE_CONSTANT(basic_string_view, string_type); ++MOZ_FMT_TYPE_CONSTANT(const void*, pointer_type); + + constexpr auto is_integral_type(type t) -> bool { + return t > type::none_type && t <= type::last_integer_type; +@@ -1036,25 +1036,25 @@ template struct named_arg_info { + int id; + }; + +-template ::value)> ++template ::value)> + void init_named_arg(named_arg_info*, int& arg_index, int&, const T&) { + ++arg_index; + } +-template ::value)> ++template ::value)> + void init_named_arg(named_arg_info* named_args, int& arg_index, + int& named_arg_index, const T& arg) { + named_args[named_arg_index++] = {arg.name, arg_index++}; + } + + template ::value)> +-FMT_CONSTEXPR void init_static_named_arg(named_arg_info*, int& arg_index, ++ MOZ_FMT_ENABLE_IF(!is_static_named_arg::value)> ++MOZ_FMT_CONSTEXPR void init_static_named_arg(named_arg_info*, int& arg_index, + int&) { + ++arg_index; + } + template ::value)> +-FMT_CONSTEXPR void init_static_named_arg(named_arg_info* named_args, ++ MOZ_FMT_ENABLE_IF(is_static_named_arg::value)> ++MOZ_FMT_CONSTEXPR void init_static_named_arg(named_arg_info* named_args, + int& arg_index, int& named_arg_index) { + named_args[named_arg_index++] = {T::name, arg_index++}; + } +@@ -1128,7 +1128,7 @@ template struct type_mapper { + static auto map(ubitint) + -> conditional_t; + +- template ::value)> ++ template ::value)> + static auto map(T) -> conditional_t< + std::is_same::value || std::is_same::value, Char, void>; + +@@ -1139,7 +1139,7 @@ template struct type_mapper { + static auto map(Char*) -> const Char*; + static auto map(const Char*) -> const Char*; + template , +- FMT_ENABLE_IF(!std::is_pointer::value)> ++ MOZ_FMT_ENABLE_IF(!std::is_pointer::value)> + static auto map(const T&) -> conditional_t::value, + basic_string_view, void>; + +@@ -1148,19 +1148,19 @@ template struct type_mapper { + static auto map(volatile void*) -> const void*; + static auto map(const volatile void*) -> const void*; + static auto map(nullptr_t) -> const void*; +- template ::value || ++ template ::value || + std::is_member_pointer::value)> + static auto map(const T&) -> void; + +- template ::value)> ++ template ::value)> + static auto map(const T& x) -> decltype(map(format_as(x))); +- template ::value)> ++ template ::value)> + static auto map(const T& x) -> decltype(map(formatter::format_as(x))); + +- template ::value)> ++ template ::value)> + static auto map(T&) -> conditional_t(), T&, void>; + +- template ::value)> ++ template ::value)> + static auto map(const T& named_arg) -> decltype(map(named_arg.value)); + }; + +@@ -1187,7 +1187,7 @@ class compile_parse_context : public parse_context { + using base = parse_context; + + public: +- explicit FMT_CONSTEXPR compile_parse_context(basic_string_view fmt, ++ explicit MOZ_FMT_CONSTEXPR compile_parse_context(basic_string_view fmt, + int num_args, const type* types, + int next_arg_id = 0) + : base(fmt, next_arg_id), num_args_(num_args), types_(types) {} +@@ -1195,19 +1195,19 @@ class compile_parse_context : public parse_context { + constexpr auto num_args() const -> int { return num_args_; } + constexpr auto arg_type(int id) const -> type { return types_[id]; } + +- FMT_CONSTEXPR auto next_arg_id() -> int { ++ MOZ_FMT_CONSTEXPR auto next_arg_id() -> int { + int id = base::next_arg_id(); + if (id >= num_args_) report_error("argument not found"); + return id; + } + +- FMT_CONSTEXPR void check_arg_id(int id) { ++ MOZ_FMT_CONSTEXPR void check_arg_id(int id) { + base::check_arg_id(id); + if (id >= num_args_) report_error("argument not found"); + } + using base::check_arg_id; + +- FMT_CONSTEXPR void check_dynamic_spec(int arg_id) { ++ MOZ_FMT_CONSTEXPR void check_dynamic_spec(int arg_id) { + ignore_unused(arg_id); + if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id])) + report_error("width/precision is not integer"); +@@ -1216,8 +1216,8 @@ class compile_parse_context : public parse_context { + + // An argument reference. + template union arg_ref { +- FMT_CONSTEXPR arg_ref(int idx = 0) : index(idx) {} +- FMT_CONSTEXPR arg_ref(basic_string_view n) : name(n) {} ++ MOZ_FMT_CONSTEXPR arg_ref(int idx = 0) : index(idx) {} ++ MOZ_FMT_CONSTEXPR arg_ref(basic_string_view n) : name(n) {} + + int index; + basic_string_view name; +@@ -1232,14 +1232,14 @@ template struct dynamic_format_specs : format_specs { + }; + + // Converts a character to ASCII. Returns '\0' on conversion failure. +-template ::value)> ++template ::value)> + constexpr auto to_ascii(Char c) -> char { + return c <= 0xff ? static_cast(c) : '\0'; + } + + // Returns the number of code units in a code point or 1 on error. + template +-FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int { ++MOZ_FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int { + if (const_check(sizeof(Char) != 1)) return 1; + auto c = static_cast(*begin); + return static_cast((0x3a55000000000000ull >> (2 * (c >> 3))) & 3) + 1; +@@ -1248,9 +1248,9 @@ FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int { + // Parses the range [begin, end) as an unsigned integer. This function assumes + // that the range is non-empty and the first character is a digit. + template +-FMT_CONSTEXPR auto parse_nonnegative_int(const Char*& begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_nonnegative_int(const Char*& begin, const Char* end, + int error_value) noexcept -> int { +- FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', ""); ++ MOZ_FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', ""); + unsigned value = 0, prev = 0; + auto p = begin; + do { +@@ -1270,7 +1270,7 @@ FMT_CONSTEXPR auto parse_nonnegative_int(const Char*& begin, const Char* end, + : error_value; + } + +-FMT_CONSTEXPR inline auto parse_align(char c) -> align { ++MOZ_FMT_CONSTEXPR inline auto parse_align(char c) -> align { + switch (c) { + case '<': return align::left; + case '>': return align::right; +@@ -1284,7 +1284,7 @@ template constexpr auto is_name_start(Char c) -> bool { + } + + template +-FMT_CONSTEXPR auto parse_arg_id(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_arg_id(const Char* begin, const Char* end, + Handler&& handler) -> const Char* { + Char c = *begin; + if (c >= '0' && c <= '9') { +@@ -1299,7 +1299,7 @@ FMT_CONSTEXPR auto parse_arg_id(const Char* begin, const Char* end, + handler.on_index(index); + return begin; + } +- if (FMT_OPTIMIZE_SIZE > 1 || !is_name_start(c)) { ++ if (MOZ_FMT_OPTIMIZE_SIZE > 1 || !is_name_start(c)) { + report_error("invalid format string"); + return begin; + } +@@ -1316,13 +1316,13 @@ template struct dynamic_spec_handler { + arg_ref& ref; + arg_id_kind& kind; + +- FMT_CONSTEXPR void on_index(int id) { ++ MOZ_FMT_CONSTEXPR void on_index(int id) { + ref = id; + kind = arg_id_kind::index; + ctx.check_arg_id(id); + ctx.check_dynamic_spec(id); + } +- FMT_CONSTEXPR void on_name(basic_string_view id) { ++ MOZ_FMT_CONSTEXPR void on_name(basic_string_view id) { + ref = id; + kind = arg_id_kind::name; + ctx.check_arg_id(id); +@@ -1336,11 +1336,11 @@ template struct parse_dynamic_spec_result { + + // Parses integer | "{" [arg_id] "}". + template +-FMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end, + int& value, arg_ref& ref, + parse_context& ctx) + -> parse_dynamic_spec_result { +- FMT_ASSERT(begin != end, ""); ++ MOZ_FMT_ASSERT(begin != end, ""); + auto kind = arg_id_kind::none; + if ('0' <= *begin && *begin <= '9') { + int val = parse_nonnegative_int(begin, end, -1); +@@ -1369,7 +1369,7 @@ FMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end, + } + + template +-FMT_CONSTEXPR auto parse_width(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_width(const Char* begin, const Char* end, + format_specs& specs, arg_ref& width_ref, + parse_context& ctx) -> const Char* { + auto result = parse_dynamic_spec(begin, end, specs.width, width_ref, ctx); +@@ -1378,7 +1378,7 @@ FMT_CONSTEXPR auto parse_width(const Char* begin, const Char* end, + } + + template +-FMT_CONSTEXPR auto parse_precision(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_precision(const Char* begin, const Char* end, + format_specs& specs, + arg_ref& precision_ref, + parse_context& ctx) -> const Char* { +@@ -1397,7 +1397,7 @@ enum class state { start, align, sign, hash, zero, width, precision, locale }; + + // Parses standard format specifiers. + template +-FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + dynamic_format_specs& specs, + parse_context& ctx, type arg_type) + -> const Char* { +@@ -1412,7 +1412,7 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + + struct { + state current_state = state::start; +- FMT_CONSTEXPR void operator()(state s, bool valid = true) { ++ MOZ_FMT_CONSTEXPR void operator()(state s, bool valid = true) { + if (current_state >= s || !valid) + report_error("invalid format specifier"); + current_state = s; +@@ -1426,7 +1426,7 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + format_specs& specs; + type arg_type; + +- FMT_CONSTEXPR auto operator()(pres pres_type, int set) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto operator()(pres pres_type, int set) -> const Char* { + if (!in(arg_type, set)) report_error("invalid format specifier"); + specs.set_type(pres_type); + return begin + 1; +@@ -1445,7 +1445,7 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + case '+': + case ' ': + specs.set_sign(c == ' ' ? sign::space : sign::plus); +- FMT_FALLTHROUGH; ++ MOZ_FMT_FALLTHROUGH; + case '-': + enter_state(state::sign, in(arg_type, sint_set | float_set)); + ++begin; +@@ -1484,18 +1484,18 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + ++begin; + break; + case 'd': return parse_presentation_type(pres::dec, integral_set); +- case 'X': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'X': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'x': return parse_presentation_type(pres::hex, integral_set); + case 'o': return parse_presentation_type(pres::oct, integral_set); +- case 'B': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'B': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'b': return parse_presentation_type(pres::bin, integral_set); +- case 'E': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'E': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'e': return parse_presentation_type(pres::exp, float_set); +- case 'F': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'F': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'f': return parse_presentation_type(pres::fixed, float_set); +- case 'G': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'G': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'g': return parse_presentation_type(pres::general, float_set); +- case 'A': specs.set_upper(); FMT_FALLTHROUGH; ++ case 'A': specs.set_upper(); MOZ_FMT_FALLTHROUGH; + case 'a': return parse_presentation_type(pres::hexfloat, float_set); + case 'c': + if (arg_type == type::bool_type) report_error("invalid format specifier"); +@@ -1535,7 +1535,7 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end, + } + + template +-FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char* begin, ++MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto parse_replacement_field(const Char* begin, + const Char* end, + Handler&& handler) + -> const Char* { +@@ -1556,8 +1556,8 @@ FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char* begin, + Handler& handler; + int arg_id; + +- FMT_CONSTEXPR void on_index(int id) { arg_id = handler.on_arg_id(id); } +- FMT_CONSTEXPR void on_name(basic_string_view id) { ++ MOZ_FMT_CONSTEXPR void on_index(int id) { arg_id = handler.on_arg_id(id); } ++ MOZ_FMT_CONSTEXPR void on_name(basic_string_view id) { + arg_id = handler.on_arg_id(id); + } + } adapter = {handler, 0}; +@@ -1582,7 +1582,7 @@ FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char* begin, + } + + template +-FMT_CONSTEXPR void parse_format_string(basic_string_view fmt, ++MOZ_FMT_CONSTEXPR void parse_format_string(basic_string_view fmt, + Handler&& handler) { + auto begin = fmt.data(), end = begin + fmt.size(); + auto p = begin; +@@ -1602,7 +1602,7 @@ FMT_CONSTEXPR void parse_format_string(basic_string_view fmt, + } + + // Checks char specs and returns true iff the presentation type is char-like. +-FMT_CONSTEXPR inline auto check_char_specs(const format_specs& specs) -> bool { ++MOZ_FMT_CONSTEXPR inline auto check_char_specs(const format_specs& specs) -> bool { + auto type = specs.type(); + if (type != presentation_type::none && type != presentation_type::chr && + type != presentation_type::debug) { +@@ -1619,8 +1619,8 @@ FMT_CONSTEXPR inline auto check_char_specs(const format_specs& specs) -> bool { + struct compile_string {}; + + template +-FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769). +-FMT_CONSTEXPR auto invoke_parse(parse_context& ctx) -> const Char* { ++MOZ_FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769). ++MOZ_FMT_CONSTEXPR auto invoke_parse(parse_context& ctx) -> const Char* { + using mapped_type = remove_cvref_t>; + constexpr bool formattable = + std::is_constructible>::value; +@@ -1643,26 +1643,26 @@ class format_string_checker { + + public: + template +- explicit FMT_CONSTEXPR format_string_checker(basic_string_view fmt, ++ explicit MOZ_FMT_CONSTEXPR format_string_checker(basic_string_view fmt, + arg_pack) + : types_{mapped_type_constant::value...}, + named_args_{}, + context_(fmt, NUM_ARGS, types_), + parse_funcs_{&invoke_parse...} { + int arg_index = 0, named_arg_index = 0; +- FMT_APPLY_VARIADIC( ++ MOZ_FMT_APPLY_VARIADIC( + init_static_named_arg(named_args_, arg_index, named_arg_index)); + ignore_unused(arg_index, named_arg_index); + } + +- FMT_CONSTEXPR void on_text(const Char*, const Char*) {} ++ MOZ_FMT_CONSTEXPR void on_text(const Char*, const Char*) {} + +- FMT_CONSTEXPR auto on_arg_id() -> int { return context_.next_arg_id(); } +- FMT_CONSTEXPR auto on_arg_id(int id) -> int { ++ MOZ_FMT_CONSTEXPR auto on_arg_id() -> int { return context_.next_arg_id(); } ++ MOZ_FMT_CONSTEXPR auto on_arg_id(int id) -> int { + context_.check_arg_id(id); + return id; + } +- FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { ++ MOZ_FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { + for (int i = 0; i < NUM_NAMED_ARGS; ++i) { + if (named_args_[i].name == id) return named_args_[i].id; + } +@@ -1670,11 +1670,11 @@ class format_string_checker { + return -1; + } + +- FMT_CONSTEXPR void on_replacement_field(int id, const Char* begin) { ++ MOZ_FMT_CONSTEXPR void on_replacement_field(int id, const Char* begin) { + on_format_specs(id, begin, begin); // Call parse() on empty specs. + } + +- FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin, const Char* end) ++ MOZ_FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin, const Char* end) + -> const Char* { + context_.advance_to(begin); + if (id >= 0 && id < NUM_ARGS) return parse_funcs_[id](context_); +@@ -1682,7 +1682,7 @@ class format_string_checker { + return begin; + } + +- FMT_NORETURN FMT_CONSTEXPR void on_error(const char* message) { ++ MOZ_FMT_NORETURN MOZ_FMT_CONSTEXPR void on_error(const char* message) { + report_error(message); + } + }; +@@ -1700,19 +1700,19 @@ template class buffer { + + protected: + // Don't initialize ptr_ since it is not accessed to save a few cycles. +- FMT_MSC_WARNING(suppress : 26495) +- FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept ++ MOZ_FMT_MSC_WARNING(suppress : 26495) ++ MOZ_FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept + : size_(sz), capacity_(sz), grow_(grow) {} + + constexpr buffer(grow_fun grow, T* p = nullptr, size_t sz = 0, + size_t cap = 0) noexcept + : ptr_(p), size_(sz), capacity_(cap), grow_(grow) {} + +- FMT_CONSTEXPR20 ~buffer() = default; ++ MOZ_FMT_CONSTEXPR20 ~buffer() = default; + buffer(buffer&&) = default; + + /// Sets the buffer data and capacity. +- FMT_CONSTEXPR void set(T* buf_data, size_t buf_capacity) noexcept { ++ MOZ_FMT_CONSTEXPR void set(T* buf_data, size_t buf_capacity) noexcept { + ptr_ = buf_data; + capacity_ = buf_capacity; + } +@@ -1737,15 +1737,15 @@ template class buffer { + constexpr auto capacity() const noexcept -> size_t { return capacity_; } + + /// Returns a pointer to the buffer data (not null-terminated). +- FMT_CONSTEXPR auto data() noexcept -> T* { return ptr_; } +- FMT_CONSTEXPR auto data() const noexcept -> const T* { return ptr_; } ++ MOZ_FMT_CONSTEXPR auto data() noexcept -> T* { return ptr_; } ++ MOZ_FMT_CONSTEXPR auto data() const noexcept -> const T* { return ptr_; } + + /// Clears this buffer. +- FMT_CONSTEXPR void clear() { size_ = 0; } ++ MOZ_FMT_CONSTEXPR void clear() { size_ = 0; } + + // Tries resizing the buffer to contain `count` elements. If T is a POD type + // the new elements may not be initialized. +- FMT_CONSTEXPR void try_resize(size_t count) { ++ MOZ_FMT_CONSTEXPR void try_resize(size_t count) { + try_reserve(count); + size_ = min_of(count, capacity_); + } +@@ -1754,11 +1754,11 @@ template class buffer { + // capacity by a smaller amount than requested but guarantees there is space + // for at least one additional element either by increasing the capacity or by + // flushing the buffer if it is full. +- FMT_CONSTEXPR void try_reserve(size_t new_capacity) { ++ MOZ_FMT_CONSTEXPR void try_reserve(size_t new_capacity) { + if (new_capacity > capacity_) grow_(*this, new_capacity); + } + +- FMT_CONSTEXPR void push_back(const T& value) { ++ MOZ_FMT_CONSTEXPR void push_back(const T& value) { + try_reserve(size_ + 1); + ptr_[size_++] = value; + } +@@ -1766,9 +1766,9 @@ template class buffer { + /// Appends data to the end of the buffer. + template + // Workaround for MSVC2019 to fix error C2893: Failed to specialize function +-// template 'void fmt::v11::detail::buffer::append(const U *,const U *)'. +-#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1940 +- FMT_CONSTEXPR20 ++// template 'void mozilla::fmt::v11::detail::buffer::append(const U *,const U *)'. ++#if !MOZ_FMT_MSC_VERSION || MOZ_FMT_MSC_VERSION >= 1940 ++ MOZ_FMT_CONSTEXPR20 + #endif + void + append(const U* begin, const U* end) { +@@ -1785,11 +1785,11 @@ template class buffer { + } + } + +- template FMT_CONSTEXPR auto operator[](Idx index) -> T& { ++ template MOZ_FMT_CONSTEXPR auto operator[](Idx index) -> T& { + return ptr_[index]; + } + template +- FMT_CONSTEXPR auto operator[](Idx index) const -> const T& { ++ MOZ_FMT_CONSTEXPR auto operator[](Idx index) const -> const T& { + return ptr_[index]; + } + }; +@@ -1808,7 +1808,7 @@ class fixed_buffer_traits { + public: + constexpr explicit fixed_buffer_traits(size_t limit) : limit_(limit) {} + constexpr auto count() const -> size_t { return count_; } +- FMT_CONSTEXPR auto limit(size_t size) -> size_t { ++ MOZ_FMT_CONSTEXPR auto limit(size_t size) -> size_t { + size_t n = limit_ > count_ ? limit_ - count_ : 0; + count_ += size; + return min_of(size, n); +@@ -1823,7 +1823,7 @@ class iterator_buffer : public Traits, public buffer { + enum { buffer_size = 256 }; + T data_[buffer_size]; + +- static FMT_CONSTEXPR void grow(buffer& buf, size_t) { ++ static MOZ_FMT_CONSTEXPR void grow(buffer& buf, size_t) { + if (buf.size() == buffer_size) static_cast(buf).flush(); + } + +@@ -1844,8 +1844,8 @@ class iterator_buffer : public Traits, public buffer { + out_(other.out_) {} + ~iterator_buffer() { + // Don't crash if flush fails during unwinding. +- FMT_TRY { flush(); } +- FMT_CATCH(...) {} ++ MOZ_FMT_TRY { flush(); } ++ MOZ_FMT_CATCH(...) {} + } + + auto out() -> OutputIt { +@@ -1863,7 +1863,7 @@ class iterator_buffer : public fixed_buffer_traits, + enum { buffer_size = 256 }; + T data_[buffer_size]; + +- static FMT_CONSTEXPR void grow(buffer& buf, size_t) { ++ static MOZ_FMT_CONSTEXPR void grow(buffer& buf, size_t) { + if (buf.size() == buf.capacity()) + static_cast(buf).flush(); + } +@@ -1913,7 +1913,7 @@ class container_buffer : public buffer { + private: + using value_type = typename Container::value_type; + +- static FMT_CONSTEXPR void grow(buffer& buf, size_t capacity) { ++ static MOZ_FMT_CONSTEXPR void grow(buffer& buf, size_t capacity) { + auto& self = static_cast(buf); + self.container.resize(capacity); + self.set(&self.container[0], capacity); +@@ -1952,14 +1952,14 @@ template class counting_buffer : public buffer { + T data_[buffer_size]; + size_t count_ = 0; + +- static FMT_CONSTEXPR void grow(buffer& buf, size_t) { ++ static MOZ_FMT_CONSTEXPR void grow(buffer& buf, size_t) { + if (buf.size() != buffer_size) return; + static_cast(buf).count_ += buf.size(); + buf.clear(); + } + + public: +- FMT_CONSTEXPR counting_buffer() : buffer(grow, data_, 0, buffer_size) {} ++ MOZ_FMT_CONSTEXPR counting_buffer() : buffer(grow, data_, 0, buffer_size) {} + + constexpr auto count() const noexcept -> size_t { + return count_ + this->size(); +@@ -1971,22 +1971,22 @@ struct is_back_insert_iterator> : std::true_type {}; + + // An optimized version of std::copy with the output value type (T). + template ::value)> +-FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) ++ MOZ_FMT_ENABLE_IF(is_back_insert_iterator::value)> ++MOZ_FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) + -> OutputIt { + get_container(out).append(begin, end); + return out; + } + + template ::value)> +-FMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt { ++ MOZ_FMT_ENABLE_IF(!is_back_insert_iterator::value)> ++MOZ_FMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt { + while (begin != end) *out++ = static_cast(*begin++); + return out; + } + + template +-FMT_CONSTEXPR auto copy(basic_string_view s, OutputIt out) -> OutputIt { ++MOZ_FMT_CONSTEXPR auto copy(basic_string_view s, OutputIt out) -> OutputIt { + return copy(s.begin(), s.end(), out); + } + +@@ -2002,12 +2002,12 @@ struct is_buffer_appender< + + // Maps an output iterator to a buffer. + template ::value)> ++ MOZ_FMT_ENABLE_IF(!is_buffer_appender::value)> + auto get_buffer(OutputIt out) -> iterator_buffer { + return iterator_buffer(out); + } + template ::value)> ++ MOZ_FMT_ENABLE_IF(is_buffer_appender::value)> + auto get_buffer(OutputIt out) -> buffer& { + return get_container(out); + } +@@ -2043,10 +2043,10 @@ template struct named_arg_value { + + struct custom_tag {}; + +-#if !FMT_BUILTIN_TYPES +-# define FMT_BUILTIN , monostate ++#if !MOZ_FMT_BUILTIN_TYPES ++# define MOZ_FMT_BUILTIN , monostate + #else +-# define FMT_BUILTIN ++# define MOZ_FMT_BUILTIN + #endif + + // A formatting argument value. +@@ -2073,69 +2073,69 @@ template class value { + named_arg_value named_args; + }; + +- constexpr FMT_INLINE value() : no_value() {} +- constexpr FMT_INLINE value(signed char x) : int_value(x) {} +- constexpr FMT_INLINE value(unsigned char x FMT_BUILTIN) : uint_value(x) {} +- constexpr FMT_INLINE value(signed short x) : int_value(x) {} +- constexpr FMT_INLINE value(unsigned short x FMT_BUILTIN) : uint_value(x) {} +- constexpr FMT_INLINE value(int x) : int_value(x) {} +- constexpr FMT_INLINE value(unsigned x FMT_BUILTIN) : uint_value(x) {} +- FMT_CONSTEXPR FMT_INLINE value(long x FMT_BUILTIN) : value(long_type(x)) {} +- FMT_CONSTEXPR FMT_INLINE value(unsigned long x FMT_BUILTIN) ++ constexpr MOZ_FMT_INLINE value() : no_value() {} ++ constexpr MOZ_FMT_INLINE value(signed char x) : int_value(x) {} ++ constexpr MOZ_FMT_INLINE value(unsigned char x MOZ_FMT_BUILTIN) : uint_value(x) {} ++ constexpr MOZ_FMT_INLINE value(signed short x) : int_value(x) {} ++ constexpr MOZ_FMT_INLINE value(unsigned short x MOZ_FMT_BUILTIN) : uint_value(x) {} ++ constexpr MOZ_FMT_INLINE value(int x) : int_value(x) {} ++ constexpr MOZ_FMT_INLINE value(unsigned x MOZ_FMT_BUILTIN) : uint_value(x) {} ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE value(long x MOZ_FMT_BUILTIN) : value(long_type(x)) {} ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE value(unsigned long x MOZ_FMT_BUILTIN) + : value(ulong_type(x)) {} +- constexpr FMT_INLINE value(long long x FMT_BUILTIN) : long_long_value(x) {} +- constexpr FMT_INLINE value(unsigned long long x FMT_BUILTIN) ++ constexpr MOZ_FMT_INLINE value(long long x MOZ_FMT_BUILTIN) : long_long_value(x) {} ++ constexpr MOZ_FMT_INLINE value(unsigned long long x MOZ_FMT_BUILTIN) + : ulong_long_value(x) {} +- FMT_INLINE value(int128_opt x FMT_BUILTIN) : int128_value(x) {} +- FMT_INLINE value(uint128_opt x FMT_BUILTIN) : uint128_value(x) {} +- constexpr FMT_INLINE value(bool x FMT_BUILTIN) : bool_value(x) {} ++ MOZ_FMT_INLINE value(int128_opt x MOZ_FMT_BUILTIN) : int128_value(x) {} ++ MOZ_FMT_INLINE value(uint128_opt x MOZ_FMT_BUILTIN) : uint128_value(x) {} ++ constexpr MOZ_FMT_INLINE value(bool x MOZ_FMT_BUILTIN) : bool_value(x) {} + + template +- constexpr FMT_INLINE value(bitint x FMT_BUILTIN) : long_long_value(x) { ++ constexpr MOZ_FMT_INLINE value(bitint x MOZ_FMT_BUILTIN) : long_long_value(x) { + static_assert(N <= 64, "unsupported _BitInt"); + } + template +- constexpr FMT_INLINE value(ubitint x FMT_BUILTIN) : ulong_long_value(x) { ++ constexpr MOZ_FMT_INLINE value(ubitint x MOZ_FMT_BUILTIN) : ulong_long_value(x) { + static_assert(N <= 64, "unsupported _BitInt"); + } + +- template ::value)> +- constexpr FMT_INLINE value(T x FMT_BUILTIN) : char_value(x) { ++ template ::value)> ++ constexpr MOZ_FMT_INLINE value(T x MOZ_FMT_BUILTIN) : char_value(x) { + static_assert( + std::is_same::value || std::is_same::value, + "mixing character types is disallowed"); + } + +- constexpr FMT_INLINE value(float x FMT_BUILTIN) : float_value(x) {} +- constexpr FMT_INLINE value(double x FMT_BUILTIN) : double_value(x) {} +- FMT_INLINE value(long double x FMT_BUILTIN) : long_double_value(x) {} ++ constexpr MOZ_FMT_INLINE value(float x MOZ_FMT_BUILTIN) : float_value(x) {} ++ constexpr MOZ_FMT_INLINE value(double x MOZ_FMT_BUILTIN) : double_value(x) {} ++ MOZ_FMT_INLINE value(long double x MOZ_FMT_BUILTIN) : long_double_value(x) {} + +- FMT_CONSTEXPR FMT_INLINE value(char_type* x FMT_BUILTIN) { ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE value(char_type* x MOZ_FMT_BUILTIN) { + string.data = x; + if (is_constant_evaluated()) string.size = 0; + } +- FMT_CONSTEXPR FMT_INLINE value(const char_type* x FMT_BUILTIN) { ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE value(const char_type* x MOZ_FMT_BUILTIN) { + string.data = x; + if (is_constant_evaluated()) string.size = 0; + } + template , +- FMT_ENABLE_IF(!std::is_pointer::value)> +- FMT_CONSTEXPR value(const T& x FMT_BUILTIN) { ++ MOZ_FMT_ENABLE_IF(!std::is_pointer::value)> ++ MOZ_FMT_CONSTEXPR value(const T& x MOZ_FMT_BUILTIN) { + static_assert(std::is_same::value, + "mixing character types is disallowed"); + auto sv = to_string_view(x); + string.data = sv.data(); + string.size = sv.size(); + } +- FMT_INLINE value(void* x FMT_BUILTIN) : pointer(x) {} +- FMT_INLINE value(const void* x FMT_BUILTIN) : pointer(x) {} +- FMT_INLINE value(volatile void* x FMT_BUILTIN) ++ MOZ_FMT_INLINE value(void* x MOZ_FMT_BUILTIN) : pointer(x) {} ++ MOZ_FMT_INLINE value(const void* x MOZ_FMT_BUILTIN) : pointer(x) {} ++ MOZ_FMT_INLINE value(volatile void* x MOZ_FMT_BUILTIN) + : pointer(const_cast(x)) {} +- FMT_INLINE value(const volatile void* x FMT_BUILTIN) ++ MOZ_FMT_INLINE value(const volatile void* x MOZ_FMT_BUILTIN) + : pointer(const_cast(x)) {} +- FMT_INLINE value(nullptr_t) : pointer(nullptr) {} ++ MOZ_FMT_INLINE value(nullptr_t) : pointer(nullptr) {} + +- template ::value || ++ template ::value || + std::is_member_pointer::value)> + value(const T&) { + // Formatting of arbitrary pointers is disallowed. If you want to format a +@@ -2145,24 +2145,24 @@ template class value { + "formatting of non-void pointers is disallowed"); + } + +- template ::value)> ++ template ::value)> + value(const T& x) : value(format_as(x)) {} +- template ::value)> ++ template ::value)> + value(const T& x) : value(formatter::format_as(x)) {} + +- template ::value)> ++ template ::value)> + value(const T& named_arg) : value(named_arg.value) {} + + template ::value || !FMT_BUILTIN_TYPES)> +- FMT_CONSTEXPR20 FMT_INLINE value(T& x) : value(x, custom_tag()) {} ++ MOZ_FMT_ENABLE_IF(use_formatter::value || !MOZ_FMT_BUILTIN_TYPES)> ++ MOZ_FMT_CONSTEXPR20 MOZ_FMT_INLINE value(T& x) : value(x, custom_tag()) {} + +- FMT_ALWAYS_INLINE value(const named_arg_info* args, size_t size) ++ MOZ_FMT_ALWAYS_INLINE value(const named_arg_info* args, size_t size) + : named_args{args, size} {} + + private: +- template ())> +- FMT_CONSTEXPR value(T& x, custom_tag) { ++ template ())> ++ MOZ_FMT_CONSTEXPR value(T& x, custom_tag) { + using value_type = remove_const_t; + // T may overload operator& e.g. std::vector::reference in libc++. + if (!is_constant_evaluated()) { +@@ -2178,8 +2178,8 @@ template class value { + custom.format = format_custom>; + } + +- template ())> +- FMT_CONSTEXPR value(const T&, custom_tag) { ++ template ())> ++ MOZ_FMT_CONSTEXPR value(const T&, custom_tag) { + // Cannot format an argument; to make type T formattable provide a + // formatter specialization: https://fmt.dev/latest/api.html#udt. + type_is_unformattable_for _; +@@ -2216,24 +2216,24 @@ struct is_output_iterator< + void_t&>()++ = std::declval())>> + : std::true_type {}; + +-#ifndef FMT_USE_LOCALE +-# define FMT_USE_LOCALE (FMT_OPTIMIZE_SIZE <= 1) ++#ifndef MOZ_FMT_USE_LOCALE ++# define MOZ_FMT_USE_LOCALE (MOZ_FMT_OPTIMIZE_SIZE <= 1) + #endif + + // A type-erased reference to an std::locale to avoid a heavy include. + struct locale_ref { +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + private: + const void* locale_; // A type-erased pointer to std::locale. + + public: + constexpr locale_ref() : locale_(nullptr) {} + +- template ++ template + locale_ref(const Locale& loc); + + inline explicit operator bool() const noexcept { return locale_ != nullptr; } +-#endif // FMT_USE_LOCALE ++#endif // MOZ_FMT_USE_LOCALE + + template auto get() const -> Locale; + }; +@@ -2266,10 +2266,10 @@ struct named_arg_store { + named_arg_info named_args[NUM_NAMED_ARGS]; + + template +- FMT_CONSTEXPR FMT_ALWAYS_INLINE named_arg_store(T&... values) ++ MOZ_FMT_CONSTEXPR MOZ_FMT_ALWAYS_INLINE named_arg_store(T&... values) + : args{{named_args, NUM_NAMED_ARGS}, values...} { + int arg_index = 0, named_arg_index = 0; +- FMT_APPLY_VARIADIC( ++ MOZ_FMT_APPLY_VARIADIC( + init_named_arg(named_args, arg_index, named_arg_index, values)); + } + +@@ -2309,7 +2309,7 @@ template struct native_formatter { + public: + using nonlocking = void; + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + if (ctx.begin() == ctx.end() || *ctx.begin() == '}') return ctx.begin(); + auto end = parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, TYPE); + if (const_check(TYPE == type::char_type)) check_char_specs(specs_); +@@ -2317,15 +2317,15 @@ template struct native_formatter { + } + + template +- FMT_CONSTEXPR void set_debug_format(bool set = true) { ++ MOZ_FMT_CONSTEXPR void set_debug_format(bool set = true) { + specs_.set_type(set ? presentation_type::debug : presentation_type::none); + } + +- FMT_PRAGMA_CLANG(diagnostic ignored "-Wundefined-inline") ++ MOZ_FMT_PRAGMA_CLANG(diagnostic ignored "-Wundefined-inline") + template +- FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const ++ MOZ_FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const + -> decltype(ctx.out()); + }; + +@@ -2336,19 +2336,19 @@ template + struct locking>::nonlocking>> + : std::false_type {}; + +-template FMT_CONSTEXPR inline auto is_locking() -> bool { ++template MOZ_FMT_CONSTEXPR inline auto is_locking() -> bool { + return locking::value; + } + template +-FMT_CONSTEXPR inline auto is_locking() -> bool { ++MOZ_FMT_CONSTEXPR inline auto is_locking() -> bool { + return locking::value || is_locking(); + } + +-FMT_API void vformat_to(buffer& buf, string_view fmt, format_args args, ++MOZ_FMT_API void vformat_to(buffer& buf, string_view fmt, format_args args, + locale_ref loc = {}); + +-#if FMT_WIN32 +-FMT_API void vprint_mojibake(FILE*, string_view, format_args, bool); ++#if MOZ_FMT_WIN32 ++MOZ_FMT_API void vprint_mojibake(FILE*, string_view, format_args, bool); + #else // format_args is passed by reference since it is defined later. + inline void vprint_mojibake(FILE*, string_view, const format_args&, bool) {} + #endif +@@ -2357,7 +2357,7 @@ inline void vprint_mojibake(FILE*, string_view, const format_args&, bool) {} + // The main public API. + + template +-FMT_CONSTEXPR void parse_context::do_check_arg_id(int arg_id) { ++MOZ_FMT_CONSTEXPR void parse_context::do_check_arg_id(int arg_id) { + // Argument id is only checked at compile time during parsing because + // formatting has its own validation. + if (detail::is_constant_evaluated() && use_constexpr_cast) { +@@ -2367,13 +2367,13 @@ FMT_CONSTEXPR void parse_context::do_check_arg_id(int arg_id) { + } + + template +-FMT_CONSTEXPR void parse_context::check_dynamic_spec(int arg_id) { ++MOZ_FMT_CONSTEXPR void parse_context::check_dynamic_spec(int arg_id) { + using detail::compile_parse_context; + if (detail::is_constant_evaluated() && use_constexpr_cast) + static_cast*>(this)->check_dynamic_spec(arg_id); + } + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + // An output iterator that appends to a buffer. It is used instead of + // back_insert_iterator to reduce symbol sizes and avoid dependency. +@@ -2384,15 +2384,15 @@ template class basic_appender { + public: + using container_type = detail::buffer; + +- FMT_CONSTEXPR basic_appender(detail::buffer& buf) : container(&buf) {} ++ MOZ_FMT_CONSTEXPR basic_appender(detail::buffer& buf) : container(&buf) {} + +- FMT_CONSTEXPR20 auto operator=(T c) -> basic_appender& { ++ MOZ_FMT_CONSTEXPR20 auto operator=(T c) -> basic_appender& { + container->push_back(c); + return *this; + } +- FMT_CONSTEXPR20 auto operator*() -> basic_appender& { return *this; } +- FMT_CONSTEXPR20 auto operator++() -> basic_appender& { return *this; } +- FMT_CONSTEXPR20 auto operator++(int) -> basic_appender { return *this; } ++ MOZ_FMT_CONSTEXPR20 auto operator*() -> basic_appender& { return *this; } ++ MOZ_FMT_CONSTEXPR20 auto operator++() -> basic_appender& { return *this; } ++ MOZ_FMT_CONSTEXPR20 auto operator++(int) -> basic_appender { return *this; } + }; + + // A formatting argument. Context is a template parameter for the compiled API +@@ -2437,7 +2437,7 @@ template class basic_format_arg { + * `vis(value)` will be called with the value of type `double`. + */ + template +- FMT_CONSTEXPR FMT_INLINE auto visit(Visitor&& vis) const -> decltype(vis(0)) { ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto visit(Visitor&& vis) const -> decltype(vis(0)) { + using detail::map; + switch (type_) { + case detail::type::none_type: break; +@@ -2475,8 +2475,8 @@ template class basic_format_arg { + * should only be used as a parameter type in type-erased functions such as + * `vformat`: + * +- * void vlog(fmt::string_view fmt, fmt::format_args args); // OK +- * fmt::format_args args = fmt::make_format_args(); // Dangling reference ++ * void vlog(mozilla::fmt::string_view fmt, mozilla::fmt::format_args args); // OK ++ * mozilla::fmt::format_args args = mozilla::fmt::make_format_args(); // Dangling reference + */ + template class basic_format_args { + private: +@@ -2502,7 +2502,7 @@ template class basic_format_args { + return (desc_ & detail::has_named_args_bit) != 0; + } + +- FMT_CONSTEXPR auto type(int index) const -> detail::type { ++ MOZ_FMT_CONSTEXPR auto type(int index) const -> detail::type { + int shift = index * detail::packed_arg_bits; + unsigned mask = (1 << detail::packed_arg_bits) - 1; + return static_cast((desc_ >> shift) & mask); +@@ -2519,14 +2519,14 @@ template class basic_format_args { + + /// Constructs a `basic_format_args` object from `format_arg_store`. + template +- constexpr FMT_ALWAYS_INLINE basic_format_args( ++ MOZ_FMT_ENABLE_IF(NUM_ARGS <= detail::max_packed_args)> ++ constexpr MOZ_FMT_ALWAYS_INLINE basic_format_args( + const store& s) + : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +detail::has_named_args_bit : 0)), + values_(s.args) {} + + template detail::max_packed_args)> ++ MOZ_FMT_ENABLE_IF(NUM_ARGS > detail::max_packed_args)> + constexpr basic_format_args(const store& s) + : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +detail::has_named_args_bit : 0)), + args_(s.args) {} +@@ -2539,7 +2539,7 @@ template class basic_format_args { + args_(args) {} + + /// Returns the argument with the specified id. +- FMT_CONSTEXPR auto get(int id) const -> format_arg { ++ MOZ_FMT_CONSTEXPR auto get(int id) const -> format_arg { + auto arg = format_arg(); + if (!is_packed()) { + if (id < max_size()) arg = args_[id]; +@@ -2558,7 +2558,7 @@ template class basic_format_args { + } + + template +- FMT_CONSTEXPR auto get_id(basic_string_view name) const -> int { ++ MOZ_FMT_CONSTEXPR auto get_id(basic_string_view name) const -> int { + if (!has_named_args()) return -1; + const auto& named_args = + (is_packed() ? values_[-1] : args_[-1].value_).named_args; +@@ -2587,32 +2587,32 @@ class context : private detail::locale_ref { + + using iterator = appender; + using format_arg = basic_format_arg; +- using parse_context_type FMT_DEPRECATED = parse_context<>; +- template using formatter_type FMT_DEPRECATED = formatter; +- enum { builtin_types = FMT_BUILTIN_TYPES }; ++ using parse_context_type MOZ_FMT_DEPRECATED = parse_context<>; ++ template using formatter_type MOZ_FMT_DEPRECATED = formatter; ++ enum { builtin_types = MOZ_FMT_BUILTIN_TYPES }; + + /// Constructs a `context` object. References to the arguments are stored + /// in the object so make sure they have appropriate lifetimes. +- FMT_CONSTEXPR context(iterator out, format_args args, ++ MOZ_FMT_CONSTEXPR context(iterator out, format_args args, + detail::locale_ref loc = {}) + : locale_ref(loc), out_(out), args_(args) {} + context(context&&) = default; + context(const context&) = delete; + void operator=(const context&) = delete; + +- FMT_CONSTEXPR auto arg(int id) const -> format_arg { return args_.get(id); } ++ MOZ_FMT_CONSTEXPR auto arg(int id) const -> format_arg { return args_.get(id); } + inline auto arg(string_view name) -> format_arg { return args_.get(name); } +- FMT_CONSTEXPR auto arg_id(string_view name) -> int { ++ MOZ_FMT_CONSTEXPR auto arg_id(string_view name) -> int { + return args_.get_id(name); + } + + // Returns an iterator to the beginning of the output range. +- FMT_CONSTEXPR auto out() -> iterator { return out_; } ++ MOZ_FMT_CONSTEXPR auto out() -> iterator { return out_; } + + // Advances the begin iterator to `it`. +- FMT_CONSTEXPR void advance_to(iterator) {} ++ MOZ_FMT_CONSTEXPR void advance_to(iterator) {} + +- FMT_CONSTEXPR auto locale() -> detail::locale_ref { return *this; } ++ MOZ_FMT_CONSTEXPR auto locale() -> detail::locale_ref { return *this; } + }; + + template struct runtime_format_string { +@@ -2625,7 +2625,7 @@ template struct runtime_format_string { + * **Example**: + * + * // Check format string at runtime instead of compile-time. +- * fmt::print(fmt::runtime("{:d}"), "I am not a number"); ++ * mozilla::fmt::print(mozilla::fmt::runtime("{:d}"), "I am not a number"); + */ + inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } + +@@ -2647,43 +2647,43 @@ template struct fstring { + + // Reports a compile-time error if S is not a valid format string for T. + template +- FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const char (&s)[N]) : str(s, N - 1) { ++ MOZ_FMT_CONSTEVAL MOZ_FMT_ALWAYS_INLINE fstring(const char (&s)[N]) : str(s, N - 1) { + using namespace detail; + static_assert(count<(std::is_base_of>::value && + std::is_reference::value)...>() == 0, + "passing views as lvalues is disallowed"); +- if (FMT_USE_CONSTEVAL) parse_format_string(s, checker(s, arg_pack())); +-#ifdef FMT_ENFORCE_COMPILE_STRING ++ if (MOZ_FMT_USE_CONSTEVAL) parse_format_string(s, checker(s, arg_pack())); ++#ifdef MOZ_FMT_ENFORCE_COMPILE_STRING + static_assert( +- FMT_USE_CONSTEVAL && sizeof(s) != 0, +- "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING"); ++ MOZ_FMT_USE_CONSTEVAL && sizeof(s) != 0, ++ "MOZ_FMT_ENFORCE_COMPILE_STRING requires format strings to use MOZ_FMT_STRING"); + #endif + } + template ::value)> +- FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S& s) : str(s) { ++ MOZ_FMT_ENABLE_IF(std::is_convertible::value)> ++ MOZ_FMT_CONSTEVAL MOZ_FMT_ALWAYS_INLINE fstring(const S& s) : str(s) { + auto sv = string_view(str); +- if (FMT_USE_CONSTEVAL) ++ if (MOZ_FMT_USE_CONSTEVAL) + detail::parse_format_string(sv, checker(sv, arg_pack())); +-#ifdef FMT_ENFORCE_COMPILE_STRING ++#ifdef MOZ_FMT_ENFORCE_COMPILE_STRING + static_assert( +- FMT_USE_CONSTEVAL && sizeof(s) != 0, +- "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING"); ++ MOZ_FMT_USE_CONSTEVAL && sizeof(s) != 0, ++ "MOZ_FMT_ENFORCE_COMPILE_STRING requires format strings to use MOZ_FMT_STRING"); + #endif + } + template ::value&& ++ MOZ_FMT_ENABLE_IF(std::is_base_of::value&& + std::is_same::value)> +- FMT_ALWAYS_INLINE fstring(const S&) : str(S()) { +- FMT_CONSTEXPR auto sv = string_view(S()); +- FMT_CONSTEXPR int ignore = ++ MOZ_FMT_ALWAYS_INLINE fstring(const S&) : str(S()) { ++ MOZ_FMT_CONSTEXPR auto sv = string_view(S()); ++ MOZ_FMT_CONSTEXPR int ignore = + (parse_format_string(sv, checker(sv, arg_pack())), 0); + detail::ignore_unused(ignore); + } + fstring(runtime_format_string<> fmt) : str(fmt.str) {} + + // Returning by reference generates better code in debug mode. +- FMT_ALWAYS_INLINE operator const string_view&() const { return str; } ++ MOZ_FMT_ALWAYS_INLINE operator const string_view&() const { return str; } + auto get() const -> string_view { return str; } + }; + +@@ -2699,7 +2699,7 @@ concept formattable = is_formattable, Char>::value; + #endif + + template +-using has_formatter FMT_DEPRECATED = std::is_constructible>; ++using has_formatter MOZ_FMT_DEPRECATED = std::is_constructible>; + + // A formatter specialization for natively supported types. + template +@@ -2720,10 +2720,10 @@ template (), + unsigned long long DESC = detail::make_descriptor()> +-constexpr FMT_ALWAYS_INLINE auto make_format_args(T&... args) ++constexpr MOZ_FMT_ALWAYS_INLINE auto make_format_args(T&... args) + -> detail::format_arg_store { + // Suppress warnings for pathological types convertible to detail::value. +- FMT_PRAGMA_GCC(diagnostic ignored "-Wconversion") ++ MOZ_FMT_PRAGMA_GCC(diagnostic ignored "-Wconversion") + return {{args...}}; + } + +@@ -2739,7 +2739,7 @@ using vargs = + * + * **Example**: + * +- * fmt::print("The answer is {answer}.", fmt::arg("answer", 42)); ++ * mozilla::fmt::print("The answer is {answer}.", mozilla::fmt::arg("answer", 42)); + */ + template + inline auto arg(const Char* name, const T& arg) -> detail::named_arg { +@@ -2748,7 +2748,7 @@ inline auto arg(const Char* name, const T& arg) -> detail::named_arg { + + /// Formats a string and writes the output to `out`. + template , ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator, + char>::value)> + auto vformat_to(OutputIt&& out, string_view fmt, format_args args) + -> remove_cvref_t { +@@ -2765,12 +2765,12 @@ auto vformat_to(OutputIt&& out, string_view fmt, format_args args) + * **Example**: + * + * auto out = std::vector(); +- * fmt::format_to(std::back_inserter(out), "{}", 42); ++ * mozilla::fmt::format_to(std::back_inserter(out), "{}", 42); + */ + template , ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator, + char>::value)> +-FMT_INLINE auto format_to(OutputIt&& out, format_string fmt, T&&... args) ++MOZ_FMT_INLINE auto format_to(OutputIt&& out, format_string fmt, T&&... args) + -> remove_cvref_t { + return vformat_to(out, fmt.str, vargs{{args...}}); + } +@@ -2783,7 +2783,7 @@ template struct format_to_n_result { + }; + + template ::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> + auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) + -> format_to_n_result { + using traits = detail::fixed_buffer_traits; +@@ -2799,8 +2799,8 @@ auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) + * range. `format_to_n` does not append a terminating null character. + */ + template ::value)> +-FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string fmt, ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> ++MOZ_FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string fmt, + T&&... args) -> format_to_n_result { + return vformat_to_n(out, n, fmt.str, vargs{{args...}}); + } +@@ -2811,7 +2811,7 @@ struct format_to_result { + /// Specifies if the output was truncated. + bool truncated; + +- FMT_CONSTEXPR operator char*() const { ++ MOZ_FMT_CONSTEXPR operator char*() const { + // Report truncation to prevent silent data loss. + if (truncated) report_error("output is truncated"); + return out; +@@ -2826,7 +2826,7 @@ auto vformat_to(char (&out)[N], string_view fmt, format_args args) + } + + template +-FMT_INLINE auto format_to(char (&out)[N], format_string fmt, T&&... args) ++MOZ_FMT_INLINE auto format_to(char (&out)[N], format_string fmt, T&&... args) + -> format_to_result { + auto result = vformat_to_n(out, N, fmt.str, vargs{{args...}}); + return {result.out, result.size > N}; +@@ -2834,17 +2834,17 @@ FMT_INLINE auto format_to(char (&out)[N], format_string fmt, T&&... args) + + /// Returns the number of chars in the output of `format(fmt, args...)`. + template +-FMT_NODISCARD FMT_INLINE auto formatted_size(format_string fmt, ++MOZ_FMT_NODISCARD MOZ_FMT_INLINE auto formatted_size(format_string fmt, + T&&... args) -> size_t { + auto buf = detail::counting_buffer<>(); + detail::vformat_to(buf, fmt.str, vargs{{args...}}, {}); + return buf.count(); + } + +-FMT_API void vprint(string_view fmt, format_args args); +-FMT_API void vprint(FILE* f, string_view fmt, format_args args); +-FMT_API void vprintln(FILE* f, string_view fmt, format_args args); +-FMT_API void vprint_buffered(FILE* f, string_view fmt, format_args args); ++MOZ_FMT_API void vprint(string_view fmt, format_args args); ++MOZ_FMT_API void vprint(FILE* f, string_view fmt, format_args args); ++MOZ_FMT_API void vprintln(FILE* f, string_view fmt, format_args args); ++MOZ_FMT_API void vprint_buffered(FILE* f, string_view fmt, format_args args); + + /** + * Formats `args` according to specifications in `fmt` and writes the output +@@ -2852,10 +2852,10 @@ FMT_API void vprint_buffered(FILE* f, string_view fmt, format_args args); + * + * **Example**: + * +- * fmt::print("The answer is {}.", 42); ++ * mozilla::fmt::print("The answer is {}.", 42); + */ + template +-FMT_INLINE void print(format_string fmt, T&&... args) { ++MOZ_FMT_INLINE void print(format_string fmt, T&&... args) { + vargs va = {{args...}}; + if (!detail::use_utf8) + return detail::vprint_mojibake(stdout, fmt.str, va, false); +@@ -2869,10 +2869,10 @@ FMT_INLINE void print(format_string fmt, T&&... args) { + * + * **Example**: + * +- * fmt::print(stderr, "Don't {}!", "panic"); ++ * mozilla::fmt::print(stderr, "Don't {}!", "panic"); + */ + template +-FMT_INLINE void print(FILE* f, format_string fmt, T&&... args) { ++MOZ_FMT_INLINE void print(FILE* f, format_string fmt, T&&... args) { + vargs va = {{args...}}; + if (!detail::use_utf8) return detail::vprint_mojibake(f, fmt.str, va, false); + return detail::is_locking() ? vprint_buffered(f, fmt.str, va) +@@ -2882,7 +2882,7 @@ FMT_INLINE void print(FILE* f, format_string fmt, T&&... args) { + /// Formats `args` according to specifications in `fmt` and writes the output + /// to the file `f` followed by a newline. + template +-FMT_INLINE void println(FILE* f, format_string fmt, T&&... args) { ++MOZ_FMT_INLINE void println(FILE* f, format_string fmt, T&&... args) { + vargs va = {{args...}}; + return detail::use_utf8 ? vprintln(f, fmt.str, va) + : detail::vprint_mojibake(f, fmt.str, va, true); +@@ -2891,16 +2891,16 @@ FMT_INLINE void println(FILE* f, format_string fmt, T&&... args) { + /// Formats `args` according to specifications in `fmt` and writes the output + /// to `stdout` followed by a newline. + template +-FMT_INLINE void println(format_string fmt, T&&... args) { +- return fmt::println(stdout, fmt, static_cast(args)...); ++MOZ_FMT_INLINE void println(format_string fmt, T&&... args) { ++ return mozilla::fmt::println(stdout, fmt, static_cast(args)...); + } + +-FMT_END_EXPORT +-FMT_PRAGMA_CLANG(diagnostic pop) +-FMT_PRAGMA_GCC(pop_options) +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_PRAGMA_CLANG(diagnostic pop) ++MOZ_FMT_PRAGMA_GCC(pop_options) ++MOZ_FMT_END_NAMESPACE + +-#ifdef FMT_HEADER_ONLY ++#ifdef MOZ_FMT_HEADER_ONLY + # include "format.h" + #endif +-#endif // FMT_BASE_H_ ++#endif // MOZ_FMT_BASE_H_ +diff --git a/third_party/fmt/include/fmt/chrono.h b/third_party/fmt/include/fmt/chrono.h +index cc08ff8..2df2e06 100644 +--- a/third_party/fmt/include/fmt/chrono.h ++++ b/third_party/fmt/include/fmt/chrono.h +@@ -5,10 +5,10 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_CHRONO_H_ +-#define FMT_CHRONO_H_ ++#ifndef MOZ_FMT_CHRONO_H_ ++#define MOZ_FMT_CHRONO_H_ + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include + # include + # include // std::isfinite +@@ -22,7 +22,7 @@ + + #include "format.h" + +-namespace fmt_detail { ++namespace mozilla::fmt_detail { + struct time_zone { + template + auto to_sys(T) +@@ -35,15 +35,15 @@ template inline auto current_zone(T...) -> time_zone* { + } + + template inline void _tzset(T...) {} +-} // namespace fmt_detail ++} // namespace mozilla::fmt_detail + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + + // Enable safe chrono durations, unless explicitly disabled. +-#ifndef FMT_SAFE_DURATION_CAST +-# define FMT_SAFE_DURATION_CAST 1 ++#ifndef MOZ_FMT_SAFE_DURATION_CAST ++# define MOZ_FMT_SAFE_DURATION_CAST 1 + #endif +-#if FMT_SAFE_DURATION_CAST ++#if MOZ_FMT_SAFE_DURATION_CAST + + // For conversion between std::chrono::durations without undefined + // behaviour or erroneous results. +@@ -54,10 +54,10 @@ FMT_BEGIN_NAMESPACE + namespace safe_duration_cast { + + template ::value && ++ MOZ_FMT_ENABLE_IF(!std::is_same::value && + std::numeric_limits::is_signed == + std::numeric_limits::is_signed)> +-FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) ++MOZ_FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + -> To { + ec = 0; + using F = std::numeric_limits; +@@ -82,10 +82,10 @@ FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + /// Converts From to To, without loss. If the dynamic value of from + /// can't be converted to To without loss, ec is set. + template ::value && ++ MOZ_FMT_ENABLE_IF(!std::is_same::value && + std::numeric_limits::is_signed != + std::numeric_limits::is_signed)> +-FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) ++MOZ_FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + -> To { + ec = 0; + using F = std::numeric_limits; +@@ -95,7 +95,7 @@ FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + + if (detail::const_check(F::is_signed && !T::is_signed)) { + // From may be negative, not allowed! +- if (fmt::detail::is_negative(from)) { ++ if (mozilla::fmt::detail::is_negative(from)) { + ec = 1; + return {}; + } +@@ -117,8 +117,8 @@ FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + } + + template ::value)> +-FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> ++MOZ_FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + -> To { + ec = 0; + return from; +@@ -139,8 +139,8 @@ FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec) + */ + // clang-format on + template ::value)> +-FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { ++ MOZ_FMT_ENABLE_IF(!std::is_same::value)> ++MOZ_FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { + ec = 0; + using T = std::numeric_limits; + static_assert(std::is_floating_point::value, "From must be floating"); +@@ -161,8 +161,8 @@ FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { + } // function + + template ::value)> +-FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> ++MOZ_FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { + ec = 0; + static_assert(std::is_floating_point::value, "From must be floating"); + return from; +@@ -170,8 +170,8 @@ FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To { + + /// Safe duration_cast between floating point durations + template ::value), +- FMT_ENABLE_IF(std::is_floating_point::value)> ++ MOZ_FMT_ENABLE_IF(std::is_floating_point::value), ++ MOZ_FMT_ENABLE_IF(std::is_floating_point::value)> + auto safe_duration_cast(std::chrono::duration from, + int& ec) -> To { + using From = std::chrono::duration; +@@ -250,14 +250,14 @@ auto safe_duration_cast(std::chrono::duration from, + namespace detail { + + // Check if std::chrono::utc_time is available. +-#ifdef FMT_USE_UTC_TIME ++#ifdef MOZ_FMT_USE_UTC_TIME + // Use the provided definition. + #elif defined(__cpp_lib_chrono) +-# define FMT_USE_UTC_TIME (__cpp_lib_chrono >= 201907L) ++# define MOZ_FMT_USE_UTC_TIME (__cpp_lib_chrono >= 201907L) + #else +-# define FMT_USE_UTC_TIME 0 ++# define MOZ_FMT_USE_UTC_TIME 0 + #endif +-#if FMT_USE_UTC_TIME ++#if MOZ_FMT_USE_UTC_TIME + using utc_clock = std::chrono::utc_clock; + #else + struct utc_clock { +@@ -266,14 +266,14 @@ struct utc_clock { + #endif + + // Check if std::chrono::local_time is available. +-#ifdef FMT_USE_LOCAL_TIME ++#ifdef MOZ_FMT_USE_LOCAL_TIME + // Use the provided definition. + #elif defined(__cpp_lib_chrono) +-# define FMT_USE_LOCAL_TIME (__cpp_lib_chrono >= 201907L) ++# define MOZ_FMT_USE_LOCAL_TIME (__cpp_lib_chrono >= 201907L) + #else +-# define FMT_USE_LOCAL_TIME 0 ++# define MOZ_FMT_USE_LOCAL_TIME 0 + #endif +-#if FMT_USE_LOCAL_TIME ++#if MOZ_FMT_USE_LOCAL_TIME + using local_t = std::chrono::local_t; + #else + struct local_t {}; +@@ -293,11 +293,11 @@ using local_time = std::chrono::time_point; + namespace detail { + + // Prevents expansion of a preceding token as a function-style macro. +-// Usage: f FMT_NOMACRO() +-#define FMT_NOMACRO ++// Usage: f MOZ_FMT_NOMACRO() ++#define MOZ_FMT_NOMACRO + + template struct null {}; +-inline auto localtime_r FMT_NOMACRO(...) -> null<> { return null<>(); } ++inline auto localtime_r MOZ_FMT_NOMACRO(...) -> null<> { return null<>(); } + inline auto localtime_s(...) -> null<> { return null<>(); } + inline auto gmtime_r(...) -> null<> { return null<>(); } + inline auto gmtime_s(...) -> null<> { return null<>(); } +@@ -349,16 +349,16 @@ template struct codecvt_result { + template + void write_codecvt(codecvt_result& out, string_view in, + const std::locale& loc) { +- FMT_PRAGMA_CLANG(diagnostic push) +- FMT_PRAGMA_CLANG(diagnostic ignored "-Wdeprecated") ++ MOZ_FMT_PRAGMA_CLANG(diagnostic push) ++ MOZ_FMT_PRAGMA_CLANG(diagnostic ignored "-Wdeprecated") + auto& f = std::use_facet>(loc); +- FMT_PRAGMA_CLANG(diagnostic pop) ++ MOZ_FMT_PRAGMA_CLANG(diagnostic pop) + auto mb = std::mbstate_t(); + const char* from_next = nullptr; + auto result = f.in(mb, in.begin(), in.end(), from_next, std::begin(out.buf), + std::end(out.buf), out.end); + if (result != std::codecvt_base::ok) +- FMT_THROW(format_error("failed to format time")); ++ MOZ_FMT_THROW(format_error("failed to format time")); + } + + template +@@ -367,7 +367,7 @@ auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc) + if (detail::use_utf8 && loc != get_classic_locale()) { + // char16_t and char32_t codecvts are broken in MSVC (linkage errors) and + // gcc-4. +-#if FMT_MSC_VERSION != 0 || \ ++#if MOZ_FMT_MSC_VERSION != 0 || \ + (defined(__GLIBCXX__) && \ + (!defined(_GLIBCXX_USE_DUAL_ABI) || _GLIBCXX_USE_DUAL_ABI == 0)) + // The _GLIBCXX_USE_DUAL_ABI macro is always defined in libstdc++ from gcc-5 +@@ -384,14 +384,14 @@ auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc) + auto u = + to_utf8>(); + if (!u.convert({unit.buf, to_unsigned(unit.end - unit.buf)})) +- FMT_THROW(format_error("failed to format time")); ++ MOZ_FMT_THROW(format_error("failed to format time")); + return copy(u.c_str(), u.c_str() + u.size(), out); + } + return copy(in.data(), in.data() + in.size(), out); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(!std::is_same::value)> + auto write_tm_str(OutputIt out, string_view sv, const std::locale& loc) + -> OutputIt { + codecvt_result unit; +@@ -400,7 +400,7 @@ auto write_tm_str(OutputIt out, string_view sv, const std::locale& loc) + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> + auto write_tm_str(OutputIt out, string_view sv, const std::locale& loc) + -> OutputIt { + return write_encoded_tm_str(out, sv, loc); +@@ -414,11 +414,11 @@ inline void do_write(buffer& buf, const std::tm& time, + os.imbue(loc); + const auto& facet = std::use_facet>(loc); + auto end = facet.put(os, os, Char(' '), &time, format, modifier); +- if (end.failed()) FMT_THROW(format_error("failed to format time")); ++ if (end.failed()) MOZ_FMT_THROW(format_error("failed to format time")); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(!std::is_same::value)> + auto write(OutputIt out, const std::tm& time, const std::locale& loc, + char format, char modifier = 0) -> OutputIt { + auto&& buf = get_buffer(out); +@@ -427,7 +427,7 @@ auto write(OutputIt out, const std::tm& time, const std::locale& loc, + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> + auto write(OutputIt out, const std::tm& time, const std::locale& loc, + char format, char modifier = 0) -> OutputIt { + auto&& buf = basic_memory_buffer(); +@@ -445,15 +445,15 @@ struct is_same_arithmetic_type + }; + + inline void throw_duration_error() { +- FMT_THROW(format_error("cannot format duration")); ++ MOZ_FMT_THROW(format_error("cannot format duration")); + } + + // Cast one integral duration to another with an overflow check. + template ::value&& ++ MOZ_FMT_ENABLE_IF(std::is_integral::value&& + std::is_integral::value)> + auto duration_cast(std::chrono::duration from) -> To { +-#if !FMT_SAFE_DURATION_CAST ++#if !MOZ_FMT_SAFE_DURATION_CAST + return std::chrono::duration_cast(from); + #else + // The conversion factor: to.count() == factor * from.count(). +@@ -485,10 +485,10 @@ auto duration_cast(std::chrono::duration from) -> To { + } + + template ::value&& ++ MOZ_FMT_ENABLE_IF(std::is_floating_point::value&& + std::is_floating_point::value)> + auto duration_cast(std::chrono::duration from) -> To { +-#if FMT_SAFE_DURATION_CAST ++#if MOZ_FMT_SAFE_DURATION_CAST + // Throwing version of safe_duration_cast is only available for + // integer to integer or float to float casts. + int ec; +@@ -503,7 +503,7 @@ auto duration_cast(std::chrono::duration from) -> To { + + template < + typename To, typename FromRep, typename FromPeriod, +- FMT_ENABLE_IF(!is_same_arithmetic_type::value)> ++ MOZ_FMT_ENABLE_IF(!is_same_arithmetic_type::value)> + auto duration_cast(std::chrono::duration from) -> To { + // Mixed integer <-> float cast is not supported by safe_duration_cast. + return std::chrono::duration_cast(from); +@@ -521,14 +521,14 @@ auto to_time_t(sys_time time_point) -> std::time_t { + + // Workaround a bug in libstdc++ which sets __cpp_lib_chrono to 201907 without + // providing current_zone(): https://github.com/fmtlib/fmt/issues/4160. +-template FMT_CONSTEXPR auto has_current_zone() -> bool { ++template MOZ_FMT_CONSTEXPR auto has_current_zone() -> bool { + using namespace std::chrono; +- using namespace fmt_detail; ++ using namespace mozilla::fmt_detail; + return !std::is_same::value; + } + } // namespace detail + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + /** + * Converts given time since epoch as `std::time_t` value into calendar time, +@@ -543,22 +543,22 @@ inline auto localtime(std::time_t time) -> std::tm { + inline dispatcher(std::time_t t) : time_(t) {} + + inline auto run() -> bool { +- using namespace fmt::detail; ++ using namespace mozilla::fmt::detail; + return handle(localtime_r(&time_, &tm_)); + } + + inline auto handle(std::tm* tm) -> bool { return tm != nullptr; } + + inline auto handle(detail::null<>) -> bool { +- using namespace fmt::detail; ++ using namespace mozilla::fmt::detail; + return fallback(localtime_s(&tm_, &time_)); + } + + inline auto fallback(int res) -> bool { return res == 0; } + +-#if !FMT_MSC_VERSION ++#if !MOZ_FMT_MSC_VERSION + inline auto fallback(detail::null<>) -> bool { +- using namespace fmt::detail; ++ using namespace mozilla::fmt::detail; + std::tm* tm = std::localtime(&time_); + if (tm) tm_ = *tm; + return tm != nullptr; +@@ -567,16 +567,16 @@ inline auto localtime(std::time_t time) -> std::tm { + }; + dispatcher lt(time); + // Too big time values may be unsupported. +- if (!lt.run()) FMT_THROW(format_error("time_t value out of range")); ++ if (!lt.run()) MOZ_FMT_THROW(format_error("time_t value out of range")); + return lt.tm_; + } + +-#if FMT_USE_LOCAL_TIME ++#if MOZ_FMT_USE_LOCAL_TIME + template ())> ++ MOZ_FMT_ENABLE_IF(detail::has_current_zone())> + inline auto localtime(std::chrono::local_time time) -> std::tm { + using namespace std::chrono; +- using namespace fmt_detail; ++ using namespace mozilla::fmt_detail; + return localtime(detail::to_time_t(current_zone()->to_sys(time))); + } + #endif +@@ -594,20 +594,20 @@ inline auto gmtime(std::time_t time) -> std::tm { + inline dispatcher(std::time_t t) : time_(t) {} + + inline auto run() -> bool { +- using namespace fmt::detail; ++ using namespace mozilla::fmt::detail; + return handle(gmtime_r(&time_, &tm_)); + } + + inline auto handle(std::tm* tm) -> bool { return tm != nullptr; } + + inline auto handle(detail::null<>) -> bool { +- using namespace fmt::detail; ++ using namespace mozilla::fmt::detail; + return fallback(gmtime_s(&tm_, &time_)); + } + + inline auto fallback(int res) -> bool { return res == 0; } + +-#if !FMT_MSC_VERSION ++#if !MOZ_FMT_MSC_VERSION + inline auto fallback(detail::null<>) -> bool { + std::tm* tm = std::gmtime(&time_); + if (tm) tm_ = *tm; +@@ -617,7 +617,7 @@ inline auto gmtime(std::time_t time) -> std::tm { + }; + auto gt = dispatcher(time); + // Too big time values may be unsupported. +- if (!gt.run()) FMT_THROW(format_error("time_t value out of range")); ++ if (!gt.run()) MOZ_FMT_THROW(format_error("time_t value out of range")); + return gt.tm_; + } + +@@ -663,7 +663,7 @@ inline void write_digit2_separated(char* buf, unsigned a, unsigned b, + } + + template +-FMT_CONSTEXPR inline auto get_units() -> const char* { ++MOZ_FMT_CONSTEXPR inline auto get_units() -> const char* { + if (std::is_same::value) return "as"; + if (std::is_same::value) return "fs"; + if (std::is_same::value) return "ps"; +@@ -718,10 +718,10 @@ auto write_padding(OutputIt out, pad_type pad) -> OutputIt { + + // Parses a put_time-like format string and invokes handler actions. + template +-FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + Handler&& handler) -> const Char* { + if (begin == end || *begin == '}') return begin; +- if (*begin != '%') FMT_THROW(format_error("invalid format")); ++ if (*begin != '%') MOZ_FMT_THROW(format_error("invalid format")); + auto ptr = begin; + while (ptr != end) { + pad_type pad = pad_type::zero; +@@ -733,7 +733,7 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + } + if (begin != ptr) handler.on_text(begin, ptr); + ++ptr; // consume '%' +- if (ptr == end) FMT_THROW(format_error("invalid format")); ++ if (ptr == end) MOZ_FMT_THROW(format_error("invalid format")); + c = *ptr; + switch (c) { + case '_': +@@ -745,7 +745,7 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + ++ptr; + break; + } +- if (ptr == end) FMT_THROW(format_error("invalid format")); ++ if (ptr == end) MOZ_FMT_THROW(format_error("invalid format")); + c = *ptr++; + switch (c) { + case '%': handler.on_text(ptr - 1, ptr); break; +@@ -809,7 +809,7 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + case 'Z': handler.on_tz_name(); break; + // Alternative representation: + case 'E': { +- if (ptr == end) FMT_THROW(format_error("invalid format")); ++ if (ptr == end) MOZ_FMT_THROW(format_error("invalid format")); + c = *ptr++; + switch (c) { + case 'Y': handler.on_year(numeric_system::alternative, pad); break; +@@ -819,12 +819,12 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + case 'x': handler.on_loc_date(numeric_system::alternative); break; + case 'X': handler.on_loc_time(numeric_system::alternative); break; + case 'z': handler.on_utc_offset(numeric_system::alternative); break; +- default: FMT_THROW(format_error("invalid format")); ++ default: MOZ_FMT_THROW(format_error("invalid format")); + } + break; + } + case 'O': +- if (ptr == end) FMT_THROW(format_error("invalid format")); ++ if (ptr == end) MOZ_FMT_THROW(format_error("invalid format")); + c = *ptr++; + switch (c) { + case 'y': handler.on_short_year(numeric_system::alternative); break; +@@ -851,10 +851,10 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + case 'M': handler.on_minute(numeric_system::alternative, pad); break; + case 'S': handler.on_second(numeric_system::alternative, pad); break; + case 'z': handler.on_utc_offset(numeric_system::alternative); break; +- default: FMT_THROW(format_error("invalid format")); ++ default: MOZ_FMT_THROW(format_error("invalid format")); + } + break; +- default: FMT_THROW(format_error("invalid format")); ++ default: MOZ_FMT_THROW(format_error("invalid format")); + } + begin = ptr; + } +@@ -863,94 +863,94 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end, + } + + template struct null_chrono_spec_handler { +- FMT_CONSTEXPR void unsupported() { ++ MOZ_FMT_CONSTEXPR void unsupported() { + static_cast(this)->unsupported(); + } +- FMT_CONSTEXPR void on_year(numeric_system, pad_type) { unsupported(); } +- FMT_CONSTEXPR void on_short_year(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_offset_year() { unsupported(); } +- FMT_CONSTEXPR void on_century(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_iso_week_based_year() { unsupported(); } +- FMT_CONSTEXPR void on_iso_week_based_short_year() { unsupported(); } +- FMT_CONSTEXPR void on_abbr_weekday() { unsupported(); } +- FMT_CONSTEXPR void on_full_weekday() { unsupported(); } +- FMT_CONSTEXPR void on_dec0_weekday(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_dec1_weekday(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_abbr_month() { unsupported(); } +- FMT_CONSTEXPR void on_full_month() { unsupported(); } +- FMT_CONSTEXPR void on_dec_month(numeric_system, pad_type) { unsupported(); } +- FMT_CONSTEXPR void on_dec0_week_of_year(numeric_system, pad_type) { ++ MOZ_FMT_CONSTEXPR void on_year(numeric_system, pad_type) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_short_year(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_offset_year() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_century(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_iso_week_based_year() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_iso_week_based_short_year() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_abbr_weekday() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_full_weekday() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_dec0_weekday(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_dec1_weekday(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_abbr_month() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_full_month() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_dec_month(numeric_system, pad_type) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_dec0_week_of_year(numeric_system, pad_type) { + unsupported(); + } +- FMT_CONSTEXPR void on_dec1_week_of_year(numeric_system, pad_type) { ++ MOZ_FMT_CONSTEXPR void on_dec1_week_of_year(numeric_system, pad_type) { + unsupported(); + } +- FMT_CONSTEXPR void on_iso_week_of_year(numeric_system, pad_type) { ++ MOZ_FMT_CONSTEXPR void on_iso_week_of_year(numeric_system, pad_type) { + unsupported(); + } +- FMT_CONSTEXPR void on_day_of_year(pad_type) { unsupported(); } +- FMT_CONSTEXPR void on_day_of_month(numeric_system, pad_type) { ++ MOZ_FMT_CONSTEXPR void on_day_of_year(pad_type) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_day_of_month(numeric_system, pad_type) { + unsupported(); + } +- FMT_CONSTEXPR void on_24_hour(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_12_hour(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_minute(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_second(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_datetime(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_loc_date(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_loc_time(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_us_date() { unsupported(); } +- FMT_CONSTEXPR void on_iso_date() { unsupported(); } +- FMT_CONSTEXPR void on_12_hour_time() { unsupported(); } +- FMT_CONSTEXPR void on_24_hour_time() { unsupported(); } +- FMT_CONSTEXPR void on_iso_time() { unsupported(); } +- FMT_CONSTEXPR void on_am_pm() { unsupported(); } +- FMT_CONSTEXPR void on_duration_value() { unsupported(); } +- FMT_CONSTEXPR void on_duration_unit() { unsupported(); } +- FMT_CONSTEXPR void on_utc_offset(numeric_system) { unsupported(); } +- FMT_CONSTEXPR void on_tz_name() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_24_hour(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_12_hour(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_minute(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_second(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_datetime(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_loc_date(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_loc_time(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_us_date() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_iso_date() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_12_hour_time() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_24_hour_time() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_iso_time() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_am_pm() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_duration_value() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_duration_unit() { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_utc_offset(numeric_system) { unsupported(); } ++ MOZ_FMT_CONSTEXPR void on_tz_name() { unsupported(); } + }; + + struct tm_format_checker : null_chrono_spec_handler { +- FMT_NORETURN inline void unsupported() { +- FMT_THROW(format_error("no format")); ++ MOZ_FMT_NORETURN inline void unsupported() { ++ MOZ_FMT_THROW(format_error("no format")); + } + + template +- FMT_CONSTEXPR void on_text(const Char*, const Char*) {} +- FMT_CONSTEXPR void on_year(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_short_year(numeric_system) {} +- FMT_CONSTEXPR void on_offset_year() {} +- FMT_CONSTEXPR void on_century(numeric_system) {} +- FMT_CONSTEXPR void on_iso_week_based_year() {} +- FMT_CONSTEXPR void on_iso_week_based_short_year() {} +- FMT_CONSTEXPR void on_abbr_weekday() {} +- FMT_CONSTEXPR void on_full_weekday() {} +- FMT_CONSTEXPR void on_dec0_weekday(numeric_system) {} +- FMT_CONSTEXPR void on_dec1_weekday(numeric_system) {} +- FMT_CONSTEXPR void on_abbr_month() {} +- FMT_CONSTEXPR void on_full_month() {} +- FMT_CONSTEXPR void on_dec_month(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_dec0_week_of_year(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_dec1_week_of_year(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_iso_week_of_year(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_day_of_year(pad_type) {} +- FMT_CONSTEXPR void on_day_of_month(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_24_hour(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_12_hour(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_minute(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_second(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_datetime(numeric_system) {} +- FMT_CONSTEXPR void on_loc_date(numeric_system) {} +- FMT_CONSTEXPR void on_loc_time(numeric_system) {} +- FMT_CONSTEXPR void on_us_date() {} +- FMT_CONSTEXPR void on_iso_date() {} +- FMT_CONSTEXPR void on_12_hour_time() {} +- FMT_CONSTEXPR void on_24_hour_time() {} +- FMT_CONSTEXPR void on_iso_time() {} +- FMT_CONSTEXPR void on_am_pm() {} +- FMT_CONSTEXPR void on_utc_offset(numeric_system) {} +- FMT_CONSTEXPR void on_tz_name() {} ++ MOZ_FMT_CONSTEXPR void on_text(const Char*, const Char*) {} ++ MOZ_FMT_CONSTEXPR void on_year(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_short_year(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_offset_year() {} ++ MOZ_FMT_CONSTEXPR void on_century(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_iso_week_based_year() {} ++ MOZ_FMT_CONSTEXPR void on_iso_week_based_short_year() {} ++ MOZ_FMT_CONSTEXPR void on_abbr_weekday() {} ++ MOZ_FMT_CONSTEXPR void on_full_weekday() {} ++ MOZ_FMT_CONSTEXPR void on_dec0_weekday(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_dec1_weekday(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_abbr_month() {} ++ MOZ_FMT_CONSTEXPR void on_full_month() {} ++ MOZ_FMT_CONSTEXPR void on_dec_month(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_dec0_week_of_year(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_dec1_week_of_year(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_iso_week_of_year(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_day_of_year(pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_day_of_month(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_24_hour(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_12_hour(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_minute(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_second(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_datetime(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_loc_date(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_loc_time(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_us_date() {} ++ MOZ_FMT_CONSTEXPR void on_iso_date() {} ++ MOZ_FMT_CONSTEXPR void on_12_hour_time() {} ++ MOZ_FMT_CONSTEXPR void on_24_hour_time() {} ++ MOZ_FMT_CONSTEXPR void on_iso_time() {} ++ MOZ_FMT_CONSTEXPR void on_am_pm() {} ++ MOZ_FMT_CONSTEXPR void on_utc_offset(numeric_system) {} ++ MOZ_FMT_CONSTEXPR void on_tz_name() {} + }; + + inline auto tm_wday_full_name(int wday) -> const char* { +@@ -993,7 +993,7 @@ struct has_member_data_tm_zone> + + inline void tzset_once() { + static bool init = []() { +- using namespace fmt_detail; ++ using namespace mozilla::fmt_detail; + _tzset(); + return false; + }(); +@@ -1001,19 +1001,19 @@ inline void tzset_once() { + } + + // Converts value to Int and checks that it's in the range [0, upper). +-template ::value)> ++template ::value)> + inline auto to_nonnegative_int(T value, Int upper) -> Int { + if (!std::is_unsigned::value && + (value < 0 || to_unsigned(value) > to_unsigned(upper))) { +- FMT_THROW(fmt::format_error("chrono value is out of range")); ++ MOZ_FMT_THROW(mozilla::fmt::format_error("chrono value is out of range")); + } + return static_cast(value); + } +-template ::value)> ++template ::value)> + inline auto to_nonnegative_int(T value, Int upper) -> Int { + auto int_value = static_cast(value); + if (int_value < 0 || value > static_cast(upper)) +- FMT_THROW(format_error("invalid value")); ++ MOZ_FMT_THROW(format_error("invalid value")); + return int_value; + } + +@@ -1062,7 +1062,7 @@ void write_fractional_seconds(OutputIt& out, Duration d, int precision = -1) { + + int leading_zeroes = (std::max)(0, num_fractional_digits - num_digits); + if (precision < 0) { +- FMT_ASSERT(!std::is_floating_point::value, ""); ++ MOZ_FMT_ASSERT(!std::is_floating_point::value, ""); + if (std::ratio_less::value) { + *out++ = '.'; +@@ -1095,7 +1095,7 @@ template + void write_floating_seconds(memory_buffer& buf, Duration duration, + int num_fractional_digits = -1) { + using rep = typename Duration::rep; +- FMT_ASSERT(std::is_floating_point::value, ""); ++ MOZ_FMT_ASSERT(std::is_floating_point::value, ""); + + auto val = duration.count(); + +@@ -1110,7 +1110,7 @@ void write_floating_seconds(memory_buffer& buf, Duration duration, + num_fractional_digits = 6; + } + +- fmt::format_to(std::back_inserter(buf), FMT_STRING("{:.{}f}"), ++ mozilla::fmt::format_to(std::back_inserter(buf), MOZ_FMT_STRING("{:.{}f}"), + std::fmod(val * static_cast(Duration::period::num) / + static_cast(Duration::period::den), + static_cast(60)), +@@ -1130,32 +1130,32 @@ class tm_writer { + const std::tm& tm_; + + auto tm_sec() const noexcept -> int { +- FMT_ASSERT(tm_.tm_sec >= 0 && tm_.tm_sec <= 61, ""); ++ MOZ_FMT_ASSERT(tm_.tm_sec >= 0 && tm_.tm_sec <= 61, ""); + return tm_.tm_sec; + } + auto tm_min() const noexcept -> int { +- FMT_ASSERT(tm_.tm_min >= 0 && tm_.tm_min <= 59, ""); ++ MOZ_FMT_ASSERT(tm_.tm_min >= 0 && tm_.tm_min <= 59, ""); + return tm_.tm_min; + } + auto tm_hour() const noexcept -> int { +- FMT_ASSERT(tm_.tm_hour >= 0 && tm_.tm_hour <= 23, ""); ++ MOZ_FMT_ASSERT(tm_.tm_hour >= 0 && tm_.tm_hour <= 23, ""); + return tm_.tm_hour; + } + auto tm_mday() const noexcept -> int { +- FMT_ASSERT(tm_.tm_mday >= 1 && tm_.tm_mday <= 31, ""); ++ MOZ_FMT_ASSERT(tm_.tm_mday >= 1 && tm_.tm_mday <= 31, ""); + return tm_.tm_mday; + } + auto tm_mon() const noexcept -> int { +- FMT_ASSERT(tm_.tm_mon >= 0 && tm_.tm_mon <= 11, ""); ++ MOZ_FMT_ASSERT(tm_.tm_mon >= 0 && tm_.tm_mon <= 11, ""); + return tm_.tm_mon; + } + auto tm_year() const noexcept -> long long { return 1900ll + tm_.tm_year; } + auto tm_wday() const noexcept -> int { +- FMT_ASSERT(tm_.tm_wday >= 0 && tm_.tm_wday <= 6, ""); ++ MOZ_FMT_ASSERT(tm_.tm_wday >= 0 && tm_.tm_wday <= 6, ""); + return tm_.tm_wday; + } + auto tm_yday() const noexcept -> int { +- FMT_ASSERT(tm_.tm_yday >= 0 && tm_.tm_yday <= 365, ""); ++ MOZ_FMT_ASSERT(tm_.tm_yday >= 0 && tm_.tm_yday <= 365, ""); + return tm_.tm_yday; + } + +@@ -1259,11 +1259,11 @@ class tm_writer { + write2(static_cast(offset % 60)); + } + +- template ::value)> ++ template ::value)> + void format_utc_offset_impl(const T& tm, numeric_system ns) { + write_utc_offset(tm.tm_gmtoff, ns); + } +- template ::value)> ++ template ::value)> + void format_utc_offset_impl(const T& tm, numeric_system ns) { + #if defined(_WIN32) && defined(_UCRT) + tzset_once(); +@@ -1288,14 +1288,14 @@ class tm_writer { + #endif + } + +- template ::value)> ++ template ::value)> + void format_tz_name_impl(const T& tm) { + if (is_classic_) + out_ = write_tm_str(out_, tm.tm_zone, loc_); + else + format_localized('Z'); + } +- template ::value)> ++ template ::value)> + void format_tz_name_impl(const T&) { + format_localized('Z'); + } +@@ -1315,7 +1315,7 @@ class tm_writer { + + auto out() const -> OutputIt { return out_; } + +- FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) { ++ MOZ_FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) { + out_ = copy(begin, end, out_); + } + +@@ -1574,37 +1574,37 @@ class tm_writer { + struct chrono_format_checker : null_chrono_spec_handler { + bool has_precision_integral = false; + +- FMT_NORETURN inline void unsupported() { FMT_THROW(format_error("no date")); } ++ MOZ_FMT_NORETURN inline void unsupported() { MOZ_FMT_THROW(format_error("no date")); } + + template +- FMT_CONSTEXPR void on_text(const Char*, const Char*) {} +- FMT_CONSTEXPR void on_day_of_year(pad_type) {} +- FMT_CONSTEXPR void on_24_hour(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_12_hour(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_minute(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_second(numeric_system, pad_type) {} +- FMT_CONSTEXPR void on_12_hour_time() {} +- FMT_CONSTEXPR void on_24_hour_time() {} +- FMT_CONSTEXPR void on_iso_time() {} +- FMT_CONSTEXPR void on_am_pm() {} +- FMT_CONSTEXPR void on_duration_value() const { ++ MOZ_FMT_CONSTEXPR void on_text(const Char*, const Char*) {} ++ MOZ_FMT_CONSTEXPR void on_day_of_year(pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_24_hour(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_12_hour(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_minute(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_second(numeric_system, pad_type) {} ++ MOZ_FMT_CONSTEXPR void on_12_hour_time() {} ++ MOZ_FMT_CONSTEXPR void on_24_hour_time() {} ++ MOZ_FMT_CONSTEXPR void on_iso_time() {} ++ MOZ_FMT_CONSTEXPR void on_am_pm() {} ++ MOZ_FMT_CONSTEXPR void on_duration_value() const { + if (has_precision_integral) +- FMT_THROW(format_error("precision not allowed for this argument type")); ++ MOZ_FMT_THROW(format_error("precision not allowed for this argument type")); + } +- FMT_CONSTEXPR void on_duration_unit() {} ++ MOZ_FMT_CONSTEXPR void on_duration_unit() {} + }; + + template ::value&& has_isfinite::value)> ++ MOZ_FMT_ENABLE_IF(std::is_integral::value&& has_isfinite::value)> + inline auto isfinite(T) -> bool { + return true; + } + +-template ::value)> ++template ::value)> + inline auto mod(T x, int y) -> T { + return x % static_cast(y); + } +-template ::value)> ++template ::value)> + inline auto mod(T x, int y) -> T { + return std::fmod(x, static_cast(y)); + } +@@ -1621,12 +1621,12 @@ template struct make_unsigned_or_unchanged { + }; + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_integral::value)> + inline auto get_milliseconds(std::chrono::duration d) + -> std::chrono::duration { + // this may overflow and/or the result may not fit in the + // target type. +-#if FMT_SAFE_DURATION_CAST ++#if MOZ_FMT_SAFE_DURATION_CAST + using CommonSecondsType = + typename std::common_type::type; + const auto d_as_common = detail::duration_cast(d); +@@ -1644,13 +1644,13 @@ inline auto get_milliseconds(std::chrono::duration d) + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_integral::value)> + auto format_duration_value(OutputIt out, Rep val, int) -> OutputIt { + return write(out, val); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_floating_point::value)> + auto format_duration_value(OutputIt out, Rep val, int precision) -> OutputIt { + auto specs = format_specs(); + specs.precision = precision; +@@ -1999,17 +1999,17 @@ class year { + + class year_month_day { + private: +- fmt::year year_; +- fmt::month month_; +- fmt::day day_; ++ mozilla::fmt::year year_; ++ mozilla::fmt::month month_; ++ mozilla::fmt::day day_; + + public: + year_month_day() = default; + constexpr year_month_day(const year& y, const month& m, const day& d) noexcept + : year_(y), month_(m), day_(d) {} +- constexpr auto year() const noexcept -> fmt::year { return year_; } +- constexpr auto month() const noexcept -> fmt::month { return month_; } +- constexpr auto day() const noexcept -> fmt::day { return day_; } ++ constexpr auto year() const noexcept -> mozilla::fmt::year { return year_; } ++ constexpr auto month() const noexcept -> mozilla::fmt::month { return month_; } ++ constexpr auto day() const noexcept -> mozilla::fmt::day { return day_; } + }; + #endif + +@@ -2020,7 +2020,7 @@ struct formatter : private formatter { + bool use_tm_formatter_ = false; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + if (it != end && *it == 'L') { + ++it; +@@ -2049,7 +2049,7 @@ struct formatter : private formatter { + bool use_tm_formatter_ = false; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + use_tm_formatter_ = it != end && *it != '}'; + return use_tm_formatter_ ? formatter::parse(ctx) : it; +@@ -2074,7 +2074,7 @@ struct formatter : private formatter { + bool use_tm_formatter_ = false; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + if (it != end && *it == 'L') { + ++it; +@@ -2103,7 +2103,7 @@ struct formatter : private formatter { + bool use_tm_formatter_ = false; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + use_tm_formatter_ = it != end && *it != '}'; + return use_tm_formatter_ ? formatter::parse(ctx) : it; +@@ -2127,7 +2127,7 @@ struct formatter : private formatter { + bool use_tm_formatter_ = false; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + use_tm_formatter_ = it != end && *it != '}'; + return use_tm_formatter_ ? formatter::parse(ctx) : it; +@@ -2158,7 +2158,7 @@ struct formatter, Char> { + basic_string_view fmt_; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + if (it == end || *it == '}') return it; + +@@ -2243,7 +2243,7 @@ template struct formatter { + } + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + if (it == end || *it == '}') return it; + +@@ -2271,7 +2271,7 @@ template struct formatter { + + template + struct formatter, Char> : formatter { +- FMT_CONSTEXPR formatter() { ++ MOZ_FMT_CONSTEXPR formatter() { + this->fmt_ = detail::string_literal(); + } + +@@ -2313,7 +2313,7 @@ struct formatter, Char> + + template + struct formatter, Char> : formatter { +- FMT_CONSTEXPR formatter() { ++ MOZ_FMT_CONSTEXPR formatter() { + this->fmt_ = detail::string_literal(); + } + +@@ -2332,7 +2332,7 @@ struct formatter, Char> : formatter { + } + }; + +-FMT_END_EXPORT +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_CHRONO_H_ ++#endif // MOZ_FMT_CHRONO_H_ +diff --git a/third_party/fmt/include/fmt/color.h b/third_party/fmt/include/fmt/color.h +index 2faaf3a..ec87049 100644 +--- a/third_party/fmt/include/fmt/color.h ++++ b/third_party/fmt/include/fmt/color.h +@@ -5,13 +5,13 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_COLOR_H_ +-#define FMT_COLOR_H_ ++#ifndef MOZ_FMT_COLOR_H_ ++#define MOZ_FMT_COLOR_H_ + + #include "format.h" + +-FMT_BEGIN_NAMESPACE +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_EXPORT + + enum class color : uint32_t { + alice_blue = 0xF0F8FF, // rgb(240,248,255) +@@ -190,11 +190,11 @@ enum class emphasis : uint8_t { + // rgb is a struct for red, green and blue colors. + // Using the name "rgb" makes some editors show the color in a tooltip. + struct rgb { +- FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {} +- FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} +- FMT_CONSTEXPR rgb(uint32_t hex) ++ MOZ_FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {} ++ MOZ_FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} ++ MOZ_FMT_CONSTEXPR rgb(uint32_t hex) + : r((hex >> 16) & 0xFF), g((hex >> 8) & 0xFF), b(hex & 0xFF) {} +- FMT_CONSTEXPR rgb(color hex) ++ MOZ_FMT_CONSTEXPR rgb(color hex) + : r((uint32_t(hex) >> 16) & 0xFF), + g((uint32_t(hex) >> 8) & 0xFF), + b(uint32_t(hex) & 0xFF) {} +@@ -207,15 +207,15 @@ namespace detail { + + // color is a struct of either a rgb color or a terminal color. + struct color_type { +- FMT_CONSTEXPR color_type() noexcept : is_rgb(), value{} {} +- FMT_CONSTEXPR color_type(color rgb_color) noexcept : is_rgb(true), value{} { ++ MOZ_FMT_CONSTEXPR color_type() noexcept : is_rgb(), value{} {} ++ MOZ_FMT_CONSTEXPR color_type(color rgb_color) noexcept : is_rgb(true), value{} { + value.rgb_color = static_cast(rgb_color); + } +- FMT_CONSTEXPR color_type(rgb rgb_color) noexcept : is_rgb(true), value{} { ++ MOZ_FMT_CONSTEXPR color_type(rgb rgb_color) noexcept : is_rgb(true), value{} { + value.rgb_color = (static_cast(rgb_color.r) << 16) | + (static_cast(rgb_color.g) << 8) | rgb_color.b; + } +- FMT_CONSTEXPR color_type(terminal_color term_color) noexcept ++ MOZ_FMT_CONSTEXPR color_type(terminal_color term_color) noexcept + : is_rgb(), value{} { + value.term_color = static_cast(term_color); + } +@@ -230,10 +230,10 @@ struct color_type { + /// A text style consisting of foreground and background colors and emphasis. + class text_style { + public: +- FMT_CONSTEXPR text_style(emphasis em = emphasis()) noexcept ++ MOZ_FMT_CONSTEXPR text_style(emphasis em = emphasis()) noexcept + : set_foreground_color(), set_background_color(), ems(em) {} + +- FMT_CONSTEXPR auto operator|=(const text_style& rhs) -> text_style& { ++ MOZ_FMT_CONSTEXPR auto operator|=(const text_style& rhs) -> text_style& { + if (!set_foreground_color) { + set_foreground_color = rhs.set_foreground_color; + foreground_color = rhs.foreground_color; +@@ -257,35 +257,35 @@ class text_style { + return *this; + } + +- friend FMT_CONSTEXPR auto operator|(text_style lhs, const text_style& rhs) ++ friend MOZ_FMT_CONSTEXPR auto operator|(text_style lhs, const text_style& rhs) + -> text_style { + return lhs |= rhs; + } + +- FMT_CONSTEXPR auto has_foreground() const noexcept -> bool { ++ MOZ_FMT_CONSTEXPR auto has_foreground() const noexcept -> bool { + return set_foreground_color; + } +- FMT_CONSTEXPR auto has_background() const noexcept -> bool { ++ MOZ_FMT_CONSTEXPR auto has_background() const noexcept -> bool { + return set_background_color; + } +- FMT_CONSTEXPR auto has_emphasis() const noexcept -> bool { ++ MOZ_FMT_CONSTEXPR auto has_emphasis() const noexcept -> bool { + return static_cast(ems) != 0; + } +- FMT_CONSTEXPR auto get_foreground() const noexcept -> detail::color_type { +- FMT_ASSERT(has_foreground(), "no foreground specified for this style"); ++ MOZ_FMT_CONSTEXPR auto get_foreground() const noexcept -> detail::color_type { ++ MOZ_FMT_ASSERT(has_foreground(), "no foreground specified for this style"); + return foreground_color; + } +- FMT_CONSTEXPR auto get_background() const noexcept -> detail::color_type { +- FMT_ASSERT(has_background(), "no background specified for this style"); ++ MOZ_FMT_CONSTEXPR auto get_background() const noexcept -> detail::color_type { ++ MOZ_FMT_ASSERT(has_background(), "no background specified for this style"); + return background_color; + } +- FMT_CONSTEXPR auto get_emphasis() const noexcept -> emphasis { +- FMT_ASSERT(has_emphasis(), "no emphasis specified for this style"); ++ MOZ_FMT_CONSTEXPR auto get_emphasis() const noexcept -> emphasis { ++ MOZ_FMT_ASSERT(has_emphasis(), "no emphasis specified for this style"); + return ems; + } + + private: +- FMT_CONSTEXPR text_style(bool is_foreground, ++ MOZ_FMT_CONSTEXPR text_style(bool is_foreground, + detail::color_type text_color) noexcept + : set_foreground_color(), set_background_color(), ems() { + if (is_foreground) { +@@ -297,10 +297,10 @@ class text_style { + } + } + +- friend FMT_CONSTEXPR auto fg(detail::color_type foreground) noexcept ++ friend MOZ_FMT_CONSTEXPR auto fg(detail::color_type foreground) noexcept + -> text_style; + +- friend FMT_CONSTEXPR auto bg(detail::color_type background) noexcept ++ friend MOZ_FMT_CONSTEXPR auto bg(detail::color_type background) noexcept + -> text_style; + + detail::color_type foreground_color; +@@ -311,18 +311,18 @@ class text_style { + }; + + /// Creates a text style from the foreground (text) color. +-FMT_CONSTEXPR inline auto fg(detail::color_type foreground) noexcept ++MOZ_FMT_CONSTEXPR inline auto fg(detail::color_type foreground) noexcept + -> text_style { + return text_style(true, foreground); + } + + /// Creates a text style from the background color. +-FMT_CONSTEXPR inline auto bg(detail::color_type background) noexcept ++MOZ_FMT_CONSTEXPR inline auto bg(detail::color_type background) noexcept + -> text_style { + return text_style(false, background); + } + +-FMT_CONSTEXPR inline auto operator|(emphasis lhs, emphasis rhs) noexcept ++MOZ_FMT_CONSTEXPR inline auto operator|(emphasis lhs, emphasis rhs) noexcept + -> text_style { + return text_style(lhs) | rhs; + } +@@ -330,7 +330,7 @@ FMT_CONSTEXPR inline auto operator|(emphasis lhs, emphasis rhs) noexcept + namespace detail { + + template struct ansi_color_escape { +- FMT_CONSTEXPR ansi_color_escape(color_type text_color, ++ MOZ_FMT_CONSTEXPR ansi_color_escape(color_type text_color, + const char* esc) noexcept { + // If we have a terminal color, we need to output another escape code + // sequence. +@@ -366,7 +366,7 @@ template struct ansi_color_escape { + to_esc(color.b, buffer + 15, 'm'); + buffer[19] = static_cast(0); + } +- FMT_CONSTEXPR ansi_color_escape(emphasis em) noexcept { ++ MOZ_FMT_CONSTEXPR ansi_color_escape(emphasis em) noexcept { + uint8_t em_codes[num_emphases] = {}; + if (has_emphasis(em, emphasis::bold)) em_codes[0] = 1; + if (has_emphasis(em, emphasis::faint)) em_codes[1] = 2; +@@ -387,10 +387,10 @@ template struct ansi_color_escape { + } + buffer[index++] = static_cast(0); + } +- FMT_CONSTEXPR operator const Char*() const noexcept { return buffer; } ++ MOZ_FMT_CONSTEXPR operator const Char*() const noexcept { return buffer; } + +- FMT_CONSTEXPR auto begin() const noexcept -> const Char* { return buffer; } +- FMT_CONSTEXPR20 auto end() const noexcept -> const Char* { ++ MOZ_FMT_CONSTEXPR auto begin() const noexcept -> const Char* { return buffer; } ++ MOZ_FMT_CONSTEXPR20 auto end() const noexcept -> const Char* { + return buffer + basic_string_view(buffer).size(); + } + +@@ -398,33 +398,33 @@ template struct ansi_color_escape { + static constexpr size_t num_emphases = 8; + Char buffer[7u + 3u * num_emphases + 1u]; + +- static FMT_CONSTEXPR void to_esc(uint8_t c, Char* out, ++ static MOZ_FMT_CONSTEXPR void to_esc(uint8_t c, Char* out, + char delimiter) noexcept { + out[0] = static_cast('0' + c / 100); + out[1] = static_cast('0' + c / 10 % 10); + out[2] = static_cast('0' + c % 10); + out[3] = static_cast(delimiter); + } +- static FMT_CONSTEXPR auto has_emphasis(emphasis em, emphasis mask) noexcept ++ static MOZ_FMT_CONSTEXPR auto has_emphasis(emphasis em, emphasis mask) noexcept + -> bool { + return static_cast(em) & static_cast(mask); + } + }; + + template +-FMT_CONSTEXPR auto make_foreground_color(color_type foreground) noexcept ++MOZ_FMT_CONSTEXPR auto make_foreground_color(color_type foreground) noexcept + -> ansi_color_escape { + return ansi_color_escape(foreground, "\x1b[38;2;"); + } + + template +-FMT_CONSTEXPR auto make_background_color(color_type background) noexcept ++MOZ_FMT_CONSTEXPR auto make_background_color(color_type background) noexcept + -> ansi_color_escape { + return ansi_color_escape(background, "\x1b[48;2;"); + } + + template +-FMT_CONSTEXPR auto make_emphasis(emphasis em) noexcept ++MOZ_FMT_CONSTEXPR auto make_emphasis(emphasis em) noexcept + -> ansi_color_escape { + return ansi_color_escape(em); + } +@@ -469,7 +469,7 @@ inline void vprint(FILE* f, const text_style& ts, string_view fmt, + format_args args) { + auto buf = memory_buffer(); + detail::vformat_to(buf, ts, fmt, args); +- print(f, FMT_STRING("{}"), string_view(buf.begin(), buf.size())); ++ print(f, MOZ_FMT_STRING("{}"), string_view(buf.begin(), buf.size())); + } + + /** +@@ -478,7 +478,7 @@ inline void vprint(FILE* f, const text_style& ts, string_view fmt, + * + * **Example**: + * +- * fmt::print(fmt::emphasis::bold | fg(fmt::color::red), ++ * mozilla::fmt::print(mozilla::fmt::emphasis::bold | fg(mozilla::fmt::color::red), + * "Elapsed time: {0:.2f} seconds", 1.23); + */ + template +@@ -493,7 +493,7 @@ void print(FILE* f, const text_style& ts, format_string fmt, + * + * **Example**: + * +- * fmt::print(fmt::emphasis::bold | fg(fmt::color::red), ++ * mozilla::fmt::print(mozilla::fmt::emphasis::bold | fg(mozilla::fmt::color::red), + * "Elapsed time: {0:.2f} seconds", 1.23); + */ + template +@@ -505,7 +505,7 @@ inline auto vformat(const text_style& ts, string_view fmt, format_args args) + -> std::string { + auto buf = memory_buffer(); + detail::vformat_to(buf, ts, fmt, args); +- return fmt::to_string(buf); ++ return mozilla::fmt::to_string(buf); + } + + /** +@@ -516,19 +516,19 @@ inline auto vformat(const text_style& ts, string_view fmt, format_args args) + * + * ``` + * #include +- * std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red), ++ * std::string message = mozilla::fmt::format(mozilla::fmt::emphasis::bold | fg(mozilla::fmt::color::red), + * "The answer is {}", 42); + * ``` + */ + template + inline auto format(const text_style& ts, format_string fmt, T&&... args) + -> std::string { +- return fmt::vformat(ts, fmt.str, vargs{{args...}}); ++ return mozilla::fmt::vformat(ts, fmt.str, vargs{{args...}}); + } + + /// Formats a string with the given text_style and writes the output to `out`. + template ::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> + auto vformat_to(OutputIt out, const text_style& ts, string_view fmt, + format_args args) -> OutputIt { + auto&& buf = detail::get_buffer(out); +@@ -543,11 +543,11 @@ auto vformat_to(OutputIt out, const text_style& ts, string_view fmt, + * **Example**: + * + * std::vector out; +- * fmt::format_to(std::back_inserter(out), +- * fmt::emphasis::bold | fg(fmt::color::red), "{}", 42); ++ * mozilla::fmt::format_to(std::back_inserter(out), ++ * mozilla::fmt::emphasis::bold | fg(mozilla::fmt::color::red), "{}", 42); + */ + template ::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> + inline auto format_to(OutputIt out, const text_style& ts, + format_string fmt, T&&... args) -> OutputIt { + return vformat_to(out, ts, fmt.str, vargs{{args...}}); +@@ -594,17 +594,17 @@ struct formatter, Char> : formatter { + * + * **Example**: + * +- * fmt::print("Elapsed time: {0:.2f} seconds", +- * fmt::styled(1.23, fmt::fg(fmt::color::green) | +- * fmt::bg(fmt::color::blue))); ++ * mozilla::fmt::print("Elapsed time: {0:.2f} seconds", ++ * mozilla::fmt::styled(1.23, mozilla::fmt::fg(mozilla::fmt::color::green) | ++ * mozilla::fmt::bg(mozilla::fmt::color::blue))); + */ + template +-FMT_CONSTEXPR auto styled(const T& value, text_style ts) ++MOZ_FMT_CONSTEXPR auto styled(const T& value, text_style ts) + -> detail::styled_arg> { + return detail::styled_arg>{value, ts}; + } + +-FMT_END_EXPORT +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_COLOR_H_ ++#endif // MOZ_FMT_COLOR_H_ +diff --git a/third_party/fmt/include/fmt/format-inl.h b/third_party/fmt/include/fmt/format-inl.h +index 83d91c4..88800db 100644 +--- a/third_party/fmt/include/fmt/format-inl.h ++++ b/third_party/fmt/include/fmt/format-inl.h +@@ -5,10 +5,10 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_FORMAT_INL_H_ +-#define FMT_FORMAT_INL_H_ ++#ifndef MOZ_FMT_FORMAT_INL_H_ ++#define MOZ_FMT_FORMAT_INL_H_ + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include + # include // errno + # include +@@ -16,31 +16,31 @@ + # include + #endif + +-#if defined(_WIN32) && !defined(FMT_USE_WRITE_CONSOLE) ++#if defined(_WIN32) && !defined(MOZ_FMT_USE_WRITE_CONSOLE) + # include // _isatty + #endif + + #include "format.h" + +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + # include + #endif + +-#ifndef FMT_FUNC +-# define FMT_FUNC ++#ifndef MOZ_FMT_FUNC ++# define MOZ_FMT_FUNC + #endif + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + +-FMT_FUNC void assert_fail(const char* file, int line, const char* message) { ++MOZ_FMT_FUNC void assert_fail(const char* file, int line, const char* message) { + // Use unchecked std::fprintf to avoid triggering another assertion when + // writing to stderr fails. + fprintf(stderr, "%s:%d: assertion failed: %s", file, line, message); + abort(); + } + +-FMT_FUNC void format_error_code(detail::buffer& out, int error_code, ++MOZ_FMT_FUNC void format_error_code(detail::buffer& out, int error_code, + string_view message) noexcept { + // Report error code making sure that the output fits into + // inline_buffer_size to avoid dynamic memory allocation and potential +@@ -58,12 +58,12 @@ FMT_FUNC void format_error_code(detail::buffer& out, int error_code, + error_code_size += detail::to_unsigned(detail::count_digits(abs_value)); + auto it = appender(out); + if (message.size() <= inline_buffer_size - error_code_size) +- fmt::format_to(it, FMT_STRING("{}{}"), message, SEP); +- fmt::format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code); +- FMT_ASSERT(out.size() <= inline_buffer_size, ""); ++ mozilla::fmt::format_to(it, MOZ_FMT_STRING("{}{}"), message, SEP); ++ mozilla::fmt::format_to(it, MOZ_FMT_STRING("{}{}"), ERROR_STR, error_code); ++ MOZ_FMT_ASSERT(out.size() <= inline_buffer_size, ""); + } + +-FMT_FUNC void do_report_error(format_func func, int error_code, ++MOZ_FMT_FUNC void do_report_error(format_func func, int error_code, + const char* message) noexcept { + memory_buffer full_message; + func(full_message, error_code, message); +@@ -77,10 +77,10 @@ inline void fwrite_all(const void* ptr, size_t count, FILE* stream) { + std::fwrite(ptr, 1, count, stream); + // size_t written = std::fwrite(ptr, 1, count, stream); + // if (written < count) +- // FMT_THROW(system_error(errno, FMT_STRING("cannot write to file"))); ++ // MOZ_FMT_THROW(system_error(errno, MOZ_FMT_STRING("cannot write to file"))); + } + +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + using std::locale; + using std::numpunct; + using std::use_facet; +@@ -97,30 +97,30 @@ template struct numpunct { + auto decimal_point() const -> Char { return '.'; } + }; + template Facet use_facet(locale) { return {}; } +-#endif // FMT_USE_LOCALE ++#endif // MOZ_FMT_USE_LOCALE + + template auto locale_ref::get() const -> Locale { + static_assert(std::is_same::value, ""); +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + if (locale_) return *static_cast(locale_); + #endif + return locale(); + } + + template +-FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result { ++MOZ_FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result { + auto&& facet = use_facet>(loc.get()); + auto grouping = facet.grouping(); + auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep(); + return {std::move(grouping), thousands_sep}; + } + template +-FMT_FUNC auto decimal_point_impl(locale_ref loc) -> Char { ++MOZ_FMT_FUNC auto decimal_point_impl(locale_ref loc) -> Char { + return use_facet>(loc.get()).decimal_point(); + } + +-#if FMT_USE_LOCALE +-FMT_FUNC auto write_loc(appender out, loc_value value, ++#if MOZ_FMT_USE_LOCALE ++MOZ_FMT_FUNC auto write_loc(appender out, loc_value value, + const format_specs& specs, locale_ref loc) -> bool { + auto locale = loc.get(); + // We cannot use the num_put facet because it may produce output in +@@ -133,8 +133,8 @@ FMT_FUNC auto write_loc(appender out, loc_value value, + #endif + } // namespace detail + +-FMT_FUNC void report_error(const char* message) { +-#if FMT_USE_EXCEPTIONS ++MOZ_FMT_FUNC void report_error(const char* message) { ++#if MOZ_FMT_USE_EXCEPTIONS + throw format_error(message); + #else + fputs(message, stderr); +@@ -150,16 +150,16 @@ template format_facet::format_facet(Locale& loc) { + if (!grouping_.empty()) separator_ = std::string(1, np.thousands_sep()); + } + +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + template <> +-FMT_API FMT_FUNC auto format_facet::do_put( ++MOZ_FMT_API MOZ_FMT_FUNC auto format_facet::do_put( + appender out, loc_value val, const format_specs& specs) const -> bool { + return val.visit( + detail::loc_writer<>{out, specs, separator_, grouping_, decimal_point_}); + } + #endif + +-// FMT_FUNC auto vsystem_error(int error_code, string_view fmt, format_args args) ++// MOZ_FMT_FUNC auto vsystem_error(int error_code, string_view fmt, format_args args) + // -> std::system_error { + // auto ec = std::error_code(error_code, std::generic_category()); + // return std::system_error(ec, vformat(fmt, args)); +@@ -173,11 +173,11 @@ inline auto operator==(basic_fp x, basic_fp y) -> bool { + } + + // Compilers should be able to optimize this into the ror instruction. +-FMT_CONSTEXPR inline auto rotr(uint32_t n, uint32_t r) noexcept -> uint32_t { ++MOZ_FMT_CONSTEXPR inline auto rotr(uint32_t n, uint32_t r) noexcept -> uint32_t { + r &= 31; + return (n >> r) | (n << (32 - r)); + } +-FMT_CONSTEXPR inline auto rotr(uint64_t n, uint32_t r) noexcept -> uint64_t { ++MOZ_FMT_CONSTEXPR inline auto rotr(uint64_t n, uint32_t r) noexcept -> uint64_t { + r &= 63; + return (n >> r) | (n << (64 - r)); + } +@@ -207,11 +207,11 @@ inline auto umul96_lower64(uint32_t x, uint64_t y) noexcept -> uint64_t { + + // Various fast log computations. + inline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int { +- FMT_ASSERT(e <= 2936 && e >= -2985, "too large exponent"); ++ MOZ_FMT_ASSERT(e <= 2936 && e >= -2985, "too large exponent"); + return (e * 631305 - 261663) >> 21; + } + +-FMT_INLINE_VARIABLE constexpr struct { ++MOZ_FMT_INLINE_VARIABLE constexpr struct { + uint32_t divisor; + int shift_amount; + } div_small_pow10_infos[] = {{10, 16}, {100, 16}}; +@@ -233,7 +233,7 @@ auto check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept -> bool { + // to ceil(2^k/d) for large enough k. + // The idea for item 2 originates from Schubfach. + constexpr auto info = div_small_pow10_infos[N - 1]; +- FMT_ASSERT(n <= info.divisor * 10, "n is too large"); ++ MOZ_FMT_ASSERT(n <= info.divisor * 10, "n is too large"); + constexpr uint32_t magic_number = + (1u << info.shift_amount) / info.divisor + 1; + n *= magic_number; +@@ -247,7 +247,7 @@ auto check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept -> bool { + // Precondition: n <= pow(10, N + 1). + template auto small_division_by_pow10(uint32_t n) noexcept -> uint32_t { + constexpr auto info = div_small_pow10_infos[N - 1]; +- FMT_ASSERT(n <= info.divisor * 10, "n is too large"); ++ MOZ_FMT_ASSERT(n <= info.divisor * 10, "n is too large"); + constexpr uint32_t magic_number = + (1u << info.shift_amount) / info.divisor + 1; + return (n * magic_number) >> info.shift_amount; +@@ -272,7 +272,7 @@ template <> struct cache_accessor { + using cache_entry_type = uint64_t; + + static auto get_cached_power(int k) noexcept -> uint64_t { +- FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, ++ MOZ_FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, + "k is out of range"); + static constexpr const uint64_t pow10_significands[] = { + 0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f, +@@ -330,8 +330,8 @@ template <> struct cache_accessor { + const cache_entry_type& cache, + int beta) noexcept + -> compute_mul_parity_result { +- FMT_ASSERT(beta >= 1, ""); +- FMT_ASSERT(beta < 64, ""); ++ MOZ_FMT_ASSERT(beta >= 1, ""); ++ MOZ_FMT_ASSERT(beta < 64, ""); + + auto r = umul96_lower64(two_f, cache); + return {((r >> (64 - beta)) & 1) != 0, +@@ -366,11 +366,11 @@ template <> struct cache_accessor { + using cache_entry_type = uint128_fallback; + + static auto get_cached_power(int k) noexcept -> uint128_fallback { +- FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, ++ MOZ_FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, + "k is out of range"); + + static constexpr const uint128_fallback pow10_significands[] = { +-#if FMT_USE_FULL_CACHE_DRAGONBOX ++#if MOZ_FMT_USE_FULL_CACHE_DRAGONBOX + {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, + {0x9faacf3df73609b1, 0x77b191618c54e9ad}, + {0xc795830d75038c1d, 0xd59df5b9ef6a2418}, +@@ -1033,7 +1033,7 @@ template <> struct cache_accessor { + #endif + }; + +-#if FMT_USE_FULL_CACHE_DRAGONBOX ++#if MOZ_FMT_USE_FULL_CACHE_DRAGONBOX + return pow10_significands[k - float_info::min_k]; + #else + static constexpr const uint64_t powers_of_5_64[] = { +@@ -1060,7 +1060,7 @@ template <> struct cache_accessor { + + // Compute the required amount of bit-shift. + int alpha = floor_log2_pow10(kb + offset) - floor_log2_pow10(kb) - offset; +- FMT_ASSERT(alpha > 0 && alpha < 64, "shifting error detected"); ++ MOZ_FMT_ASSERT(alpha > 0 && alpha < 64, "shifting error detected"); + + // Try to recover the real cache. + uint64_t pow5 = powers_of_5_64[offset]; +@@ -1075,7 +1075,7 @@ template <> struct cache_accessor { + recovered_cache = + uint128_fallback{(recovered_cache.low() >> alpha) | high_to_middle, + ((middle_low.low() >> alpha) | middle_to_low)}; +- FMT_ASSERT(recovered_cache.low() + 1 != 0, ""); ++ MOZ_FMT_ASSERT(recovered_cache.low() + 1 != 0, ""); + return {recovered_cache.high(), recovered_cache.low() + 1}; + #endif + } +@@ -1105,8 +1105,8 @@ template <> struct cache_accessor { + const cache_entry_type& cache, + int beta) noexcept + -> compute_mul_parity_result { +- FMT_ASSERT(beta >= 1, ""); +- FMT_ASSERT(beta < 64, ""); ++ MOZ_FMT_ASSERT(beta >= 1, ""); ++ MOZ_FMT_ASSERT(beta < 64, ""); + + auto r = umul192_lower128(two_f, cache); + return {((r.high() >> (64 - beta)) & 1) != 0, +@@ -1135,7 +1135,7 @@ template <> struct cache_accessor { + } + }; + +-FMT_FUNC auto get_cached_power(int k) noexcept -> uint128_fallback { ++MOZ_FMT_FUNC auto get_cached_power(int k) noexcept -> uint128_fallback { + return cache_accessor::get_cached_power(k); + } + +@@ -1149,8 +1149,8 @@ auto is_left_endpoint_integer_shorter_interval(int exponent) noexcept -> bool { + } + + // Remove trailing zeros from n and return the number of zeros removed (float) +-FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept { +- FMT_ASSERT(n != 0, ""); ++MOZ_FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept { ++ MOZ_FMT_ASSERT(n != 0, ""); + // Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1. + constexpr uint32_t mod_inv_5 = 0xcccccccd; + constexpr uint32_t mod_inv_25 = 0xc28f5c29; // = mod_inv_5 * mod_inv_5 +@@ -1170,8 +1170,8 @@ FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept { + } + + // Removes trailing zeros and returns the number of zeros removed (double) +-FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept { +- FMT_ASSERT(n != 0, ""); ++MOZ_FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept { ++ MOZ_FMT_ASSERT(n != 0, ""); + + // This magic number is ceil(2^90 / 10^8). + constexpr uint64_t magic_number = 12379400392853802749ull; +@@ -1209,7 +1209,7 @@ FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept { + + // The main algorithm for shorter interval case + template +-FMT_INLINE decimal_fp shorter_interval_case(int exponent) noexcept { ++MOZ_FMT_INLINE decimal_fp shorter_interval_case(int exponent) noexcept { + decimal_fp ret_value; + // Compute k and beta + const int minus_k = floor_log10_pow2_minus_log10_4_over_3(exponent); +@@ -1382,7 +1382,7 @@ small_divisor_case_label: + } // namespace detail + + template <> struct formatter { +- FMT_CONSTEXPR auto parse(format_parse_context& ctx) ++ MOZ_FMT_CONSTEXPR auto parse(format_parse_context& ctx) + -> format_parse_context::iterator { + return ctx.begin(); + } +@@ -1394,22 +1394,22 @@ template <> struct formatter { + for (auto i = n.bigits_.size(); i > 0; --i) { + auto value = n.bigits_[i - 1u]; + if (first) { +- out = fmt::format_to(out, FMT_STRING("{:x}"), value); ++ out = mozilla::fmt::format_to(out, MOZ_FMT_STRING("{:x}"), value); + first = false; + continue; + } +- out = fmt::format_to(out, FMT_STRING("{:08x}"), value); ++ out = mozilla::fmt::format_to(out, MOZ_FMT_STRING("{:08x}"), value); + } + if (n.exp_ > 0) +- out = fmt::format_to(out, FMT_STRING("p{}"), ++ out = mozilla::fmt::format_to(out, MOZ_FMT_STRING("p{}"), + n.exp_ * detail::bigint::bigit_bits); + return out; + } + }; + +-FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { ++MOZ_FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { + for_each_codepoint(s, [this](uint32_t cp, string_view) { +- if (cp == invalid_code_point) FMT_THROW(std::runtime_error("invalid utf8")); ++ if (cp == invalid_code_point) MOZ_FMT_THROW(std::runtime_error("invalid utf8")); + if (cp <= 0xFFFF) { + buffer_.push_back(static_cast(cp)); + } else { +@@ -1422,25 +1422,25 @@ FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { + buffer_.push_back(0); + } + +-FMT_FUNC void format_system_error(detail::buffer& out, int error_code, ++MOZ_FMT_FUNC void format_system_error(detail::buffer& out, int error_code, + const char* message) noexcept { +- // FMT_TRY { ++ // MOZ_FMT_TRY { + // auto ec = std::error_code(error_code, std::generic_category()); + // detail::write(appender(out), std::system_error(ec, message).what()); + // return; + // } +- // FMT_CATCH(...) {} ++ // MOZ_FMT_CATCH(...) {} + format_error_code(out, error_code, message); + } + +-FMT_FUNC void report_system_error(int error_code, ++MOZ_FMT_FUNC void report_system_error(int error_code, + const char* message) noexcept { + do_report_error(format_system_error, error_code, message); + } + +-FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string { ++MOZ_FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string { + // Don't optimize the "{}" case to keep the binary size small and because it +- // can be better optimized in fmt::format anyway. ++ // can be better optimized in mozilla::fmt::format anyway. + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt, args); + return to_string(buffer); +@@ -1448,7 +1448,7 @@ FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string { + + namespace detail { + +-FMT_FUNC void vformat_to(buffer& buf, string_view fmt, format_args args, ++MOZ_FMT_FUNC void vformat_to(buffer& buf, string_view fmt, format_args args, + locale_ref loc) { + auto out = appender(buf); + if (fmt.size() == 2 && equal2(fmt.data(), "{}")) +@@ -1496,14 +1496,14 @@ template class file_base { + auto get() -> int { + int result = getc_unlocked(file_); + if (result == EOF && ferror(file_) != 0) +- FMT_THROW(system_error(errno, FMT_STRING("getc failed"))); ++ MOZ_FMT_THROW(system_error(errno, MOZ_FMT_STRING("getc failed"))); + return result; + } + + // Puts the code unit back into the stream buffer. + void unget(char c) { + if (ungetc(c, file_) == EOF) +- FMT_THROW(system_error(errno, FMT_STRING("ungetc failed"))); ++ MOZ_FMT_THROW(system_error(errno, MOZ_FMT_STRING("ungetc failed"))); + } + + void flush() { fflush(this->file_); } +@@ -1634,17 +1634,17 @@ template class fallback_file : public file_base { + } + }; + +-#ifndef FMT_USE_FALLBACK_FILE +-# define FMT_USE_FALLBACK_FILE 0 ++#ifndef MOZ_FMT_USE_FALLBACK_FILE ++# define MOZ_FMT_USE_FALLBACK_FILE 0 + #endif + + template ++ MOZ_FMT_ENABLE_IF(sizeof(F::_p) != 0 && !MOZ_FMT_USE_FALLBACK_FILE)> + auto get_file(F* f, int) -> apple_file { + return f; + } + template ++ MOZ_FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0 && !MOZ_FMT_USE_FALLBACK_FILE)> + inline auto get_file(F* f, int) -> glibc_file { + return f; + } +@@ -1670,7 +1670,7 @@ class file_print_buffer::value>> + self.file_.advance_write_buffer(self.size()); + if (self.file_.get_write_buffer().size == 0) self.file_.flush(); + auto buf = self.file_.get_write_buffer(); +- FMT_ASSERT(buf.size > 0, ""); ++ MOZ_FMT_ASSERT(buf.size > 0, ""); + self.set(buf.data, buf.size); + self.clear(); + } +@@ -1691,14 +1691,14 @@ class file_print_buffer::value>> + } + }; + +-#if !defined(_WIN32) || defined(FMT_USE_WRITE_CONSOLE) +-FMT_FUNC auto write_console(int, string_view) -> bool { return false; } ++#if !defined(_WIN32) || defined(MOZ_FMT_USE_WRITE_CONSOLE) ++MOZ_FMT_FUNC auto write_console(int, string_view) -> bool { return false; } + #else + using dword = conditional_t; + extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( // + void*, const void*, dword, dword*, void*); + +-FMT_FUNC bool write_console(int fd, string_view text) { ++MOZ_FMT_FUNC bool write_console(int fd, string_view text) { + auto u16 = utf8_to_utf16(text); + return WriteConsoleW(reinterpret_cast(_get_osfhandle(fd)), u16.c_str(), + static_cast(u16.size()), nullptr, nullptr) != 0; +@@ -1707,7 +1707,7 @@ FMT_FUNC bool write_console(int fd, string_view text) { + + #ifdef _WIN32 + // Print assuming legacy (non-Unicode) encoding. +-FMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args, ++MOZ_FMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args, + bool newline) { + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt, args); +@@ -1716,8 +1716,8 @@ FMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args, + } + #endif + +-FMT_FUNC void print(std::FILE* f, string_view text) { +-#if defined(_WIN32) && !defined(FMT_USE_WRITE_CONSOLE) ++MOZ_FMT_FUNC void print(std::FILE* f, string_view text) { ++#if defined(_WIN32) && !defined(MOZ_FMT_USE_WRITE_CONSOLE) + int fd = _fileno(f); + if (_isatty(fd)) { + std::fflush(f); +@@ -1728,27 +1728,27 @@ FMT_FUNC void print(std::FILE* f, string_view text) { + } + } // namespace detail + +-FMT_FUNC void vprint_buffered(std::FILE* f, string_view fmt, format_args args) { ++MOZ_FMT_FUNC void vprint_buffered(std::FILE* f, string_view fmt, format_args args) { + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt, args); + detail::print(f, {buffer.data(), buffer.size()}); + } + +-FMT_FUNC void vprint(std::FILE* f, string_view fmt, format_args args) { ++MOZ_FMT_FUNC void vprint(std::FILE* f, string_view fmt, format_args args) { + if (!detail::file_ref(f).is_buffered() || !detail::has_flockfile<>()) + return vprint_buffered(f, fmt, args); + auto&& buffer = detail::file_print_buffer<>(f); + return detail::vformat_to(buffer, fmt, args); + } + +-FMT_FUNC void vprintln(std::FILE* f, string_view fmt, format_args args) { ++MOZ_FMT_FUNC void vprintln(std::FILE* f, string_view fmt, format_args args) { + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt, args); + buffer.push_back('\n'); + detail::print(f, {buffer.data(), buffer.size()}); + } + +-FMT_FUNC void vprint(string_view fmt, format_args args) { ++MOZ_FMT_FUNC void vprint(string_view fmt, format_args args) { + vprint(stdout, fmt, args); + } + +@@ -1791,7 +1791,7 @@ inline auto is_printable(uint16_t x, const singleton* singletons, + } + + // This code is generated by support/printable.py. +-FMT_FUNC auto is_printable(uint32_t cp) -> bool { ++MOZ_FMT_FUNC auto is_printable(uint32_t cp) -> bool { + static constexpr singleton singletons0[] = { + {0x00, 1}, {0x03, 5}, {0x05, 6}, {0x06, 3}, {0x07, 6}, {0x08, 8}, + {0x09, 17}, {0x0a, 28}, {0x0b, 25}, {0x0c, 20}, {0x0d, 16}, {0x0e, 13}, +@@ -1943,6 +1943,6 @@ FMT_FUNC auto is_printable(uint32_t cp) -> bool { + + } // namespace detail + +-FMT_END_NAMESPACE ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_FORMAT_INL_H_ ++#endif // MOZ_FMT_FORMAT_INL_H_ +diff --git a/third_party/fmt/include/fmt/format.h b/third_party/fmt/include/fmt/format.h +index 01b090d..0819adb 100644 +--- a/third_party/fmt/include/fmt/format.h ++++ b/third_party/fmt/include/fmt/format.h +@@ -30,19 +30,19 @@ + without including the above copyright and permission notices. + */ + +-#ifndef FMT_FORMAT_H_ +-#define FMT_FORMAT_H_ ++#ifndef MOZ_FMT_FORMAT_H_ ++#define MOZ_FMT_FORMAT_H_ + + #include "double-conversion/double-to-string.h" + + #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES + # define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES +-# define FMT_REMOVE_TRANSITIVE_INCLUDES ++# define MOZ_FMT_REMOVE_TRANSITIVE_INCLUDES + #endif + + #include "base.h" + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include // std::signbit + # include // std::byte + # include // uint32_t +@@ -58,70 +58,70 @@ + # include // std::string + # include // std::system_error + +-// Checking FMT_CPLUSPLUS for warning suppression in MSVC. +-# if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 201703L ++// Checking MOZ_FMT_CPLUSPLUS for warning suppression in MSVC. ++# if MOZ_FMT_HAS_INCLUDE() && MOZ_FMT_CPLUSPLUS > 201703L + # include // std::bit_cast + # endif + + // libc++ supports string_view in pre-c++17. +-# if FMT_HAS_INCLUDE() && \ +- (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) ++# if MOZ_FMT_HAS_INCLUDE() && \ ++ (MOZ_FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) + # include +-# define FMT_USE_STRING_VIEW ++# define MOZ_FMT_USE_STRING_VIEW + # endif + +-# if FMT_MSC_VERSION ++# if MOZ_FMT_MSC_VERSION + # include // _BitScanReverse[64], _BitScanForward[64], _umul128 + # endif +-#endif // FMT_MODULE ++#endif // MOZ_FMT_MODULE + +-#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS) ++#if defined(MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS) + // Use the provided definition. + #elif defined(__NVCOMPILER) +-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 +-#elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L +-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 ++# define MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS 0 ++#elif MOZ_FMT_GCC_VERSION >= 903 && MOZ_FMT_CPLUSPLUS >= 201709L ++# define MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS 1 + #elif defined(__cpp_nontype_template_args) && \ + __cpp_nontype_template_args >= 201911L +-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 +-#elif FMT_CLANG_VERSION >= 1200 && FMT_CPLUSPLUS >= 202002L +-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 ++# define MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS 1 ++#elif MOZ_FMT_CLANG_VERSION >= 1200 && MOZ_FMT_CPLUSPLUS >= 202002L ++# define MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS 1 + #else +-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 ++# define MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS 0 + #endif + + #if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L +-# define FMT_INLINE_VARIABLE inline ++# define MOZ_FMT_INLINE_VARIABLE inline + #else +-# define FMT_INLINE_VARIABLE ++# define MOZ_FMT_INLINE_VARIABLE + #endif + + // Check if RTTI is disabled. +-#ifdef FMT_USE_RTTI ++#ifdef MOZ_FMT_USE_RTTI + // Use the provided definition. +-#elif defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \ ++#elif defined(__GXX_RTTI) || MOZ_FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \ + defined(__INTEL_RTTI__) || defined(__RTTI) + // __RTTI is for EDG compilers. _CPPRTTI is for MSVC. +-# define FMT_USE_RTTI 1 ++# define MOZ_FMT_USE_RTTI 1 + #else +-# define FMT_USE_RTTI 0 ++# define MOZ_FMT_USE_RTTI 0 + #endif + + // Visibility when compiled as a shared library/object. +-#if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) +-# define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value) ++#if defined(MOZ_FMT_LIB_EXPORT) || defined(MOZ_FMT_SHARED) ++# define MOZ_FMT_SO_VISIBILITY(value) MOZ_FMT_VISIBILITY(value) + #else +-# define FMT_SO_VISIBILITY(value) ++# define MOZ_FMT_SO_VISIBILITY(value) + #endif + +-#if FMT_GCC_VERSION || FMT_CLANG_VERSION +-# define FMT_NOINLINE __attribute__((noinline)) ++#if MOZ_FMT_GCC_VERSION || MOZ_FMT_CLANG_VERSION ++# define MOZ_FMT_NOINLINE __attribute__((noinline)) + #else +-# define FMT_NOINLINE ++# define MOZ_FMT_NOINLINE + #endif + + namespace std { +-template struct iterator_traits> { ++template struct iterator_traits> { + using iterator_category = output_iterator_tag; + using value_type = T; + using difference_type = +@@ -131,10 +131,10 @@ template struct iterator_traits> { + }; + } // namespace std + +-#ifndef FMT_THROW +-# if FMT_USE_EXCEPTIONS +-# if FMT_MSC_VERSION || defined(__NVCC__) +-FMT_BEGIN_NAMESPACE ++#ifndef MOZ_FMT_THROW ++# if MOZ_FMT_USE_EXCEPTIONS ++# if MOZ_FMT_MSC_VERSION || defined(__NVCC__) ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + template inline void do_throw(const Exception& x) { + // Silence unreachable code warnings in MSVC and NVCC because these +@@ -143,69 +143,69 @@ template inline void do_throw(const Exception& x) { + if (b) throw x; + } + } // namespace detail +-FMT_END_NAMESPACE +-# define FMT_THROW(x) detail::do_throw(x) ++MOZ_FMT_END_NAMESPACE ++# define MOZ_FMT_THROW(x) detail::do_throw(x) + # else +-# define FMT_THROW(x) throw x ++# define MOZ_FMT_THROW(x) throw x + # endif + # else +-# define FMT_THROW(x) \ +- ::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what()) ++# define MOZ_FMT_THROW(x) \ ++ ::mozilla::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what()) + # endif + #endif + +-#ifdef FMT_NO_UNIQUE_ADDRESS ++#ifdef MOZ_FMT_NO_UNIQUE_ADDRESS + // Use the provided definition. +-#elif FMT_CPLUSPLUS < 202002L ++#elif MOZ_FMT_CPLUSPLUS < 202002L + // Not supported. +-#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address) +-# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] ++#elif MOZ_FMT_HAS_CPP_ATTRIBUTE(no_unique_address) ++# define MOZ_FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] + // VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485). +-#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION +-# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] ++#elif MOZ_FMT_MSC_VERSION >= 1929 && !MOZ_FMT_CLANG_VERSION ++# define MOZ_FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] + #endif +-#ifndef FMT_NO_UNIQUE_ADDRESS +-# define FMT_NO_UNIQUE_ADDRESS ++#ifndef MOZ_FMT_NO_UNIQUE_ADDRESS ++# define MOZ_FMT_NO_UNIQUE_ADDRESS + #endif + +-// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of ++// Defining MOZ_FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of + // integer formatter template instantiations to just one by only using the + // largest integer type. This results in a reduction in binary size but will + // cause a decrease in integer formatting performance. +-#if !defined(FMT_REDUCE_INT_INSTANTIATIONS) +-# define FMT_REDUCE_INT_INSTANTIATIONS 0 ++#if !defined(MOZ_FMT_REDUCE_INT_INSTANTIATIONS) ++# define MOZ_FMT_REDUCE_INT_INSTANTIATIONS 0 + #endif + + // __builtin_clz is broken in clang with Microsoft codegen: + // https://github.com/fmtlib/fmt/issues/519. +-#if !FMT_MSC_VERSION +-# if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION +-# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) ++#if !MOZ_FMT_MSC_VERSION ++# if MOZ_FMT_HAS_BUILTIN(__builtin_clz) || MOZ_FMT_GCC_VERSION || MOZ_FMT_ICC_VERSION ++# define MOZ_FMT_BUILTIN_CLZ(n) __builtin_clz(n) + # endif +-# if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION +-# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) ++# if MOZ_FMT_HAS_BUILTIN(__builtin_clzll) || MOZ_FMT_GCC_VERSION || MOZ_FMT_ICC_VERSION ++# define MOZ_FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) + # endif + #endif + + // __builtin_ctz is broken in Intel Compiler Classic on Windows: + // https://github.com/fmtlib/fmt/issues/2510. + #ifndef __ICL +-# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION || \ ++# if MOZ_FMT_HAS_BUILTIN(__builtin_ctz) || MOZ_FMT_GCC_VERSION || MOZ_FMT_ICC_VERSION || \ + defined(__NVCOMPILER) +-# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n) ++# define MOZ_FMT_BUILTIN_CTZ(n) __builtin_ctz(n) + # endif +-# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \ +- FMT_ICC_VERSION || defined(__NVCOMPILER) +-# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n) ++# if MOZ_FMT_HAS_BUILTIN(__builtin_ctzll) || MOZ_FMT_GCC_VERSION || \ ++ MOZ_FMT_ICC_VERSION || defined(__NVCOMPILER) ++# define MOZ_FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n) + # endif + #endif + + // Some compilers masquerade as both MSVC and GCC-likes or otherwise support +-// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the ++// __builtin_clz and __builtin_clzll, so only define MOZ_FMT_BUILTIN_CLZ using the + // MSVC intrinsics if the clz and clzll builtins are not available. +-#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) && \ +- !defined(FMT_BUILTIN_CTZLL) +-FMT_BEGIN_NAMESPACE ++#if MOZ_FMT_MSC_VERSION && !defined(MOZ_FMT_BUILTIN_CLZLL) && \ ++ !defined(MOZ_FMT_BUILTIN_CTZLL) ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + // Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning. + # if !defined(__clang__) +@@ -220,14 +220,14 @@ namespace detail { + inline auto clz(uint32_t x) -> int { + unsigned long r = 0; + _BitScanReverse(&r, x); +- FMT_ASSERT(x != 0, ""); ++ MOZ_FMT_ASSERT(x != 0, ""); + // Static analysis complains about using uninitialized data + // "r", but the only way that can happen is if "x" is 0, + // which the callers guarantee to not happen. +- FMT_MSC_WARNING(suppress : 6102) ++ MOZ_FMT_MSC_WARNING(suppress : 6102) + return 31 ^ static_cast(r); + } +-# define FMT_BUILTIN_CLZ(n) detail::clz(n) ++# define MOZ_FMT_BUILTIN_CLZ(n) detail::clz(n) + + inline auto clzll(uint64_t x) -> int { + unsigned long r = 0; +@@ -240,25 +240,25 @@ inline auto clzll(uint64_t x) -> int { + // Scan the low 32 bits. + _BitScanReverse(&r, static_cast(x)); + # endif +- FMT_ASSERT(x != 0, ""); +- FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. ++ MOZ_FMT_ASSERT(x != 0, ""); ++ MOZ_FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. + return 63 ^ static_cast(r); + } +-# define FMT_BUILTIN_CLZLL(n) detail::clzll(n) ++# define MOZ_FMT_BUILTIN_CLZLL(n) detail::clzll(n) + + inline auto ctz(uint32_t x) -> int { + unsigned long r = 0; + _BitScanForward(&r, x); +- FMT_ASSERT(x != 0, ""); +- FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. ++ MOZ_FMT_ASSERT(x != 0, ""); ++ MOZ_FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. + return static_cast(r); + } +-# define FMT_BUILTIN_CTZ(n) detail::ctz(n) ++# define MOZ_FMT_BUILTIN_CTZ(n) detail::ctz(n) + + inline auto ctzll(uint64_t x) -> int { + unsigned long r = 0; +- FMT_ASSERT(x != 0, ""); +- FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. ++ MOZ_FMT_ASSERT(x != 0, ""); ++ MOZ_FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. + # ifdef _WIN64 + _BitScanForward64(&r, x); + # else +@@ -270,12 +270,12 @@ inline auto ctzll(uint64_t x) -> int { + # endif + return static_cast(r); + } +-# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n) ++# define MOZ_FMT_BUILTIN_CTZLL(n) detail::ctzll(n) + } // namespace detail +-FMT_END_NAMESPACE ++MOZ_FMT_END_NAMESPACE + #endif + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + + template + struct is_contiguous> +@@ -283,14 +283,14 @@ struct is_contiguous> + + namespace detail { + +-FMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) { ++MOZ_FMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) { + ignore_unused(condition); +-#ifdef FMT_FUZZ ++#ifdef MOZ_FMT_FUZZ + if (condition) throw std::runtime_error("fuzzing limit reached"); + #endif + } + +-#if defined(FMT_USE_STRING_VIEW) ++#if defined(MOZ_FMT_USE_STRING_VIEW) + template using std_string_view = std::basic_string_view; + #else + template struct std_string_view {}; +@@ -302,14 +302,14 @@ template struct string_literal { + return {value, sizeof...(C)}; + } + }; +-#if FMT_CPLUSPLUS < 201703L ++#if MOZ_FMT_CPLUSPLUS < 201703L + template + constexpr Char string_literal::value[sizeof...(C)]; + #endif + + // Implementation of std::bit_cast for pre-C++20. +-template +-FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { ++template ++MOZ_FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { + #ifdef __cpp_lib_bit_cast + if (is_constant_evaluated()) return std::bit_cast(from); + #endif +@@ -345,7 +345,7 @@ class uint128_fallback { + constexpr auto high() const noexcept -> uint64_t { return hi_; } + constexpr auto low() const noexcept -> uint64_t { return lo_; } + +- template ::value)> ++ template ::value)> + constexpr explicit operator T() const { + return static_cast(lo_); + } +@@ -376,16 +376,16 @@ class uint128_fallback { + -> uint128_fallback { + return {~n.hi_, ~n.lo_}; + } +- friend FMT_CONSTEXPR auto operator+(const uint128_fallback& lhs, ++ friend MOZ_FMT_CONSTEXPR auto operator+(const uint128_fallback& lhs, + const uint128_fallback& rhs) + -> uint128_fallback { + auto result = uint128_fallback(lhs); + result += rhs; + return result; + } +- friend FMT_CONSTEXPR auto operator*(const uint128_fallback& lhs, uint32_t rhs) ++ friend MOZ_FMT_CONSTEXPR auto operator*(const uint128_fallback& lhs, uint32_t rhs) + -> uint128_fallback { +- FMT_ASSERT(lhs.hi_ == 0, ""); ++ MOZ_FMT_ASSERT(lhs.hi_ == 0, ""); + uint64_t hi = (lhs.lo_ >> 32) * rhs; + uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs; + uint64_t new_lo = (hi << 32) + lo; +@@ -395,42 +395,42 @@ class uint128_fallback { + -> uint128_fallback { + return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs}; + } +- FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback { ++ MOZ_FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback { + if (shift == 64) return {0, hi_}; + if (shift > 64) return uint128_fallback(0, hi_) >> (shift - 64); + return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)}; + } +- FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback { ++ MOZ_FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback { + if (shift == 64) return {lo_, 0}; + if (shift > 64) return uint128_fallback(lo_, 0) << (shift - 64); + return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)}; + } +- FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback& { ++ MOZ_FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback& { + return *this = *this >> shift; + } +- FMT_CONSTEXPR void operator+=(uint128_fallback n) { ++ MOZ_FMT_CONSTEXPR void operator+=(uint128_fallback n) { + uint64_t new_lo = lo_ + n.lo_; + uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0); +- FMT_ASSERT(new_hi >= hi_, ""); ++ MOZ_FMT_ASSERT(new_hi >= hi_, ""); + lo_ = new_lo; + hi_ = new_hi; + } +- FMT_CONSTEXPR void operator&=(uint128_fallback n) { ++ MOZ_FMT_CONSTEXPR void operator&=(uint128_fallback n) { + lo_ &= n.lo_; + hi_ &= n.hi_; + } + +- FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback& { ++ MOZ_FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback& { + if (is_constant_evaluated()) { + lo_ += n; + hi_ += (lo_ < n ? 1 : 0); + return *this; + } +-#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) ++#if MOZ_FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) + unsigned long long carry; + lo_ = __builtin_addcll(lo_, n, 0, &carry); + hi_ += carry; +-#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__) ++#elif MOZ_FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__) + unsigned long long result; + auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result); + lo_ = result; +@@ -446,7 +446,7 @@ class uint128_fallback { + } + }; + +-using uint128_t = conditional_t; ++using uint128_t = conditional_t; + + #ifdef UINTPTR_MAX + using uintptr_t = ::uintptr_t; +@@ -469,7 +469,7 @@ template <> constexpr auto num_bits() -> int { return 128; } + + // A heterogeneous bit_cast used for converting 96-bit long double to uint128_t + // and 128-bit pointers to uint128_fallback. +-template sizeof(From))> ++template sizeof(From))> + inline auto bit_cast(const From& from) -> To { + constexpr auto size = static_cast(sizeof(From) / sizeof(unsigned)); + struct data_t { +@@ -487,32 +487,32 @@ inline auto bit_cast(const From& from) -> To { + } + + template +-FMT_CONSTEXPR20 inline auto countl_zero_fallback(UInt n) -> int { ++MOZ_FMT_CONSTEXPR20 inline auto countl_zero_fallback(UInt n) -> int { + int lz = 0; + constexpr UInt msb_mask = static_cast(1) << (num_bits() - 1); + for (; (n & msb_mask) == 0; n <<= 1) lz++; + return lz; + } + +-FMT_CONSTEXPR20 inline auto countl_zero(uint32_t n) -> int { +-#ifdef FMT_BUILTIN_CLZ +- if (!is_constant_evaluated()) return FMT_BUILTIN_CLZ(n); ++MOZ_FMT_CONSTEXPR20 inline auto countl_zero(uint32_t n) -> int { ++#ifdef MOZ_FMT_BUILTIN_CLZ ++ if (!is_constant_evaluated()) return MOZ_FMT_BUILTIN_CLZ(n); + #endif + return countl_zero_fallback(n); + } + +-FMT_CONSTEXPR20 inline auto countl_zero(uint64_t n) -> int { +-#ifdef FMT_BUILTIN_CLZLL +- if (!is_constant_evaluated()) return FMT_BUILTIN_CLZLL(n); ++MOZ_FMT_CONSTEXPR20 inline auto countl_zero(uint64_t n) -> int { ++#ifdef MOZ_FMT_BUILTIN_CLZLL ++ if (!is_constant_evaluated()) return MOZ_FMT_BUILTIN_CLZLL(n); + #endif + return countl_zero_fallback(n); + } + +-FMT_INLINE void assume(bool condition) { ++MOZ_FMT_INLINE void assume(bool condition) { + (void)condition; +-#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION ++#if MOZ_FMT_HAS_BUILTIN(__builtin_assume) && !MOZ_FMT_ICC_VERSION + __builtin_assume(condition); +-#elif FMT_GCC_VERSION ++#elif MOZ_FMT_GCC_VERSION + if (!condition) __builtin_unreachable(); + #endif + } +@@ -520,12 +520,12 @@ FMT_INLINE void assume(bool condition) { + // Attempts to reserve space for n extra characters in the output range. + // Returns a pointer to the reserved range or a reference to it. + template ::value&& ++ MOZ_FMT_ENABLE_IF(is_back_insert_iterator::value&& + is_contiguous::value)> +-#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION ++#if MOZ_FMT_CLANG_VERSION >= 307 && !MOZ_FMT_ICC_VERSION + __attribute__((no_sanitize("undefined"))) + #endif +-FMT_CONSTEXPR20 inline auto ++MOZ_FMT_CONSTEXPR20 inline auto + reserve(OutputIt it, size_t n) -> typename OutputIt::value_type* { + auto& c = get_container(it); + size_t size = c.size(); +@@ -534,7 +534,7 @@ reserve(OutputIt it, size_t n) -> typename OutputIt::value_type* { + } + + template +-FMT_CONSTEXPR20 inline auto reserve(basic_appender it, size_t n) ++MOZ_FMT_CONSTEXPR20 inline auto reserve(basic_appender it, size_t n) + -> basic_appender { + buffer& buf = get_container(it); + buf.try_reserve(buf.size() + n); +@@ -555,7 +555,7 @@ constexpr auto to_pointer(OutputIt, size_t) -> T* { + return nullptr; + } + template +-FMT_CONSTEXPR20 auto to_pointer(basic_appender it, size_t n) -> T* { ++MOZ_FMT_CONSTEXPR20 auto to_pointer(basic_appender it, size_t n) -> T* { + buffer& buf = get_container(it); + auto size = buf.size(); + buf.try_reserve(size + n); +@@ -565,7 +565,7 @@ FMT_CONSTEXPR20 auto to_pointer(basic_appender it, size_t n) -> T* { + } + + template ::value&& ++ MOZ_FMT_ENABLE_IF(is_back_insert_iterator::value&& + is_contiguous::value)> + inline auto base_iterator(OutputIt it, + typename OutputIt::container_type::value_type*) +@@ -581,20 +581,20 @@ constexpr auto base_iterator(Iterator, Iterator it) -> Iterator { + // is spectacularly slow to compile in C++20 so use a simple fill_n + // instead (#1998). + template +-FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) ++MOZ_FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) + -> OutputIt { + for (Size i = 0; i < count; ++i) *out++ = value; + return out; + } + template +-FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { ++MOZ_FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { + if (is_constant_evaluated()) return fill_n(out, count, value); + std::memset(out, value, to_unsigned(count)); + return out + count; + } + + template +-FMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, ++MOZ_FMT_CONSTEXPR MOZ_FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, + OutputIt out) -> OutputIt { + return copy(begin, end, out); + } +@@ -616,7 +616,7 @@ FMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, + * occurs, this pointer will be a guess that depends on the particular + * error, but it will always advance at least one byte. + */ +-FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e) ++MOZ_FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e) + -> const char* { + constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07}; + constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536}; +@@ -653,12 +653,12 @@ FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e) + return next; + } + +-constexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point = ~uint32_t(); ++constexpr MOZ_FMT_INLINE_VARIABLE uint32_t invalid_code_point = ~uint32_t(); + + // Invokes f(cp, sv) for every code point cp in s with sv being the string view + // corresponding to the code point. cp is invalid_code_point on error. + template +-FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { ++MOZ_FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { + auto decode = [f](const char* buf_ptr, const char* ptr) { + auto cp = uint32_t(); + auto error = 0; +@@ -679,7 +679,7 @@ FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { + auto num_chars_left = to_unsigned(s.data() + s.size() - p); + if (num_chars_left == 0) return; + +- FMT_ASSERT(num_chars_left < block_size, ""); ++ MOZ_FMT_ASSERT(num_chars_left < block_size, ""); + char buf[2 * block_size - 1] = {}; + copy(p, p + num_chars_left, buf); + const char* buf_ptr = buf; +@@ -697,12 +697,12 @@ inline auto compute_width(basic_string_view s) -> size_t { + } + + // Computes approximate display width of a UTF-8 string. +-FMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t { ++MOZ_FMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t { + size_t num_code_points = 0; + // It is not a lambda for compatibility with C++14. + struct count_code_points { + size_t* count; +- FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool { ++ MOZ_FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool { + *count += to_unsigned( + 1 + + (cp >= 0x1100 && +@@ -766,17 +766,17 @@ using is_integer = + !std::is_same::value && + !std::is_same::value>; + +-#if defined(FMT_USE_FLOAT128) ++#if defined(MOZ_FMT_USE_FLOAT128) + // Use the provided definition. +-#elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE() +-# define FMT_USE_FLOAT128 1 +-#elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \ ++#elif MOZ_FMT_CLANG_VERSION && MOZ_FMT_HAS_INCLUDE() ++# define MOZ_FMT_USE_FLOAT128 1 ++#elif MOZ_FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \ + !defined(__STRICT_ANSI__) +-# define FMT_USE_FLOAT128 1 ++# define MOZ_FMT_USE_FLOAT128 1 + #else +-# define FMT_USE_FLOAT128 0 ++# define MOZ_FMT_USE_FLOAT128 0 + #endif +-#if FMT_USE_FLOAT128 ++#if MOZ_FMT_USE_FLOAT128 + using float128 = __float128; + #else + struct float128 {}; +@@ -796,8 +796,8 @@ template struct is_fast_float : std::false_type {}; + template + using is_double_double = bool_constant::digits == 106>; + +-#ifndef FMT_USE_FULL_CACHE_DRAGONBOX +-# define FMT_USE_FULL_CACHE_DRAGONBOX 0 ++#ifndef MOZ_FMT_USE_FULL_CACHE_DRAGONBOX ++# define MOZ_FMT_USE_FULL_CACHE_DRAGONBOX 0 + #endif + + // An allocator that uses malloc/free to allow removing dependency on the C++ +@@ -806,9 +806,9 @@ template struct allocator { + using value_type = T; + + T* allocate(size_t n) { +- FMT_ASSERT(n <= max_value() / sizeof(T), ""); ++ MOZ_FMT_ASSERT(n <= max_value() / sizeof(T), ""); + T* p = static_cast(malloc(n * sizeof(T))); +- if (!p) FMT_THROW(std::bad_alloc()); ++ if (!p) MOZ_FMT_THROW(std::bad_alloc()); + return p; + } + +@@ -817,7 +817,7 @@ template struct allocator { + + } // namespace detail + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + // The number of characters to store in the basic_memory_buffer object itself + // to avoid dynamic memory allocation. +@@ -830,8 +830,8 @@ enum { inline_buffer_size = 500 }; + * + * **Example**: + * +- * auto out = fmt::memory_buffer(); +- * fmt::format_to(std::back_inserter(out), "The answer is {}.", 42); ++ * auto out = mozilla::fmt::memory_buffer(); ++ * mozilla::fmt::format_to(std::back_inserter(out), "The answer is {}.", 42); + * + * This will append "The answer is 42." to `out`. The buffer content can be + * converted to `std::string` with `to_string(out)`. +@@ -843,15 +843,15 @@ class basic_memory_buffer : public detail::buffer { + T store_[SIZE]; + + // Don't inherit from Allocator to avoid generating type_info for it. +- FMT_NO_UNIQUE_ADDRESS Allocator alloc_; ++ MOZ_FMT_NO_UNIQUE_ADDRESS Allocator alloc_; + + // Deallocate memory allocated by the buffer. +- FMT_CONSTEXPR20 void deallocate() { ++ MOZ_FMT_CONSTEXPR20 void deallocate() { + T* data = this->data(); + if (data != store_) alloc_.deallocate(data, this->capacity()); + } + +- static FMT_CONSTEXPR20 void grow(detail::buffer& buf, size_t size) { ++ static MOZ_FMT_CONSTEXPR20 void grow(detail::buffer& buf, size_t size) { + detail::abort_fuzzing_if(size > 5000); + auto& self = static_cast(buf); + const size_t max_size = +@@ -879,17 +879,17 @@ class basic_memory_buffer : public detail::buffer { + using value_type = T; + using const_reference = const T&; + +- FMT_CONSTEXPR explicit basic_memory_buffer( ++ MOZ_FMT_CONSTEXPR explicit basic_memory_buffer( + const Allocator& alloc = Allocator()) + : detail::buffer(grow), alloc_(alloc) { + this->set(store_, SIZE); + if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); + } +- FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } ++ MOZ_FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } + + private: + // Move data from other to this buffer. +- FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { ++ MOZ_FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { + alloc_ = std::move(other.alloc_); + T* data = other.data(); + size_t size = other.size(), capacity = other.capacity(); +@@ -909,14 +909,14 @@ class basic_memory_buffer : public detail::buffer { + public: + /// Constructs a `basic_memory_buffer` object moving the content of the other + /// object to it. +- FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer&& other) noexcept ++ MOZ_FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer&& other) noexcept + : detail::buffer(grow) { + move(other); + } + + /// Moves the content of the other `basic_memory_buffer` object to this one. + auto operator=(basic_memory_buffer&& other) noexcept -> basic_memory_buffer& { +- FMT_ASSERT(this != &other, ""); ++ MOZ_FMT_ASSERT(this != &other, ""); + deallocate(); + move(other); + return *this; +@@ -927,14 +927,14 @@ class basic_memory_buffer : public detail::buffer { + + /// Resizes the buffer to contain `count` elements. If T is a POD type new + /// elements may not be initialized. +- FMT_CONSTEXPR void resize(size_t count) { this->try_resize(count); } ++ MOZ_FMT_CONSTEXPR void resize(size_t count) { this->try_resize(count); } + + /// Increases the buffer capacity to `new_capacity`. + void reserve(size_t new_capacity) { this->try_reserve(new_capacity); } + + using detail::buffer::append; + template +- FMT_CONSTEXPR20 void append(const ContiguousRange& range) { ++ MOZ_FMT_CONSTEXPR20 void append(const ContiguousRange& range) { + append(range.data(), range.data() + range.size()); + } + }; +@@ -942,7 +942,7 @@ class basic_memory_buffer : public detail::buffer { + using memory_buffer = basic_memory_buffer; + + template +-FMT_NODISCARD auto to_string(basic_memory_buffer& buf) ++MOZ_FMT_NODISCARD auto to_string(basic_memory_buffer& buf) + -> std::string { + auto size = buf.size(); + detail::assume(size < std::string().max_size()); +@@ -966,9 +966,9 @@ class writer { + /// output to the file. + template void print(format_string fmt, T&&... args) { + if (buf_) +- fmt::format_to(appender(*buf_), fmt, std::forward(args)...); ++ mozilla::fmt::format_to(appender(*buf_), fmt, std::forward(args)...); + else +- fmt::print(file_, fmt, std::forward(args)...); ++ mozilla::fmt::print(file_, fmt, std::forward(args)...); + } + }; + +@@ -988,26 +988,26 @@ template + struct is_contiguous> : std::true_type { + }; + +-FMT_END_EXPORT ++MOZ_FMT_END_EXPORT + namespace detail { +-FMT_API auto write_console(int fd, string_view text) -> bool; +-FMT_API void print(FILE*, string_view); ++MOZ_FMT_API auto write_console(int fd, string_view text) -> bool; ++MOZ_FMT_API void print(FILE*, string_view); + } // namespace detail + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + // Suppress a misleading warning in older versions of clang. +-FMT_PRAGMA_CLANG(diagnostic ignored "-Wweak-vtables") ++MOZ_FMT_PRAGMA_CLANG(diagnostic ignored "-Wweak-vtables") + + /// An error reported from a formatting function. +-class FMT_SO_VISIBILITY("default") format_error : public std::runtime_error { ++class MOZ_FMT_SO_VISIBILITY("default") format_error : public std::runtime_error { + public: + using std::runtime_error::runtime_error; + }; + + namespace detail { + template struct fixed_string { +- FMT_CONSTEXPR20 fixed_string(const Char (&s)[N]) { ++ MOZ_FMT_CONSTEXPR20 fixed_string(const Char (&s)[N]) { + detail::copy(static_cast(s), s + N, + data); + } +@@ -1041,10 +1041,10 @@ template class generic_context { + public: + using char_type = Char; + using iterator = OutputIt; +- using parse_context_type FMT_DEPRECATED = parse_context; ++ using parse_context_type MOZ_FMT_DEPRECATED = parse_context; + template +- using formatter_type FMT_DEPRECATED = formatter; +- enum { builtin_types = FMT_BUILTIN_TYPES }; ++ using formatter_type MOZ_FMT_DEPRECATED = formatter; ++ enum { builtin_types = MOZ_FMT_BUILTIN_TYPES }; + + constexpr generic_context(OutputIt out, + basic_format_args args, +@@ -1060,17 +1060,17 @@ template class generic_context { + auto arg(basic_string_view name) -> basic_format_arg { + return args_.get(name); + } +- FMT_CONSTEXPR auto arg_id(basic_string_view name) -> int { ++ MOZ_FMT_CONSTEXPR auto arg_id(basic_string_view name) -> int { + return args_.get_id(name); + } + +- FMT_CONSTEXPR auto out() -> iterator { return out_; } ++ MOZ_FMT_CONSTEXPR auto out() -> iterator { return out_; } + + void advance_to(iterator it) { + if (!detail::is_back_insert_iterator()) out_ = it; + } + +- FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; } ++ MOZ_FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; } + }; + + class loc_value { +@@ -1078,10 +1078,10 @@ class loc_value { + basic_format_arg value_; + + public: +- template ::value)> ++ template ::value)> + loc_value(T value) : value_(value) {} + +- template ::value)> ++ template ::value)> + loc_value(T) {} + + template auto visit(Visitor&& vis) -> decltype(vis(0)) { +@@ -1102,7 +1102,7 @@ template class format_facet : public Locale::facet { + const format_specs& specs) const -> bool; + + public: +- static FMT_API typename Locale::id id; ++ static MOZ_FMT_API typename Locale::id id; + + explicit format_facet(Locale& loc); + explicit format_facet(string_view sep = "", +@@ -1118,17 +1118,17 @@ template class format_facet : public Locale::facet { + } + }; + +-FMT_END_EXPORT ++MOZ_FMT_END_EXPORT + + namespace detail { + + // Returns true if value is negative, false otherwise. + // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. +-template ::value)> ++template ::value)> + constexpr auto is_negative(T value) -> bool { + return value < 0; + } +-template ::value)> ++template ::value)> + constexpr auto is_negative(T) -> bool { + return false; + } +@@ -1137,13 +1137,13 @@ constexpr auto is_negative(T) -> bool { + // represent all values of an integral type T. + template + using uint32_or_64_or_128_t = +- conditional_t() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS, ++ conditional_t() <= 32 && !MOZ_FMT_REDUCE_INT_INSTANTIATIONS, + uint32_t, + conditional_t() <= 64, uint64_t, uint128_t>>; + template + using uint64_or_128_t = conditional_t() <= 64, uint64_t, uint128_t>; + +-#define FMT_POWERS_OF_10(factor) \ ++#define MOZ_FMT_POWERS_OF_10(factor) \ + factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \ + (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \ + (factor) * 100000000, (factor) * 1000000000 +@@ -1167,7 +1167,7 @@ template constexpr auto getsign(sign s) -> Char { + (static_cast(s) * 8)); + } + +-template FMT_CONSTEXPR auto count_digits_fallback(T n) -> int { ++template MOZ_FMT_CONSTEXPR auto count_digits_fallback(T n) -> int { + int count = 1; + for (;;) { + // Integer division is slow so do it for a group of four digits instead +@@ -1181,13 +1181,13 @@ template FMT_CONSTEXPR auto count_digits_fallback(T n) -> int { + count += 4; + } + } +-#if FMT_USE_INT128 +-FMT_CONSTEXPR inline auto count_digits(uint128_opt n) -> int { ++#if MOZ_FMT_USE_INT128 ++MOZ_FMT_CONSTEXPR inline auto count_digits(uint128_opt n) -> int { + return count_digits_fallback(n); + } + #endif + +-#ifdef FMT_BUILTIN_CLZLL ++#ifdef MOZ_FMT_BUILTIN_CLZLL + // It is a separate function rather than a part of count_digits to workaround + // the lack of static constexpr in constexpr functions. + inline auto do_count_digits(uint64_t n) -> int { +@@ -1200,9 +1200,9 @@ inline auto do_count_digits(uint64_t n) -> int { + 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, + 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, + 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20}; +- auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63]; ++ auto t = bsr2log10[MOZ_FMT_BUILTIN_CLZLL(n | 1) ^ 63]; + static constexpr const uint64_t zero_or_powers_of_10[] = { +- 0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL), ++ 0, 0, MOZ_FMT_POWERS_OF_10(1U), MOZ_FMT_POWERS_OF_10(1000000000ULL), + 10000000000000000000ULL}; + return t - (n < zero_or_powers_of_10[t]); + } +@@ -1210,19 +1210,19 @@ inline auto do_count_digits(uint64_t n) -> int { + + // Returns the number of decimal digits in n. Leading zeros are not counted + // except for n == 0 in which case count_digits returns 1. +-FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { +-#ifdef FMT_BUILTIN_CLZLL +- if (!is_constant_evaluated() && !FMT_OPTIMIZE_SIZE) return do_count_digits(n); ++MOZ_FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { ++#ifdef MOZ_FMT_BUILTIN_CLZLL ++ if (!is_constant_evaluated() && !MOZ_FMT_OPTIMIZE_SIZE) return do_count_digits(n); + #endif + return count_digits_fallback(n); + } + + // Counts the number of digits in n. BITS = log2(radix). + template +-FMT_CONSTEXPR auto count_digits(UInt n) -> int { +-#ifdef FMT_BUILTIN_CLZ ++MOZ_FMT_CONSTEXPR auto count_digits(UInt n) -> int { ++#ifdef MOZ_FMT_BUILTIN_CLZ + if (!is_constant_evaluated() && num_bits() == 32) +- return (FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; ++ return (MOZ_FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; + #endif + // Lambda avoids unreachable code warnings from NVHPC. + return [](UInt m) { +@@ -1234,35 +1234,35 @@ FMT_CONSTEXPR auto count_digits(UInt n) -> int { + }(n); + } + +-#ifdef FMT_BUILTIN_CLZ ++#ifdef MOZ_FMT_BUILTIN_CLZ + // It is a separate function rather than a part of count_digits to workaround + // the lack of static constexpr in constexpr functions. +-FMT_INLINE auto do_count_digits(uint32_t n) -> int { ++MOZ_FMT_INLINE auto do_count_digits(uint32_t n) -> int { + // An optimization by Kendall Willets from https://bit.ly/3uOIQrB. + // This increments the upper 32 bits (log10(T) - 1) when >= T is added. +-# define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T) ++# define MOZ_FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T) + static constexpr uint64_t table[] = { +- FMT_INC(0), FMT_INC(0), FMT_INC(0), // 8 +- FMT_INC(10), FMT_INC(10), FMT_INC(10), // 64 +- FMT_INC(100), FMT_INC(100), FMT_INC(100), // 512 +- FMT_INC(1000), FMT_INC(1000), FMT_INC(1000), // 4096 +- FMT_INC(10000), FMT_INC(10000), FMT_INC(10000), // 32k +- FMT_INC(100000), FMT_INC(100000), FMT_INC(100000), // 256k +- FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000), // 2048k +- FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000), // 16M +- FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000), // 128M +- FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000), // 1024M +- FMT_INC(1000000000), FMT_INC(1000000000) // 4B ++ MOZ_FMT_INC(0), MOZ_FMT_INC(0), MOZ_FMT_INC(0), // 8 ++ MOZ_FMT_INC(10), MOZ_FMT_INC(10), MOZ_FMT_INC(10), // 64 ++ MOZ_FMT_INC(100), MOZ_FMT_INC(100), MOZ_FMT_INC(100), // 512 ++ MOZ_FMT_INC(1000), MOZ_FMT_INC(1000), MOZ_FMT_INC(1000), // 4096 ++ MOZ_FMT_INC(10000), MOZ_FMT_INC(10000), MOZ_FMT_INC(10000), // 32k ++ MOZ_FMT_INC(100000), MOZ_FMT_INC(100000), MOZ_FMT_INC(100000), // 256k ++ MOZ_FMT_INC(1000000), MOZ_FMT_INC(1000000), MOZ_FMT_INC(1000000), // 2048k ++ MOZ_FMT_INC(10000000), MOZ_FMT_INC(10000000), MOZ_FMT_INC(10000000), // 16M ++ MOZ_FMT_INC(100000000), MOZ_FMT_INC(100000000), MOZ_FMT_INC(100000000), // 128M ++ MOZ_FMT_INC(1000000000), MOZ_FMT_INC(1000000000), MOZ_FMT_INC(1000000000), // 1024M ++ MOZ_FMT_INC(1000000000), MOZ_FMT_INC(1000000000) // 4B + }; +- auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31]; ++ auto inc = table[MOZ_FMT_BUILTIN_CLZ(n | 1) ^ 31]; + return static_cast((n + inc) >> 32); + } + #endif + + // Optional version of count_digits for better performance on 32-bit platforms. +-FMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int { +-#ifdef FMT_BUILTIN_CLZ +- if (!is_constant_evaluated() && !FMT_OPTIMIZE_SIZE) return do_count_digits(n); ++MOZ_FMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int { ++#ifdef MOZ_FMT_BUILTIN_CLZ ++ if (!is_constant_evaluated() && !MOZ_FMT_OPTIMIZE_SIZE) return do_count_digits(n); + #endif + return count_digits_fallback(n); + } +@@ -1279,7 +1279,7 @@ template struct thousands_sep_result { + }; + + template +-FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result; ++MOZ_FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result; + template + inline auto thousands_sep(locale_ref loc) -> thousands_sep_result { + auto result = thousands_sep_impl(loc); +@@ -1291,7 +1291,7 @@ inline auto thousands_sep(locale_ref loc) -> thousands_sep_result { + } + + template +-FMT_API auto decimal_point_impl(locale_ref loc) -> Char; ++MOZ_FMT_API auto decimal_point_impl(locale_ref loc) -> Char; + template inline auto decimal_point(locale_ref loc) -> Char { + return Char(decimal_point_impl(loc)); + } +@@ -1299,16 +1299,16 @@ template <> inline auto decimal_point(locale_ref loc) -> wchar_t { + return decimal_point_impl(loc); + } + +-#ifndef FMT_HEADER_ONLY +-FMT_BEGIN_EXPORT +-extern template FMT_API auto thousands_sep_impl(locale_ref) ++#ifndef MOZ_FMT_HEADER_ONLY ++MOZ_FMT_BEGIN_EXPORT ++extern template MOZ_FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +-extern template FMT_API auto thousands_sep_impl(locale_ref) ++extern template MOZ_FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +-extern template FMT_API auto decimal_point_impl(locale_ref) -> char; +-extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; +-FMT_END_EXPORT +-#endif // FMT_HEADER_ONLY ++extern template MOZ_FMT_API auto decimal_point_impl(locale_ref) -> char; ++extern template MOZ_FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; ++MOZ_FMT_END_EXPORT ++#endif // MOZ_FMT_HEADER_ONLY + + // Compares two characters for equality. + template auto equal2(const Char* lhs, const char* rhs) -> bool { +@@ -1320,9 +1320,9 @@ inline auto equal2(const char* lhs, const char* rhs) -> bool { + + // Writes a two-digit value to out. + template +-FMT_CONSTEXPR20 FMT_INLINE void write2digits(Char* out, size_t value) { ++MOZ_FMT_CONSTEXPR20 MOZ_FMT_INLINE void write2digits(Char* out, size_t value) { + if (!is_constant_evaluated() && std::is_same::value && +- !FMT_OPTIMIZE_SIZE) { ++ !MOZ_FMT_OPTIMIZE_SIZE) { + memcpy(out, digits2(value), 2); + return; + } +@@ -1333,9 +1333,9 @@ FMT_CONSTEXPR20 FMT_INLINE void write2digits(Char* out, size_t value) { + // Formats a decimal unsigned integer value writing to out pointing to a buffer + // of specified size. The caller must ensure that the buffer is large enough. + template +-FMT_CONSTEXPR20 auto do_format_decimal(Char* out, UInt value, int size) ++MOZ_FMT_CONSTEXPR20 auto do_format_decimal(Char* out, UInt value, int size) + -> Char* { +- FMT_ASSERT(size >= count_digits(value), "invalid digit count"); ++ MOZ_FMT_ASSERT(size >= count_digits(value), "invalid digit count"); + unsigned n = to_unsigned(size); + while (value >= 100) { + // Integer division is slow so do it for a group of two digits instead +@@ -1355,15 +1355,15 @@ FMT_CONSTEXPR20 auto do_format_decimal(Char* out, UInt value, int size) + } + + template +-FMT_CONSTEXPR FMT_INLINE auto format_decimal(Char* out, UInt value, ++MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto format_decimal(Char* out, UInt value, + int num_digits) -> Char* { + do_format_decimal(out, value, num_digits); + return out + num_digits; + } + + template ::value)> +-FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) ++ MOZ_FMT_ENABLE_IF(is_back_insert_iterator::value)> ++MOZ_FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) + -> OutputIt { + if (auto ptr = to_pointer(out, to_unsigned(num_digits))) { + do_format_decimal(ptr, value, num_digits); +@@ -1377,7 +1377,7 @@ FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) + } + + template +-FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char* out, UInt value, ++MOZ_FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char* out, UInt value, + int size, bool upper = false) -> Char* { + out += size; + do { +@@ -1391,15 +1391,15 @@ FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char* out, UInt value, + + // Formats an unsigned integer in the power of two base (binary, octal, hex). + template +-FMT_CONSTEXPR auto format_base2e(int base_bits, Char* out, UInt value, ++MOZ_FMT_CONSTEXPR auto format_base2e(int base_bits, Char* out, UInt value, + int num_digits, bool upper = false) -> Char* { + do_format_base2e(base_bits, out, value, num_digits, upper); + return out + num_digits; + } + + template ::value)> +-FMT_CONSTEXPR inline auto format_base2e(int base_bits, OutputIt out, UInt value, ++ MOZ_FMT_ENABLE_IF(is_back_insert_iterator::value)> ++MOZ_FMT_CONSTEXPR inline auto format_base2e(int base_bits, OutputIt out, UInt value, + int num_digits, bool upper = false) + -> OutputIt { + if (auto ptr = to_pointer(out, to_unsigned(num_digits))) { +@@ -1419,7 +1419,7 @@ class utf8_to_utf16 { + basic_memory_buffer buffer_; + + public: +- FMT_API explicit utf8_to_utf16(string_view s); ++ MOZ_FMT_API explicit utf8_to_utf16(string_view s); + inline operator basic_string_view() const { + return {&buffer_[0], size()}; + } +@@ -1442,7 +1442,7 @@ template class to_utf8 { + static_assert(sizeof(WChar) == 2 || sizeof(WChar) == 4, + "Expect utf16 or utf32"); + if (!convert(s, policy)) +- FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? "invalid utf16" ++ MOZ_FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? "invalid utf16" + : "invalid utf32")); + } + operator string_view() const { return string_view(&buffer_[0], size()); } +@@ -1501,7 +1501,7 @@ template class to_utf8 { + + // Computes 128-bit result of multiplication of two 64-bit unsigned integers. + inline auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback { +-#if FMT_USE_INT128 ++#if MOZ_FMT_USE_INT128 + auto p = static_cast(x) * static_cast(y); + return {static_cast(p >> 64), static_cast(p)}; + #elif defined(_MSC_VER) && defined(_M_X64) +@@ -1532,19 +1532,19 @@ namespace dragonbox { + // Computes floor(log10(pow(2, e))) for e in [-2620, 2620] using the method from + // https://fmt.dev/papers/Dragonbox.pdf#page=28, section 6.1. + inline auto floor_log10_pow2(int e) noexcept -> int { +- FMT_ASSERT(e <= 2620 && e >= -2620, "too large exponent"); ++ MOZ_FMT_ASSERT(e <= 2620 && e >= -2620, "too large exponent"); + static_assert((-1 >> 1) == -1, "right shift is not arithmetic"); + return (e * 315653) >> 20; + } + + inline auto floor_log2_pow10(int e) noexcept -> int { +- FMT_ASSERT(e <= 1233 && e >= -1233, "too large exponent"); ++ MOZ_FMT_ASSERT(e <= 1233 && e >= -1233, "too large exponent"); + return (e * 1741647) >> 19; + } + + // Computes upper 64 bits of multiplication of two 64-bit unsigned integers. + inline auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t { +-#if FMT_USE_INT128 ++#if MOZ_FMT_USE_INT128 + auto p = static_cast(x) * static_cast(y); + return static_cast(p >> 64); + #elif defined(_MSC_VER) && defined(_M_X64) +@@ -1563,7 +1563,7 @@ inline auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept + return r; + } + +-FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback; ++MOZ_FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback; + + // Type-specific information that Dragonbox uses. + template struct float_info; +@@ -1613,7 +1613,7 @@ template struct decimal_fp { + int exponent; + }; + +-template FMT_API auto to_decimal(T x) noexcept -> decimal_fp; ++template MOZ_FMT_API auto to_decimal(T x) noexcept -> decimal_fp; + } // namespace dragonbox + + // Returns true iff Float has the implicit bit which is not stored. +@@ -1646,8 +1646,8 @@ template constexpr auto exponent_bias() -> int { + + // Writes the exponent exp in the form "[+-]d{2,3}" to buffer. + template +-FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { +- FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); ++MOZ_FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { ++ MOZ_FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); + if (exp < 0) { + *out++ = static_cast('-'); + exp = -exp; +@@ -1683,11 +1683,11 @@ template struct basic_fp { + constexpr basic_fp(uint64_t f_val, int e_val) : f(f_val), e(e_val) {} + + // Constructs fp from an IEEE754 floating-point number. +- template FMT_CONSTEXPR basic_fp(Float n) { assign(n); } ++ template MOZ_FMT_CONSTEXPR basic_fp(Float n) { assign(n); } + + // Assigns n to this and return true iff predecessor is closer than successor. +- template ::value)> +- FMT_CONSTEXPR auto assign(Float n) -> bool { ++ template ::value)> ++ MOZ_FMT_CONSTEXPR auto assign(Float n) -> bool { + static_assert(std::numeric_limits::digits <= 113, "unsupported FP"); + // Assume Float is in the format [sign][exponent][significand]. + using carrier_uint = typename dragonbox::float_info::carrier_uint; +@@ -1711,8 +1711,8 @@ template struct basic_fp { + return is_predecessor_closer; + } + +- template ::value)> +- FMT_CONSTEXPR auto assign(Float n) -> bool { ++ template ::value)> ++ MOZ_FMT_CONSTEXPR auto assign(Float n) -> bool { + static_assert(std::numeric_limits::is_iec559, "unsupported FP"); + return assign(static_cast(n)); + } +@@ -1722,7 +1722,7 @@ using fp = basic_fp; + + // Normalizes the value converted from double and multiplied by (1 << SHIFT). + template +-FMT_CONSTEXPR auto normalize(basic_fp value) -> basic_fp { ++MOZ_FMT_CONSTEXPR auto normalize(basic_fp value) -> basic_fp { + // Handle subnormals. + const auto implicit_bit = F(1) << num_significand_bits(); + const auto shifted_implicit_bit = implicit_bit << SHIFT; +@@ -1739,8 +1739,8 @@ FMT_CONSTEXPR auto normalize(basic_fp value) -> basic_fp { + } + + // Computes lhs * rhs / pow(2, 64) rounded to nearest with half-up tie breaking. +-FMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t { +-#if FMT_USE_INT128 ++MOZ_FMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t { ++#if MOZ_FMT_USE_INT128 + auto product = static_cast<__uint128_t>(lhs) * rhs; + auto f = static_cast(product >> 64); + return (static_cast(product) & (1ULL << 63)) != 0 ? f + 1 : f; +@@ -1756,7 +1756,7 @@ FMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t { + #endif + } + +-FMT_CONSTEXPR inline auto operator*(fp x, fp y) -> fp { ++MOZ_FMT_CONSTEXPR inline auto operator*(fp x, fp y) -> fp { + return {multiply(x.f, y.f), x.e + y.e + 64}; + } + +@@ -1770,7 +1770,7 @@ constexpr auto convert_float(T value) -> convert_float_result { + } + + template +-FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, ++MOZ_FMT_NOINLINE MOZ_FMT_CONSTEXPR auto fill(OutputIt it, size_t n, + const basic_specs& specs) -> OutputIt { + auto fill_size = specs.fill_size(); + if (fill_size == 1) return detail::fill_n(it, n, specs.fill_unit()); +@@ -1785,7 +1785,7 @@ FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, + // width: output display width in (terminal) column positions. + template +-FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, ++MOZ_FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, + size_t size, size_t width, F&& f) -> OutputIt { + static_assert(default_align == align::left || default_align == align::right, + ""); +@@ -1812,7 +1812,7 @@ constexpr auto write_padded(OutputIt out, const format_specs& specs, + } + + template +-FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, ++MOZ_FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, + const format_specs& specs = {}) -> OutputIt { + return write_padded( + out, specs, bytes.size(), [bytes](reserve_iterator it) { +@@ -1836,11 +1836,11 @@ auto write_ptr(OutputIt out, UIntPtr value, const format_specs* specs) + } + + // Returns true iff the code point cp is printable. +-FMT_API auto is_printable(uint32_t cp) -> bool; ++MOZ_FMT_API auto is_printable(uint32_t cp) -> bool; + + inline auto needs_escape(uint32_t cp) -> bool { + if (cp < 0x20 || cp == 0x7f || cp == '"' || cp == '\\') return true; +- if (FMT_OPTIMIZE_SIZE > 1) return false; ++ if (MOZ_FMT_OPTIMIZE_SIZE > 1) return false; + return !is_printable(cp); + } + +@@ -1903,8 +1903,8 @@ auto write_escaped_cp(OutputIt out, const find_escape_result& escape) + *out++ = static_cast('\\'); + c = static_cast('t'); + break; +- case '"': FMT_FALLTHROUGH; +- case '\'': FMT_FALLTHROUGH; ++ case '"': MOZ_FMT_FALLTHROUGH; ++ case '\'': MOZ_FMT_FALLTHROUGH; + case '\\': *out++ = static_cast('\\'); break; + default: + if (escape.cp < 0x100) return write_codepoint<2, Char>(out, 'x', escape.cp); +@@ -1956,7 +1956,7 @@ auto write_escaped_char(OutputIt out, Char v) -> OutputIt { + } + + template +-FMT_CONSTEXPR auto write_char(OutputIt out, Char value, ++MOZ_FMT_CONSTEXPR auto write_char(OutputIt out, Char value, + const format_specs& specs) -> OutputIt { + bool is_debug = specs.type() == presentation_type::debug; + return write_padded(out, specs, 1, [=](reserve_iterator it) { +@@ -1966,7 +1966,7 @@ FMT_CONSTEXPR auto write_char(OutputIt out, Char value, + }); + } + template +-FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs& specs, ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs& specs, + locale_ref loc = {}) -> OutputIt { + // char is formatted as unsigned char for consistency across platforms. + using unsigned_type = +@@ -2040,7 +2040,7 @@ template class digit_grouping { + } + }; + +-FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) { ++MOZ_FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) { + prefix |= prefix != 0 ? value << 8 : value; + prefix += (1u + (value > 0xff ? 1 : 0)) << 24; + } +@@ -2054,7 +2054,7 @@ auto write_int(OutputIt out, UInt value, unsigned prefix, + int num_digits = 0; + auto buffer = memory_buffer(); + switch (specs.type()) { +- default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; ++ default: MOZ_FMT_ASSERT(false, ""); MOZ_FMT_FALLTHROUGH; + case presentation_type::none: + case presentation_type::dec: + num_digits = count_digits(value); +@@ -2094,9 +2094,9 @@ auto write_int(OutputIt out, UInt value, unsigned prefix, + }); + } + +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + // Writes a localized value. +-FMT_API auto write_loc(appender out, loc_value value, const format_specs& specs, ++MOZ_FMT_API auto write_loc(appender out, loc_value value, const format_specs& specs, + locale_ref loc) -> bool; + #endif + template +@@ -2111,7 +2111,7 @@ template struct write_int_arg { + }; + + template +-FMT_CONSTEXPR auto make_write_int_arg(T value, sign s) ++MOZ_FMT_CONSTEXPR auto make_write_int_arg(T value, sign s) + -> write_int_arg> { + auto prefix = 0u; + auto abs_value = static_cast>(value); +@@ -2133,7 +2133,7 @@ template struct loc_writer { + std::string grouping; + std::basic_string decimal_point; + +- template ::value)> ++ template ::value)> + auto operator()(T value) -> bool { + auto arg = make_write_int_arg(value, specs.sign()); + write_int(out, static_cast>(arg.abs_value), arg.prefix, +@@ -2141,7 +2141,7 @@ template struct loc_writer { + return true; + } + +- template ::value)> ++ template ::value)> + auto operator()(T) -> bool { + return false; + } +@@ -2152,7 +2152,7 @@ struct size_padding { + unsigned size; + unsigned padding; + +- FMT_CONSTEXPR size_padding(int num_digits, unsigned prefix, ++ MOZ_FMT_CONSTEXPR size_padding(int num_digits, unsigned prefix, + const format_specs& specs) + : size((prefix >> 24) + to_unsigned(num_digits)), padding(0) { + if (specs.align() == align::numeric) { +@@ -2169,7 +2169,7 @@ struct size_padding { + }; + + template +-FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, ++MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, + const format_specs& specs) -> OutputIt { + static_assert(std::is_same>::value, ""); + +@@ -2182,7 +2182,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, + auto abs_value = arg.abs_value; + auto prefix = arg.prefix; + switch (specs.type()) { +- default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; ++ default: MOZ_FMT_ASSERT(false, ""); MOZ_FMT_FALLTHROUGH; + case presentation_type::none: + case presentation_type::dec: + begin = do_format_decimal(buffer, abs_value, buffer_size); +@@ -2233,7 +2233,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, + } + + template +-FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out, ++MOZ_FMT_CONSTEXPR MOZ_FMT_NOINLINE auto write_int_noinline(OutputIt out, + write_int_arg arg, + const format_specs& specs) + -> OutputIt { +@@ -2241,10 +2241,10 @@ FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out, + } + + template ::value && ++ MOZ_FMT_ENABLE_IF(is_integral::value && + !std::is_same::value && + !std::is_same::value)> +-FMT_CONSTEXPR FMT_INLINE auto write(basic_appender out, T value, ++MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto write(basic_appender out, T value, + const format_specs& specs, locale_ref loc) + -> basic_appender { + if (specs.localized() && write_loc(out, value, specs, loc)) return out; +@@ -2254,11 +2254,11 @@ FMT_CONSTEXPR FMT_INLINE auto write(basic_appender out, T value, + + // An inlined version of write used in format string compilation. + template ::value && ++ MOZ_FMT_ENABLE_IF(is_integral::value && + !std::is_same::value && + !std::is_same::value && + !std::is_same>::value)> +-FMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value, ++MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE auto write(OutputIt out, T value, + const format_specs& specs, locale_ref loc) + -> OutputIt { + if (specs.localized() && write_loc(out, value, specs, loc)) return out; +@@ -2266,7 +2266,7 @@ FMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value, + } + + template +-FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, + const format_specs& specs) -> OutputIt { + auto data = s.data(); + auto size = s.size(); +@@ -2292,12 +2292,12 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, + }); + } + template +-FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, + const format_specs& specs, locale_ref) -> OutputIt { + return write(out, s, specs); + } + template +-FMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs, ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs, + locale_ref) -> OutputIt { + if (specs.type() == presentation_type::pointer) + return write_ptr(out, bit_cast(s), &specs); +@@ -2306,10 +2306,10 @@ FMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs, + } + + template ::value && ++ MOZ_FMT_ENABLE_IF(is_integral::value && + !std::is_same::value && + !std::is_same::value)> +-FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { + auto abs_value = static_cast>(value); + bool negative = is_negative(value); + // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. +@@ -2326,9 +2326,9 @@ FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { + } + + template +-FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end, ++MOZ_FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end, + format_specs& specs) -> const Char* { +- FMT_ASSERT(begin != end, ""); ++ MOZ_FMT_ASSERT(begin != end, ""); + auto alignment = align::none; + auto p = begin + code_point_length(begin); + if (end - p <= 0) p = begin; +@@ -2362,7 +2362,7 @@ FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end, + } + + template +-FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, ++MOZ_FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, + format_specs specs, sign s) -> OutputIt { + auto str = + isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); +@@ -2406,7 +2406,7 @@ inline auto write_significand(OutputIt out, UInt significand, + return format_decimal(out, significand, significand_size); + } + template +-FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, ++MOZ_FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, + int significand_size, int exponent, + const Grouping& grouping) -> OutputIt { + if (!grouping.has_separator()) { +@@ -2420,7 +2420,7 @@ FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_integral::value)> + inline auto write_significand(Char* out, UInt significand, int significand_size, + int integral_size, Char decimal_point) -> Char* { + if (!decimal_point) return format_decimal(out, significand, significand_size); +@@ -2442,7 +2442,7 @@ inline auto write_significand(Char* out, UInt significand, int significand_size, + } + + template >::value)> ++ MOZ_FMT_ENABLE_IF(!std::is_pointer>::value)> + inline auto write_significand(OutputIt out, UInt significand, + int significand_size, int integral_size, + Char decimal_point) -> OutputIt { +@@ -2454,7 +2454,7 @@ inline auto write_significand(OutputIt out, UInt significand, + } + + template +-FMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand, ++MOZ_FMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand, + int significand_size, int integral_size, + Char decimal_point) -> OutputIt { + out = detail::copy_noinline(significand, significand + integral_size, +@@ -2466,7 +2466,7 @@ FMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand, + } + + template +-FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, ++MOZ_FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, + int significand_size, int integral_size, + Char decimal_point, + const Grouping& grouping) -> OutputIt { +@@ -2485,7 +2485,7 @@ FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, + + template > +-FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, ++MOZ_FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, + const format_specs& specs, sign s, + locale_ref loc) -> OutputIt { + auto significand = f.significand; +@@ -2604,7 +2604,7 @@ template class fallback_digit_grouping { + }; + + template +-FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, ++MOZ_FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, + const format_specs& specs, sign s, + locale_ref loc) -> OutputIt { + if (is_constant_evaluated()) { +@@ -2626,23 +2626,23 @@ template + struct has_isfinite> + : std::true_type {}; + +-template ::value&& ++template ::value&& + has_isfinite::value)> +-FMT_CONSTEXPR20 auto isfinite(T value) -> bool { ++MOZ_FMT_CONSTEXPR20 auto isfinite(T value) -> bool { + constexpr T inf = T(std::numeric_limits::infinity()); + if (is_constant_evaluated()) + return !detail::isnan(value) && value < inf && value > -inf; + return std::isfinite(value); + } +-template ::value)> +-FMT_CONSTEXPR auto isfinite(T value) -> bool { ++template ::value)> ++MOZ_FMT_CONSTEXPR auto isfinite(T value) -> bool { + T inf = T(std::numeric_limits::infinity()); + // std::isfinite doesn't support __float128. + return !detail::isnan(value) && value < inf && value > -inf; + } + +-template ::value)> +-FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { ++template ::value)> ++MOZ_FMT_INLINE MOZ_FMT_CONSTEXPR bool signbit(T value) { + if (is_constant_evaluated()) { + #ifdef __cpp_if_constexpr + if constexpr (std::numeric_limits::is_iec559) { +@@ -2654,11 +2654,11 @@ FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { + return std::signbit(static_cast(value)); + } + +-inline FMT_CONSTEXPR20 void adjust_precision(int& precision, int exp10) { ++inline MOZ_FMT_CONSTEXPR20 void adjust_precision(int& precision, int exp10) { + // Adjust fixed precision by exponent because it is relative to decimal + // point. + if (exp10 > 0 && precision > max_value() - exp10) +- FMT_THROW(format_error("number is too big")); ++ MOZ_FMT_THROW(format_error("number is too big")); + precision += exp10; + } + +@@ -2674,36 +2674,36 @@ class bigint { + + friend struct formatter; + +- FMT_CONSTEXPR auto get_bigit(int i) const -> bigit { ++ MOZ_FMT_CONSTEXPR auto get_bigit(int i) const -> bigit { + return i >= exp_ && i < num_bigits() ? bigits_[i - exp_] : 0; + } + +- FMT_CONSTEXPR void subtract_bigits(int index, bigit other, bigit& borrow) { ++ MOZ_FMT_CONSTEXPR void subtract_bigits(int index, bigit other, bigit& borrow) { + auto result = double_bigit(bigits_[index]) - other - borrow; + bigits_[index] = static_cast(result); + borrow = static_cast(result >> (bigit_bits * 2 - 1)); + } + +- FMT_CONSTEXPR void remove_leading_zeros() { ++ MOZ_FMT_CONSTEXPR void remove_leading_zeros() { + int num_bigits = static_cast(bigits_.size()) - 1; + while (num_bigits > 0 && bigits_[num_bigits] == 0) --num_bigits; + bigits_.resize(to_unsigned(num_bigits + 1)); + } + + // Computes *this -= other assuming aligned bigints and *this >= other. +- FMT_CONSTEXPR void subtract_aligned(const bigint& other) { +- FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); +- FMT_ASSERT(compare(*this, other) >= 0, ""); ++ MOZ_FMT_CONSTEXPR void subtract_aligned(const bigint& other) { ++ MOZ_FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); ++ MOZ_FMT_ASSERT(compare(*this, other) >= 0, ""); + bigit borrow = 0; + int i = other.exp_ - exp_; + for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) + subtract_bigits(i, other.bigits_[j], borrow); + if (borrow != 0) subtract_bigits(i, 0, borrow); +- FMT_ASSERT(borrow == 0, ""); ++ MOZ_FMT_ASSERT(borrow == 0, ""); + remove_leading_zeros(); + } + +- FMT_CONSTEXPR void multiply(uint32_t value) { ++ MOZ_FMT_CONSTEXPR void multiply(uint32_t value) { + bigit carry = 0; + const double_bigit wide_value = value; + for (size_t i = 0, n = bigits_.size(); i < n; ++i) { +@@ -2714,9 +2714,9 @@ class bigint { + if (carry != 0) bigits_.push_back(carry); + } + +- template ::value || ++ template ::value || + std::is_same::value)> +- FMT_CONSTEXPR void multiply(UInt value) { ++ MOZ_FMT_CONSTEXPR void multiply(UInt value) { + using half_uint = + conditional_t::value, uint64_t, uint32_t>; + const int shift = num_bits() - bigit_bits; +@@ -2735,9 +2735,9 @@ class bigint { + } + } + +- template ::value || ++ template ::value || + std::is_same::value)> +- FMT_CONSTEXPR void assign(UInt n) { ++ MOZ_FMT_CONSTEXPR void assign(UInt n) { + size_t num_bigits = 0; + do { + bigits_[num_bigits++] = static_cast(n); +@@ -2748,13 +2748,13 @@ class bigint { + } + + public: +- FMT_CONSTEXPR bigint() : exp_(0) {} ++ MOZ_FMT_CONSTEXPR bigint() : exp_(0) {} + explicit bigint(uint64_t n) { assign(n); } + + bigint(const bigint&) = delete; + void operator=(const bigint&) = delete; + +- FMT_CONSTEXPR void assign(const bigint& other) { ++ MOZ_FMT_CONSTEXPR void assign(const bigint& other) { + auto size = other.bigits_.size(); + bigits_.resize(size); + auto data = other.bigits_.data(); +@@ -2762,17 +2762,17 @@ class bigint { + exp_ = other.exp_; + } + +- template FMT_CONSTEXPR void operator=(Int n) { +- FMT_ASSERT(n > 0, ""); ++ template MOZ_FMT_CONSTEXPR void operator=(Int n) { ++ MOZ_FMT_ASSERT(n > 0, ""); + assign(uint64_or_128_t(n)); + } + +- FMT_CONSTEXPR auto num_bigits() const -> int { ++ MOZ_FMT_CONSTEXPR auto num_bigits() const -> int { + return static_cast(bigits_.size()) + exp_; + } + +- FMT_CONSTEXPR auto operator<<=(int shift) -> bigint& { +- FMT_ASSERT(shift >= 0, ""); ++ MOZ_FMT_CONSTEXPR auto operator<<=(int shift) -> bigint& { ++ MOZ_FMT_ASSERT(shift >= 0, ""); + exp_ += shift / bigit_bits; + shift %= bigit_bits; + if (shift == 0) return *this; +@@ -2786,13 +2786,13 @@ class bigint { + return *this; + } + +- template FMT_CONSTEXPR auto operator*=(Int value) -> bigint& { +- FMT_ASSERT(value > 0, ""); ++ template MOZ_FMT_CONSTEXPR auto operator*=(Int value) -> bigint& { ++ MOZ_FMT_ASSERT(value > 0, ""); + multiply(uint32_or_64_or_128_t(value)); + return *this; + } + +- friend FMT_CONSTEXPR auto compare(const bigint& b1, const bigint& b2) -> int { ++ friend MOZ_FMT_CONSTEXPR auto compare(const bigint& b1, const bigint& b2) -> int { + int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits(); + if (num_bigits1 != num_bigits2) return num_bigits1 > num_bigits2 ? 1 : -1; + int i = static_cast(b1.bigits_.size()) - 1; +@@ -2808,7 +2808,7 @@ class bigint { + } + + // Returns compare(lhs1 + lhs2, rhs). +- friend FMT_CONSTEXPR auto add_compare(const bigint& lhs1, const bigint& lhs2, ++ friend MOZ_FMT_CONSTEXPR auto add_compare(const bigint& lhs1, const bigint& lhs2, + const bigint& rhs) -> int { + int max_lhs_bigits = max_of(lhs1.num_bigits(), lhs2.num_bigits()); + int num_rhs_bigits = rhs.num_bigits(); +@@ -2828,8 +2828,8 @@ class bigint { + } + + // Assigns pow(10, exp) to this bigint. +- FMT_CONSTEXPR20 void assign_pow10(int exp) { +- FMT_ASSERT(exp >= 0, ""); ++ MOZ_FMT_CONSTEXPR20 void assign_pow10(int exp) { ++ MOZ_FMT_ASSERT(exp >= 0, ""); + if (exp == 0) return *this = 1; + int bitmask = 1 << (num_bits() - + countl_zero(static_cast(exp)) - 1); +@@ -2845,7 +2845,7 @@ class bigint { + *this <<= exp; // Multiply by pow(2, exp) by shifting. + } + +- FMT_CONSTEXPR20 void square() { ++ MOZ_FMT_CONSTEXPR20 void square() { + int num_bigits = static_cast(bigits_.size()); + int num_result_bigits = 2 * num_bigits; + basic_memory_buffer n(std::move(bigits_)); +@@ -2875,7 +2875,7 @@ class bigint { + + // If this bigint has a bigger exponent than other, adds trailing zero to make + // exponents equal. This simplifies some operations such as subtraction. +- FMT_CONSTEXPR void align(const bigint& other) { ++ MOZ_FMT_CONSTEXPR void align(const bigint& other) { + int exp_difference = exp_ - other.exp_; + if (exp_difference <= 0) return; + int num_bigits = static_cast(bigits_.size()); +@@ -2888,10 +2888,10 @@ class bigint { + + // Divides this bignum by divisor, assigning the remainder to this and + // returning the quotient. +- FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { +- FMT_ASSERT(this != &divisor, ""); ++ MOZ_FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { ++ MOZ_FMT_ASSERT(this != &divisor, ""); + if (compare(*this, divisor) < 0) return 0; +- FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); ++ MOZ_FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); + align(divisor); + int quotient = 0; + do { +@@ -2912,7 +2912,7 @@ enum dragon { + // Formats a floating-point number using a variation of the Fixed-Precision + // Positive Floating-Point Printout ((FPP)^2) algorithm by Steele & White: + // https://fmt.dev/papers/p372-steele.pdf. +-FMT_CONSTEXPR20 inline void format_dragon(basic_fp value, ++MOZ_FMT_CONSTEXPR20 inline void format_dragon(basic_fp value, + unsigned flags, int num_digits, + buffer& buf, int& exp10) { + bigint numerator; // 2 * R in (FPP)^2. +@@ -3047,8 +3047,8 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp value, + } + + // Formats a floating-point number using the hexfloat format. +-template ::value)> +-FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, ++template ::value)> ++MOZ_FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, + buffer& buf) { + // float is passed as double to reduce the number of instantiations and to + // simplify implementation. +@@ -3127,8 +3127,8 @@ FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, + format_decimal(appender(buf), abs_e, detail::count_digits(abs_e)); + } + +-template ::value)> +-FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, ++template ::value)> ++MOZ_FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, + buffer& buf) { + format_hexfloat(static_cast(value), specs, buf); + } +@@ -3145,7 +3145,7 @@ constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t { + } + + template +-FMT_CONSTEXPR20 auto format_float(Float value, int precision, ++MOZ_FMT_CONSTEXPR20 auto format_float(Float value, int precision, + const format_specs& specs, bool binary32, + buffer& buf) -> int { + // GCC and old clang seem to hit this even though this function isn't called. +@@ -3203,9 +3203,9 @@ FMT_CONSTEXPR20 auto format_float(Float value, int precision, + significand <<= 1; + } else { + // Normalize subnormal inputs. +- FMT_ASSERT(significand != 0, "zeros should not appear here"); ++ MOZ_FMT_ASSERT(significand != 0, "zeros should not appear here"); + int shift = countl_zero(significand); +- FMT_ASSERT(shift >= num_bits() - num_significand_bits(), ++ MOZ_FMT_ASSERT(shift >= num_bits() - num_significand_bits(), + ""); + shift -= (num_bits() - num_significand_bits() - 2); + exponent = (std::numeric_limits::min_exponent - +@@ -3456,7 +3456,7 @@ FMT_CONSTEXPR20 auto format_float(Float value, int precision, + template + auto format_float_gecko(Float value, int precision, format_specs specs, + buffer& buf) -> int { +- FMT_ASSERT(detail::isfinite(value), ++ MOZ_FMT_ASSERT(detail::isfinite(value), + "Non-finite values are to be handled ahead of calling this"); + using double_conversion::DoubleToStringConverter; + using DTSC = DoubleToStringConverter; +@@ -3480,15 +3480,15 @@ auto format_float_gecko(Float value, int precision, format_specs specs, + // "If an explicit precision is zero, it shall be taken as 1." + success = converter.ToPrecision(value, precision ? precision : 1, &builder); + } else { +- FMT_ASSERT(false, "Unhandled"); ++ MOZ_FMT_ASSERT(false, "Unhandled"); + } +- FMT_ASSERT(success, ""); ++ MOZ_FMT_ASSERT(success, ""); + buf.try_resize(builder.position()); + return builder.position(); + } + + template +-FMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs, ++MOZ_FMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs, + locale_ref loc) -> OutputIt { + // Use signbit because value < 0 is false for NaN. + sign s = detail::signbit(value) ? sign::minus : specs.sign(); +@@ -3546,8 +3546,8 @@ FMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs, + } + + template ::value)> +-FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, ++ MOZ_FMT_ENABLE_IF(is_floating_point::value)> ++MOZ_FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, + locale_ref loc = {}) -> OutputIt { + return specs.localized() && write_loc(out, value, specs, loc) + ? out +@@ -3555,8 +3555,8 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, + } + + template ::value)> +-FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { ++ MOZ_FMT_ENABLE_IF(is_fast_float::value)> ++MOZ_FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { + if (is_constant_evaluated()) return write(out, value, format_specs()); + + auto s = detail::signbit(value) ? sign::minus : sign::none; +@@ -3572,7 +3572,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { + } + + template ::value && ++ MOZ_FMT_ENABLE_IF(is_floating_point::value && + !is_fast_float::value)> + inline auto write(OutputIt out, T value) -> OutputIt { + return write(out, value, format_specs()); +@@ -3581,35 +3581,35 @@ inline auto write(OutputIt out, T value) -> OutputIt { + template + auto write(OutputIt out, monostate, format_specs = {}, locale_ref = {}) + -> OutputIt { +- FMT_ASSERT(false, ""); ++ MOZ_FMT_ASSERT(false, ""); + return out; + } + + template +-FMT_CONSTEXPR auto write(OutputIt out, basic_string_view value) ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, basic_string_view value) + -> OutputIt { + return copy_noinline(value.begin(), value.end(), out); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(has_to_string_view::value)> + constexpr auto write(OutputIt out, const T& value) -> OutputIt { + return write(out, to_string_view(value)); + } + +-// FMT_ENABLE_IF() condition separated to workaround an MSVC bug. ++// MOZ_FMT_ENABLE_IF() condition separated to workaround an MSVC bug. + template < + typename Char, typename OutputIt, typename T, + bool check = std::is_enum::value && !std::is_same::value && + mapped_type_constant::value != type::custom_type, +- FMT_ENABLE_IF(check)> +-FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { ++ MOZ_FMT_ENABLE_IF(check)> ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { + return write(out, static_cast>(value)); + } + + template ::value)> +-FMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {}, ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {}, + locale_ref = {}) -> OutputIt { + return specs.type() != presentation_type::none && + specs.type() != presentation_type::string +@@ -3618,30 +3618,30 @@ FMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {}, + } + + template +-FMT_CONSTEXPR auto write(OutputIt out, Char value) -> OutputIt { ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, Char value) -> OutputIt { + auto it = reserve(out, 1); + *it++ = value; + return base_iterator(out, it); + } + + template +-FMT_CONSTEXPR20 auto write(OutputIt out, const Char* value) -> OutputIt { ++MOZ_FMT_CONSTEXPR20 auto write(OutputIt out, const Char* value) -> OutputIt { + if (value) return write(out, basic_string_view(value)); + return write_bytes(out, "(null)"); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> + auto write(OutputIt out, const T* value, const format_specs& specs = {}, + locale_ref = {}) -> OutputIt { + return write_ptr(out, bit_cast(value), &specs); + } + + template ::value == ++ MOZ_FMT_ENABLE_IF(mapped_type_constant::value == + type::custom_type && + !std::is_fundamental::value)> +-FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> OutputIt { ++MOZ_FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> OutputIt { + auto f = formatter(); + auto parse_ctx = parse_context({}); + f.parse(parse_ctx); +@@ -3651,7 +3651,7 @@ FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> OutputIt { + + template + using is_builtin = +- bool_constant::value || FMT_BUILTIN_TYPES>; ++ bool_constant::value || MOZ_FMT_BUILTIN_TYPES>; + + // An argument visitor that formats the argument and writes it via the output + // iterator. It's a class and not a generic lambda for compatibility with C++11. +@@ -3662,14 +3662,14 @@ template struct default_arg_formatter { + + void operator()(monostate) { report_error("argument not found"); } + +- template ::value)> ++ template ::value)> + void operator()(T value) { + write(out, value); + } + +- template ::value)> ++ template ::value)> + void operator()(T) { +- FMT_ASSERT(false, ""); ++ MOZ_FMT_ASSERT(false, ""); + } + + void operator()(typename basic_format_arg::handle h) { +@@ -3683,16 +3683,16 @@ template struct default_arg_formatter { + template struct arg_formatter { + basic_appender out; + const format_specs& specs; +- FMT_NO_UNIQUE_ADDRESS locale_ref locale; ++ MOZ_FMT_NO_UNIQUE_ADDRESS locale_ref locale; + +- template ::value)> +- FMT_CONSTEXPR FMT_INLINE void operator()(T value) { ++ template ::value)> ++ MOZ_FMT_CONSTEXPR MOZ_FMT_INLINE void operator()(T value) { + detail::write(out, value, specs, locale); + } + +- template ::value)> ++ template ::value)> + void operator()(T) { +- FMT_ASSERT(false, ""); ++ MOZ_FMT_ASSERT(false, ""); + } + + void operator()(typename basic_format_arg>::handle) { +@@ -3702,30 +3702,30 @@ template struct arg_formatter { + }; + + struct dynamic_spec_getter { +- template ::value)> +- FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { ++ template ::value)> ++ MOZ_FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { + return is_negative(value) ? ~0ull : static_cast(value); + } + +- template ::value)> +- FMT_CONSTEXPR auto operator()(T) -> unsigned long long { ++ template ::value)> ++ MOZ_FMT_CONSTEXPR auto operator()(T) -> unsigned long long { + report_error("width/precision is not integer"); + return 0; + } + }; + + template +-FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> basic_format_arg { ++MOZ_FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> basic_format_arg { + auto arg = ctx.arg(id); + if (!arg) report_error("argument not found"); + return arg; + } + + template +-FMT_CONSTEXPR int get_dynamic_spec( ++MOZ_FMT_CONSTEXPR int get_dynamic_spec( + arg_id_kind kind, const arg_ref& ref, + Context& ctx) { +- FMT_ASSERT(kind != arg_id_kind::none, ""); ++ MOZ_FMT_ASSERT(kind != arg_id_kind::none, ""); + auto arg = + kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); + if (!arg) report_error("argument not found"); +@@ -3736,15 +3736,15 @@ FMT_CONSTEXPR int get_dynamic_spec( + } + + template +-FMT_CONSTEXPR void handle_dynamic_spec( ++MOZ_FMT_CONSTEXPR void handle_dynamic_spec( + arg_id_kind kind, int& value, + const arg_ref& ref, Context& ctx) { + if (kind != arg_id_kind::none) value = get_dynamic_spec(kind, ref, ctx); + } + +-#if FMT_USE_NONTYPE_TEMPLATE_ARGS ++#if MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS + template Str> ++ mozilla::fmt::detail::fixed_string Str> + struct static_named_arg : view { + static constexpr auto name = Str.data; + +@@ -3753,15 +3753,15 @@ struct static_named_arg : view { + }; + + template Str> ++ mozilla::fmt::detail::fixed_string Str> + struct is_named_arg> : std::true_type {}; + + template Str> ++ mozilla::fmt::detail::fixed_string Str> + struct is_static_named_arg> : std::true_type { + }; + +-template Str> ++template Str> + struct udl_arg { + template auto operator=(T&& value) const { + return static_named_arg(std::forward(value)); +@@ -3775,7 +3775,7 @@ template struct udl_arg { + return {str, std::forward(value)}; + } + }; +-#endif // FMT_USE_NONTYPE_TEMPLATE_ARGS ++#endif // MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS + + template struct format_handler { + parse_context parse_ctx; +@@ -3785,19 +3785,19 @@ template struct format_handler { + copy_noinline(begin, end, ctx.out()); + } + +- FMT_CONSTEXPR auto on_arg_id() -> int { return parse_ctx.next_arg_id(); } +- FMT_CONSTEXPR auto on_arg_id(int id) -> int { ++ MOZ_FMT_CONSTEXPR auto on_arg_id() -> int { return parse_ctx.next_arg_id(); } ++ MOZ_FMT_CONSTEXPR auto on_arg_id(int id) -> int { + parse_ctx.check_arg_id(id); + return id; + } +- FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { ++ MOZ_FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { + parse_ctx.check_arg_id(id); + int arg_id = ctx.arg_id(id); + if (arg_id < 0) report_error("argument not found"); + return arg_id; + } + +- FMT_INLINE void on_replacement_field(int id, const Char*) { ++ MOZ_FMT_INLINE void on_replacement_field(int id, const Char*) { + ctx.arg(id).visit(default_arg_formatter{ctx.out()}); + } + +@@ -3820,19 +3820,19 @@ template struct format_handler { + return begin; + } + +- FMT_NORETURN void on_error(const char* message) { report_error(message); } ++ MOZ_FMT_NORETURN void on_error(const char* message) { report_error(message); } + }; + + using format_func = void (*)(detail::buffer&, int, const char*); +-FMT_API void do_report_error(format_func func, int error_code, ++MOZ_FMT_API void do_report_error(format_func func, int error_code, + const char* message) noexcept; + +-FMT_API void format_error_code(buffer& out, int error_code, ++MOZ_FMT_API void format_error_code(buffer& out, int error_code, + string_view message) noexcept; + + template + template +-FMT_CONSTEXPR auto native_formatter::format( ++MOZ_FMT_CONSTEXPR auto native_formatter::format( + const T& val, FormatContext& ctx) const -> decltype(ctx.out()) { + if (!specs_.dynamic()) + return write(ctx.out(), val, specs_, ctx.locale()); +@@ -3861,28 +3861,28 @@ void vformat_to(buffer& buf, basic_string_view fmt, + } + } // namespace detail + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + +-#define FMT_FORMAT_AS(Type, Base) \ ++#define MOZ_FMT_FORMAT_AS(Type, Base) \ + template \ + struct formatter : formatter { \ + template \ +- FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \ ++ MOZ_FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \ + -> decltype(ctx.out()) { \ + return formatter::format(value, ctx); \ + } \ + } + +-FMT_FORMAT_AS(signed char, int); +-FMT_FORMAT_AS(unsigned char, unsigned); +-FMT_FORMAT_AS(short, int); +-FMT_FORMAT_AS(unsigned short, unsigned); +-FMT_FORMAT_AS(long, detail::long_type); +-FMT_FORMAT_AS(unsigned long, detail::ulong_type); +-FMT_FORMAT_AS(Char*, const Char*); +-FMT_FORMAT_AS(detail::std_string_view, basic_string_view); +-FMT_FORMAT_AS(std::nullptr_t, const void*); +-FMT_FORMAT_AS(void*, const void*); ++MOZ_FMT_FORMAT_AS(signed char, int); ++MOZ_FMT_FORMAT_AS(unsigned char, unsigned); ++MOZ_FMT_FORMAT_AS(short, int); ++MOZ_FMT_FORMAT_AS(unsigned short, unsigned); ++MOZ_FMT_FORMAT_AS(long, detail::long_type); ++MOZ_FMT_FORMAT_AS(unsigned long, detail::ulong_type); ++MOZ_FMT_FORMAT_AS(Char*, const Char*); ++MOZ_FMT_FORMAT_AS(detail::std_string_view, basic_string_view); ++MOZ_FMT_FORMAT_AS(std::nullptr_t, const void*); ++MOZ_FMT_FORMAT_AS(void*, const void*); + + template + struct formatter : formatter, Char> {}; +@@ -3906,7 +3906,7 @@ template + struct formatter>> + : formatter, Char> { + template +- FMT_CONSTEXPR auto format(const T& value, FormatContext& ctx) const ++ MOZ_FMT_CONSTEXPR auto format(const T& value, FormatContext& ctx) const + -> decltype(ctx.out()) { + auto&& val = format_as(value); // Make an lvalue reference for format. + return formatter, Char>::format(val, ctx); +@@ -3918,7 +3918,7 @@ struct formatter>> + * + * **Example**: + * +- * auto s = fmt::format("{}", fmt::ptr(p)); ++ * auto s = mozilla::fmt::format("{}", mozilla::fmt::ptr(p)); + */ + template auto ptr(T p) -> const void* { + static_assert(std::is_pointer::value, ""); +@@ -3931,7 +3931,7 @@ template auto ptr(T p) -> const void* { + * **Example**: + * + * enum class color { red, green, blue }; +- * auto s = fmt::format("{}", fmt::underlying(color::red)); ++ * auto s = mozilla::fmt::format("{}", mozilla::fmt::underlying(color::red)); + */ + template + constexpr auto underlying(Enum e) noexcept -> underlying_t { +@@ -3939,7 +3939,7 @@ constexpr auto underlying(Enum e) noexcept -> underlying_t { + } + + namespace enums { +-template ::value)> ++template ::value)> + constexpr auto format_as(Enum e) noexcept -> underlying_t { + return static_cast>(e); + } +@@ -3968,7 +3968,7 @@ template <> struct formatter { + detail::dynamic_format_specs<> specs_; + + public: +- FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { + return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, + detail::type::string_type); + } +@@ -3995,7 +3995,7 @@ template struct group_digits_view { + * + * **Example**: + * +- * fmt::print("{}", fmt::group_digits(12345)); ++ * mozilla::fmt::print("{}", mozilla::fmt::group_digits(12345)); + * // Output: "12,345" + */ + template auto group_digits(T value) -> group_digits_view { +@@ -4007,7 +4007,7 @@ template struct formatter> : formatter { + detail::dynamic_format_specs<> specs_; + + public: +- FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { + return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, + detail::type::int_type); + } +@@ -4034,7 +4034,7 @@ template struct nested_view { + + template + struct formatter, Char> { +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + return ctx.begin(); + } + template +@@ -4053,7 +4053,7 @@ template struct nested_formatter { + public: + constexpr nested_formatter() : width_(0) {} + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(), end = ctx.end(); + if (it == end) return it; + auto specs = format_specs(); +@@ -4089,24 +4089,24 @@ template struct nested_formatter { + }; + + inline namespace literals { +-#if FMT_USE_NONTYPE_TEMPLATE_ARGS ++#if MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS + template constexpr auto operator""_a() { + using char_t = remove_cvref_t; + return detail::udl_arg(); + } + #else + /** +- * User-defined literal equivalent of `fmt::arg`. ++ * User-defined literal equivalent of `mozilla::fmt::arg`. + * + * **Example**: + * +- * using namespace fmt::literals; +- * fmt::print("The answer is {answer}.", "answer"_a=42); ++ * using namespace mozilla::fmt::literals; ++ * mozilla::fmt::print("The answer is {answer}.", "answer"_a=42); + */ + constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg { + return {s}; + } +-#endif // FMT_USE_NONTYPE_TEMPLATE_ARGS ++#endif // MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS + } // namespace literals + + /// A fast integer formatter. +@@ -4119,13 +4119,13 @@ class format_int { + char* str_; + + template +- FMT_CONSTEXPR20 auto format_unsigned(UInt value) -> char* { ++ MOZ_FMT_CONSTEXPR20 auto format_unsigned(UInt value) -> char* { + auto n = static_cast>(value); + return detail::do_format_decimal(buffer_, n, buffer_size - 1); + } + + template +- FMT_CONSTEXPR20 auto format_signed(Int value) -> char* { ++ MOZ_FMT_CONSTEXPR20 auto format_signed(Int value) -> char* { + auto abs_value = static_cast>(value); + bool negative = value < 0; + if (negative) abs_value = 0 - abs_value; +@@ -4135,30 +4135,30 @@ class format_int { + } + + public: +- explicit FMT_CONSTEXPR20 format_int(int value) : str_(format_signed(value)) {} +- explicit FMT_CONSTEXPR20 format_int(long value) ++ explicit MOZ_FMT_CONSTEXPR20 format_int(int value) : str_(format_signed(value)) {} ++ explicit MOZ_FMT_CONSTEXPR20 format_int(long value) + : str_(format_signed(value)) {} +- explicit FMT_CONSTEXPR20 format_int(long long value) ++ explicit MOZ_FMT_CONSTEXPR20 format_int(long long value) + : str_(format_signed(value)) {} +- explicit FMT_CONSTEXPR20 format_int(unsigned value) ++ explicit MOZ_FMT_CONSTEXPR20 format_int(unsigned value) + : str_(format_unsigned(value)) {} +- explicit FMT_CONSTEXPR20 format_int(unsigned long value) ++ explicit MOZ_FMT_CONSTEXPR20 format_int(unsigned long value) + : str_(format_unsigned(value)) {} +- explicit FMT_CONSTEXPR20 format_int(unsigned long long value) ++ explicit MOZ_FMT_CONSTEXPR20 format_int(unsigned long long value) + : str_(format_unsigned(value)) {} + + /// Returns the number of characters written to the output buffer. +- FMT_CONSTEXPR20 auto size() const -> size_t { ++ MOZ_FMT_CONSTEXPR20 auto size() const -> size_t { + return detail::to_unsigned(buffer_ - str_ + buffer_size - 1); + } + + /// Returns a pointer to the output buffer content. No terminating null + /// character is appended. +- FMT_CONSTEXPR20 auto data() const -> const char* { return str_; } ++ MOZ_FMT_CONSTEXPR20 auto data() const -> const char* { return str_; } + + /// Returns a pointer to the output buffer content with terminating null + /// character appended. +- FMT_CONSTEXPR20 auto c_str() const -> const char* { ++ MOZ_FMT_CONSTEXPR20 auto c_str() const -> const char* { + buffer_[buffer_size - 1] = '\0'; + return str_; + } +@@ -4167,21 +4167,21 @@ class format_int { + inline auto str() const -> std::string { return {str_, size()}; } + }; + +-#define FMT_STRING_IMPL(s, base) \ ++#define MOZ_FMT_STRING_IMPL(s, base) \ + [] { \ + /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ + /* Use a macro-like name to avoid shadowing warnings. */ \ +- struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ +- using char_type = fmt::remove_cvref_t; \ +- FMT_CONSTEXPR explicit operator fmt::basic_string_view() \ ++ struct MOZ_FMT_VISIBILITY("hidden") MOZ_FMT_COMPILE_STRING : base { \ ++ using char_type = mozilla::fmt::remove_cvref_t; \ ++ MOZ_FMT_CONSTEXPR explicit operator mozilla::fmt::basic_string_view() \ + const { \ +- return fmt::detail::compile_string_to_view(s); \ ++ return mozilla::fmt::detail::compile_string_to_view(s); \ + } \ + }; \ +- using FMT_STRING_VIEW = \ +- fmt::basic_string_view; \ +- fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ +- return FMT_COMPILE_STRING(); \ ++ using MOZ_FMT_STRING_VIEW = \ ++ mozilla::fmt::basic_string_view; \ ++ mozilla::fmt::detail::ignore_unused(MOZ_FMT_STRING_VIEW(MOZ_FMT_COMPILE_STRING())); \ ++ return MOZ_FMT_COMPILE_STRING(); \ + }() + + /** +@@ -4190,16 +4190,16 @@ class format_int { + * **Example**: + * + * // A compile-time error because 'd' is an invalid specifier for strings. +- * std::string s = fmt::format(FMT_STRING("{:d}"), "foo"); ++ * std::string s = mozilla::fmt::format(MOZ_FMT_STRING("{:d}"), "foo"); + */ +-#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string) ++#define MOZ_FMT_STRING(s) MOZ_FMT_STRING_IMPL(s, mozilla::fmt::detail::compile_string) + +-// FMT_API auto vsystem_error(int error_code, string_view fmt, format_args args) ++// MOZ_FMT_API auto vsystem_error(int error_code, string_view fmt, format_args args) + // -> std::system_error; + + /** + * Constructs `std::system_error` with a message formatted with +- * `fmt::format(fmt, args...)`. ++ * `mozilla::fmt::format(fmt, args...)`. + * `error_code` is a system error code as given by `errno`. + * + * **Example**: +@@ -4210,7 +4210,7 @@ class format_int { + * const char* filename = "madeup"; + * FILE* file = fopen(filename, "r"); + * if (!file) +- * throw fmt::system_error(errno, "cannot open file '{}'", filename); ++ * throw mozilla::fmt::system_error(errno, "cannot open file '{}'", filename); + */ + // template + // auto system_error(int error_code, format_string fmt, T&&... args) +@@ -4231,12 +4231,12 @@ class format_int { + * message corresponding to the error code. + * `error_code` is a system error code as given by `errno`. + */ +-// FMT_API void format_system_error(detail::buffer& out, int error_code, ++// MOZ_FMT_API void format_system_error(detail::buffer& out, int error_code, + // const char* message) noexcept; + + // Reports a system error without throwing an exception. + // Can be used to report errors from destructors. +-FMT_API void report_system_error(int error_code, const char* message) noexcept; ++MOZ_FMT_API void report_system_error(int error_code, const char* message) noexcept; + + inline auto vformat(detail::locale_ref loc, string_view fmt, format_args args) + -> std::string { +@@ -4246,13 +4246,13 @@ inline auto vformat(detail::locale_ref loc, string_view fmt, format_args args) + } + + template +-FMT_INLINE auto format(detail::locale_ref loc, format_string fmt, ++MOZ_FMT_INLINE auto format(detail::locale_ref loc, format_string fmt, + T&&... args) -> std::string { + return vformat(loc, fmt.str, vargs{{args...}}); + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> + auto vformat_to(OutputIt out, detail::locale_ref loc, string_view fmt, + format_args args) -> OutputIt { + auto&& buf = detail::get_buffer(out); +@@ -4261,14 +4261,14 @@ auto vformat_to(OutputIt out, detail::locale_ref loc, string_view fmt, + } + + template ::value)> +-FMT_INLINE auto format_to(OutputIt out, detail::locale_ref loc, ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value)> ++MOZ_FMT_INLINE auto format_to(OutputIt out, detail::locale_ref loc, + format_string fmt, T&&... args) -> OutputIt { +- return fmt::vformat_to(out, loc, fmt.str, vargs{{args...}}); ++ return mozilla::fmt::vformat_to(out, loc, fmt.str, vargs{{args...}}); + } + + template +-FMT_NODISCARD FMT_INLINE auto formatted_size(detail::locale_ref loc, ++MOZ_FMT_NODISCARD MOZ_FMT_INLINE auto formatted_size(detail::locale_ref loc, + format_string fmt, + T&&... args) -> size_t { + auto buf = detail::counting_buffer<>(); +@@ -4276,7 +4276,7 @@ FMT_NODISCARD FMT_INLINE auto formatted_size(detail::locale_ref loc, + return buf.count(); + } + +-FMT_API auto vformat(string_view fmt, format_args args) -> std::string; ++MOZ_FMT_API auto vformat(string_view fmt, format_args args) -> std::string; + + /** + * Formats `args` according to specifications in `fmt` and returns the result +@@ -4285,10 +4285,10 @@ FMT_API auto vformat(string_view fmt, format_args args) -> std::string; + * **Example**: + * + * #include +- * std::string message = fmt::format("The answer is {}.", 42); ++ * std::string message = mozilla::fmt::format("The answer is {}.", 42); + */ + template +-FMT_NODISCARD FMT_INLINE auto format(format_string fmt, T&&... args) ++MOZ_FMT_NODISCARD MOZ_FMT_INLINE auto format(format_string fmt, T&&... args) + -> std::string { + return vformat(fmt.str, vargs{{args...}}); + } +@@ -4298,10 +4298,10 @@ FMT_NODISCARD FMT_INLINE auto format(format_string fmt, T&&... args) + * + * **Example**: + * +- * std::string answer = fmt::to_string(42); ++ * std::string answer = mozilla::fmt::to_string(42); + */ +-template ::value)> +-FMT_NODISCARD auto to_string(T value) -> std::string { ++template ::value)> ++MOZ_FMT_NODISCARD auto to_string(T value) -> std::string { + // The buffer should be large enough to store the number including the sign + // or "false" for bool. + char buffer[max_of(detail::digits10() + 2, 5)]; +@@ -4309,30 +4309,30 @@ FMT_NODISCARD auto to_string(T value) -> std::string { + return {buffer, detail::write(begin, value)}; + } + +-template ::value)> +-FMT_NODISCARD auto to_string(const T& value) -> std::string { ++template ::value)> ++MOZ_FMT_NODISCARD auto to_string(const T& value) -> std::string { + return to_string(format_as(value)); + } + +-template ::value && ++template ::value && + !detail::use_format_as::value)> +-FMT_NODISCARD auto to_string(const T& value) -> std::string { ++MOZ_FMT_NODISCARD auto to_string(const T& value) -> std::string { + auto buffer = memory_buffer(); + detail::write(appender(buffer), value); + return {buffer.data(), buffer.size()}; + } + +-FMT_END_EXPORT +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_END_NAMESPACE + +-#ifdef FMT_HEADER_ONLY +-# define FMT_FUNC inline ++#ifdef MOZ_FMT_HEADER_ONLY ++# define MOZ_FMT_FUNC inline + # include "format-inl.h" + #endif + + // Restore _LIBCPP_REMOVE_TRANSITIVE_INCLUDES. +-#ifdef FMT_REMOVE_TRANSITIVE_INCLUDES ++#ifdef MOZ_FMT_REMOVE_TRANSITIVE_INCLUDES + # undef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES + #endif + +-#endif // FMT_FORMAT_H_ ++#endif // MOZ_FMT_FORMAT_H_ +diff --git a/third_party/fmt/include/fmt/ostream.h b/third_party/fmt/include/fmt/ostream.h +index 114b8c2..d580736 100644 +--- a/third_party/fmt/include/fmt/ostream.h ++++ b/third_party/fmt/include/fmt/ostream.h +@@ -5,10 +5,10 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_OSTREAM_H_ +-#define FMT_OSTREAM_H_ ++#ifndef MOZ_FMT_OSTREAM_H_ ++#define MOZ_FMT_OSTREAM_H_ + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include // std::filebuf + #endif + +@@ -22,7 +22,7 @@ + + #include "chrono.h" // formatbuf + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + + // Generate a unique explicit instantion in every translation unit using a tag +@@ -35,7 +35,7 @@ class file_access { + friend auto get_file(BufType& obj) -> FILE* { return obj.*FileMemberPtr; } + }; + +-#if FMT_MSC_VERSION ++#if MOZ_FMT_MSC_VERSION + template class file_access; + auto get_file(std::filebuf&) -> FILE*; +@@ -97,8 +97,8 @@ struct formatter, Char> + * + * **Example**: + * +- * fmt::print("Current thread id: {}\n", +- * fmt::streamed(std::this_thread::get_id())); ++ * mozilla::fmt::print("Current thread id: {}\n", ++ * mozilla::fmt::streamed(std::this_thread::get_id())); + */ + template + constexpr auto streamed(const T& value) -> detail::streamed_view { +@@ -109,10 +109,10 @@ inline void vprint(std::ostream& os, string_view fmt, format_args args) { + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt, args); + FILE* f = nullptr; +-#if FMT_MSC_VERSION && FMT_USE_RTTI ++#if MOZ_FMT_MSC_VERSION && MOZ_FMT_USE_RTTI + if (auto* buf = dynamic_cast(os.rdbuf())) + f = detail::get_file(*buf); +-#elif defined(_WIN32) && defined(__GLIBCXX__) && FMT_USE_RTTI ++#elif defined(_WIN32) && defined(__GLIBCXX__) && MOZ_FMT_USE_RTTI + auto* rdbuf = os.rdbuf(); + if (auto* sfbuf = dynamic_cast<__gnu_cxx::stdio_sync_filebuf*>(rdbuf)) + f = sfbuf->file(); +@@ -137,22 +137,22 @@ inline void vprint(std::ostream& os, string_view fmt, format_args args) { + * + * **Example**: + * +- * fmt::print(cerr, "Don't {}!", "panic"); ++ * mozilla::fmt::print(cerr, "Don't {}!", "panic"); + */ +-FMT_EXPORT template ++MOZ_FMT_EXPORT template + void print(std::ostream& os, format_string fmt, T&&... args) { +- fmt::vargs vargs = {{args...}}; ++ mozilla::fmt::vargs vargs = {{args...}}; + if (detail::use_utf8) return vprint(os, fmt.str, vargs); + auto buffer = memory_buffer(); + detail::vformat_to(buffer, fmt.str, vargs); + detail::write_buffer(os, buffer); + } + +-FMT_EXPORT template ++MOZ_FMT_EXPORT template + void println(std::ostream& os, format_string fmt, T&&... args) { +- fmt::print(os, "{}\n", fmt::format(fmt, std::forward(args)...)); ++ mozilla::fmt::print(os, "{}\n", mozilla::fmt::format(fmt, std::forward(args)...)); + } + +-FMT_END_NAMESPACE ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_OSTREAM_H_ ++#endif // MOZ_FMT_OSTREAM_H_ +diff --git a/third_party/fmt/include/fmt/ranges.h b/third_party/fmt/include/fmt/ranges.h +index c6020ab..7a865ab 100644 +--- a/third_party/fmt/include/fmt/ranges.h ++++ b/third_party/fmt/include/fmt/ranges.h +@@ -5,10 +5,10 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_RANGES_H_ +-#define FMT_RANGES_H_ ++#ifndef MOZ_FMT_RANGES_H_ ++#define MOZ_FMT_RANGES_H_ + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include + # include + # include +@@ -19,9 +19,9 @@ + + #include "format.h" + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + +-FMT_EXPORT ++MOZ_FMT_EXPORT + enum class range_format { disabled, map, set, sequence, string, debug_string }; + + namespace detail { +@@ -125,7 +125,7 @@ template class is_tuple_like_ { + }; + + // Check for integer_sequence +-#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VERSION >= 1900 ++#if defined(__cpp_lib_integer_sequence) || MOZ_FMT_MSC_VERSION >= 1900 + template + using integer_sequence = std::integer_sequence; + template using index_sequence = std::index_sequence; +@@ -134,7 +134,7 @@ template using make_index_sequence = std::make_index_sequence; + template struct integer_sequence { + using value_type = T; + +- static FMT_CONSTEXPR auto size() -> size_t { return sizeof...(N); } ++ static MOZ_FMT_CONSTEXPR auto size() -> size_t { return sizeof...(N); } + }; + + template using index_sequence = integer_sequence; +@@ -175,7 +175,7 @@ template class is_tuple_formattable_ { + }; + + template +-FMT_CONSTEXPR void for_each(index_sequence, Tuple&& t, F&& f) { ++MOZ_FMT_CONSTEXPR void for_each(index_sequence, Tuple&& t, F&& f) { + using std::get; + // Using a free function get(Tuple) now. + const int unused[] = {0, ((void)f(get(t)), 0)...}; +@@ -183,7 +183,7 @@ FMT_CONSTEXPR void for_each(index_sequence, Tuple&& t, F&& f) { + } + + template +-FMT_CONSTEXPR void for_each(Tuple&& t, F&& f) { ++MOZ_FMT_CONSTEXPR void for_each(Tuple&& t, F&& f) { + for_each(tuple_index_sequence>(), + std::forward(t), std::forward(f)); + } +@@ -213,7 +213,7 @@ auto get_formatters(index_sequence) + -> result_t(std::declval()))...>; + } // namespace tuple + +-#if FMT_MSC_VERSION && FMT_MSC_VERSION < 1920 ++#if MOZ_FMT_MSC_VERSION && MOZ_FMT_MSC_VERSION < 1920 + // Older MSVC doesn't get the reference type correctly for arrays. + template struct range_reference_type_impl { + using type = decltype(*detail::range_begin(std::declval())); +@@ -237,12 +237,12 @@ template + using uncvref_type = remove_cvref_t>; + + template +-FMT_CONSTEXPR auto maybe_set_debug_format(Formatter& f, bool set) ++MOZ_FMT_CONSTEXPR auto maybe_set_debug_format(Formatter& f, bool set) + -> decltype(f.set_debug_format(set)) { + f.set_debug_format(set); + } + template +-FMT_CONSTEXPR void maybe_set_debug_format(Formatter&, ...) {} ++MOZ_FMT_CONSTEXPR void maybe_set_debug_format(Formatter&, ...) {} + + template + struct range_format_kind_ +@@ -258,7 +258,7 @@ using range_format_constant = std::integral_constant; + + // These are not generic lambdas for compatibility with C++11. + template struct parse_empty_specs { +- template FMT_CONSTEXPR void operator()(Formatter& f) { ++ template MOZ_FMT_CONSTEXPR void operator()(Formatter& f) { + f.parse(ctx); + detail::maybe_set_debug_format(f, true); + } +@@ -293,8 +293,8 @@ template struct is_tuple_formattable { + + template + struct formatter::value && +- fmt::is_tuple_formattable::value>> { ++ enable_if_t::value && ++ mozilla::fmt::is_tuple_formattable::value>> { + private: + decltype(detail::tuple::get_formatters( + detail::tuple_index_sequence())) formatters_; +@@ -306,19 +306,19 @@ struct formatter{}; + + public: +- FMT_CONSTEXPR formatter() {} ++ MOZ_FMT_CONSTEXPR formatter() {} + +- FMT_CONSTEXPR void set_separator(basic_string_view sep) { ++ MOZ_FMT_CONSTEXPR void set_separator(basic_string_view sep) { + separator_ = sep; + } + +- FMT_CONSTEXPR void set_brackets(basic_string_view open, ++ MOZ_FMT_CONSTEXPR void set_brackets(basic_string_view open, + basic_string_view close) { + opening_bracket_ = open; + closing_bracket_ = close; + } + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(); + auto end = ctx.end(); + if (it != end && detail::to_ascii(*it) == 'n') { +@@ -358,7 +358,7 @@ using maybe_const_range = + conditional_t::value, const R, R>; + + // Workaround a bug in MSVC 2015 and earlier. +-#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910 ++#if !MOZ_FMT_MSC_VERSION || MOZ_FMT_MSC_VERSION >= 1910 + template + struct is_formattable_delayed + : is_formattable>, Char> {}; +@@ -389,7 +389,7 @@ struct range_formatter< + bool is_debug = false; + + template ::value)> ++ MOZ_FMT_ENABLE_IF(std::is_same::value)> + auto write_debug_string(Output& out, It it, Sentinel end) const -> Output { + auto buf = basic_memory_buffer(); + for (; it != end; ++it) buf.push_back(*it); +@@ -400,29 +400,29 @@ struct range_formatter< + } + + template ::value)> ++ MOZ_FMT_ENABLE_IF(!std::is_same::value)> + auto write_debug_string(Output& out, It, Sentinel) const -> Output { + return out; + } + + public: +- FMT_CONSTEXPR range_formatter() {} ++ MOZ_FMT_CONSTEXPR range_formatter() {} + +- FMT_CONSTEXPR auto underlying() -> detail::range_formatter_type& { ++ MOZ_FMT_CONSTEXPR auto underlying() -> detail::range_formatter_type& { + return underlying_; + } + +- FMT_CONSTEXPR void set_separator(basic_string_view sep) { ++ MOZ_FMT_CONSTEXPR void set_separator(basic_string_view sep) { + separator_ = sep; + } + +- FMT_CONSTEXPR void set_brackets(basic_string_view open, ++ MOZ_FMT_CONSTEXPR void set_brackets(basic_string_view open, + basic_string_view close) { + opening_bracket_ = open; + closing_bracket_ = close; + } + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(); + auto end = ctx.end(); + detail::maybe_set_debug_format(underlying_, true); +@@ -438,7 +438,7 @@ struct range_formatter< + set_brackets({}, {}); + ++it; + if (it == end || *it != 's') report_error("invalid format specifier"); +- FMT_FALLTHROUGH; ++ MOZ_FMT_FALLTHROUGH; + case 's': + if (!std::is_same::value) + report_error("invalid format specifier"); +@@ -483,7 +483,7 @@ struct range_formatter< + } + }; + +-FMT_EXPORT ++MOZ_FMT_EXPORT + template + struct range_format_kind + : conditional_t< +@@ -500,7 +500,7 @@ struct formatter< + range_format_kind::value != range_format::string && + range_format_kind::value != range_format::debug_string> + // Workaround a bug in MSVC 2015 and earlier. +-#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910 ++#if !MOZ_FMT_MSC_VERSION || MOZ_FMT_MSC_VERSION >= 1910 + , + detail::is_formattable_delayed + #endif +@@ -512,7 +512,7 @@ struct formatter< + public: + using nonlocking = void; + +- FMT_CONSTEXPR formatter() { ++ MOZ_FMT_CONSTEXPR formatter() { + if (detail::const_check(range_format_kind::value != + range_format::set)) + return; +@@ -520,7 +520,7 @@ struct formatter< + detail::string_literal{}); + } + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + return range_formatter_.parse(ctx); + } + +@@ -545,9 +545,9 @@ struct formatter< + bool no_delimiters_ = false; + + public: +- FMT_CONSTEXPR formatter() {} ++ MOZ_FMT_CONSTEXPR formatter() {} + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + auto it = ctx.begin(); + auto end = ctx.end(); + if (it != end) { +@@ -605,7 +605,7 @@ struct formatter< + formatter underlying_; + + public: +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + return underlying_.parse(ctx); + } + +@@ -653,7 +653,7 @@ struct formatter, Char> { + public: + using nonlocking = void; + +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + return value_formatter_.parse(ctx); + } + +@@ -688,12 +688,12 @@ auto join(It begin, Sentinel end, string_view sep) -> join_view { + * **Example**: + * + * auto v = std::vector{1, 2, 3}; +- * fmt::print("{}", fmt::join(v, ", ")); ++ * mozilla::fmt::print("{}", mozilla::fmt::join(v, ", ")); + * // Output: 1, 2, 3 + * +- * `fmt::join` applies passed format specifiers to the range elements: ++ * `mozilla::fmt::join` applies passed format specifiers to the range elements: + * +- * fmt::print("{:02}", fmt::join(v, ", ")); ++ * mozilla::fmt::print("{:02}", mozilla::fmt::join(v, ", ")); + * // Output: 01, 02, 03 + */ + template +@@ -711,16 +711,16 @@ template struct tuple_join_view : detail::view { + : tuple(t), sep{s} {} + }; + +-// Define FMT_TUPLE_JOIN_SPECIFIERS to enable experimental format specifiers ++// Define MOZ_FMT_TUPLE_JOIN_SPECIFIERS to enable experimental format specifiers + // support in tuple_join. It is disabled by default because of issues with + // the dynamic width and precision. +-#ifndef FMT_TUPLE_JOIN_SPECIFIERS +-# define FMT_TUPLE_JOIN_SPECIFIERS 0 ++#ifndef MOZ_FMT_TUPLE_JOIN_SPECIFIERS ++# define MOZ_FMT_TUPLE_JOIN_SPECIFIERS 0 + #endif + + template + struct formatter, Char> { +- FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { ++ MOZ_FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + return do_parse(ctx, std::integral_constant()); + } + +@@ -734,18 +734,18 @@ struct formatter, Char> { + private: + std::tuple::type, Char>...> formatters_; + +- FMT_CONSTEXPR auto do_parse(parse_context& ctx, ++ MOZ_FMT_CONSTEXPR auto do_parse(parse_context& ctx, + std::integral_constant) + -> const Char* { + return ctx.begin(); + } + + template +- FMT_CONSTEXPR auto do_parse(parse_context& ctx, ++ MOZ_FMT_CONSTEXPR auto do_parse(parse_context& ctx, + std::integral_constant) + -> const Char* { + auto end = ctx.begin(); +-#if FMT_TUPLE_JOIN_SPECIFIERS ++#if MOZ_FMT_TUPLE_JOIN_SPECIFIERS + end = std::get(formatters_).parse(ctx); + if (N > 1) { + auto end1 = do_parse(ctx, std::integral_constant()); +@@ -814,7 +814,7 @@ struct formatter< + } + }; + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + /** + * Returns an object that formats `std::tuple` with elements separated by `sep`. +@@ -822,11 +822,11 @@ FMT_BEGIN_EXPORT + * **Example**: + * + * auto t = std::tuple{1, 'a'}; +- * fmt::print("{}", fmt::join(t, ", ")); ++ * mozilla::fmt::print("{}", mozilla::fmt::join(t, ", ")); + * // Output: 1, a + */ + template +-FMT_CONSTEXPR auto join(const std::tuple& tuple, string_view sep) ++MOZ_FMT_CONSTEXPR auto join(const std::tuple& tuple, string_view sep) + -> tuple_join_view { + return {tuple, sep}; + } +@@ -837,7 +837,7 @@ FMT_CONSTEXPR auto join(const std::tuple& tuple, string_view sep) + * + * **Example**: + * +- * fmt::print("{}", fmt::join({1, 2, 3}, ", ")); ++ * mozilla::fmt::print("{}", mozilla::fmt::join({1, 2, 3}, ", ")); + * // Output: "1, 2, 3" + */ + template +@@ -846,7 +846,7 @@ auto join(std::initializer_list list, string_view sep) + return join(std::begin(list), std::end(list), sep); + } + +-FMT_END_EXPORT +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_RANGES_H_ ++#endif // MOZ_FMT_RANGES_H_ +diff --git a/third_party/fmt/include/fmt/xchar.h b/third_party/fmt/include/fmt/xchar.h +index dc3e289..c00e828 100644 +--- a/third_party/fmt/include/fmt/xchar.h ++++ b/third_party/fmt/include/fmt/xchar.h +@@ -5,22 +5,22 @@ + // + // For the license information refer to format.h. + +-#ifndef FMT_XCHAR_H_ +-#define FMT_XCHAR_H_ ++#ifndef MOZ_FMT_XCHAR_H_ ++#define MOZ_FMT_XCHAR_H_ + + #include "color.h" + #include "format.h" + #include "ostream.h" + #include "ranges.h" + +-#ifndef FMT_MODULE ++#ifndef MOZ_FMT_MODULE + # include +-# if FMT_USE_LOCALE ++# if MOZ_FMT_USE_LOCALE + # include + # endif + #endif + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + + template +@@ -45,7 +45,7 @@ using format_string_char_t = typename format_string_char::type; + + inline auto write_loc(basic_appender out, loc_value value, + const format_specs& specs, locale_ref loc) -> bool { +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + auto& numpunct = + std::use_facet>(loc.get()); + auto separator = std::wstring(); +@@ -57,7 +57,7 @@ inline auto write_loc(basic_appender out, loc_value value, + } + } // namespace detail + +-FMT_BEGIN_EXPORT ++MOZ_FMT_BEGIN_EXPORT + + using wstring_view = basic_string_view; + using wformat_parse_context = parse_context; +@@ -82,18 +82,18 @@ template struct basic_fstring { + using t = basic_fstring; + + template >::value)> +- FMT_CONSTEVAL FMT_ALWAYS_INLINE basic_fstring(const S& s) : str_(s) { +- if (FMT_USE_CONSTEVAL) ++ MOZ_FMT_CONSTEVAL MOZ_FMT_ALWAYS_INLINE basic_fstring(const S& s) : str_(s) { ++ if (MOZ_FMT_USE_CONSTEVAL) + detail::parse_format_string(s, checker(s, arg_pack())); + } + template ::value&& ++ MOZ_FMT_ENABLE_IF(std::is_base_of::value&& + std::is_same::value)> +- FMT_ALWAYS_INLINE basic_fstring(const S&) : str_(S()) { +- FMT_CONSTEXPR auto sv = basic_string_view(S()); +- FMT_CONSTEXPR int ignore = ++ MOZ_FMT_ALWAYS_INLINE basic_fstring(const S&) : str_(S()) { ++ MOZ_FMT_CONSTEXPR auto sv = basic_string_view(S()); ++ MOZ_FMT_CONSTEXPR int ignore = + (parse_format_string(sv, checker(sv, arg_pack())), 0); + detail::ignore_unused(ignore); + } +@@ -122,11 +122,11 @@ template <> struct is_char : bool_constant {}; + + template + constexpr auto make_wformat_args(T&... args) +- -> decltype(fmt::make_format_args(args...)) { +- return fmt::make_format_args(args...); ++ -> decltype(mozilla::fmt::make_format_args(args...)) { ++ return mozilla::fmt::make_format_args(args...); + } + +-#if !FMT_USE_NONTYPE_TEMPLATE_ARGS ++#if !MOZ_FMT_USE_NONTYPE_TEMPLATE_ARGS + inline namespace literals { + inline auto operator""_a(const wchar_t* s, size_t) -> detail::udl_arg { + return {s}; +@@ -159,7 +159,7 @@ auto join(const std::tuple& tuple, basic_string_view sep) + return {tuple, sep}; + } + +-template ::value)> ++template ::value)> + auto vformat(basic_string_view fmt, + typename detail::vformat_args::type args) + -> std::basic_string { +@@ -170,29 +170,29 @@ auto vformat(basic_string_view fmt, + + template + auto format(wformat_string fmt, T&&... args) -> std::wstring { +- return vformat(fmt::wstring_view(fmt), fmt::make_wformat_args(args...)); ++ return vformat(mozilla::fmt::wstring_view(fmt), mozilla::fmt::make_wformat_args(args...)); + } + + template + auto format_to(OutputIt out, wformat_string fmt, T&&... args) + -> OutputIt { +- return vformat_to(out, fmt::wstring_view(fmt), +- fmt::make_wformat_args(args...)); ++ return vformat_to(out, mozilla::fmt::wstring_view(fmt), ++ mozilla::fmt::make_wformat_args(args...)); + } + + // Pass char_t as a default template parameter instead of using + // std::basic_string> to reduce the symbol size. + template , +- FMT_ENABLE_IF(!std::is_same::value && ++ MOZ_FMT_ENABLE_IF(!std::is_same::value && + !std::is_same::value)> + auto format(const S& fmt, T&&... args) -> std::basic_string { + return vformat(detail::to_string_view(fmt), +- fmt::make_format_args>(args...)); ++ mozilla::fmt::make_format_args>(args...)); + } + + template , +- FMT_ENABLE_IF(detail::is_exotic_char::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_exotic_char::value)> + inline auto vformat(detail::locale_ref loc, const S& fmt, + typename detail::vformat_args::type args) + -> std::basic_string { +@@ -204,16 +204,16 @@ inline auto vformat(detail::locale_ref loc, const S& fmt, + + template , +- FMT_ENABLE_IF(detail::is_exotic_char::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_exotic_char::value)> + inline auto format(detail::locale_ref loc, const S& fmt, T&&... args) + -> std::basic_string { + return vformat(loc, detail::to_string_view(fmt), +- fmt::make_format_args>(args...)); ++ mozilla::fmt::make_format_args>(args...)); + } + + template , +- FMT_ENABLE_IF(detail::is_output_iterator::value&& ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value&& + detail::is_exotic_char::value)> + auto vformat_to(OutputIt out, const S& fmt, + typename detail::vformat_args::type args) -> OutputIt { +@@ -224,17 +224,17 @@ auto vformat_to(OutputIt out, const S& fmt, + + template , +- FMT_ENABLE_IF(detail::is_output_iterator::value && ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value && + !std::is_same::value && + !std::is_same::value)> + inline auto format_to(OutputIt out, const S& fmt, T&&... args) -> OutputIt { + return vformat_to(out, detail::to_string_view(fmt), +- fmt::make_format_args>(args...)); ++ mozilla::fmt::make_format_args>(args...)); + } + + template , +- FMT_ENABLE_IF(detail::is_output_iterator::value&& ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value&& + detail::is_exotic_char::value)> + inline auto vformat_to(OutputIt out, detail::locale_ref loc, const S& fmt, + typename detail::vformat_args::type args) +@@ -252,11 +252,11 @@ inline auto format_to(OutputIt out, detail::locale_ref loc, const S& fmt, + T&&... args) -> + typename std::enable_if::type { + return vformat_to(out, loc, detail::to_string_view(fmt), +- fmt::make_format_args>(args...)); ++ mozilla::fmt::make_format_args>(args...)); + } + + template ::value&& ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value&& + detail::is_exotic_char::value)> + inline auto vformat_to_n(OutputIt out, size_t n, basic_string_view fmt, + typename detail::vformat_args::type args) +@@ -269,21 +269,21 @@ inline auto vformat_to_n(OutputIt out, size_t n, basic_string_view fmt, + + template , +- FMT_ENABLE_IF(detail::is_output_iterator::value&& ++ MOZ_FMT_ENABLE_IF(detail::is_output_iterator::value&& + detail::is_exotic_char::value)> + inline auto format_to_n(OutputIt out, size_t n, const S& fmt, T&&... args) + -> format_to_n_result { +- return vformat_to_n(out, n, fmt::basic_string_view(fmt), +- fmt::make_format_args>(args...)); ++ return vformat_to_n(out, n, mozilla::fmt::basic_string_view(fmt), ++ mozilla::fmt::make_format_args>(args...)); + } + + template , +- FMT_ENABLE_IF(detail::is_exotic_char::value)> ++ MOZ_FMT_ENABLE_IF(detail::is_exotic_char::value)> + inline auto formatted_size(const S& fmt, T&&... args) -> size_t { + auto buf = detail::counting_buffer(); + detail::vformat_to(buf, detail::to_string_view(fmt), +- fmt::make_format_args>(args...)); ++ mozilla::fmt::make_format_args>(args...)); + return buf.count(); + } + +@@ -293,7 +293,7 @@ inline void vprint(std::FILE* f, wstring_view fmt, wformat_args args) { + buf.push_back(L'\0'); + std::fputws(buf.data(), f); + // if (std::fputws(buf.data(), f) == -1) +- // FMT_THROW(system_error(errno, FMT_STRING("cannot write to file"))); ++ // MOZ_FMT_THROW(system_error(errno, MOZ_FMT_STRING("cannot write to file"))); + } + + inline void vprint(wstring_view fmt, wformat_args args) { +@@ -302,20 +302,20 @@ inline void vprint(wstring_view fmt, wformat_args args) { + + template + void print(std::FILE* f, wformat_string fmt, T&&... args) { +- return vprint(f, wstring_view(fmt), fmt::make_wformat_args(args...)); ++ return vprint(f, wstring_view(fmt), mozilla::fmt::make_wformat_args(args...)); + } + + template void print(wformat_string fmt, T&&... args) { +- return vprint(wstring_view(fmt), fmt::make_wformat_args(args...)); ++ return vprint(wstring_view(fmt), mozilla::fmt::make_wformat_args(args...)); + } + + template + void println(std::FILE* f, wformat_string fmt, T&&... args) { +- return print(f, L"{}\n", fmt::format(fmt, std::forward(args)...)); ++ return print(f, L"{}\n", mozilla::fmt::format(fmt, std::forward(args)...)); + } + + template void println(wformat_string fmt, T&&... args) { +- return print(L"{}\n", fmt::format(fmt, std::forward(args)...)); ++ return print(L"{}\n", mozilla::fmt::format(fmt, std::forward(args)...)); + } + + inline auto vformat(const text_style& ts, wstring_view fmt, wformat_args args) +@@ -328,17 +328,17 @@ inline auto vformat(const text_style& ts, wstring_view fmt, wformat_args args) + template + inline auto format(const text_style& ts, wformat_string fmt, T&&... args) + -> std::wstring { +- return fmt::vformat(ts, fmt, fmt::make_wformat_args(args...)); ++ return mozilla::fmt::vformat(ts, fmt, mozilla::fmt::make_wformat_args(args...)); + } + + template +-FMT_DEPRECATED void print(std::FILE* f, const text_style& ts, ++MOZ_FMT_DEPRECATED void print(std::FILE* f, const text_style& ts, + wformat_string fmt, const T&... args) { +- vprint(f, ts, fmt, fmt::make_wformat_args(args...)); ++ vprint(f, ts, fmt, mozilla::fmt::make_wformat_args(args...)); + } + + template +-FMT_DEPRECATED void print(const text_style& ts, wformat_string fmt, ++MOZ_FMT_DEPRECATED void print(const text_style& ts, wformat_string fmt, + const T&... args) { + return print(stdout, ts, fmt, args...); + } +@@ -351,19 +351,19 @@ inline void vprint(std::wostream& os, wstring_view fmt, wformat_args args) { + + template + void print(std::wostream& os, wformat_string fmt, T&&... args) { +- vprint(os, fmt, fmt::make_format_args>(args...)); ++ vprint(os, fmt, mozilla::fmt::make_format_args>(args...)); + } + + template + void println(std::wostream& os, wformat_string fmt, T&&... args) { +- print(os, L"{}\n", fmt::format(fmt, std::forward(args)...)); ++ print(os, L"{}\n", mozilla::fmt::format(fmt, std::forward(args)...)); + } + + /// Converts `value` to `std::wstring` using the default format for type `T`. + template inline auto to_wstring(const T& value) -> std::wstring { +- return format(FMT_STRING(L"{}"), value); ++ return format(MOZ_FMT_STRING(L"{}"), value); + } +-FMT_END_EXPORT +-FMT_END_NAMESPACE ++MOZ_FMT_END_EXPORT ++MOZ_FMT_END_NAMESPACE + +-#endif // FMT_XCHAR_H_ ++#endif // MOZ_FMT_XCHAR_H_ +diff --git a/third_party/fmt/src/format.cc b/third_party/fmt/src/format.cc +index 3ccd806..d801711 100644 +--- a/third_party/fmt/src/format.cc ++++ b/third_party/fmt/src/format.cc +@@ -7,40 +7,40 @@ + + #include "fmt/format-inl.h" + +-FMT_BEGIN_NAMESPACE ++MOZ_FMT_BEGIN_NAMESPACE + namespace detail { + +-template FMT_API auto dragonbox::to_decimal(float x) noexcept ++template MOZ_FMT_API auto dragonbox::to_decimal(float x) noexcept + -> dragonbox::decimal_fp; +-template FMT_API auto dragonbox::to_decimal(double x) noexcept ++template MOZ_FMT_API auto dragonbox::to_decimal(double x) noexcept + -> dragonbox::decimal_fp; + +-#if FMT_USE_LOCALE ++#if MOZ_FMT_USE_LOCALE + // DEPRECATED! locale_ref in the detail namespace +-template FMT_API locale_ref::locale_ref(const std::locale& loc); +-template FMT_API auto locale_ref::get() const -> std::locale; ++template MOZ_FMT_API locale_ref::locale_ref(const std::locale& loc); ++template MOZ_FMT_API auto locale_ref::get() const -> std::locale; + #endif + + // Explicit instantiations for char. + +-template FMT_API auto thousands_sep_impl(locale_ref) ++template MOZ_FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +-template FMT_API auto decimal_point_impl(locale_ref) -> char; ++template MOZ_FMT_API auto decimal_point_impl(locale_ref) -> char; + + // DEPRECATED! +-template FMT_API void buffer::append(const char*, const char*); ++template MOZ_FMT_API void buffer::append(const char*, const char*); + + // DEPRECATED! +-template FMT_API void vformat_to(buffer&, string_view, ++template MOZ_FMT_API void vformat_to(buffer&, string_view, + typename vformat_args<>::type, locale_ref); + + // Explicit instantiations for wchar_t. + +-template FMT_API auto thousands_sep_impl(locale_ref) ++template MOZ_FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +-template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; ++template MOZ_FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; + +-template FMT_API void buffer::append(const wchar_t*, const wchar_t*); ++template MOZ_FMT_API void buffer::append(const wchar_t*, const wchar_t*); + + } // namespace detail +-FMT_END_NAMESPACE ++MOZ_FMT_END_NAMESPACE +-- +2.45.2.windows.1 + diff --git a/libraries/source/spidermonkey/patches/SuppressDanglingPointerWarning.patch b/libraries/source/spidermonkey/patches/SuppressDanglingPointerWarning.patch deleted file mode 100644 index 8be1cb37d7..0000000000 --- a/libraries/source/spidermonkey/patches/SuppressDanglingPointerWarning.patch +++ /dev/null @@ -1,46 +0,0 @@ - -# HG changeset patch -# User Steve Fink -# Date 1746227785 0 -# Node ID 5c04f022856284273c3f1a0367a599431798bab3 -# Parent 0a9b2997cbcf9652ce9440ba74cbbb3bf513a937 -Bug 1953622 - Suppress -Wdangling-pointer warning when storing a Rooted address r=spidermonkey-reviewers,jonco - -Differential Revision: https://phabricator.services.mozilla.com/D241310 - - -diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h ---- a/js/public/RootingAPI.h -+++ b/js/public/RootingAPI.h -@@ -1140,21 +1140,30 @@ using RootedTraits = - * function that requires a handle, e.g. Foo(Root(cx, x)). - * - * If you want to add additional methods to Rooted for a specific - * specialization, define a RootedOperations specialization containing them. - */ - template - class MOZ_RAII Rooted : public detail::RootedTraits::StackBase, - public js::RootedOperations> { -+ -+ // Intentionally store a pointer into the stack. -+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12) -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Wdangling-pointer" -+#endif - inline void registerWithRootLists(RootedListHeads& roots) { - this->stack = &roots[JS::MapTypeToRootKind::kind]; - this->prev = *this->stack; - *this->stack = this; - } -+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12) -+#pragma GCC diagnostic pop -+#endif - - inline RootedListHeads& rootLists(RootingContext* cx) { - return cx->stackRoots_; - } - inline RootedListHeads& rootLists(JSContext* cx) { - return rootLists(RootingContext::get(cx)); - } - - diff --git a/libraries/source/spidermonkey/patches/patch.sh b/libraries/source/spidermonkey/patches/patch.sh index 8ea5bccf68..b950a28ec5 100755 --- a/libraries/source/spidermonkey/patches/patch.sh +++ b/libraries/source/spidermonkey/patches/patch.sh @@ -18,10 +18,6 @@ patch -p1 <"${PATCHES}"/FixLibNames.diff # https://bugzilla.mozilla.org/show_bug.cgi?id=1935346 patch -p1 <"${PATCHES}"/FixPkgConfigDebug.diff -# Fix a regression in GC tracing, which creates segfaults during GCs -# https://bugzilla.mozilla.org/show_bug.cgi?id=1982134 -patch -p1 <"${PATCHES}"/FixExtraGCTracing.diff - # There is an issue on 32-bit linux builds sometimes. # NB: the patch here is Comment 21 modified by Comment 25 # but that seems to imperfectly fix the issue with GCC. @@ -41,12 +37,17 @@ if [ "${OS}" = "Darwin" ]; then patch -p1 <"${PATCHES}"/FixMacOSBuild.diff fi -# Supress warning on newer GCC compilers. -# https://bugzilla.mozilla.org/show_bug.cgi?id=1953622 -patch -p1 <"${PATCHES}"/SuppressDanglingPointerWarning.patch - # Fix building with python 3.14 patch -p1 <"${PATCHES}"/FixPython3_14.diff +# Fix conflicts between vendored fmtlib in SM and our own use of fmtlib. +# This is not upstreamable and can be dropped when we use std::format (can be done in R30 when +# we move to ESR153 which requires C++20 anyway). +# Note: after building SM, it is still needed to rename the fmt include directory so that our +# compiler doesn't mix up the vendored fmtlib headers and the actual ones. The -FixIncludes patch +# is applied to dist/include after building. +# https://bugzilla.mozilla.org/show_bug.cgi?id=1987410 +patch -p1 <"${PATCHES}"/StashVendoredLibfmt.patch + # Cherry-pick an upstream commit to allow passing custom flags to ar patch -p1 <"${PATCHES}"/UpstreamCustomARFlags.patch