mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: support floating point #define macros
Current code doesn't support floating point #define macros. This CL compiles floats to a object file and retrive values from it. That approach is the same work as we've already done for integers. Updates #18720 Change-Id: I88b7ab174d0f73bda975cf90c5aeb797961fe034 Reviewed-on: https://go-review.googlesource.com/35511 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
735fe51a4b
commit
89ff0b1b6b
4 changed files with 163 additions and 65 deletions
|
|
@ -88,7 +88,7 @@ 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", "fpvar", "func", "not-type"
|
||||
Kind string // "iconst", "fconst", "sconst", "type", "var", "fpvar", "func", "not-type"
|
||||
Type *Type // the type of xxx
|
||||
FuncType *FuncType
|
||||
AddError bool
|
||||
|
|
@ -100,6 +100,11 @@ func (n *Name) IsVar() bool {
|
|||
return n.Kind == "var" || n.Kind == "fpvar"
|
||||
}
|
||||
|
||||
// IsConst reports whether Kind is either "iconst", "fconst" or "sconst"
|
||||
func (n *Name) IsConst() bool {
|
||||
return n.Kind == "iconst" || n.Kind == "fconst" || n.Kind == "sconst"
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue