Make method wrappers suffix optional and disabled by default
Unfortunately the changes of 26bf86322 (Use SWIG-specific for
non-overloaded synthesized functions too, 2021-11-09) did break some
existing code bases using SWIG as they hardcoded the old wrapper
function names.
So turn this off by default and add a global variable allowing to enable
this, which can be done for a specific language only. This is ugly but,
unfortunately, there is no way to use the Language object from the C
function Swig_MethodToFunction(), so the only alternative would be to
add another parameter to it, but it already has 6 of them, so it
wouldn't really be that much better.
See #2366, #2368, #2370.
This commit is contained in:
parent
e97181ebc0
commit
b9fa8c23bb
3 changed files with 12 additions and 4 deletions
|
|
@ -15,6 +15,8 @@
|
|||
#include "swig.h"
|
||||
#include "cparse.h"
|
||||
|
||||
extern int UseWrapperSuffix; // from main.cxx
|
||||
|
||||
static const char *cresult_variable_name = "result";
|
||||
|
||||
static Parm *nonvoid_parms(Parm *p) {
|
||||
|
|
@ -1083,13 +1085,13 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
in C.
|
||||
|
||||
But when not using the suffix used for overloaded functions, we still need to ensure that the
|
||||
wrapper name doesn't conflict with any wrapper functions, so make it sufficiently unique by
|
||||
appending a suffix similar to the one used for overloaded functions to it.
|
||||
wrapper name doesn't conflict with any wrapper functions for some languages, so optionally make
|
||||
it sufficiently unique by appending a suffix similar to the one used for overloaded functions to it.
|
||||
*/
|
||||
if (code) {
|
||||
if (Getattr(n, "sym:overloaded")) {
|
||||
Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
||||
} else {
|
||||
} else if (UseWrapperSuffix) {
|
||||
Append(mangled, "__SWIG");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue