Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16935)

Issue 96320043: code review 96320043: cmd/go: SWIG #go pseudo directives to tweak compiler be...

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 11 months ago by slimsag
Modified:
9 years, 4 months ago
Reviewers:
CC:
golang-codereviews, ioe, iant, michael-schaller
Visibility:
Public.

Description

cmd/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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+337 lines, -43 lines) Patch
A misc/swig/cflags/file.c View 1 1 chunk +9 lines, -0 lines 0 comments Download
A misc/swig/cflags/file.swig View 1 1 chunk +10 lines, -0 lines 0 comments Download
A misc/swig/cflags/file_test.go View 1 1 chunk +15 lines, -0 lines 0 comments Download
M src/cmd/go/build.go View 1 2 3 9 chunks +76 lines, -35 lines 0 comments Download
M src/cmd/go/doc.go View 1 2 3 4 chunks +45 lines, -3 lines 0 comments Download
M src/cmd/go/help.go View 1 2 chunks +40 lines, -3 lines 0 comments Download
M src/cmd/go/list.go View 1 1 chunk +7 lines, -0 lines 0 comments Download
M src/cmd/go/main.go View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/go/pkg.go View 1 2 chunks +12 lines, -0 lines 0 comments Download
M src/pkg/go/build/build.go View 1 2 3 5 chunks +122 lines, -2 lines 0 comments Download

Messages

Total messages: 13
slimsag
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
9 years, 11 months ago (2014-05-13 11:12:44 UTC) #1
ioe
May I suggest to use '#cgo' as the tag? Rationale: It is actually the cgo ...
9 years, 11 months ago (2014-05-13 17:34:56 UTC) #2
slimsag
On 2014/05/13 17:34:56, ioe wrote: > May I suggest to use '#cgo' as the tag? ...
9 years, 11 months ago (2014-05-13 21:16:31 UTC) #3
ioe
Ok, I take back my suggestion. Your arguments make a lot of sense to me. ...
9 years, 11 months ago (2014-05-13 22:46:00 UTC) #4
iant
I think this is a good idea but it's clearly a new feature and we ...
9 years, 11 months ago (2014-05-14 13:29:04 UTC) #5
slimsag
On 2014/05/14 13:29:04, iant wrote: > I think this is a good idea but it's ...
9 years, 11 months ago (2014-05-14 21:20:02 UTC) #6
slimsag
On 2014/05/14 21:20:02, slimsag wrote: > On 2014/05/14 13:29:04, iant wrote: > > I think ...
9 years, 10 months ago (2014-06-19 23:46:36 UTC) #7
slimsag
On 2014/06/19 23:46:36, slimsag wrote: > On 2014/05/14 21:20:02, slimsag wrote: > > On 2014/05/14 ...
9 years, 10 months ago (2014-06-20 02:50:43 UTC) #8
slimsag
9 years, 10 months ago (2014-06-20 16:56:35 UTC) #9
michael-schaller
@slimlang Can you also add general SWIG options? I would like to run SWIG with ...
9 years, 5 months ago (2014-11-05 09:34:04 UTC) #10
slimsag
The CL probably doesn't apply well to tip, surely a lot has changed since then. ...
9 years, 5 months ago (2014-11-05 13:43:10 UTC) #11
michael-schaller
Stephen, I would be very happy if you could do that. The code looks good ...
9 years, 5 months ago (2014-11-05 15:05:45 UTC) #12
gobot
9 years, 4 months ago (2014-12-19 05:19:21 UTC) #13
R=close

To the author of this CL:

The Go project has moved to Gerrit Code Review.

If this CL should be continued, please see the latest version of
https://golang.org/doc/contribute.html for instructions on
how to set up Git and the Go project's Gerrit codereview plugin,
and then create a new change with your current code.

If there has been discussion on this CL, please give a link to it
(golang.org/cl/96320043 is best) in the description in your
new CL.

Thanks very much.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b