From 2e828ae053a6e4df7aa85540d921ed657f850ba7 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 12 May 2024 10:27:01 -0700 Subject: [PATCH] [upstream_utils] Fix fmtlib tautological-compare warning from GCC 14 (#6613) The patch is from upstream. --- .../0001-Suppress-warnings-we-can-t-fix.patch | 2 +- ...002-Fix-tautological-compare-warning.patch | 33 +++++++++++++++++++ upstream_utils/update_fmt.py | 1 + .../thirdparty/fmtlib/include/fmt/ranges.h | 13 ++++---- 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 upstream_utils/fmt_patches/0002-Fix-tautological-compare-warning.patch diff --git a/upstream_utils/fmt_patches/0001-Suppress-warnings-we-can-t-fix.patch b/upstream_utils/fmt_patches/0001-Suppress-warnings-we-can-t-fix.patch index 304d11eb67..b0b08ba836 100644 --- a/upstream_utils/fmt_patches/0001-Suppress-warnings-we-can-t-fix.patch +++ b/upstream_utils/fmt_patches/0001-Suppress-warnings-we-can-t-fix.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 16 May 2023 13:49:18 -0700 -Subject: [PATCH] Suppress warnings we can't fix +Subject: [PATCH 1/2] Suppress warnings we can't fix --- include/fmt/format.h | 7 +++++++ diff --git a/upstream_utils/fmt_patches/0002-Fix-tautological-compare-warning.patch b/upstream_utils/fmt_patches/0002-Fix-tautological-compare-warning.patch new file mode 100644 index 0000000000..2118e2551a --- /dev/null +++ b/upstream_utils/fmt_patches/0002-Fix-tautological-compare-warning.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Victor Zverovich +Date: Mon, 29 Jan 2024 07:48:48 -0800 +Subject: [PATCH 2/2] Fix tautological-compare warning + +--- + include/fmt/ranges.h | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h +index 3638fffb83bce6035c13659f26fe13749c8b19ea..767378c6203fc34e7d763075bd663d2bb6774a97 100644 +--- a/include/fmt/ranges.h ++++ b/include/fmt/ranges.h +@@ -206,12 +206,13 @@ class is_tuple_formattable_ { + static constexpr const bool value = false; + }; + template class is_tuple_formattable_ { +- template +- static auto check2(index_sequence, +- integer_sequence) -> std::true_type; +- static auto check2(...) -> std::false_type; +- template +- static auto check(index_sequence) -> decltype(check2( ++ template ++ static auto all_true(index_sequence, ++ integer_sequence= 0)...>) -> std::true_type; ++ static auto all_true(...) -> std::false_type; ++ ++ template ++ static auto check(index_sequence) -> decltype(all_true( + index_sequence{}, + integer_sequence::type, diff --git a/upstream_utils/update_fmt.py b/upstream_utils/update_fmt.py index 0d275c18bf..9fdff1ded2 100755 --- a/upstream_utils/update_fmt.py +++ b/upstream_utils/update_fmt.py @@ -21,6 +21,7 @@ def main(): os.chdir(upstream_root) for f in [ "0001-Suppress-warnings-we-can-t-fix.patch", + "0002-Fix-tautological-compare-warning.patch", ]: git_am(os.path.join(wpilib_root, "upstream_utils/fmt_patches", f)) diff --git a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/ranges.h b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/ranges.h index 3638fffb83..767378c620 100644 --- a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/ranges.h +++ b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/ranges.h @@ -206,12 +206,13 @@ class is_tuple_formattable_ { static constexpr const bool value = false; }; template class is_tuple_formattable_ { - template - static auto check2(index_sequence, - integer_sequence) -> std::true_type; - static auto check2(...) -> std::false_type; - template - static auto check(index_sequence) -> decltype(check2( + template + static auto all_true(index_sequence, + integer_sequence= 0)...>) -> std::true_type; + static auto all_true(...) -> std::false_type; + + template + static auto check(index_sequence) -> decltype(all_true( index_sequence{}, integer_sequence::type,