1
0

Accepting request 961802 from home:marxin:branches:devel:languages:python:numeric

- Add gcc12-fixes.patch in order to fix GCC 12 building issues.

OBS-URL: https://build.opensuse.org/request/show/961802
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=4
This commit is contained in:
Dirk Mueller 2022-03-15 15:51:14 +00:00 committed by Git OBS Bridge
parent ab0570a88a
commit 8d2b055f70
3 changed files with 160 additions and 5 deletions

148
gcc12-fixes.patch Normal file
View File

@ -0,0 +1,148 @@
The patch contains 2 upstream changes needed for building with GCC 12.
From e06d2c95bf88f84f9e570eeece5c3408fd8f24fe Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Mon, 14 Mar 2022 16:10:12 +0100
Subject: [PATCH] Move mult operator for str to the appropriate ns
---
pythran/pythonic/include/types/str.hpp | 11 +++--
pythran/pythonic/types/str.hpp | 64 +++++++++++++-------------
2 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..5aa526692 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -318,6 +318,12 @@ namespace types
std::ostream &operator<<(std::ostream &os, chr const &s);
std::ostream &operator<<(std::ostream &os, str const &s);
+
+ str operator*(str const &s, long n);
+ str operator*(long t, str const &s);
+ str operator*(chr const &s, long n);
+ str operator*(long t, chr const &s);
+
}
namespace operator_
@@ -356,11 +362,6 @@ struct assignable<char const[N]> {
};
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::str const &s);
-pythonic::types::str operator*(pythonic::types::chr const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::chr const &s);
-
namespace std
{
template <>
diff --git a/pythran/pythonic/types/str.hpp b/pythran/pythonic/types/str.hpp
index 6e9bc241f..ee540a73b 100644
--- a/pythran/pythonic/types/str.hpp
+++ b/pythran/pythonic/types/str.hpp
@@ -655,6 +655,38 @@ namespace types
{
return os << s.c_str();
}
+
+ str operator*(str const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(s.size() * n);
+ auto where = other.chars().begin();
+ for (long i = 0; i < n; i++, where += s.size())
+ std::copy(s.chars().begin(), s.chars().end(), where);
+ return other;
+ }
+
+ str operator*(long t, str const &s)
+ {
+ return s * t;
+ }
+
+ str operator*(chr const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(n);
+ std::fill(other.chars().begin(), other.chars().end(), s.c);
+ return other;
+ }
+
+ str operator*(long t, chr const &c)
+ {
+ return c * t;
+ }
}
namespace operator_
@@ -686,38 +718,6 @@ namespace operator_
}
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(s.size() * n);
- auto where = other.chars().begin();
- for (long i = 0; i < n; i++, where += s.size())
- std::copy(s.chars().begin(), s.chars().end(), where);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::str const &s)
-{
- return s * t;
-}
-
-pythonic::types::str operator*(pythonic::types::chr const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(n);
- std::fill(other.chars().begin(), other.chars().end(), s.c);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::chr const &c)
-{
- return c * t;
-}
-
namespace std
{
From 343cb724d857fe8adcef071ab088df2c02ba0d4c Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Mon, 14 Mar 2022 10:11:00 +0000
Subject: [PATCH] Add default constructor to string_iterator
A type must be default constructible to meet the forward iterator requirements.
GCC 12 won't compile `std::reverse_iterator<string_iterator>` without
this change.
---
pythran/pythonic/include/types/str.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..a0df45905 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -231,6 +231,7 @@ namespace types
struct string_iterator : std::iterator<std::random_access_iterator_tag, str,
std::ptrdiff_t, str *, str> {
std::string::const_iterator curr;
+ string_iterator() = default;
string_iterator(std::string::const_iterator iter) : curr(iter)
{
}

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Mar 15 07:59:46 UTC 2022 - Martin Liška <mliska@suse.cz>
- Add gcc12-fixes.patch in order to fix GCC 12 building issues.
-------------------------------------------------------------------
Fri Jan 28 18:47:52 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@ -1,5 +1,5 @@
#
# spec file for package python-pythran
# spec file
#
# Copyright (c) 2022 SUSE LLC
#
@ -22,21 +22,21 @@
%define skip_python39 1
%define skip_python310 1
%bcond_without test
ExclusiveArch: x86_64
ExclusiveArch: x86_64
%endif
%if "%{flavor}" == "test-py39"
%define psuffix -test-py39
%define skip_python38 1
%define skip_python310 1
%bcond_without test
ExclusiveArch: x86_64
ExclusiveArch: x86_64
%endif
%if "%{flavor}" == "test-py310"
%define psuffix -test-py310
%define skip_python38 1
%define skip_python39 1
%bcond_without test
ExclusiveArch: x86_64
ExclusiveArch: x86_64
%endif
%if "%{flavor}" == ""
%define psuffix %{nil}
@ -53,6 +53,7 @@ URL: https://github.com/serge-sans-paille/pythran
# Tests are only availble in github archive
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
Source99: python-pythran-rpmlintrc
Patch0: gcc12-fixes.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@ -76,8 +77,8 @@ BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pythran = %{version}}
BuildRequires: %{python_module wheel}
BuildRequires: unzip
BuildRequires: gcc-c++
BuildRequires: unzip
%endif
BuildArch: noarch
%python_subpackages
@ -87,6 +88,7 @@ Ahead of Time compiler for numeric kernels
%prep
%setup -q -n pythran-%{version}
%patch0 -p1
find -name '*.hpp' -exec chmod -x {} +
sed -i '1{/env python/d}' pythran/run.py