diff mbox

Go patch committed: Permit omitting &T in composite literal

Message ID mcrpqfrqke2.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Dec. 14, 2011, 2:48 p.m. UTC
The Go language was changed to permit omitting &T in composite literals,
as in

var v = []*S{ &S{0}, &S{1} }

This can now be written as

var v = []*S{ {0}, {1} }

This patch implements this change in the gccgo frontend.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

Comments

Tristan Gingold Dec. 14, 2011, 2:56 p.m. UTC | #1
On Dec 14, 2011, at 3:48 PM, Ian Lance Taylor wrote:

> The Go language was changed to permit omitting &T in composite literals,
> as in
> 
> var v = []*S{ &S{0}, &S{1} }
> 
> This can now be written as
> 
> var v = []*S{ {0}, {1} }
> 
> This patch implements this change in the gccgo frontend.  Bootstrapped
> and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
> mainline.

Wrong attachment ?

> 
> Ian
> 
> diff -r e97b850a6f33 libgo/go/runtime/gc_test.go
> --- a/libgo/go/runtime/gc_test.go	Wed Dec 14 06:46:23 2011 -0800
> +++ b/libgo/go/runtime/gc_test.go	Wed Dec 14 06:48:27 2011 -0800
> @@ -22,7 +22,7 @@
> 		sys = runtime.MemStats.Sys - sys
> 	}
> 	t.Logf("used %d extra bytes", sys)
> -	if sys > 2<<20 {
> +	if sys > 4<<20 {
> 		t.Fatalf("using too much memory: %d bytes", sys)
> 	}
> }
diff mbox

Patch

diff -r e97b850a6f33 libgo/go/runtime/gc_test.go
--- a/libgo/go/runtime/gc_test.go	Wed Dec 14 06:46:23 2011 -0800
+++ b/libgo/go/runtime/gc_test.go	Wed Dec 14 06:48:27 2011 -0800
@@ -22,7 +22,7 @@ 
 		sys = runtime.MemStats.Sys - sys
 	}
 	t.Logf("used %d extra bytes", sys)
-	if sys > 2<<20 {
+	if sys > 4<<20 {
 		t.Fatalf("using too much memory: %d bytes", sys)
 	}
 }