From: Ian Lance Taylor Date: Sun, 22 Jan 2012 19:50:45 +0000 (-0800) Subject: test: explicitly use variables to avoid gccgo "not used" error X-Git-Tag: weekly.2012-01-27~115 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=387e7c274249a307f62ed94c8dfdabfe42e3b01c;p=gostls13.git test: explicitly use variables to avoid gccgo "not used" error I haven't looked at the source, but the gc compiler appears to omit "not used" errors when there is an error in the initializer. This is harder to do in gccgo, and frankly I think the "not used" error is still useful even if the initializer has a problem. This CL tweaks some tests to avoid the error, which is not the point of these tests in any case. R=golang-dev, r CC=golang-dev https://golang.org/cl/5561059 --- diff --git a/test/blank1.go b/test/blank1.go index 5bc1efce5f..bcc78466dc 100644 --- a/test/blank1.go +++ b/test/blank1.go @@ -9,4 +9,5 @@ package _ // ERROR "invalid package name _" func main() { _() // ERROR "cannot use _ as value" x := _+1 // ERROR "cannot use _ as value" + _ = x } diff --git a/test/fixedbugs/bug014.go b/test/fixedbugs/bug014.go index dac2ce5174..38a6e51abc 100644 --- a/test/fixedbugs/bug014.go +++ b/test/fixedbugs/bug014.go @@ -11,4 +11,5 @@ func main() { var c01 uint8 = '\07'; // ERROR "oct|char" var cx0 uint8 = '\x0'; // ERROR "hex|char" var cx1 uint8 = '\x'; // ERROR "hex|char" + _, _, _, _ = c00, c01, cx0, cx1 } diff --git a/test/fixedbugs/bug108.go b/test/fixedbugs/bug108.go index 5c7649f081..10e406de6e 100644 --- a/test/fixedbugs/bug108.go +++ b/test/fixedbugs/bug108.go @@ -7,4 +7,5 @@ package main func f() { v := 1 << 1025; // ERROR "overflow|stupid shift" + _ = v } diff --git a/test/fixedbugs/bug175.go b/test/fixedbugs/bug175.go index a8f6e3ca40..1ca1415076 100644 --- a/test/fixedbugs/bug175.go +++ b/test/fixedbugs/bug175.go @@ -10,5 +10,5 @@ func f() (int, bool) { return 0, true } func main() { x, y := f(), 2; // ERROR "multi" + _, _ = x, y } - diff --git a/test/fixedbugs/bug363.go b/test/fixedbugs/bug363.go index 04fcfe1a87..9347ec28b6 100644 --- a/test/fixedbugs/bug363.go +++ b/test/fixedbugs/bug363.go @@ -17,5 +17,5 @@ func main() { println(b) var c int64 = (1<