From 06b1157470457ef6fe85dab32c0a9c1a73aab520 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 10 Sep 2014 16:17:54 -0700 Subject: [PATCH] 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. --- Source/Modules/go.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx index 388014cc0..ea890285a 100644 --- a/Source/Modules/go.cxx +++ b/Source/Modules/go.cxx @@ -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) { Wrapper *dummy = NewWrapper(); 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("gotype", parms, dummy); Swig_typemap_attach_parms("goin", parms, dummy); Swig_typemap_attach_parms("goargout", parms, dummy); Swig_typemap_attach_parms("imtype", parms, dummy); - int parm_count = emit_num_arguments(parms); + int required_count = emit_num_required(parms); String *receiver = class_receiver; @@ -901,7 +910,7 @@ private: // See whether any of the function parameters are represented by // interface values. When calling the C++ code, we need to convert // back to a uintptr. - Parm *p = parms; + p = parms; for (int i = 0; i < parm_count; ++i) { p = getParm(p); String *ty = Getattr(p, "type"); @@ -935,7 +944,6 @@ private: Printv(f_go_wrappers, "int", NULL); } Parm *p = getParm(parms); - Swig_cparm_name(p, 0); int i = 0; if (is_destructor) { if (parm_count > required_count) { @@ -956,8 +964,6 @@ private: } for (; i < parm_count; ++i) { 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) { Printv(f_go_wrappers, ", ", NULL); } @@ -1264,6 +1270,7 @@ private: } // \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); Delete(fn_name);