summaryrefslogtreecommitdiff
path: root/misc/cgo
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2014-07-18 02:59:54 -0400
committerShenghou Ma <minux@golang.org>2014-07-18 02:59:54 -0400
commitf1431c74e4fd5d1e8401208d480081d1312fdc49 (patch)
treedf16a6dca8bc9d298cbf883e46796137c39d6f23 /misc/cgo
parent1e08d624017fafdff66db1db283bb510a4f69db7 (diff)
downloadgo-f1431c74e4fd5d1e8401208d480081d1312fdc49.tar.gz
undo CL 109640045 / f97fb06525e5
Breaks build for FreeBSD. Probably clang related? ??? original CL description cmd/cgo: disable inappropriate warnings when the gcc struct is empty package main //#cgo CFLAGS: -Wall //void test() {} import "C" func main() { C.test() } This code will cause gcc issuing warnings about unused variable. This commit use offset of the second return value of Packages.structType to detect whether the gcc struct is empty, and if it's directly invoke the C function instead of writing an unused code. LGTM=dave, minux R=golang-codereviews, iant, minux, dave CC=golang-codereviews https://codereview.appspot.com/109640045 Committer: Shenghou Ma <minux@golang.org> ??? TBR=dfc R=dave CC=golang-codereviews https://codereview.appspot.com/114990044
Diffstat (limited to 'misc/cgo')
-rw-r--r--misc/cgo/test/empty.go18
1 files changed, 0 insertions, 18 deletions
diff --git a/misc/cgo/test/empty.go b/misc/cgo/test/empty.go
deleted file mode 100644
index daa748549..000000000
--- a/misc/cgo/test/empty.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cgotest
-
-/*
-#cgo CFLAGS: -Werror=unused-variable
-void funcWithoutAnyParams() {}
-*/
-import "C"
-
-// Only test whether this can be compiled, unused
-// variable (e.g. empty gcc strut) could cause
-// warning/error under stricter CFLAGS.
-func testEmptyGccStruct() {
- C.funcWithoutAnyParams()
-}