reflect: Fix build for systems that do not define ffi_go_closure.
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 19 Jan 2015 02:56:28 +0000 (02:56 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 19 Jan 2015 02:56:28 +0000 (02:56 +0000)
From-SVN: r219831

libgo/go/reflect/makefunc.go
libgo/go/reflect/makefunc_ffi.go
libgo/go/reflect/makefunc_ffi_c.c

index 71aadfbceec784540b030d5a1b1164c2ea846ce3..7ec277b864a8fab84dfa5ee4392de6dbc5847443 100644 (file)
@@ -63,7 +63,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
                method: -1,
        }
 
-       makeFuncFFI(ftyp, impl)
+       makeFuncFFI(ftyp, unsafe.Pointer(impl))
 
        return Value{t, unsafe.Pointer(&impl), flag(Func) | flagIndir}
 }
@@ -102,7 +102,7 @@ func makeMethodValue(op string, v Value) Value {
                rcvr:   rcvr,
        }
 
-       makeFuncFFI(ftyp, fv)
+       makeFuncFFI(ftyp, unsafe.Pointer(fv))
 
        return Value{ft, unsafe.Pointer(&fv), v.flag&flagRO | flag(Func) | flagIndir}
 }
@@ -128,7 +128,7 @@ func makeValueMethod(v Value) Value {
                rcvr:   v,
        }
 
-       makeFuncFFI(ftyp, impl)
+       makeFuncFFI(ftyp, unsafe.Pointer(impl))
 
        return Value{t, unsafe.Pointer(&impl), v.flag&flagRO | flag(Func) | flagIndir}
 }
index 6b61f23112732b88996f911ea29b9e73ba1a8771..c821131bab7adb75fbec5203aa27a479fa10f014 100644 (file)
@@ -10,7 +10,7 @@ import (
 
 // The makeFuncFFI function, written in C, fills in an FFI closure.
 // It arranges for ffiCall to be invoked directly from FFI.
-func makeFuncFFI(ftyp *funcType, impl *makeFuncImpl)
+func makeFuncFFI(ftyp *funcType, impl unsafe.Pointer)
 
 // FFICallbackGo implements the Go side of the libffi callback.
 // It is exported so that C code can call it.
index 727ae8180ad1ea72a8dd632d576a7fe82f9c738a..2a98e9b101912170d012df2579ae60c800982fbe 100644 (file)
@@ -18,7 +18,7 @@
 
 /* Declare C functions with the names used to call from Go.  */
 
-void makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+void makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
   __asm__ (GOSYM_PREFIX "reflect.makeFuncFFI");
 
 #ifdef USE_LIBFFI_CLOSURES
@@ -70,7 +70,7 @@ ffi_callback (ffi_cif* cif __attribute__ ((unused)), void *results,
 /* Allocate an FFI closure and arrange to call ffi_callback.  */
 
 void
-makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
 {
   ffi_cif *cif;
 
@@ -83,7 +83,7 @@ makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
 #else /* !defined(USE_LIBFFI_CLOSURES) */
 
 void
-makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
 {
   runtime_panicstring ("libgo built without FFI does not support "
                       "reflect.MakeFunc");