[go] push by alex.bra...@gmail.com - cmd/cgo: do not output empty struct for -cdefs... on 2013-05-25 10:54 GMT

2 views
Skip to first unread message

g...@googlecode.com

unread,
May 25, 2013, 6:54:21 AM5/25/13
to golang-...@googlegroups.com
Revision: 2a106010f660
Branch: default
Author: Alex Brainman <alex.b...@gmail.com>
Date: Sat May 25 03:53:55 2013
Log: cmd/cgo: do not output empty struct for -cdefs

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/9574043
http://code.google.com/p/go/source/detail?r=2a106010f660

Modified:
/src/cmd/cgo/godefs.go

=======================================
--- /src/cmd/cgo/godefs.go Fri Feb 1 08:41:25 2013
+++ /src/cmd/cgo/godefs.go Sat May 25 03:53:55 2013
@@ -204,6 +204,11 @@
// byte Z[4];
// }
if strings.HasPrefix(line, "type ") && strings.HasSuffix(line, " struct
{") {
+ if len(lines) > i+1 && lines[i+1] == "}" {
+ // do not output empty struct
+ i++
+ continue
+ }
s := line[len("type ") : len(line)-len(" struct {")]
printf("struct %s {\n", s)
for i++; i < len(lines) && lines[i] != "}"; i++ {
Reply all
Reply to author
Forward
0 new messages