[gccgo] Don't export top level function literals
diff mbox

Message ID mcrocezac1g.fsf@dhcp-172-17-9-151.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Taylor June 25, 2010, 5:58 a.m. UTC
Given code like

var Usage = func() {
	fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])

gccgo was exporting the function literal under the name __nested1.
That makes no sense.  Fixed with this patch which also avoids
namespace issues.  Committed to gccgo branch.


diff mbox

diff -r 35f170b775c0 go/gogo.cc
--- a/go/gogo.cc	Thu Jun 24 12:42:10 2010 -0700
+++ b/go/gogo.cc	Thu Jun 24 22:55:28 2010 -0700
@@ -608,7 +608,7 @@ 
       // Invent a name for a nested function.
       static int nested_count;
       char buf[30];
-      snprintf(buf, sizeof buf, "__nested%d", nested_count);
+      snprintf(buf, sizeof buf, ".$nested%d", nested_count);
       nested_name = buf;
       pname = &nested_name;