Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: syntax error: unexpected semicolon, expecting expression #29748

Closed
calmh opened this issue Jan 15, 2019 · 3 comments
Closed

cmd/cgo: syntax error: unexpected semicolon, expecting expression #29748

calmh opened this issue Jan 15, 2019 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@calmh
Copy link
Contributor

calmh commented Jan 15, 2019

What version of Go are you using (go version)?

$ go1.12beta2 version
go version go1.12beta2 darwin/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go1.12beta2 env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jb/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jb/go"
GOPROXY="https://build.kastelo.net/athens"
GORACE=""
GOROOT="/Users/jb/sdk/go1.12beta2"
GOTMPDIR=""
GOTOOLDIR="/Users/jb/sdk/go1.12beta2/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0r/vt88n3bd6cz3b7pz29x09pd40000gp/T/go-build241446681=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go1.12beta2 get github.com/syncthing/notify
# github.com/syncthing/notify
src/github.com/syncthing/notify/watcher_fsevents_cgo.go:51:83: syntax error: unexpected semicolon, expecting expression

It builds with Go 1.11.4. The repo doesn't change often, but in case it does, at the time of reporting HEAD is syncthing/notify@4e389ea.

watcher_fsevents_cgo.go:51:83 is the cursor position in the following screenshot. I'm not sure it's pointing at the right place...

screen shot 2019-01-15 at 10 00 59

There is cgo involved, obviously, with includes and stuff on the import "C"...

@mvdan
Copy link
Member

mvdan commented Jan 15, 2019

Potentially a regression, so I'm adding this to the 1.12 milestone. Thanks for reporting.

@mvdan mvdan added this to the Go1.12 milestone Jan 15, 2019
@mvdan mvdan added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 15, 2019
@ianlancetaylor ianlancetaylor changed the title go1.12beta2: syntax error: unexpected semicolon, expecting expression cmd/cgo: syntax error: unexpected semicolon, expecting expression Jan 15, 2019
@ianlancetaylor
Copy link
Contributor

Reproduction:

package p

// typedef struct { char **p; } S;
// static int f(S *p) { return 0; }
import "C"

var V = C.f(&C.S{
	nil,
})

@ianlancetaylor ianlancetaylor self-assigned this Jan 15, 2019
@gopherbot
Copy link

Change https://golang.org/cl/157961 mentions this issue: cmd/cgo: don't replace newlines with semicolons in composite literals

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants