Updated to version 9.0.0.

This commit is contained in:
Vitaly Zaitsev 2022-07-06 14:48:41 +02:00
parent d570dd4f09
commit b1a074e783
No known key found for this signature in database
GPG Key ID: BF99FC6DD45AB90A
4 changed files with 8 additions and 79 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@
/8.0.1.tar.gz /8.0.1.tar.gz
/8.1.0.tar.gz /8.1.0.tar.gz
/8.1.1.tar.gz /8.1.1.tar.gz
/9.0.0.tar.gz

View File

@ -1,72 +0,0 @@
From 8f8a1a02d5c5cb967d240feee3ffac00d66f22a2 Mon Sep 17 00:00:00 2001
From: Victor Zverovich <viz@fb.com>
Date: Fri, 14 Jan 2022 13:08:14 -0800
Subject: [PATCH] Fix handling of formattable types implicitly convertible to
pointers
---
include/fmt/core.h | 5 +++--
test/core-test.cc | 21 ++++++++++++++++++++-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/include/fmt/core.h b/include/fmt/core.h
index f2d21e5c5a..12571ce0da 100644
--- a/include/fmt/core.h
+++ b/include/fmt/core.h
@@ -1398,10 +1398,11 @@ template <typename Context> struct arg_mapper {
template <
typename T,
FMT_ENABLE_IF(
- std::is_member_pointer<T>::value ||
+ std::is_pointer<T>::value || std::is_member_pointer<T>::value ||
std::is_function<typename std::remove_pointer<T>::type>::value ||
(std::is_convertible<const T&, const void*>::value &&
- !std::is_convertible<const T&, const char_type*>::value))>
+ !std::is_convertible<const T&, const char_type*>::value &&
+ !has_formatter<T, Context>::value))>
FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
return {};
}
diff --git a/test/core-test.cc b/test/core-test.cc
index b2f2097ea1..c9eea8ffd8 100644
--- a/test/core-test.cc
+++ b/test/core-test.cc
@@ -737,6 +737,24 @@ struct convertible_to_pointer {
operator const int*() const { return nullptr; }
};
+struct convertible_to_pointer_formattable {
+ operator const int*() const { return nullptr; }
+};
+
+FMT_BEGIN_NAMESPACE
+template <> struct formatter<convertible_to_pointer_formattable> {
+ auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
+ return ctx.begin();
+ }
+
+ auto format(convertible_to_pointer_formattable, format_context& ctx) const
+ -> decltype(ctx.out()) {
+ auto test = string_view("test");
+ return std::copy_n(test.data(), test.size(), ctx.out());
+ }
+};
+FMT_END_NAMESPACE
+
enum class test_scoped_enum {};
TEST(core_test, is_formattable) {
@@ -770,11 +788,12 @@ TEST(core_test, is_formattable) {
#endif
static_assert(!fmt::is_formattable<convertible_to_pointer>::value, "");
+ const auto f = convertible_to_pointer_formattable();
+ EXPECT_EQ(fmt::format("{}", f), "test");
static_assert(!fmt::is_formattable<void (*)()>::value, "");
struct s;
-
static_assert(!fmt::is_formattable<int(s::*)>::value, "");
static_assert(!fmt::is_formattable<int (s::*)()>::value, "");
static_assert(!fmt::is_formattable<test_scoped_enum>::value, "");

View File

@ -1,15 +1,12 @@
Name: fmt Name: fmt
Version: 8.1.1 Version: 9.0.0
Release: 5%{?dist} Release: 1%{?dist}
License: BSD License: BSD
Summary: Small, safe and fast formatting library for C++ Summary: Small, safe and fast formatting library for C++
URL: https://github.com/fmtlib/%{name} URL: https://github.com/fmtlib/%{name}
Source0: %{url}/archive/%{version}.tar.gz Source0: %{url}/archive/%{version}.tar.gz
# fix for https://github.com/fmtlib/fmt/issues/2717
Patch100: %{name}-fix_implicit_ptr_conv.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -54,7 +51,7 @@ This package contains the header file for using %{name}.
%files %files
%license LICENSE.rst %license LICENSE.rst
%doc ChangeLog.rst README.rst %doc ChangeLog.rst README.rst
%{_libdir}/lib%{name}.so.8* %{_libdir}/lib%{name}.so.9*
%files devel %files devel
%{_includedir}/%{name} %{_includedir}/%{name}
@ -63,6 +60,9 @@ This package contains the header file for using %{name}.
%{_libdir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc
%changelog %changelog
* Wed Jul 06 2022 Vitaly Zaitsev <vitaly@easycoding.org> - 9.0.0-1
- Updated to version 9.0.0.
* Wed Mar 02 2022 Vitaly Zaitsev <vitaly@easycoding.org> - 8.1.1-5 * Wed Mar 02 2022 Vitaly Zaitsev <vitaly@easycoding.org> - 8.1.1-5
- Removed obsolete macros. - Removed obsolete macros.

View File

@ -1 +1 @@
SHA512 (8.1.1.tar.gz) = 794a47d7cb352a2a9f2c050a60a46b002e4157e5ad23e15a5afc668e852b1e1847aeee3cda79e266c789ff79310d792060c94976ceef6352e322d60b94e23189 SHA512 (9.0.0.tar.gz) = f9612a53c93654753572ac038e52c683f3485691493750d5c2fdb48f3a769e181bfeab8035041cae02bf14cd67df30ec3c5614d7db913f85699cd9da8072bdf8