Gentoo Archives: gentoo-commits

From: "Andreas HAttel (dilfridge)" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/swig/files: swig-2.0.4-typedef.patch
Date: Sun, 13 Nov 2011 12:04:52
Message-Id: 20111113120442.D0D222004B@flycatcher.gentoo.org
dilfridge    11/11/13 12:04:42

  Added:                swig-2.0.4-typedef.patch
  Log:
  Backport upstream fix for bug 357483, acked by pchrist
  
  (Portage version: 2.1.10.34/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  dev-lang/swig/files/swig-2.0.4-typedef.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/swig/files/swig-2.0.4-typedef.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/swig/files/swig-2.0.4-typedef.patch?rev=1.1&content-type=text/plain

Index: swig-2.0.4-typedef.patch
===================================================================
Index: Source/Swig/stype.c
===================================================================
--- Source/Swig/stype.c	(Revision 12813)
+++ Source/Swig/stype.c	(Revision 12814)
@@ -823,7 +823,8 @@
 	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 @@
     cast = NewStringf("(%s)", result);
   }
   if (name) {
-    if (!isfunction) {
-      if (isreference) {
-	Append(cast, "*");
-      }
+    if (isreference) {
+      Append(cast, "*");
     }
     Append(cast, name);
   }
Index: Examples/test-suite/funcptr_cpp.i
===================================================================
--- Examples/test-suite/funcptr_cpp.i	(Revision 12813)
+++ Examples/test-suite/funcptr_cpp.i	(Revision 12814)
@@ -20,3 +20,14 @@
 %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; }
+%}
+