From f1431c74e4fd5d1e8401208d480081d1312fdc49 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 18 Jul 2014 02:59:54 -0400 Subject: 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 ??? TBR=dfc R=dave CC=golang-codereviews https://codereview.appspot.com/114990044 --- misc/cgo/test/empty.go | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 misc/cgo/test/empty.go (limited to 'misc/cgo') 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() -} -- cgit v1.2.1