- Update to 2.0.6

* Various fixes with templates and typedef types.
  * Some template lookup problems fixed.
  * Templated type fixes to use correct typemaps.
  * Autodoc documentation generation improvements.
  * Python STL container wrappers improvements including addition of
    stepped slicing.
  * Approximately 70 fixes and minor enhancements for the following
    target languages: AllegroCL, C#, D, Go, Java, Lua, Ocaml, Octave,
    Perl, PHP, Python, R, Ruby, Tcl, Xml.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=35
This commit is contained in:
Ismail Dönmez 2012-04-30 12:24:08 +00:00 committed by Git OBS Bridge
parent bbab5343cc
commit 77ce9f19a6
8 changed files with 28 additions and 373 deletions

View File

@ -1,59 +0,0 @@
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -2,6 +2,14 @@ This file contains the changes for the c
See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release.
+2011-09-19: wsfulton
+ Fix regression introduced in swig-2.0.1 reported by Teemu Ikonone leading to uncompilable code
+ when using typedef and function pointer references, for example:
+
+ typedef int FN(const int &a, int b);
+ void *typedef_call1(FN *& precallback, FN * postcallback);
+
+
Version 2.0.4 (in progress)
===========================
2011-05-19: wsfulton
--- a/Source/Swig/stype.c
+++ b/Source/Swig/stype.c
@@ -823,7 +823,8 @@ String *SwigType_rcaststr(const SwigType
Insert(result, 0, "(");
Append(result, ")");
}
- isreference = 1;
+ if (!isfunction)
+ isreference = 1;
} else if (SwigType_isarray(element)) {
DOH *size;
if (firstarray && !isreference) {
@@ -869,10 +870,8 @@ String *SwigType_rcaststr(const SwigType
cast = NewStringf("(%s)", result);
}
if (name) {
- if (!isfunction) {
- if (isreference) {
- Append(cast, "*");
- }
+ if (isreference) {
+ Append(cast, "*");
}
Append(cast, name);
}
--- a/Examples/test-suite/funcptr_cpp.i
+++ b/Examples/test-suite/funcptr_cpp.i
@@ -20,3 +20,14 @@ int call3(int & (*d)(const int &, int),
%constant int (*ADD_BY_VALUE)(const int &, int) = addByValue;
%constant int * (*ADD_BY_POINTER)(const int &, int) = addByPointer;
%constant int & (*ADD_BY_REFERENCE)(const int &, int) = addByReference;
+
+
+%inline %{
+typedef int AddByValueTypedef(const int &a, int b);
+typedef int * AddByPointerTypedef(const int &a, int b);
+typedef int & AddByReferenceTypedef(const int &a, int b);
+void *typedef_call1(AddByValueTypedef *& precallback, AddByValueTypedef * postcallback) { return 0; }
+void *typedef_call2(AddByPointerTypedef *& precallback, AddByPointerTypedef * postcallback) { return 0; }
+void *typedef_call3(AddByReferenceTypedef *& precallback, AddByReferenceTypedef * postcallback) { return 0; }
+%}
+

View File

@ -1,80 +0,0 @@
Description: Fix overflow errors with 64-bit IVs
The perl 5.12 packages are compiled with -Duse64bitint, which means that IVs
are 64-bits even on 32-bit architectures. When converting IVs, SWIG assumes
that an IV is the same size as a long, which causes OverflowErrors with
unsigned longs when the value is greater than 2^31.
.
This patch should remove those assumptions by using the "IV" type defined by
the perl headers, and explicitly checking the values are within the correct
range for the type being converted.
Author: Chris Butler <chrisb@debian.org>
Bug-Debian: http://bugs.debian.org/579540
Forwarded: no
--- a/Lib/perl5/perlprimtypes.swg
+++ b/Lib/perl5/perlprimtypes.swg
@@ -56,8 +56,13 @@
SWIG_AsVal_dec(long)(SV *obj, long* val)
{
if (SvIOK(obj)) {
- if (val) *val = SvIV(obj);
- return SWIG_OK;
+ IV v = SvIV(obj);
+ if (v >= LONG_MIN && v <= LONG_MAX) {
+ if (val) *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
} else {
int dispatch = 0;
const char *nptr = SvPV_nolen(obj);
@@ -108,11 +113,16 @@
SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val)
{
if (SvUOK(obj)) {
- if (val) *val = SvUV(obj);
- return SWIG_OK;
+ UV v = SvUV(obj);
+ if (v >= 0 && v <= ULONG_MAX) {
+ if (val) *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
} else if (SvIOK(obj)) {
- long v = SvIV(obj);
- if (v >= 0) {
+ IV v = SvIV(obj);
+ if (v >= 0 && v <= ULONG_MAX) {
if (val) *val = v;
return SWIG_OK;
} else {
@@ -179,8 +189,13 @@
SWIG_AsVal_dec(long long)(SV *obj, long long *val)
{
if (SvIOK(obj)) {
- if (val) *val = SvIV(obj);
- return SWIG_OK;
+ IV v = SvIV(obj);
+ if (v >= LLONG_MIN && v <= LLONG_MAX) {
+ if (val) *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
} else {
int dispatch = 0;
const char *nptr = SvPV_nolen(obj);
@@ -246,8 +261,8 @@
if (val) *val = SvUV(obj);
return SWIG_OK;
} else if (SvIOK(obj)) {
- long v = SvIV(obj);
- if (v >= 0) {
+ IV v = SvIV(obj);
+ if (v >= 0 && v <= ULLONG_MAX) {
if (val) *val = v;
return SWIG_OK;
} else {

View File

@ -1,143 +0,0 @@
diff -wruN -x '*~' ../orig-swig-2.0.4/Lib/python/pycontainer.swg ./Lib/python/pycontainer.swg
--- ../orig-swig-2.0.4/Lib/python/pycontainer.swg 2011-09-20 12:14:29.000000000 +0200
+++ ./Lib/python/pycontainer.swg 2011-09-20 12:13:22.000000000 +0200
@@ -189,7 +189,7 @@
namespace swig {
inline size_t
- check_index(ptrdiff_t i, size_t size, bool insert = false) {
+ check_index(std::ptrdiff_t i, size_t size, bool insert = false) {
if ( i < 0 ) {
if ((size_t) (-i) <= size)
return (size_t) (i + size);
@@ -203,7 +203,7 @@
}
inline size_t
- slice_index(ptrdiff_t i, size_t size) {
+ slice_index(std::ptrdiff_t i, size_t size) {
if ( i < 0 ) {
if ((size_t) (-i) <= size) {
return (size_t) (i + size);
diff -wruN -x '*~' ../orig-swig-2.0.4/Lib/python/pyiterators.swg ./Lib/python/pyiterators.swg
--- ../orig-swig-2.0.4/Lib/python/pyiterators.swg 2011-04-29 20:25:16.000000000 +0200
+++ ./Lib/python/pyiterators.swg 2011-09-20 12:14:10.000000000 +0200
@@ -41,7 +41,7 @@
}
// Random access iterator methods, but not required in Python
- virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const
+ virtual std::ptrdiff_t distance(const SwigPyIterator &/*x*/) const
{
throw std::invalid_argument("operation not supported");
}
@@ -78,7 +78,7 @@
return obj;
}
- SwigPyIterator *advance(ptrdiff_t n)
+ SwigPyIterator *advance(std::ptrdiff_t n)
{
return (n > 0) ? incr(n) : decr(-n);
}
@@ -93,27 +93,27 @@
return ! operator==(x);
}
- SwigPyIterator& operator += (ptrdiff_t n)
+ SwigPyIterator& operator += (std::ptrdiff_t n)
{
return *advance(n);
}
- SwigPyIterator& operator -= (ptrdiff_t n)
+ SwigPyIterator& operator -= (std::ptrdiff_t n)
{
return *advance(-n);
}
- SwigPyIterator* operator + (ptrdiff_t n) const
+ SwigPyIterator* operator + (std::ptrdiff_t n) const
{
return copy()->advance(n);
}
- SwigPyIterator* operator - (ptrdiff_t n) const
+ SwigPyIterator* operator - (std::ptrdiff_t n) const
{
return copy()->advance(-n);
}
- ptrdiff_t operator - (const SwigPyIterator& x) const
+ std::ptrdiff_t operator - (const SwigPyIterator& x) const
{
return x.distance(*this);
}
@@ -170,7 +170,7 @@
}
}
- ptrdiff_t distance(const SwigPyIterator &iter) const
+ std::ptrdiff_t distance(const SwigPyIterator &iter) const
{
const self_type *iters = dynamic_cast<const self_type *>(&iter);
if (iters) {
@@ -334,8 +334,8 @@
Mark methods that return new objects
*/
%newobject SwigPyIterator::copy;
- %newobject SwigPyIterator::operator + (ptrdiff_t n) const;
- %newobject SwigPyIterator::operator - (ptrdiff_t n) const;
+ %newobject SwigPyIterator::operator + (std::ptrdiff_t n) const;
+ %newobject SwigPyIterator::operator - (std::ptrdiff_t n) const;
%nodirector SwigPyIterator;
@@ -356,11 +356,11 @@
%catches(swig::stop_iteration) SwigPyIterator::__next__();
%catches(swig::stop_iteration) SwigPyIterator::next();
%catches(swig::stop_iteration) SwigPyIterator::previous();
- %catches(swig::stop_iteration) SwigPyIterator::advance(ptrdiff_t n);
- %catches(swig::stop_iteration) SwigPyIterator::operator += (ptrdiff_t n);
- %catches(swig::stop_iteration) SwigPyIterator::operator -= (ptrdiff_t n);
- %catches(swig::stop_iteration) SwigPyIterator::operator + (ptrdiff_t n) const;
- %catches(swig::stop_iteration) SwigPyIterator::operator - (ptrdiff_t n) const;
+ %catches(swig::stop_iteration) SwigPyIterator::advance(std::ptrdiff_t n);
+ %catches(swig::stop_iteration) SwigPyIterator::operator += (std::ptrdiff_t n);
+ %catches(swig::stop_iteration) SwigPyIterator::operator -= (std::ptrdiff_t n);
+ %catches(swig::stop_iteration) SwigPyIterator::operator + (std::ptrdiff_t n) const;
+ %catches(swig::stop_iteration) SwigPyIterator::operator - (std::ptrdiff_t n) const;
struct SwigPyIterator
{
@@ -380,7 +380,7 @@
virtual SwigPyIterator *decr(size_t n = 1);
// Random access iterator methods, but not required in Python
- virtual ptrdiff_t distance(const SwigPyIterator &x) const;
+ virtual std::ptrdiff_t distance(const SwigPyIterator &x) const;
virtual bool equal (const SwigPyIterator &x) const;
@@ -390,15 +390,15 @@
PyObject *next();
PyObject *__next__();
PyObject *previous();
- SwigPyIterator *advance(ptrdiff_t n);
+ SwigPyIterator *advance(std::ptrdiff_t n);
bool operator == (const SwigPyIterator& x) const;
bool operator != (const SwigPyIterator& x) const;
- SwigPyIterator& operator += (ptrdiff_t n);
- SwigPyIterator& operator -= (ptrdiff_t n);
- SwigPyIterator* operator + (ptrdiff_t n) const;
- SwigPyIterator* operator - (ptrdiff_t n) const;
- ptrdiff_t operator - (const SwigPyIterator& x) const;
+ SwigPyIterator& operator += (std::ptrdiff_t n);
+ SwigPyIterator& operator -= (std::ptrdiff_t n);
+ SwigPyIterator* operator + (std::ptrdiff_t n) const;
+ SwigPyIterator* operator - (std::ptrdiff_t n) const;
+ std::ptrdiff_t operator - (const SwigPyIterator& x) const;
};
}

View File

@ -1,67 +0,0 @@
diff -wruN -x '*~' ../orig-swig-2.0.4/Lib/python/pycontainer.swg ./Lib/python/pycontainer.swg
--- ../orig-swig-2.0.4/Lib/python/pycontainer.swg 2011-04-10 00:07:22.000000000 +0200
+++ ./Lib/python/pycontainer.swg 2011-09-20 11:27:19.000000000 +0200
@@ -657,6 +657,7 @@
return x;
}
+#if !NO_PYSLICE
/* typemap for slice object support */
%typemap(in) PySliceObject* {
if (!PySlice_Check($input)) {
@@ -667,6 +668,7 @@
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* {
$1 = PySlice_Check($input);
}
+#endif
Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) {
return swig::getslice(self, i, j);
@@ -689,7 +691,11 @@
/* Overloaded methods for Python 3 compatibility
* (Also useful in Python 2.x)
*/
+#if NO_PYSLICE
+ Sequence* __getitem__(PyObject *slice) throw (std::out_of_range) {
+#else
Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) {
+#endif
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
@@ -698,8 +704,11 @@
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
return swig::getslice(self, i, j);
}
-
+#if NO_PYSLICE
+ void __setitem__(PyObject *slice, const Sequence& v)
+#else
void __setitem__(PySliceObject *slice, const Sequence& v)
+#endif
throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
@@ -721,7 +730,11 @@
swig::delslice(self, i,j);
}
+#if NO_PYSLICE
+ void __delitem__(PyObject *slice)
+#else
void __delitem__(PySliceObject *slice)
+#endif
throw (std::out_of_range) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
diff -wruN -x '*~' ../orig-swig-2.0.4/Source/Modules/python.cxx ./Source/Modules/python.cxx
--- ../orig-swig-2.0.4/Source/Modules/python.cxx 2011-05-20 07:58:05.000000000 +0200
+++ ./Source/Modules/python.cxx 2011-09-20 11:27:19.000000000 +0200
@@ -527,6 +527,7 @@
if (py3) {
/* force disable features that not compatible with Python 3.x */
classic = 0;
+ Preprocessor_define((DOH *) "NO_PYSLICE 1", 0);
}
if (cppcast) {

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc44427d8a89539053a703a9237cf7ca313236b363676df23f07814c01030dda
size 4145216

3
swig-2.0.6.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dd376331dd76899736852881f0fc5ba874b0d79e88a5bd9b366bcb20e7fbb17d
size 5277387

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Mon Apr 30 08:30:32 UTC 2012 - idonmez@suse.com
- Update to 2.0.6
* Various fixes with templates and typedef types.
* Some template lookup problems fixed.
* Templated type fixes to use correct typemaps.
* Autodoc documentation generation improvements.
* Python STL container wrappers improvements including addition of
stepped slicing.
* Approximately 70 fixes and minor enhancements for the following
target languages: AllegroCL, C#, D, Go, Java, Lua, Ocaml, Octave,
Perl, PHP, Python, R, Ruby, Tcl, Xml.
-------------------------------------------------------------------
Mon Apr 9 19:29:34 UTC 2012 - asterios.dramis@gmail.com

View File

@ -17,28 +17,20 @@
Name: swig
Version: 2.0.4
Version: 2.0.6
Release: 0
Summary: Simplified Wrapper and Interface Generator
License: GPL-3.0+ and BSD-3-Clause
Group: Development/Languages/C and C++
Url: http://www.swig.org/
Source: %{name}-%{version}.tar.bz2
Source: http://sourceforge.net/projects/swig/files/swig/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1: %{name}.rpmlintrc
# PATCH-FIX-UPSTREAM swig-2.0.4-support-python32.patch idoenmez@suse.de -- Support Python 3.2
Patch1: swig-2.0.4-support-python32.patch
# swig-2.0.4-ptrdiff_t.patch kkaempf@suse.com -- import_stl fails under Python
Patch2: swig-2.0.4-ptrdiff_t.patch
# PATCH-FIX-UPSTREAM swig-2.0.4-disable-broken-tests.patch idoenmez@suse.de -- Disable broken tests
Patch3: swig-2.0.4-disable-broken-tests.patch
Patch1: swig-2.0.4-disable-broken-tests.patch
# swig-2.0.4-disable-broken-tests_rhel4.patch kkaempf@suse.com -- disable tests failing on RHEL4
Patch4: swig-2.0.4-disable-broken-tests_rhel4.patch
Patch2: swig-2.0.4-disable-broken-tests_rhel4.patch
# PATCH-FIX-UPSTREAM swig-2.0.4-guile2.patch pgajdos@suse.com -- generate guile 2 friendly code
Patch5: swig-2.0.4-guile2.patch
# PATCH-FIX-OPENSUSE swig-2.0.4-fix-overflow-error-64bitint.patch dvaleev@suse.com -- Fix overflow errors with 64-bit IVs
Patch6: swig-2.0.4-fix-overflow-error-64bitint.patch
# PATCH-FIX-UPSTREAM r12814.patch asterios.dramis@gmail.com -- Fix regression leading to uncompilable code when using typedef and function pointer references (taken from Debian)
Patch7: r12814.patch
Patch3: swig-2.0.4-guile2.patch
BuildRequires: boost-devel
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -124,18 +116,14 @@ understandig SWIG usage.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3
%patch1
%if 0%{?rhel_version} >= 400 && 0%{?rhel_version} < 500
%patch4 -p1
%patch2 -p1
%endif
# guile 2 from 12.1
%if 0%{?suse_version} >= 1210
%patch5 -p1
%patch3 -p1
%endif
%patch6 -p1
%patch7 -p1
%build
%configure --disable-ccache
@ -145,13 +133,14 @@ make %{?_smp_mflags}
# check fails on SLES9
%if 0%{?sles_version} != 9
# This test is buggy on x86-64
rm -f Examples/test-suite/python/li_boost_shared_ptr_runme.py
%if 0%{?suse_version} == 1010
%ifarch x86_64
# This test fails on SLES 10 SP3+SP4 on 64bit (bnc#750618)
rm -f Examples/test-suite/ruby/newobject1_runme.rb
%endif
%endif
# Segfaults
rm -f Examples/test-suite/python/li_std_containers_int_runme.py
make check
%endif
@ -163,6 +152,7 @@ cp -a TODO ANNOUNCE CHANGES* LICENSE README Doc/{Devel,Manual} \
%{buildroot}%{docpath}
install -d %{buildroot}%{_libdir}/swig
cp -a Examples %{buildroot}%{_libdir}/swig/examples
rm -rf %{buildroot}%{_libdir}/swig/examples/test-suite
# rm files that are not needed for running or rebuilding the examples
find %{buildroot}%{_libdir}/swig \