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

Comments

@calmh
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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

@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

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2019

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

This comment has been minimized.

Copy link

commented Jan 15, 2019

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.