[Go] Adjust generated code to work with upcoming Go 1.4 release.

This commit is contained in:
Ian Lance Taylor 2014-09-25 12:10:11 -07:00
commit 4b64ce71a3
3 changed files with 162 additions and 135 deletions

View file

@ -57,12 +57,21 @@ swiggo_size_assert(double, 8)
extern "C" {
#endif
extern void crosscall2(void (*fn)(void *, int), void *, int);
extern char* _cgo_topofstack(void) __attribute__ ((weak));
extern void _cgo_allocate(void *, int);
extern void _cgo_panic(void *, int);
#ifdef __cplusplus
}
#endif
static char *_swig_topofstack() {
if (_cgo_topofstack) {
return _cgo_topofstack();
} else {
return 0;
}
}
static void *_swig_goallocate(size_t len) {
struct {
size_t len;
@ -89,11 +98,11 @@ static void _swig_gopanic(const char *p) {
#include "runtime.h"
#include "cgocall.h"
#ifdef _64BIT
#define SWIG_PARM_SIZE 8
#else
#define SWIG_PARM_SIZE 4
#endif
#pragma dataflag 16
static void *cgocall = runtime·cgocall;
#pragma dataflag 16
void *·_cgo_runtime_cgocall = &cgocall;
%}
#else
@ -194,6 +203,10 @@ static _gostring_ _swig_makegostring(const char *p, size_t l) {
%go_import("unsafe", _ "runtime/cgo")
%insert(go_header) %{
var _cgo_runtime_cgocall func(unsafe.Pointer, uintptr)
%}
#else
%go_import("syscall", "unsafe")