Fix regression introduced in swig-2.0.1 (r12157) leading to uncompilable code when using typedef and function pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12814 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
91d22324e7
commit
fa8915ef5f
3 changed files with 22 additions and 5 deletions
|
|
@ -5,6 +5,13 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.5 (in progress)
|
||||
===========================
|
||||
|
||||
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);
|
||||
|
||||
2011-09-14: wsfulton
|
||||
[Lua] Patch #3408012 from Raman Gopalan - add support for embedded Lua (eLua)
|
||||
including options for targeting Lua Tiny RAM (LTR).
|
||||
|
|
|
|||
|
|
@ -20,3 +20,14 @@ int call3(int & (*d)(const int &, int), int a, int b) { return d(a, b); }
|
|||
%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; }
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -823,7 +823,8 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
|
|||
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 *s, const_String_or_char_ptr name) {
|
|||
cast = NewStringf("(%s)", result);
|
||||
}
|
||||
if (name) {
|
||||
if (!isfunction) {
|
||||
if (isreference) {
|
||||
Append(cast, "*");
|
||||
}
|
||||
if (isreference) {
|
||||
Append(cast, "*");
|
||||
}
|
||||
Append(cast, name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue