mirror of https://github.com/swig/swig
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
|
@ -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 \
|
||||
|
|
|
@ -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,34 +2141,36 @@ static void addCopyConstructor(Node *n) {
|
|||
}
|
||||
|
||||
String *symname = Swig_name_make(cn, cname, last, decl, oldname);
|
||||
if (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
Parm *p = NewParm(cc, "other");
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
Parm *p = NewParm(cc, "other");
|
||||
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
SetFlag(cn, "feature:new");
|
||||
Setattr(cn, "decl", decl);
|
||||
Setattr(cn, "parentNode", n);
|
||||
Setattr(cn, "parms", p);
|
||||
Setattr(cn, "copy_constructor", "1");
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
SetFlag(cn, "feature:new");
|
||||
Setattr(cn, "decl", decl);
|
||||
Setattr(cn, "parentNode", n);
|
||||
Setattr(cn, "parms", p);
|
||||
Setattr(cn, "copy_constructor", "1");
|
||||
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_copy_constructor", "1");
|
||||
Setattr(n, "copy_constructor_decl", decl);
|
||||
Setattr(n, "allocate:copy_constructor", "1");
|
||||
Delete(access);
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_copy_constructor", "1");
|
||||
Setattr(n, "copy_constructor_decl", decl);
|
||||
Setattr(n, "allocate:copy_constructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
|
@ -2191,31 +2193,33 @@ 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 (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = Copy(csymname);
|
||||
}
|
||||
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
SetFlag(cn, "feature:new");
|
||||
Setattr(cn, "decl", decl);
|
||||
Setattr(cn, "parentNode", n);
|
||||
Setattr(cn, "default_constructor", "1");
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
SetFlag(cn, "feature:new");
|
||||
Setattr(cn, "decl", decl);
|
||||
Setattr(cn, "parentNode", n);
|
||||
Setattr(cn, "default_constructor", "1");
|
||||
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_default_constructor", "1");
|
||||
Setattr(n, "allocate:default_constructor", "1");
|
||||
Delete(access);
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_default_constructor", "1");
|
||||
Setattr(n, "allocate:default_constructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
|
@ -2237,29 +2241,31 @@ 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 (!symname) {
|
||||
symname = NewStringf("~%s", Getattr(n, "sym:name"));
|
||||
}
|
||||
if (Strcmp(symname, "$ignore") != 0) {
|
||||
if (!symname) {
|
||||
symname = NewStringf("~%s", Getattr(n, "sym:name"));
|
||||
}
|
||||
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
Setattr(cn, "decl", "f().");
|
||||
Setattr(cn, "parentNode", n);
|
||||
Setattr(cn, "name", name);
|
||||
Setattr(cn, "sym:name", symname);
|
||||
Setattr(cn, "decl", "f().");
|
||||
Setattr(cn, "parentNode", n);
|
||||
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
Symtab *oldscope = Swig_symbol_setscope(Getattr(n, "symtab"));
|
||||
Node *on = Swig_symbol_add(symname, cn);
|
||||
Swig_symbol_setscope(oldscope);
|
||||
Swig_features_get(Swig_cparse_features(), 0, name, decl, cn);
|
||||
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_destructor", "1");
|
||||
Setattr(n, "allocate:destructor", "1");
|
||||
Delete(access);
|
||||
if (on == cn) {
|
||||
Node *access = NewHash();
|
||||
set_nodeType(access, "access");
|
||||
Setattr(access, "kind", "public");
|
||||
appendChild(n, access);
|
||||
appendChild(n, cn);
|
||||
Setattr(n, "has_destructor", "1");
|
||||
Setattr(n, "allocate:destructor", "1");
|
||||
Delete(access);
|
||||
}
|
||||
}
|
||||
Delete(cn);
|
||||
Delete(last);
|
||||
|
@ -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…
Reference in New Issue