cgo: do not reset tag generator between files

Clean up an error message and error exit too.
Insert blank line after "DO NOT EDIT" comment
to keep it from being a doc comment.

Fixes #1213.
Fixes #1222.

R=r
CC=golang-dev
https://golang.org/cl/3608042
This commit is contained in:
Russ Cox 2010-12-13 13:20:04 -05:00
parent e7a0f67603
commit 9da73612ed
6 changed files with 72 additions and 8 deletions

View file

@ -593,10 +593,10 @@ type typeConv struct {
string ast.Expr
ptrSize int64
tagGen int
}
var tagGen int
func (c *typeConv) Init(ptrSize int64) {
c.ptrSize = ptrSize
c.m = make(map[dwarf.Type]*Type)
@ -799,8 +799,8 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
// Have to give it a name to simulate C "struct foo" references.
tag := dt.StructName
if tag == "" {
tag = "__" + strconv.Itoa(c.tagGen)
c.tagGen++
tag = "__" + strconv.Itoa(tagGen)
tagGen++
} else if t.C == "" {
t.C = dt.Kind + " " + tag
}