From 2389b673154d4e680bc5b6b53430fd37f90cb706 Mon Sep 17 00:00:00 2001
From: mvyskocil <>
Date: Aug 15 2022 18:51:58 +0000
Subject: Update cxxtools to version 3.0 / rev 8 via SR 995134
https://build.opensuse.org/request/show/995134
by user mvyskocil + dimstar_suse
---
diff --git a/.files b/.files
index f8da829..8740c89 100644
Binary files a/.files and b/.files differ
diff --git a/.rev b/.rev
index 28dc871..d305c76 100644
--- a/.rev
+++ b/.rev
@@ -58,4 +58,12 @@
912405
+
+ a34775e617f2308c3ddba38aa4afa478
+ 3.0
+
+ dimstar_suse
+
+ 995134
+
diff --git a/0001-add-missing-header-time.h-to-src-timer.cpp.patch b/0001-add-missing-header-time.h-to-src-timer.cpp.patch
new file mode 100644
index 0000000..ac4f579
--- /dev/null
+++ b/0001-add-missing-header-time.h-to-src-timer.cpp.patch
@@ -0,0 +1,24 @@
+From 458c9baafbbe81550a2789b9e3d8716fd3c23ac3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tommi=20M=C3=A4kitalo?=
+Date: Sat, 6 Aug 2022 18:47:30 +0200
+Subject: [PATCH] add missing header time.h to src/timer.cpp
+
+---
+ src/timer.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/timer.cpp b/src/timer.cpp
+index f0a98b3..3098361 100644
+--- a/src/timer.cpp
++++ b/src/timer.cpp
+@@ -28,6 +28,7 @@
+ #include "cxxtools/selector.h"
+ #include "cxxtools/datetime.h"
+ #include
++#include
+
+ namespace cxxtools
+ {
+--
+2.37.1
+
diff --git a/0001-fix-reading-time-zones-on-32-bit-systems.patch b/0001-fix-reading-time-zones-on-32-bit-systems.patch
new file mode 100644
index 0000000..11bbbd7
--- /dev/null
+++ b/0001-fix-reading-time-zones-on-32-bit-systems.patch
@@ -0,0 +1,105 @@
+From c7dd08ea25a5b54922c28f2665c8027d6f93e101 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tommi=20M=C3=A4kitalo?=
+Date: Tue, 2 Feb 2021 18:27:27 +0100
+Subject: [PATCH] fix reading time zones on 32 bit systems
+
+time_t is 32 bit on 32 bit systems but we need 64 bit
+---
+ src/tz.cpp | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/src/tz.cpp b/src/tz.cpp
+index 599d8f5..66f243b 100644
+--- a/src/tz.cpp
++++ b/src/tz.cpp
+@@ -52,6 +52,8 @@ log_define("cxxtools.tz")
+ namespace cxxtools
+ {
+
++typedef int64_t TimeValue;
++
+ class Tz::Impl : public RefCounted
+ {
+ friend class Tz;
+@@ -81,13 +83,13 @@ class Tz::Impl : public RefCounted
+
+ struct LeapInfo
+ {
+- time_t transitionTime;
++ TimeValue transitionTime;
+ int32_t corrections;
+ };
+
+ struct Transition
+ {
+- time_t transitionTime;
++ TimeValue transitionTime;
+ uint8_t ttIndex;
+ };
+
+@@ -337,7 +339,7 @@ const std::string& Tz::name() const
+
+ TzDateTime Tz::toLocal(const UtcDateTime& dt) const
+ {
+- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds());
+
+ uint8_t ttIndex = 0;
+ for (unsigned i = 0; i < _impl->transitions.size(); ++i)
+@@ -365,7 +367,7 @@ TzDateTime Tz::toLocal(const UtcDateTime& dt) const
+ return TzDateTime(dt + gmtoff, tzName, gmtoff, isdst, leapSeconds);
+ }
+
+-static std::string timeT2s(time_t t)
++static std::string timeT2s(TimeValue t)
+ {
+ return cxxtools::DateTime::fromMSecsSinceEpoch(cxxtools::Seconds(t)).toString();
+ }
+@@ -377,7 +379,7 @@ UtcDateTime Tz::toUtc(const LocalDateTime& dt) const
+ if (_impl->transitions.empty())
+ return UtcDateTime(dt);
+
+- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds());
+ unsigned i;
+ for (i = 0; i < _impl->transitions.size() - 1; ++i)
+ {
+@@ -417,7 +419,7 @@ UtcDateTime Tz::toUtc(const LocalDateTime& dt, bool early) const
+ if (_impl->transitions.empty())
+ return UtcDateTime(dt);
+
+- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds());
+ unsigned i;
+ for (i = 0; i < _impl->transitions.size() - 1; ++i)
+ {
+@@ -464,7 +466,7 @@ UtcDateTime Tz::previousChange(const cxxtools::DateTime& dt, bool local) const
+
+ if (!_impl->transitions.empty())
+ {
+- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds());
+ for (unsigned i = 0; i < _impl->transitions.size() - 1; ++i)
+ {
+ if (_impl->transitions[i + 1].transitionTime > t)
+@@ -484,7 +486,7 @@ UtcDateTime Tz::nextChange(const cxxtools::DateTime& dt, bool local) const
+
+ if (!_impl->transitions.empty())
+ {
+- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds());
+ for (unsigned i = 0; i < _impl->transitions.size() - 1; ++i)
+ {
+ if (_impl->transitions[i + 1].transitionTime > t)
+@@ -500,7 +502,7 @@ UtcDateTime Tz::nextChange(const cxxtools::DateTime& dt, bool local) const
+
+ cxxtools::Timespan Tz::offset(const UtcDateTime& gmtDt) const
+ {
+- time_t t = static_cast(gmtDt.msecsSinceEpoch().totalSeconds());
++ TimeValue t = static_cast(gmtDt.msecsSinceEpoch().totalSeconds());
+
+ uint8_t ttIndex = 0;
+ for (unsigned i = 0; i < _impl->transitions.size(); ++i)
+--
+2.37.1
+
diff --git a/0001-remove-range-check-in-serializationinfo.patch b/0001-remove-range-check-in-serializationinfo.patch
new file mode 100644
index 0000000..dd5d574
--- /dev/null
+++ b/0001-remove-range-check-in-serializationinfo.patch
@@ -0,0 +1,76 @@
+From 92ef7c2fd3431ba7c17434e66721d53149d81c8d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tommi=20M=C3=A4kitalo?=
+Date: Mon, 22 Feb 2021 16:13:08 +0100
+Subject: [PATCH] remove range check in serializationinfo
+
+The test was not really useful and anyway skipped when double and long double
+are identical. Somehow it did not work on PPC64.
+---
+ test/serializationinfo-test.cpp | 44 ---------------------------------
+ 1 file changed, 44 deletions(-)
+
+diff --git a/test/serializationinfo-test.cpp b/test/serializationinfo-test.cpp
+index f33a419..3b81a20 100644
+--- a/test/serializationinfo-test.cpp
++++ b/test/serializationinfo-test.cpp
+@@ -70,7 +70,6 @@ class SerializationInfoTest : public cxxtools::unit::TestSuite
+ registerMethod("testMove", *this, &SerializationInfoTest::testMove);
+ #endif
+ registerMethod("testStringToBool", *this, &SerializationInfoTest::testStringToBool);
+- registerMethod("testRangeCheck", *this, &SerializationInfoTest::testRangeCheck);
+ registerMethod("testMember", *this, &SerializationInfoTest::testMember);
+ }
+
+@@ -543,49 +542,6 @@ class SerializationInfoTest : public cxxtools::unit::TestSuite
+ CXXTOOLS_UNIT_ASSERT(siValue(si));
+ }
+
+- void testRangeCheck()
+- {
+- cxxtools::SerializationInfo si;
+- si.setValue(-1);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+-
+- si.setValue(static_cast(std::numeric_limits::max()) + 1);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si));
+-
+- if (std::numeric_limits::max() > static_cast(std::numeric_limits::max()))
+- {
+- si.setValue(static_cast(std::numeric_limits::max()) * 1.01);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si));
+-
+- si.setValue(static_cast(-std::numeric_limits::max()) * 1.01);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si));
+- }
+- else
+- {
+- log_info("range error for double skipped since long double is not larger than double");
+- }
+-
+- if (std::numeric_limits::max() > static_cast(std::numeric_limits::max()))
+- {
+- si.setValue(static_cast(std::numeric_limits::max()) * 1.01);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si));
+-
+- si.setValue(static_cast(-std::numeric_limits::max()) * 1.01);
+- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error);
+- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si));
+- }
+- else
+- {
+- log_info("range error for float skipped since long double is not larger than double");
+- }
+- }
+-
+ void testMember()
+ {
+ cxxtools::SerializationInfo si;
+--
+2.37.1
+
diff --git a/0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch b/0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch
new file mode 100644
index 0000000..fee15bc
--- /dev/null
+++ b/0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch
@@ -0,0 +1,44 @@
+From daacbe49c4f2494b23b30318feb4baf0e5dd9ae4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tommi=20M=C3=A4kitalo?=
+Date: Tue, 2 Feb 2021 18:57:16 +0100
+Subject: [PATCH] remove timespan unittest which is prone to rounding errors
+ due to binary arithmentic
+
+---
+ test/timespan-test.cpp | 20 --------------------
+ 1 file changed, 20 deletions(-)
+
+diff --git a/test/timespan-test.cpp b/test/timespan-test.cpp
+index ee553b7..ffbc951 100644
+--- a/test/timespan-test.cpp
++++ b/test/timespan-test.cpp
+@@ -225,26 +225,6 @@ class TimespanTest : public cxxtools::unit::TestSuite
+ CXXTOOLS_UNIT_ASSERT_EQUALS(number, 17.875);
+ }
+
+- {
+- cxxtools::Seconds t(cxxtools::Timespan(14999999));
+- cxxtools::SerializationInfo si;
+- si <<= t;
+- cxxtools::Timespan t2;
+- si >>= t2;
+- CXXTOOLS_UNIT_ASSERT_EQUALS(t.totalUSecs(), t2.totalUSecs());
+- CXXTOOLS_UNIT_ASSERT_EQUALS(si.typeName(), "seconds");
+- }
+-
+- {
+- cxxtools::Seconds t(cxxtools::Timespan(14999998));
+- cxxtools::SerializationInfo si;
+- si <<= t;
+- cxxtools::Timespan t2;
+- si >>= t2;
+- CXXTOOLS_UNIT_ASSERT_EQUALS(t, t2);
+- CXXTOOLS_UNIT_ASSERT_EQUALS(si.typeName(), "seconds");
+- }
+-
+ {
+ cxxtools::Minutes t(17.875);
+ cxxtools::SerializationInfo si;
+--
+2.37.1
+
diff --git a/cxxtools.changes b/cxxtools.changes
index 5e12270..d0f6359 100644
--- a/cxxtools.changes
+++ b/cxxtools.changes
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Thu Aug 11 08:51:05 UTC 2022 - Christophe Giboudeaux
+
+- Add upstream changes to fix build and tests:
+ * 0001-add-missing-header-time.h-to-src-timer.cpp.patch
+ * 0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch
+ * 0001-fix-reading-time-zones-on-32-bit-systems.patch
+ * 0001-remove-range-check-in-serializationinfo.patch
+
+-------------------------------------------------------------------
Wed Aug 11 15:26:47 UTC 2021 - Jan Engelhardt
- Drop --with-pic, as it has no effect with --disable-static.
diff --git a/cxxtools.spec b/cxxtools.spec
index 999a415..f303103 100644
--- a/cxxtools.spec
+++ b/cxxtools.spec
@@ -27,7 +27,11 @@ Group: Development/Libraries/C and C++
URL: http://www.tntnet.org/cxxtools.html
Source0: https://github.com/maekitalo/cxxtools/archive/V%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source99: cxxtools-rpmlintrc
-Patch1: gcc11.patch
+Patch0: gcc11.patch
+Patch1: 0001-add-missing-header-time.h-to-src-timer.cpp.patch
+Patch2: 0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch
+Patch3: 0001-fix-reading-time-zones-on-32-bit-systems.patch
+Patch4: 0001-remove-range-check-in-serializationinfo.patch
BuildRequires: autoconf
BuildRequires: gcc-c++
BuildRequires: libtool