diff --git a/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch b/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch index 5b05dbf66fc..5670adbd237 100644 --- a/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch +++ b/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Wed, 18 May 2022 10:21:49 -0700 -Subject: [PATCH 1/2] Don't throw on write failure +Subject: [PATCH 1/3] Don't throw on write failure --- include/fmt/format-inl.h | 4 +--- diff --git a/upstream_utils/fmt_patches/0002-Suppress-warnings-we-can-t-fix.patch b/upstream_utils/fmt_patches/0002-Suppress-warnings-we-can-t-fix.patch index a3866e22990..abc08e6dfe8 100644 --- a/upstream_utils/fmt_patches/0002-Suppress-warnings-we-can-t-fix.patch +++ b/upstream_utils/fmt_patches/0002-Suppress-warnings-we-can-t-fix.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 16 May 2023 13:49:18 -0700 -Subject: [PATCH 2/2] Suppress warnings we can't fix +Subject: [PATCH 2/3] Suppress warnings we can't fix --- include/fmt/format.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fmt/format.h b/include/fmt/format.h -index e5bd8b110efe49e12a12b004ea246a4dba671a6f..f11be0d6d58f3d992d7d06adb3d9576f81ecfe11 100644 +index 87a34b972ce6af4e2209e4d6cf78e8401e8f0037..ac0f52def2f3e2bc88d11903f5532efd89af454d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1324,7 +1324,14 @@ inline auto equal2(const char* lhs, const char* rhs) -> bool { diff --git a/upstream_utils/fmt_patches/0003-Qualify-member-function-calls-in-template-functions.patch b/upstream_utils/fmt_patches/0003-Qualify-member-function-calls-in-template-functions.patch new file mode 100644 index 00000000000..c6f37704210 --- /dev/null +++ b/upstream_utils/fmt_patches/0003-Qualify-member-function-calls-in-template-functions.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tyler Veness +Date: Mon, 20 Nov 2023 15:36:10 -0800 +Subject: [PATCH 3/3] Qualify member function calls in template functions + +--- + include/fmt/core.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/fmt/core.h b/include/fmt/core.h +index 1fe13888a00263a085032272482475e5dafbef26..200cf3e84952abc3007237fbcf79f22a5c2e50c6 100644 +--- a/include/fmt/core.h ++++ b/include/fmt/core.h +@@ -1436,7 +1436,7 @@ template struct arg_mapper { + template , + FMT_ENABLE_IF(std::is_arithmetic::value)> + FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(this->map(U())) { +- return map(format_as(val)); ++ return this->map(format_as(val)); + } + + template > +@@ -1460,13 +1460,13 @@ template struct arg_mapper { + !is_named_arg::value && + !std::is_arithmetic>::value)> + FMT_CONSTEXPR FMT_INLINE auto map(T& val) -> decltype(this->do_map(val)) { +- return do_map(val); ++ return this->do_map(val); + } + + template ::value)> + FMT_CONSTEXPR FMT_INLINE auto map(const T& named_arg) + -> decltype(this->map(named_arg.value)) { +- return map(named_arg.value); ++ return this->map(named_arg.value); + } + + auto map(...) -> unformattable { return {}; } diff --git a/upstream_utils/update_fmt.py b/upstream_utils/update_fmt.py index 746e879ad24..edc536841b0 100755 --- a/upstream_utils/update_fmt.py +++ b/upstream_utils/update_fmt.py @@ -22,6 +22,7 @@ def main(): for f in [ "0001-Don-t-throw-on-write-failure.patch", "0002-Suppress-warnings-we-can-t-fix.patch", + "0003-Qualify-member-function-calls-in-template-functions.patch", ]: git_am(os.path.join(wpilib_root, "upstream_utils/fmt_patches", f)) diff --git a/wpilibc/src/main/native/cpp/Preferences.cpp b/wpilibc/src/main/native/cpp/Preferences.cpp index cfb5964516b..cef729ba9d4 100644 --- a/wpilibc/src/main/native/cpp/Preferences.cpp +++ b/wpilibc/src/main/native/cpp/Preferences.cpp @@ -26,8 +26,13 @@ struct Instance { std::shared_ptr table{ nt::NetworkTableInstance::GetDefault().GetTable(kTableName)}; nt::StringPublisher typePublisher{table->GetStringTopic(".type").Publish()}; - nt::MultiSubscriber tableSubscriber{nt::NetworkTableInstance::GetDefault(), - {{fmt::format("{}/", table->GetPath())}}}; + nt::MultiSubscriber tableSubscriber{ + nt::NetworkTableInstance::GetDefault(), + // `{{fmt::format("{}/", table->GetPath())}}` is miscompiled by MSVC + [&] { + std::string path = fmt::format("{}/", table->GetPath()); + return std::span{{path}}; + }()}; nt::NetworkTableListener listener; }; } // namespace diff --git a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h index 1fe13888a00..200cf3e8495 100644 --- a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h +++ b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h @@ -1436,7 +1436,7 @@ template struct arg_mapper { template , FMT_ENABLE_IF(std::is_arithmetic::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(this->map(U())) { - return map(format_as(val)); + return this->map(format_as(val)); } template > @@ -1460,13 +1460,13 @@ template struct arg_mapper { !is_named_arg::value && !std::is_arithmetic>::value)> FMT_CONSTEXPR FMT_INLINE auto map(T& val) -> decltype(this->do_map(val)) { - return do_map(val); + return this->do_map(val); } template ::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& named_arg) -> decltype(this->map(named_arg.value)) { - return map(named_arg.value); + return this->map(named_arg.value); } auto map(...) -> unformattable { return {}; }