1a2f01efa6
Update the Go library to the 1.10beta1 release. Requires a few changes to the compiler for modifications to the map runtime code, and to handle some nowritebarrier cases in the runtime. Reviewed-on: https://go-review.googlesource.com/86455 gotools/: * Makefile.am (go_cmd_vet_files): New variable. (go_cmd_buildid_files, go_cmd_test2json_files): New variables. (s-zdefaultcc): Change from constants to functions. (noinst_PROGRAMS): Add vet, buildid, and test2json. (cgo$(EXEEXT)): Link against $(LIBGOTOOL). (vet$(EXEEXT)): New target. (buildid$(EXEEXT)): New target. (test2json$(EXEEXT)): New target. (install-exec-local): Install all $(noinst_PROGRAMS). (uninstall-local): Uninstasll all $(noinst_PROGRAMS). (check-go-tool): Depend on $(noinst_PROGRAMS). Copy down objabi.go. (check-runtime): Depend on $(noinst_PROGRAMS). (check-cgo-test, check-carchive-test): Likewise. (check-vet): New target. (check): Depend on check-vet. Look at cmd_vet-testlog. (.PHONY): Add check-vet. * Makefile.in: Rebuild. From-SVN: r256365
57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
// Copyright 2017 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build darwin,cgo,!internal
|
|
|
|
package cgotest
|
|
|
|
/*
|
|
#cgo LDFLAGS: -framework CoreFoundation
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
*/
|
|
import "C"
|
|
import (
|
|
"runtime/debug"
|
|
"testing"
|
|
"unsafe"
|
|
)
|
|
|
|
func test21897(t *testing.T) {
|
|
// Please write barrier, kick in soon.
|
|
defer debug.SetGCPercent(debug.SetGCPercent(1))
|
|
|
|
for i := 0; i < 10000; i++ {
|
|
testCFNumberRef()
|
|
testCFDateRef()
|
|
testCFBooleanRef()
|
|
// Allocate some memory, so eventually the write barrier is enabled
|
|
// and it will see writes of bad pointers in the test* functions below.
|
|
byteSliceSink = make([]byte, 1024)
|
|
}
|
|
}
|
|
|
|
var byteSliceSink []byte
|
|
|
|
func testCFNumberRef() {
|
|
var v int64 = 0
|
|
xCFNumberRef = C.CFNumberCreate(C.kCFAllocatorSystemDefault, C.kCFNumberSInt64Type, unsafe.Pointer(&v))
|
|
//fmt.Printf("CFNumberRef: %x\n", uintptr(unsafe.Pointer(xCFNumberRef)))
|
|
}
|
|
|
|
var xCFNumberRef C.CFNumberRef
|
|
|
|
func testCFDateRef() {
|
|
xCFDateRef = C.CFDateCreate(C.kCFAllocatorSystemDefault, 0) // 0 value is 1 Jan 2001 00:00:00 GMT
|
|
//fmt.Printf("CFDateRef: %x\n", uintptr(unsafe.Pointer(xCFDateRef)))
|
|
}
|
|
|
|
var xCFDateRef C.CFDateRef
|
|
|
|
func testCFBooleanRef() {
|
|
xCFBooleanRef = C.kCFBooleanFalse
|
|
//fmt.Printf("CFBooleanRef: %x\n", uintptr(unsafe.Pointer(xCFBooleanRef)))
|
|
}
|
|
|
|
var xCFBooleanRef C.CFBooleanRef
|