Use "(void)" instead of "()" when wrapping no-argument extension functions.
This commit is contained in:
parent
b80f4dc5e2
commit
70cd52f44d
2 changed files with 40 additions and 1 deletions
|
|
@ -5,6 +5,45 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.10 (in progress)
|
||||
============================
|
||||
|
||||
2013-02-18: wsfulton
|
||||
Deprecate typedef names used as constructor and destructor names in %extend. The real
|
||||
class/struct name should be used.
|
||||
|
||||
typedef struct tagEStruct {
|
||||
int ivar;
|
||||
} EStruct;
|
||||
|
||||
%extend tagEStruct {
|
||||
EStruct() // illegal name, should be tagEStruct()
|
||||
{
|
||||
EStruct *s = new EStruct();
|
||||
s->ivar = ivar0;
|
||||
return s;
|
||||
}
|
||||
~EStruct() // illegal name, should be ~tagEStruct()
|
||||
{
|
||||
delete $self;
|
||||
}
|
||||
}
|
||||
|
||||
For now these trigger a warning:
|
||||
|
||||
extend_constructor_destructor.i:107: Warning 522: Use of an illegal constructor name 'EStruct' in
|
||||
%extend is deprecated, the constructor name should be 'tagEStruct'.
|
||||
extend_constructor_destructor.i:111: Warning 523: Use of an illegal destructor name 'EStruct' in
|
||||
%extend is deprecated, the destructor name should be 'tagEStruct'.
|
||||
|
||||
These %extend destructor and constructor names were valid up to swig-2.0.4, however swig-2.0.5 ignored
|
||||
them altogether for C code as reported in SF bug #1306. The old behaviour of using them has been
|
||||
restored for now, but is officially deprecated. This does not apply to anonymously defined typedef
|
||||
classes/structs such as:
|
||||
|
||||
typedef struct {...} X;
|
||||
|
||||
2013-02-17: kwwette
|
||||
When generating functions which wrap C extension code, use "(void)" for no-argument functions
|
||||
instead of "()". This prevents warnings when compiling with "gcc -Wstrict-prototypes".
|
||||
|
||||
2013-02-15: wsfulton
|
||||
Deprecate typedef names used in %extend that are not the real class/struct name. For example:
|
||||
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ void Swig_replace_special_variables(Node *n, Node *parentnode, String *code) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
static String *extension_code(Node *n, const String *function_name, ParmList *parms, SwigType *return_type, const String *code, int cplusplus, const String *self) {
|
||||
String *parms_str = cplusplus ? ParmList_str_defaultargs(parms) : ParmList_str(parms);
|
||||
String *sig = NewStringf("%s(%s)", function_name, parms_str);
|
||||
String *sig = NewStringf("%s(%s)", function_name, (cplusplus || Len(parms_str)) ? parms_str : "void");
|
||||
String *rt_sig = SwigType_str(return_type, sig);
|
||||
String *body = NewStringf("SWIGINTERN %s", rt_sig);
|
||||
Printv(body, code, "\n", NIL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue