Fix ignore on implicit constructors
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9934 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
38f6ca7f15
commit
9b79e76d93
4 changed files with 114 additions and 68 deletions
|
|
@ -1,5 +1,8 @@
|
|||
Version 1.3.32 (in progress)
|
||||
============================
|
||||
09/07/2007: wsfulton
|
||||
Fix %ignore on constructors which are not explicitly declared [SF #1777712]
|
||||
|
||||
09/05/2007: wuzzeb (John Lenz)
|
||||
- Change r_ltype in typesys.c to store a hashtable instead of a single value.
|
||||
several very subtle bugs were being caused by multiple ltypes being mapped
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ CPP_TEST_CASES += \
|
|||
constructor_copy \
|
||||
constructor_exception \
|
||||
constructor_explicit \
|
||||
constructor_ignore \
|
||||
constructor_value \
|
||||
contract \
|
||||
compactdefaultargs \
|
||||
|
|
|
|||
36
Examples/test-suite/constructor_ignore.i
Normal file
36
Examples/test-suite/constructor_ignore.i
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
%module constructor_ignore
|
||||
|
||||
%ignore Space::Delta1::Delta1();
|
||||
%ignore Space::Delta2::Delta2(int i);
|
||||
%ignore Space::Delta3::Delta3;
|
||||
%ignore Space::Delta4::Delta4;
|
||||
|
||||
%inline %{
|
||||
namespace Space {
|
||||
struct Delta1 {
|
||||
};
|
||||
struct Delta2 {
|
||||
Delta2(int i) {}
|
||||
};
|
||||
struct Delta3 {
|
||||
Delta3(const Delta3&) {}
|
||||
Delta3() {}
|
||||
Delta3(int i) {}
|
||||
};
|
||||
struct Delta4 {
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%copyctor;
|
||||
%ignore Space::Delta5::Delta5;
|
||||
%ignore Space::Delta6::Delta6(const Space::Delta6&);
|
||||
|
||||
%inline %{
|
||||
namespace Space {
|
||||
struct Delta5 {
|
||||
};
|
||||
struct Delta6 {
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
|
@ -2141,6 +2141,7 @@ static void addCopyConstructor(Node *n) {
|
|||
}
|
||||
|
||||
String *symname = Swig_name_make(cn, cname, last, decl, oldname);
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
|
|
@ -2170,6 +2171,7 @@ static void addCopyConstructor(Node *n) {
|
|||
Setattr(n, "allocate:copy_constructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
Delete(name);
|
||||
|
|
@ -2191,6 +2193,7 @@ static void addDefaultConstructor(Node *n) {
|
|||
String *csymname = Getattr(n, "sym:name");
|
||||
String *oldname = csymname;
|
||||
String *symname = Swig_name_make(cn, cname, last, decl, oldname);
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
|
|
@ -2217,6 +2220,7 @@ static void addDefaultConstructor(Node *n) {
|
|||
Setattr(n, "allocate:default_constructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
Delete(name);
|
||||
|
|
@ -2237,6 +2241,7 @@ static void addDestructor(Node *n) {
|
|||
String *name = NewStringf("%s::%s", cname, last);
|
||||
String *decl = NewString("f().");
|
||||
String *symname = Swig_name_make(cn, cname, last, decl, 0);
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = NewStringf("~%s", Getattr(n, "sym:name"));
|
||||
}
|
||||
|
|
@ -2261,6 +2266,7 @@ static void addDestructor(Node *n) {
|
|||
Setattr(n, "allocate:destructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
Delete(name);
|
||||
|
|
@ -2475,7 +2481,7 @@ int Language::constructorDeclaration(Node *n) {
|
|||
return SWIG_NOWRAP;
|
||||
|
||||
if (Extend) {
|
||||
/* extend default constructor can be safetly ignored if there is
|
||||
/* extend default constructor can be safely ignored if there is
|
||||
already one */
|
||||
int num_required = ParmList_numrequired(Getattr(n, "parms"));
|
||||
if ((num_required == 0) && Getattr(CurrentClass, "has_default_constructor")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue