Accepting request 113033 from home:adra:branches:devel:tools:building

Added a patch to fix regression leading to uncompilable code when using typedef and function pointer references

OBS-URL: https://build.opensuse.org/request/show/113033
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=33
This commit is contained in:
Ismail Dönmez 2012-04-10 08:43:19 +00:00 committed by Git OBS Bridge
parent e65876f8c1
commit bbab5343cc
3 changed files with 92 additions and 27 deletions

59
r12814.patch Normal file
View File

@ -0,0 +1,59 @@
--- 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,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 9 19:29:34 UTC 2012 - asterios.dramis@gmail.com
- Added a patch (r12814.patch) to fix regression leading to uncompilable code
when using typedef and function pointer references (taken from Debian).
-------------------------------------------------------------------
Tue Mar 6 19:24:07 UTC 2012 - dvaleev@suse.com

View File

@ -16,8 +16,29 @@
#
Name: swig
Version: 2.0.4
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
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
# 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
# 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
BuildRequires: boost-devel
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -49,25 +70,6 @@ BuildRequires: pkg-config
BuildRequires: ruby-devel
%endif
%endif
Version: 2.0.4
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
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
# 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
# PATCH-FIX-UPSTREAM swig-2.0.4-guile2.patch pgajdos@suse.com -- generate guile 2 friendly code
Patch5: swig-2.0.4-guile2.patch
Patch6: swig-2.0.4-fix-overflow-error-64bitint.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -129,10 +131,11 @@ understandig SWIG usage.
%patch4 -p1
%endif
# guile 2 from 12.1
%if 0%{?suse_version} >= 1210
%if 0%{?suse_version} >= 1210
%patch5 -p1
%endif
%patch6 -p1
%patch7 -p1
%build
%configure --disable-ccache
@ -146,7 +149,7 @@ 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
rm -f Examples/test-suite/ruby/newobject1_runme.rb
%endif
%endif
make check
@ -161,7 +164,7 @@ cp -a TODO ANNOUNCE CHANGES* LICENSE README Doc/{Devel,Manual} \
install -d %{buildroot}%{_libdir}/swig
cp -a Examples %{buildroot}%{_libdir}/swig/examples
# rm files that are not needed for runnig or rebuilding the examples
# rm files that are not needed for running or rebuilding the examples
find %{buildroot}%{_libdir}/swig \
-name '*.dsp' -o -name '*.vcproj' -o -name '*.sln' -o \
-name '*.o' -o -name '*_wrap.c' | xargs rm
@ -173,12 +176,9 @@ find %{buildroot}%{_libdir}/swig -name '*.h' -perm +111 | \
ln -s %{_libdir}/swig/examples %{buildroot}%{docpath}/Examples
%if 0%{?suse_version} > 1010
%fdupes $RPM_BUILD_ROOT
%fdupes %{buildroot}
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(644,root,root,755)
%dir %{docpath}