cherry-pick "Adapt o3tl::span to removal of std::span::cbegin et al"

https://github.com/LibreOffice/core/commit/6fbfad6b

```
In file included from /builddir/build/BUILD/libreoffice-6.3.5/include/sfx2/dispatch.hxx:30:
/builddir/build/BUILD/libreoffice-6.3.5/include/o3tl/span.hxx:19:29: error: no member named 'span' in namespace 'std'
namespace o3tl { using std::span; }
                       ~~~~~^
1 warning generated.
In file included from /builddir/build/BUILD/libreoffice-6.3.5/sfx2/source/appl/appmisc.cxx:56:
/builddir/build/BUILD/libreoffice-6.3.5/include/sfx2/dispatch.hxx:146:46: error: no template named 'span' in namespace 'o3tl'
                                       o3tl::span<sal_uInt16 const> pSIDs = o3tl::span<sal_uInt16 const>());
                                       ~~~~~~^
/builddir/build/BUILD/libreoffice-6.3.5/include/sfx2/dispatch.hxx:146:83: error: no member named 'span' in namespace 'o3tl'
                                       o3tl::span<sal_uInt16 const> pSIDs = o3tl::span<sal_uInt16 const>());
                                                                            ~~~~~~^
/builddir/build/BUILD/libreoffice-6.3.5/include/sfx2/dispatch.hxx:146:88: error: unexpected type name 'sal_uInt16': expected expression
                                       o3tl::span<sal_uInt16 const> pSIDs = o3tl::span<sal_uInt16 const>());
                                                                                       ^
1 warning and 4 errors generated.
```
This commit is contained in:
Mikhail Novosyolov 2020-04-04 15:53:25 +03:00
parent 1312ec35a0
commit 8eb31fe67c
2 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,61 @@
From 6fbfad6b00e8c35346ee59cd32a0d7ccc0d8c19c Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Sat, 22 Feb 2020 17:29:15 +0100
Subject: [PATCH] Adapt o3tl::span to removal of std::span::cbegin et al
<https://cplusplus.github.io/LWG/issue3320> "span::cbegin/cend methods produce
different results than std::[ranges::]cbegin/cend", as implemented now in
<https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=commit;
h=247f410b83797a1840573840cc2a539ef9d7f96b> "libstdc++: Remove std::span::cbegin
and std::span::cend (LWG 3320)".
Turns out we only used the removed member functions in o3tl/qa/test-span.cxx.
Change-Id: I6c73797594b4e0e753a88840033d54961e271df5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89261
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
---
include/o3tl/span.hxx | 7 -------
o3tl/qa/test-span.cxx | 6 ------
2 files changed, 13 deletions(-)
--- libreoffice-6.3.5.2/include/o3tl/span.hxx.orig 2020-04-04 16:27:13.798399505 +0300
+++ libreoffice-6.3.5.2/include/o3tl/span.hxx 2020-04-04 16:28:05.080888607 +0300
@@ -60,18 +60,11 @@
constexpr iterator begin() const noexcept { return data_; }
constexpr iterator end() const noexcept { return begin() + size(); }
- constexpr const_iterator cbegin() const noexcept { return begin(); }
- constexpr const_iterator cend() const noexcept { return end(); }
-
reverse_iterator rbegin() const noexcept
{ return reverse_iterator(end()); }
reverse_iterator rend() const noexcept
{ return reverse_iterator(begin()); }
- constexpr const_reverse_iterator crbegin() const noexcept
- { return rbegin(); }
- constexpr const_reverse_iterator crend() const noexcept { return rend(); }
-
constexpr index_type size() const noexcept { return size_; }
constexpr reference operator [](index_type pos) const {
--- libreoffice-6.3.5.2/o3tl/qa/test-span.cxx.orig 2020-04-04 16:27:13.802399388 +0300
+++ libreoffice-6.3.5.2/o3tl/qa/test-span.cxx 2020-04-04 16:30:35.256474807 +0300
@@ -33,15 +33,9 @@
CPPUNIT_ASSERT_EQUAL(1, *v.begin());
CPPUNIT_ASSERT_EQUAL(
o3tl::span<int>::difference_type(3), v.end() - v.begin());
- CPPUNIT_ASSERT_EQUAL(1, *v.cbegin());
- CPPUNIT_ASSERT_EQUAL(
- o3tl::span<int>::difference_type(3), v.cend() - v.cbegin());
CPPUNIT_ASSERT_EQUAL(3, *v.rbegin());
CPPUNIT_ASSERT_EQUAL(
o3tl::span<int>::difference_type(3), v.rend() - v.rbegin());
- CPPUNIT_ASSERT_EQUAL(3, *v.crbegin());
- CPPUNIT_ASSERT_EQUAL(
- o3tl::span<int>::difference_type(3), v.crend() - v.crbegin());
CPPUNIT_ASSERT_EQUAL(o3tl::span<int>::index_type(3), v.size());
CPPUNIT_ASSERT(!v.empty());
CPPUNIT_ASSERT_EQUAL(2, v[1]);

View file

@ -84,6 +84,8 @@ Source1000: libreoffice.rpmlintrc
Patch0: libreoffice-5.4.0.1-disable-test-languagetag.patch Patch0: libreoffice-5.4.0.1-disable-test-languagetag.patch
Patch1: libreoffice-4.2.5-icu-49.patch Patch1: libreoffice-4.2.5-icu-49.patch
Patch2: libreoffice-6.3.5.2-kde4-detection.patch Patch2: libreoffice-6.3.5.2-kde4-detection.patch
# https://github.com/LibreOffice/core/commit/6fbfad6b
Patch3: 6fbfad6b00e8c35346ee59cd32a0d7ccc0d8c19c.patch
# ROSA vendor patch # ROSA vendor patch
Patch100: libreoffice-4.1-vendor.patch Patch100: libreoffice-4.1-vendor.patch