Make sure to give all parameters a local before adding all the new

typemaps.

Also mark C functions compiled by 6c and friends as nosplit.
This commit is contained in:
Ian Lance Taylor 2014-09-10 16:17:54 -07:00
commit 06b1157470

View file

@ -865,12 +865,21 @@ private:
int goFunctionWrapper(Node *n, String *name, String *go_name, String *overname, String *wname, List *base, ParmList *parms, SwigType *result, bool is_static, bool *p_needs_wrapper) { int goFunctionWrapper(Node *n, String *name, String *go_name, String *overname, String *wname, List *base, ParmList *parms, SwigType *result, bool is_static, bool *p_needs_wrapper) {
Wrapper *dummy = NewWrapper(); Wrapper *dummy = NewWrapper();
emit_attach_parmmaps(parms, dummy); emit_attach_parmmaps(parms, dummy);
Parm *p = parms;
int parm_count = emit_num_arguments(parms);
for (int i = 0; i < parm_count; ++i) {
p = getParm(p);
Swig_cparm_name(p, i);
p = nextParm(p);
}
Swig_typemap_attach_parms("default", parms, dummy); Swig_typemap_attach_parms("default", parms, dummy);
Swig_typemap_attach_parms("gotype", parms, dummy); Swig_typemap_attach_parms("gotype", parms, dummy);
Swig_typemap_attach_parms("goin", parms, dummy); Swig_typemap_attach_parms("goin", parms, dummy);
Swig_typemap_attach_parms("goargout", parms, dummy); Swig_typemap_attach_parms("goargout", parms, dummy);
Swig_typemap_attach_parms("imtype", parms, dummy); Swig_typemap_attach_parms("imtype", parms, dummy);
int parm_count = emit_num_arguments(parms);
int required_count = emit_num_required(parms); int required_count = emit_num_required(parms);
String *receiver = class_receiver; String *receiver = class_receiver;
@ -901,7 +910,7 @@ private:
// See whether any of the function parameters are represented by // See whether any of the function parameters are represented by
// interface values. When calling the C++ code, we need to convert // interface values. When calling the C++ code, we need to convert
// back to a uintptr. // back to a uintptr.
Parm *p = parms; p = parms;
for (int i = 0; i < parm_count; ++i) { for (int i = 0; i < parm_count; ++i) {
p = getParm(p); p = getParm(p);
String *ty = Getattr(p, "type"); String *ty = Getattr(p, "type");
@ -935,7 +944,6 @@ private:
Printv(f_go_wrappers, "int", NULL); Printv(f_go_wrappers, "int", NULL);
} }
Parm *p = getParm(parms); Parm *p = getParm(parms);
Swig_cparm_name(p, 0);
int i = 0; int i = 0;
if (is_destructor) { if (is_destructor) {
if (parm_count > required_count) { if (parm_count > required_count) {
@ -956,8 +964,6 @@ private:
} }
for (; i < parm_count; ++i) { for (; i < parm_count; ++i) {
p = getParm(p); p = getParm(p);
// Give the parameter a name we will use below.
Swig_cparm_name(p, i);
if (i > 0 || (base && receiver) || parm_count > required_count) { if (i > 0 || (base && receiver) || parm_count > required_count) {
Printv(f_go_wrappers, ", ", NULL); Printv(f_go_wrappers, ", ", NULL);
} }
@ -1264,6 +1270,7 @@ private:
} }
// \xc2\xb7 is UTF-8 for U+00B7 which is Unicode 'Middle Dot' // \xc2\xb7 is UTF-8 for U+00B7 which is Unicode 'Middle Dot'
Printv(f->def, "#pragma textflag 7\n", NULL);
Printv(f->def, "\xc2\xb7", fn_name, "(struct { void *x[(", parm_size, ") / SWIG_PARM_SIZE];} p)", NULL); Printv(f->def, "\xc2\xb7", fn_name, "(struct { void *x[(", parm_size, ") / SWIG_PARM_SIZE];} p)", NULL);
Delete(fn_name); Delete(fn_name);