Get rid of special ctor/dtor handling in C module

By delegating to the base class instead we not only save quite a few
lines of code, but gain support for ctors/dtors defined using %extend,
which didn't work before, allowing to reenable some of the previously
failing tests.
This commit is contained in:
Vadim Zeitlin 2019-08-04 02:15:48 +02:00
commit b4d08c1787
3 changed files with 65 additions and 101 deletions

View file

@ -33,12 +33,9 @@ FAILING_C_TESTS := \
function_typedef \
lextype \
li_carrays \
li_cpointer \
nested \
nested_extend_c \
nested_structs \
overload_extend2 \
overload_extend_c \
typedef_struct \
union_parameter \
unions \
@ -54,15 +51,12 @@ FAILING_CPP_TESTS := \
char_strings \
constant_pointers \
default_args \
default_constructor \
director_enum \
director_smartptr \
director_string \
enum_thorough \
extend \
extend_constructor_destructor \
extend_default \
extend_placement \
extern_c \
extern_template_method \
features \
@ -93,7 +87,6 @@ FAILING_CPP_TESTS := \
nested_scope \
nested_template_base \
smart_pointer_extend \
smart_pointer_not \
smart_pointer_template_defaults_overload \
stl_no_default_constructor \
struct_initialization_cpp \

View file

@ -8,12 +8,30 @@ namespace foo {
public:
};
}
%}
// C uses different naming convention, with all functions starting with the class prefix.
#ifdef SWIGC
%{
foo::bar *foo_bar_new() {
return new foo::bar;
}
void foo_bar_delete(foo::bar *self) {
delete self;
}
%}
#else
%{
foo::bar *new_foo_bar() {
return new foo::bar;
}
void delete_foo_bar(foo::bar *self) {
delete self;
}
%}
#endif
%{
int foo_bar_blah(foo::bar *self, int x) {
return x;
}