Fix #2310483 - function pointer typedef within extern C block.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11742 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-11-14 15:55:23 +00:00
commit 7ae45bc020
5 changed files with 25 additions and 1 deletions

View file

@ -1,6 +1,9 @@
Version 1.3.41 (in progress) Version 1.3.41 (in progress)
============================ ============================
2009-11-14: wsfulton
Fix #2310483 - function pointer typedef within extern "C" block.
2009-11-13: wsfulton 2009-11-13: wsfulton
Fix usage of nested template classes within templated classes so that compileable code Fix usage of nested template classes within templated classes so that compileable code
is generated. is generated.

View file

@ -191,6 +191,7 @@ CPP_TEST_CASES += \
extend_placement \ extend_placement \
extend_template \ extend_template \
extend_template_ns \ extend_template_ns \
extern_c \
extern_namespace \ extern_namespace \
extern_throws \ extern_throws \
features \ features \

View file

@ -0,0 +1,16 @@
%module extern_c
%inline %{
extern "C" {
void RealFunction(int value);
typedef void Function1(int value); // Fails
typedef int Integer1;
}
typedef void Function2(int value); // Works
typedef int Integer2;
%}
%{
void RealFunction(int value) {}
%}

View file

@ -0,0 +1,4 @@
import extern_c
extern_c.RealFunction(2)

View file

@ -2965,7 +2965,7 @@ c_declaration : c_decl {
appendChild($$,n); appendChild($$,n);
while (n) { while (n) {
SwigType *decl = Getattr(n,"decl"); SwigType *decl = Getattr(n,"decl");
if (SwigType_isfunction(decl)) { if (SwigType_isfunction(decl) && Strcmp(Getattr(n, "storage"), "typedef") != 0) {
Setattr(n,"storage","externc"); Setattr(n,"storage","externc");
} }
n = nextSibling(n); n = nextSibling(n);