mirror of
https://github.com/golang/go
synced 2024-11-23 15:10:12 -07:00
2ae77376f7
The one in misc/makerelease/makerelease.go is particularly bad and probably warrants rotating our keys. I didn't update old weekly notes, and reverted some changes involving test code for now, since we're late in the Go 1.5 freeze. Otherwise, the rest are all auto-generated changes, and all manually reviewed. Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d Reviewed-on: https://go-review.googlesource.com/12048 Reviewed-by: Rob Pike <r@golang.org>
33 lines
791 B
Go
33 lines
791 B
Go
// Copyright 2013 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.
|
|
|
|
// Test that the #cgo CFLAGS directive works,
|
|
// with and without platform filters.
|
|
// See https://golang.org/issue/5224 for details.
|
|
package cgotest
|
|
|
|
/*
|
|
#cgo CFLAGS: -DCOMMON_VALUE=123
|
|
#cgo windows CFLAGS: -DIS_WINDOWS=1
|
|
#cgo !windows CFLAGS: -DIS_WINDOWS=0
|
|
int common = COMMON_VALUE;
|
|
int is_windows = IS_WINDOWS;
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func testCflags(t *testing.T) {
|
|
is_windows := C.is_windows == 1
|
|
if is_windows != (runtime.GOOS == "windows") {
|
|
t.Errorf("is_windows: %v, runtime.GOOS: %s", is_windows, runtime.GOOS)
|
|
}
|
|
if C.common != 123 {
|
|
t.Errorf("common: %v (expected 123)", C.common)
|
|
}
|
|
}
|