Hello community, here is the log from the commit of package fmt for openSUSE:Factory checked in at 2019-12-11 11:59:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fmt (Old) and /work/SRC/openSUSE:Factory/.fmt.new.4691 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fmt" Wed Dec 11 11:59:49 2019 rev:4 rq:753962 version:6.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/fmt/fmt.changes 2019-03-26 15:45:43.524073226 +0100 +++ /work/SRC/openSUSE:Factory/.fmt.new.4691/fmt.changes 2019-12-11 12:00:06.668866899 +0100 @@ -1,0 +2,17 @@ +Sun Dec 1 08:54:54 UTC 2019 - Luigi Baldoni <aloi...@gmx.com> + +- Added fmt-bigendian_1.patch, fmt-bigendian_2.patch, + fmt-bigendian_3.patch and fmt-bigendian_4.patch to fix tests + on big endian targets + +------------------------------------------------------------------- +Fri Nov 29 08:46:30 UTC 2019 - Luigi Baldoni <aloi...@gmx.com> + +- Update to version 6.0.0 + (too many changes to list, see ChangeLog.rst) +- Dropped 0001-install-pkg-config-file-into-libdir.patch (no + longer necessary) +- Switched to MIT license +- Increased SOVERSION to 6 + +------------------------------------------------------------------- Old: ---- 0001-install-pkg-config-file-into-libdir.patch fmt-5.3.0.tar.gz New: ---- fmt-6.0.0.tar.gz fmt-bigendian_1.patch fmt-bigendian_2.patch fmt-bigendian_3.patch fmt-bigendian_4.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fmt.spec ++++++ --- /var/tmp/diff_new_pack.w7eG9N/_old 2019-12-11 12:00:07.948866360 +0100 +++ /var/tmp/diff_new_pack.w7eG9N/_new 2019-12-11 12:00:07.952866358 +0100 @@ -1,7 +1,7 @@ # # spec file for package fmt # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,17 +16,24 @@ # -%define sover 5 +%define sover 6 Name: fmt -Version: 5.3.0 +Version: 6.0.0 Release: 0 Summary: A formatting library for C++ -License: BSD-2-Clause +License: MIT Group: Development/Libraries/C and C++ URL: http://fmtlib.net/ Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: baselibs.conf -Patch0: 0001-install-pkg-config-file-into-libdir.patch +# PATCH-FIX-UPSTREAM fmt-bigendian_1.patch +Patch0: fmt-bigendian_1.patch +# PATCH-FIX-UPSTREAM fmt-bigendian_2.patch +Patch1: fmt-bigendian_2.patch +# PATCH-FIX-UPSTREAM fmt-bigendian_3.patch +Patch2: fmt-bigendian_3.patch +# PATCH-FIX-UPSTREAM fmt-bigendian_4.patch +Patch3: fmt-bigendian_4.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig ++++++ baselibs.conf ++++++ --- /var/tmp/diff_new_pack.w7eG9N/_old 2019-12-11 12:00:07.984866345 +0100 +++ /var/tmp/diff_new_pack.w7eG9N/_new 2019-12-11 12:00:07.984866345 +0100 @@ -1 +1 @@ -libfmt5 +libfmt6 ++++++ fmt-5.3.0.tar.gz -> fmt-6.0.0.tar.gz ++++++ ++++ 33343 lines of diff (skipped) ++++++ fmt-bigendian_1.patch ++++++ >From bb205d940d8929d086eadb59705349dbdaa1a274 Mon Sep 17 00:00:00 2001 From: Victor Zverovich <victor.zverov...@gmail.com> Date: Fri, 29 Nov 2019 05:15:59 -0800 Subject: [PATCH] Fix fallback pointer formatting on big endian --- include/fmt/format-inl.h | 2 +- include/fmt/format.h | 40 ++++++++++++++++++++++++++++------------ test/format-impl-test.cc | 2 +- 3 files changed, 30 insertions(+), 14 deletions(-) Index: fmt-6.0.0/include/fmt/format-inl.h =================================================================== --- fmt-6.0.0.orig/include/fmt/format-inl.h +++ fmt-6.0.0/include/fmt/format-inl.h @@ -241,7 +241,7 @@ FMT_FUNC void system_error::init(int err namespace internal { template <> FMT_FUNC int count_digits<4>(internal::fallback_uintptr n) { - // Assume little endian; pointer formatting is implementation-defined anyway. + // fallback_uintptr is always stored in little endian. int i = static_cast<int>(sizeof(void*)) - 1; while (i > 0 && n.value[i] == 0) --i; auto char_digits = std::numeric_limits<unsigned char>::digits / 4; Index: fmt-6.0.0/include/fmt/format.h =================================================================== --- fmt-6.0.0.orig/include/fmt/format.h +++ fmt-6.0.0/include/fmt/format.h @@ -196,17 +196,7 @@ FMT_END_NAMESPACE FMT_BEGIN_NAMESPACE namespace internal { -// A fallback implementation of uintptr_t for systems that lack it. -struct fallback_uintptr { - unsigned char value[sizeof(void*)]; -}; -#ifdef UINTPTR_MAX -using uintptr_t = ::uintptr_t; -#else -using uintptr_t = fallback_uintptr; -#endif - -// An equivalent of `*reinterpret_cast<Dest*>(&source)` that doesn't produce +// An equivalent of `*reinterpret_cast<Dest*>(&source)` that doesn't have // undefined behavior (e.g. due to type aliasing). // Example: uint64_t d = bit_cast<uint64_t>(2.718); template <typename Dest, typename Source> @@ -217,6 +207,32 @@ inline Dest bit_cast(const Source& sourc return dest; } +inline bool is_big_endian() { + auto u = 1u; + struct bytes { char data[sizeof(u)]; }; + return bit_cast<bytes>(u).data[0] == 0; +} + +// A fallback implementation of uintptr_t for systems that lack it. +struct fallback_uintptr { + unsigned char value[sizeof(void*)]; + + fallback_uintptr() = default; + explicit fallback_uintptr(const void* p) { + *this = bit_cast<fallback_uintptr>(p); + if (is_big_endian()) std::memmove(value, value, sizeof(void*)); + } +}; +#ifdef UINTPTR_MAX +using uintptr_t = ::uintptr_t; +inline uintptr_t to_uintptr(const void* p) { return bit_cast<uintptr_t>(p); } +#else +using uintptr_t = fallback_uintptr; +inline fallback_uintptr to_uintptr(const void* p) { + return fallback_uintptr(p); +} +#endif + // An approximation of iterator_t for pre-C++20 systems. template <typename T> using iterator_t = decltype(std::begin(std::declval<T&>())); @@ -1731,7 +1747,7 @@ class arg_formatter_base { } void write_pointer(const void* p) { - writer_.write_pointer(internal::bit_cast<internal::uintptr_t>(p), specs_); + writer_.write_pointer(internal::to_uintptr(p), specs_); } protected: Index: fmt-6.0.0/test/format-impl-test.cc =================================================================== --- fmt-6.0.0.orig/test/format-impl-test.cc +++ fmt-6.0.0/test/format-impl-test.cc @@ -259,7 +259,7 @@ TEST(UtilTest, CountDigits) { TEST(UtilTest, WriteUIntPtr) { fmt::memory_buffer buf; fmt::internal::writer writer(buf); - writer.write_pointer(fmt::internal::bit_cast<fmt::internal::fallback_uintptr>( + writer.write_pointer(fmt::internal::fallback_uintptr( reinterpret_cast<void*>(0xface)), nullptr); EXPECT_EQ("0xface", to_string(buf)); ++++++ fmt-bigendian_2.patch ++++++ >From aaf829bfb124fcd7953c33f38154027537efb072 Mon Sep 17 00:00:00 2001 From: Victor Zverovich <victor.zverov...@gmail.com> Date: Fri, 29 Nov 2019 07:07:08 -0800 Subject: [PATCH] Fix fallback pointer formatting on big endian, take 2 --- include/fmt/format.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: fmt-6.0.0/include/fmt/format.h =================================================================== --- fmt-6.0.0.orig/include/fmt/format.h +++ fmt-6.0.0/include/fmt/format.h @@ -220,7 +220,10 @@ struct fallback_uintptr { fallback_uintptr() = default; explicit fallback_uintptr(const void* p) { *this = bit_cast<fallback_uintptr>(p); - if (is_big_endian()) std::memmove(value, value, sizeof(void*)); + if (is_big_endian()) { + for (size_t i = 0, j = sizeof(void*) - 1; i < j; ++i, --j) + std::swap(value[i], value[j]); + } } }; #ifdef UINTPTR_MAX ++++++ fmt-bigendian_3.patch ++++++ >From fafb03fa6d764f3cedf80e222a1e5998b80ef79c Mon Sep 17 00:00:00 2001 From: Victor Zverovich <victor.zverov...@gmail.com> Date: Sat, 30 Nov 2019 06:35:52 -0800 Subject: [PATCH] Fix handling of fallback_uintptr --- include/fmt/format.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: fmt-6.0.0/include/fmt/format.h =================================================================== --- fmt-6.0.0.orig/include/fmt/format.h +++ fmt-6.0.0/include/fmt/format.h @@ -281,6 +281,12 @@ template <typename Container> inline typename Container::value_type* get_data(Container& c) { return c.data(); } +template <typename T> constexpr int digits() { + return std::numeric_limits<T>::digits; +} +template <> constexpr int digits<fallback_uintptr>() { + return sizeof(void*) * std::numeric_limits<unsigned char>::digits; +} #ifdef _SECURE_SCL // Make a checked iterator to avoid MSVC warnings. @@ -900,7 +906,7 @@ Char* format_uint(Char* buffer, internal template <unsigned BASE_BITS, typename Char, typename It, typename UInt> inline It format_uint(It out, UInt value, int num_digits, bool upper = false) { // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). - char buffer[std::numeric_limits<UInt>::digits / BASE_BITS + 1]; + char buffer[digits<UInt>() / BASE_BITS + 1]; format_uint<BASE_BITS>(buffer, value, num_digits, upper); return internal::copy_str<Char>(buffer, buffer + num_digits, out); } ++++++ fmt-bigendian_4.patch ++++++ >From ba6e330fd3a9c2d859d651c59d6206620940a265 Mon Sep 17 00:00:00 2001 From: Victor Zverovich <victor.zverov...@gmail.com> Date: Sat, 30 Nov 2019 08:19:58 -0800 Subject: [PATCH] digits -> num_bits --- include/fmt/format.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: fmt-6.0.0/include/fmt/format.h =================================================================== --- fmt-6.0.0.orig/include/fmt/format.h +++ fmt-6.0.0/include/fmt/format.h @@ -281,11 +281,12 @@ template <typename Container> inline typename Container::value_type* get_data(Container& c) { return c.data(); } -template <typename T> constexpr int digits() { +template <typename T> constexpr int num_bits() { return std::numeric_limits<T>::digits; } -template <> constexpr int digits<fallback_uintptr>() { - return sizeof(void*) * std::numeric_limits<unsigned char>::digits; +template <> constexpr int num_bits<fallback_uintptr>() { + return static_cast<int>(sizeof(void*) * + std::numeric_limits<unsigned char>::digits); } #ifdef _SECURE_SCL @@ -906,7 +907,7 @@ Char* format_uint(Char* buffer, internal template <unsigned BASE_BITS, typename Char, typename It, typename UInt> inline It format_uint(It out, UInt value, int num_digits, bool upper = false) { // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). - char buffer[digits<UInt>() / BASE_BITS + 1]; + char buffer[num_bits<UInt>() / BASE_BITS + 1]; format_uint<BASE_BITS>(buffer, value, num_digits, upper); return internal::copy_str<Char>(buffer, buffer + num_digits, out); }