diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-01-02 15:05:27 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-01-21 23:53:22 -0800 |
commit | 5a8ea165926cb0737ab03bc48c18dc5198ab5305 (patch) | |
tree | 962dc3357c57f019f85658f99e2e753e30201c27 /libgo/go/strings | |
parent | 6ac6529e155c9baa0aaaed7aca06bd38ebda5b43 (diff) | |
download | gcc-5a8ea165926cb0737ab03bc48c18dc5198ab5305.tar.gz |
libgo: update to Go1.14beta1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214297
Diffstat (limited to 'libgo/go/strings')
-rw-r--r-- | libgo/go/strings/builder.go | 1 | ||||
-rw-r--r-- | libgo/go/strings/builder_test.go | 15 | ||||
-rw-r--r-- | libgo/go/strings/strings.go | 5 | ||||
-rw-r--r-- | libgo/go/strings/strings_test.go | 10 |
4 files changed, 10 insertions, 21 deletions
diff --git a/libgo/go/strings/builder.go b/libgo/go/strings/builder.go index 3f33a875087..6ff151d74b2 100644 --- a/libgo/go/strings/builder.go +++ b/libgo/go/strings/builder.go @@ -24,6 +24,7 @@ type Builder struct { // USE CAREFULLY! // This was copied from the runtime; see issues 23382 and 7921. //go:nosplit +//go:nocheckptr func noescape(p unsafe.Pointer) unsafe.Pointer { x := uintptr(p) return unsafe.Pointer(x ^ 0) diff --git a/libgo/go/strings/builder_test.go b/libgo/go/strings/builder_test.go index 63130d2b674..fbf6617e1e3 100644 --- a/libgo/go/strings/builder_test.go +++ b/libgo/go/strings/builder_test.go @@ -185,21 +185,6 @@ func TestBuilderAllocs(t *testing.T) { if runtime.Compiler == "gccgo" { t.Skip("skip for gccgo until escape analysis improves") } - var b Builder - const msg = "hello" - b.Grow(len(msg) * 2) // because AllocsPerRun does an extra "warm-up" iteration - var s string - allocs := int(testing.AllocsPerRun(1, func() { - b.WriteString("hello") - s = b.String() - })) - if want := msg + msg; s != want { - t.Errorf("String: got %#q; want %#q", s, want) - } - if allocs > 0 { - t.Fatalf("got %d alloc(s); want 0", allocs) - } - // Issue 23382; verify that copyCheck doesn't force the // Builder to escape and be heap allocated. n := testing.AllocsPerRun(10000, func() { diff --git a/libgo/go/strings/strings.go b/libgo/go/strings/strings.go index cee315ce9e4..69f51b6e2d4 100644 --- a/libgo/go/strings/strings.go +++ b/libgo/go/strings/strings.go @@ -969,7 +969,8 @@ func ReplaceAll(s, old, new string) string { } // EqualFold reports whether s and t, interpreted as UTF-8 strings, -// are equal under Unicode case-folding. +// are equal under Unicode case-folding, which is a more general +// form of case-insensitivity. func EqualFold(s, t string) bool { for s != "" && t != "" { // Extract first rune from each string. @@ -1093,7 +1094,7 @@ func Index(s, substr string) int { i++ fails++ if fails >= 4+i>>4 && i < t { - // See comment in ../bytes/bytes_generic.go. + // See comment in ../bytes/bytes.go. j := indexRabinKarp(s[i:], substr) if j < 0 { return -1 diff --git a/libgo/go/strings/strings_test.go b/libgo/go/strings/strings_test.go index 76d827b47fa..7eddce5233f 100644 --- a/libgo/go/strings/strings_test.go +++ b/libgo/go/strings/strings_test.go @@ -195,10 +195,12 @@ func runIndexTests(t *testing.T, f func(s, sep string) int, funcName string, tes } } -func TestIndex(t *testing.T) { runIndexTests(t, Index, "Index", indexTests) } -func TestLastIndex(t *testing.T) { runIndexTests(t, LastIndex, "LastIndex", lastIndexTests) } -func TestIndexAny(t *testing.T) { runIndexTests(t, IndexAny, "IndexAny", indexAnyTests) } -func TestLastIndexAny(t *testing.T) { runIndexTests(t, LastIndexAny, "LastIndexAny", lastIndexAnyTests) } +func TestIndex(t *testing.T) { runIndexTests(t, Index, "Index", indexTests) } +func TestLastIndex(t *testing.T) { runIndexTests(t, LastIndex, "LastIndex", lastIndexTests) } +func TestIndexAny(t *testing.T) { runIndexTests(t, IndexAny, "IndexAny", indexAnyTests) } +func TestLastIndexAny(t *testing.T) { + runIndexTests(t, LastIndexAny, "LastIndexAny", lastIndexAnyTests) +} func TestIndexByte(t *testing.T) { for _, tt := range indexTests { |