Restrict the name used in %extend to be just the struct/class name and not a typedef to a class/struct. Typedefs were only partially working anyway. Anonymous struct typedefs excluded. Deprecate with a warning for now.

This commit is contained in:
William S Fulton 2013-02-18 19:53:37 +00:00
commit b80f4dc5e2
10 changed files with 134 additions and 20 deletions

View file

@ -188,6 +188,10 @@ pp_variable_args.i:6: Error: Variable length macro argument must be last paramet
:::::::::::::::::::::::::::::::: swig_apply_nargs.i :::::::::::::::::::::::::::::::::::
swig_apply_nargs.i:6: Error: Can't apply (char *str,int len) to (int x). Number of arguments don't match.
:::::::::::::::::::::::::::::::: swig_extend.i :::::::::::::::::::::::::::::::::::
swig_extend.i:19: Warning 326: Deprecated %extend name used - the struct name 'StructBName' should be used instead of the typedef name 'StructB'.
swig_extend.i:34: Warning 303: %extend defined for an undeclared class StructDName.
:::::::::::::::::::::::::::::::: swig_identifier.i :::::::::::::::::::::::::::::::::::
swig_identifier.i:5: Warning 503: Can't wrap 'foo bar' unless renamed to a valid identifier.

View file

@ -54,6 +54,7 @@ pp_unterm_comment
pp_unterm_string
pp_variable_args
swig_apply_nargs
swig_extend
swig_identifier
swig_insert_bad
swig_typemap_copy

View file

@ -0,0 +1,35 @@
%module xxx
typedef struct {
int myint;
} StructA;
typedef struct StructBName {
int myint;
} StructB;
typedef struct StructC {
int myint;
} StructC;
%extend StructA {
void method() {}
}
%extend StructB {
void method() {}
}
%extend StructC {
void method() {}
}
struct StructD {
int myint;
};
typedef struct StructD StructDName;
%extend StructDName {
void method() {}
}

View file

@ -1,5 +1,8 @@
%module extend_constructor_destructor
%warnfilter(SWIGWARN_PARSE_EXTEND_NAME) Space::tagCStruct;
%warnfilter(SWIGWARN_PARSE_EXTEND_NAME) tagEStruct;
%inline %{
int globalVar = 0;

View file

@ -1,5 +1,8 @@
%module extend_typedef_class
%warnfilter(SWIGWARN_PARSE_EXTEND_NAME) tagCClass;
%warnfilter(SWIGWARN_PARSE_EXTEND_NAME) tagCStruct;
// classes in global namespace
%inline %{
typedef struct tagAClass {