diff options
Diffstat (limited to 'src/cmd/cgo/main.go')
-rw-r--r-- | src/cmd/cgo/main.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go index 9bd326e1d..17b0cdd16 100644 --- a/src/cmd/cgo/main.go +++ b/src/cmd/cgo/main.go @@ -80,13 +80,18 @@ type Name struct { Mangle string // name used in generated Go C string // name used in C Define string // #define expansion - Kind string // "const", "type", "var", "func", "not-type" + Kind string // "const", "type", "var", "fpvar", "func", "not-type" Type *Type // the type of xxx FuncType *FuncType AddError bool Const string // constant definition } +// IsVar returns true if Kind is either "var" or "fpvar" +func (n *Name) IsVar() bool { + return n.Kind == "var" || n.Kind == "fpvar" +} + // A ExpFunc is an exported function, callable from C. // Such functions are identified in the Go input file // by doc comments containing the line //export ExpName @@ -336,7 +341,7 @@ func (p *Package) Record(f *File) { if p.Name[k] == nil { p.Name[k] = v } else if !reflect.DeepEqual(p.Name[k], v) { - error_(token.NoPos, "inconsistent definitions for C.%s", k) + error_(token.NoPos, "inconsistent definitions for C.%s", fixGo(k)) } } } |