Skip to content

Commit 1f9f88b

Browse files
author
Jay Conrod
committed
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 #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>
1 parent 8d7be1e commit 1f9f88b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

misc/cgo/test/testdata/issue24161e0/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package issue24161e0
1212
#include <TargetConditionals.h>
1313
#include <CoreFoundation/CoreFoundation.h>
1414
#include <Security/Security.h>
15-
#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
15+
#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
1616
typedef CFStringRef SecKeyAlgorithm;
1717
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
1818
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()

misc/cgo/test/testdata/issue24161e1/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package issue24161e1
1212
#include <TargetConditionals.h>
1313
#include <CoreFoundation/CoreFoundation.h>
1414
#include <Security/Security.h>
15-
#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
15+
#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
1616
typedef CFStringRef SecKeyAlgorithm;
1717
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
1818
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()

misc/cgo/test/testdata/issue24161e2/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package issue24161e2
1212
#include <TargetConditionals.h>
1313
#include <CoreFoundation/CoreFoundation.h>
1414
#include <Security/Security.h>
15-
#if TARGET_OS_IPHONE == 0 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
15+
#if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
1616
typedef CFStringRef SecKeyAlgorithm;
1717
static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
1818
#define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()

0 commit comments

Comments
 (0)