`TARGET_OS_IOS` and `TARGET_OS_WATCH` are not mutually exclusive.
`SANITIZER_IOS` is defined for all embedded platforms. So the branch
for watchOS is never taken. We could fix this by switching the order
of the branches (but the reason for doing so is non-obvious). Instead,
lets use the Darwin-specific `TARGET_OS_*` macros which are mutually
exclusive.
// XNU 17 -- macOS 10.13 -- iOS 11 -- tvOS 11 -- watchOS 4
constexpr u16 GetOSMajorKernelOffset() {
if (TARGET_OS_OSX) return 4;
- if (SANITIZER_IOS || SANITIZER_TVOS) return 6;
- if (SANITIZER_WATCHOS) return 13;
+ if (TARGET_OS_IOS || TARGET_OS_TV) return 6;
+ if (TARGET_OS_WATCH) return 13;
}
using VersStr = char[64];
if (TARGET_OS_OSX)
return;
- if (SANITIZER_IOS || SANITIZER_TVOS)
+ if (TARGET_OS_IOS || TARGET_OS_TV)
*major += 2;
- else if (SANITIZER_WATCHOS)
+ else if (TARGET_OS_WATCH)
*major += 9;
else
UNREACHABLE("unsupported platform");