Skip to content

Commit

Permalink
Update fmt to v11.0.2 (#1457)
Browse files Browse the repository at this point in the history
Signed-off-by: Kefu Chai <[email protected]>
Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
tchaikov and BillyONeal authored Jul 23, 2024
1 parent bf8aee5 commit d67080f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"Type": "other",
"other": {
"name": "fmt",
"version": "10.1.0",
"downloadUrl": "https://github.com/fmtlib/fmt/archive/refs/tags/10.1.0.tar.gz",
"hash": "69a7b8584f828528e3bb4b87153449e96df29bd740adcd42a2e3d50ae4a270c80a5eb2c3057337048be5b978094d8bb73bec3378e3b6370748de2b063dd0aa4b"
"version": "11.0.2",
"downloadUrl": "https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz",
"hash": "47ff6d289dcc22681eea6da465b0348172921e7cafff8fd57a1540d3232cc6b53250a4625c954ee0944c87963b17680ecbc3ea123e43c2c822efe0dc6fa6cef3"
}
},
"DevelopmentDependency": false,
Expand Down
9 changes: 3 additions & 6 deletions cmake/Findfmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if("$CACHE{VCPKG_FMT_URL}" MATCHES "^https://github.com/fmtlib/fmt/archive/refs/
unset(VCPKG_FMT_URL CACHE) # Fix upgrade
endif()
if(NOT VCPKG_FMT_URL)
set(VCPKG_FMT_URL "https://github.com/fmtlib/fmt/archive/refs/tags/10.1.0.tar.gz")
set(VCPKG_FMT_URL "https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz")
endif()

if(POLICY CMP0135)
Expand All @@ -20,11 +20,8 @@ set(OLD_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(SKIP_WARNINGS OFF)
if(MSVC AND VCPKG_DEVELOPMENT_WARNINGS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang"))
set(SKIP_WARNINGS ON)
# fmt\core.h(418): warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>: Did you intend to use the bitwise-and (&) operator? If not, consider removing the redundant '<non-zero constant>' and the && operator.
# fmt\base.h(451): warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>: Did you intend to use the bitwise-and (`&`) operator? If not, consider removing the redundant '<non-zero constant>' and the `&&` operator.
string(APPEND CMAKE_CXX_FLAGS " /wd6239")
# This one is guarded by an assert
# fmt\format-inl.h(327): warning C6385: Reading invalid data from 'pow10_significands'.: Lines: 298, 300, 327
string(APPEND CMAKE_CXX_FLAGS " /wd6385")
# fmt\os.h(377): warning C6326: Potential comparison of a constant with another constant.
string(APPEND CMAKE_CXX_FLAGS " /wd6326")
endif()
Expand All @@ -33,7 +30,7 @@ include(FetchContent)
FetchContent_Declare(
fmt
URL "${VCPKG_FMT_URL}"
URL_HASH "SHA512=69a7b8584f828528e3bb4b87153449e96df29bd740adcd42a2e3d50ae4a270c80a5eb2c3057337048be5b978094d8bb73bec3378e3b6370748de2b063dd0aa4b"
URL_HASH "SHA512=47ff6d289dcc22681eea6da465b0348172921e7cafff8fd57a1540d3232cc6b53250a4625c954ee0944c87963b17680ecbc3ea123e43c2c822efe0dc6fa6cef3"
)

if(NOT fmt_FIND_REQUIRED)
Expand Down
9 changes: 6 additions & 3 deletions include/vcpkg/base/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ VCPKG_MSVC_WARNING(push)
// C6239 is not a useful warning for external code; it is
// (<non-zero constant> && <expression>) always evaluates to the result of <expression>.
//
// include\fmt\format.h(1812): warning C4189: 'zero': local variable is initialized but not referenced
// include\fmt\compile.h(151): warning C4702: unreachable code (expected due to if constexpr)
VCPKG_MSVC_WARNING(disable : 6239 4189 4702)
// fmt\base.h(451): warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>
// Did you intend to use the bitwise-and (`&`) operator? If not, consider removing the redundant '<non-zero constant>'
// and the `&&` operator.
// include\fmt\compile.h(153): warning C4702: unreachable code (expected due to if constexpr)
VCPKG_MSVC_WARNING(disable : 6239 4702)
#include <fmt/compile.h>
#include <fmt/format.h>
#include <fmt/ranges.h>
VCPKG_MSVC_WARNING(pop)
2 changes: 1 addition & 1 deletion include/vcpkg/base/fwd/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace fmt
{
inline namespace v10
inline namespace v11
{
template<typename T, typename Char, typename Enable>
struct formatter;
Expand Down
19 changes: 19 additions & 0 deletions include/vcpkg/base/stringview.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ namespace vcpkg
};
}

template<class Char>
struct fmt::range_format_kind<vcpkg::StringView, Char>
: std::integral_constant<fmt::range_format, fmt::range_format::disabled>
{
};

template<class Char>
struct fmt::formatter<vcpkg::StringView, Char, void> : fmt::formatter<fmt::basic_string_view<char>, Char, void>
{
Expand All @@ -115,5 +121,18 @@ struct fmt::formatter<vcpkg::StringView, Char, void> : fmt::formatter<fmt::basic
}
};

template<class Char>
struct fmt::range_format_kind<vcpkg::ZStringView, Char>
: std::integral_constant<fmt::range_format, fmt::range_format::disabled>
{
};

VCPKG_FORMAT_AS(vcpkg::ZStringView, vcpkg::StringView);

template<class Char>
struct fmt::range_format_kind<vcpkg::StringLiteral, Char>
: std::integral_constant<fmt::range_format, fmt::range_format::disabled>
{
};

VCPKG_FORMAT_AS(vcpkg::StringLiteral, vcpkg::StringView);

0 comments on commit d67080f

Please sign in to comment.