Skip to content

Commit f89c155

Browse files
fhgwrightmascguy
authored andcommitted
test_usb: Fix "reverse mismatch" failures.
This test is normally eligible for "reverse SDK mismatch" tests, but fails on 10.15 with a <10.12 SDK. This provides a fix for that case. It also fails on 26.x+ with a <12.x SDK. That is also fixed. TESTED: Now passes on all OS/SDK combinations.
1 parent 939ea4e commit f89c155

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

xtest/test_usb.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
1+
/* Test that USB.h can be successfully included */
2+
3+
/*
4+
* Extra hacks to allow testing with "reverse mismatched" SDK.
5+
*
6+
* Building for 10.15 with a <10.12 SDK fails due to referencing a
7+
* missing definition for uuid_t. This situation is extremely unlikely
8+
* to occur "for real", so we only fix it in the test, just so that we don't
9+
* need to exclude this test from the allowable "reverse mismatch" tests.
10+
*
11+
* Similarly, we provide a missing (empty) definition for building
12+
* 26.x+ with a <12.x SDK.
13+
*/
14+
15+
#if defined(_MACPORTS_LEGACY_MIN_EARLY_SDK_ALLOWED) \
16+
&& defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
17+
18+
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 \
19+
&& __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000
20+
21+
#include <_macports_extras/sdkversion.h>
22+
23+
#if __MPLS_SDK_MAJOR < 101200
24+
25+
#include <sys/_types.h>
26+
typedef __darwin_uuid_t uuid_t;
27+
28+
#endif /* __MPLS_SDK_MAJOR < 101200 */
29+
30+
#endif /* 10.15 target */
31+
32+
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 260000
33+
34+
#ifndef __kernel_ptr_semantics
35+
#define __kernel_ptr_semantics
36+
#endif
37+
38+
#endif /* 26.x+ target */
39+
40+
#endif /* Older SDK allowed and known target */
141

2-
/* Not very exciting but normally this inclusion will fail with GCC 4.5+ pre-10.15 */
342
#include <IOKit/usb/USB.h>
443
#include <stdio.h>
544

0 commit comments

Comments
 (0)