aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2020-01-24 08:25:52 -0800
committerCarlos Amedee <carlos@golang.org>2020-02-26 17:04:41 +0000
commitb27bda0365c46c4da8e74bd4af7016f44f8e2c65 (patch)
tree52d7df17eb22559b7b2dd546ab0337b79abe5f47
parent20a2e0a58454cbfa4aa32c673c87859d4cf6c52c (diff)
downloadgo-b27bda0365c46c4da8e74bd4af7016f44f8e2c65.tar.gz
go-b27bda0365c46c4da8e74bd4af7016f44f8e2c65.zip
[release-branch.go1.13] cmd/go: fix cgo test when min macOS version is set
Regression tests for #24161 use a macro to conditionally compile some stub definitions. The macro tests that the minimum macOS version is less than 10.12. We get duplicate definitions when building this test with CGO_CFLAGS=-mmacosx-version-min=10.x where 10.x < 10.12. With this change, we use a different macro, __MAC_OS_X_VERSION_MAX_ALLOWED__, which tests the SDK version instead of the minimum macOS version. This checks whether these definitions are present in headers. After this change, 'go tool dist test cgo_test' should pass with CGO_FLAGS=-mmacosx-version-min=10.10. Updates #36846 Updates #35459 Change-Id: I88d63601c94b0369c73c38d216a2d41ba7d4e579 Reviewed-on: https://go-review.googlesource.com/c/go/+/216243 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit 1f9f88b95eaec50c72c8595ca9f52b7b876e28f9) Reviewed-on: https://go-review.googlesource.com/c/go/+/217059 Run-TryBot: Carlos Amedee <carlos@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
-rw-r--r--misc/cgo/test/testdata/issue24161e0/main.go2
-rw-r--r--misc/cgo/test/testdata/issue24161e1/main.go2
-rw-r--r--misc/cgo/test/testdata/issue24161e2/main.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/misc/cgo/test/testdata/issue24161e0/main.go b/misc/cgo/test/testdata/issue24161e0/main.go
index cbc1deea78..efe53458d8 100644
--- a/misc/cgo/test/testdata/issue24161e0/main.go
+++ b/misc/cgo/test/testdata/issue24161e0/main.go
@@ -12,7 +12,7 @@ package issue24161e0
#include <TargetConditionals.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
-#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
+#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
typedef CFStringRef SecKeyAlgorithm;
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()
diff --git a/misc/cgo/test/testdata/issue24161e1/main.go b/misc/cgo/test/testdata/issue24161e1/main.go
index eb48fc0059..82bf172b7d 100644
--- a/misc/cgo/test/testdata/issue24161e1/main.go
+++ b/misc/cgo/test/testdata/issue24161e1/main.go
@@ -12,7 +12,7 @@ package issue24161e1
#include <TargetConditionals.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
-#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
+#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
typedef CFStringRef SecKeyAlgorithm;
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()
diff --git a/misc/cgo/test/testdata/issue24161e2/main.go b/misc/cgo/test/testdata/issue24161e2/main.go
index 1951c86317..82d2ec1296 100644
--- a/misc/cgo/test/testdata/issue24161e2/main.go
+++ b/misc/cgo/test/testdata/issue24161e2/main.go
@@ -12,7 +12,7 @@ package issue24161e2
#include <TargetConditionals.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
-#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
+#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
typedef CFStringRef SecKeyAlgorithm;
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()