Descriptioncmd/go: SWIG #go pseudo directives to tweak compiler behavior.
This CL has the go tool parse .swig and .swigcxx files to look for
comments at the top of the file containing CGO-like pseudo directives in
the form of:
// #go LDFLAGS: -lpng
The comments may only be preceded by other single-line (not multiline)
comments. This is to simplify the parser implementation. The pseudo
directives added by this CL are all of the CGO ones (CFLAGS, CPPFLAGS,
CXXFLAGS, LDFLAGS, and even pkg-config).
cmd/go/doc.go is modified to have an explicit section on the go tool's
SWIG integration reflecting these changes.
A simple example is added at misc/swig/cflags which demonstrates using a
CFLAGS #go pseudo directive to define a generic value (additionally it
serves as a test because it will not compile if the parser implementation
does not work).
The parsing itself occurs in the go/build package, this CL inherently adds
public SwigCFLAGS etc. fields to the Package struct.
Discussion: https://groups.google.com/forum/#!topic/golang-dev/B_gY96GKVc8
Fixes issue 6696.
Patch Set 1 #Patch Set 2 : diff -r e09975f9c771 https://code.google.com/p/go #Patch Set 3 : diff -r b9c40afbd66c https://code.google.com/p/go #Patch Set 4 : diff -r 5df696558635 https://code.google.com/p/go #
MessagesTotal messages: 13
|