From 5892ed4373791ce229d2f4d8bf1203da43be29db Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 16 Sep 2022 09:44:39 -0700
Subject: [PATCH] Fixed Xcode warnings on macOS
---
src/SDL_log.c | 3 ++-
src/joystick/iphoneos/SDL_mfijoystick.m | 13 ++++---------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/SDL_log.c b/src/SDL_log.c
index dd6026c7c48..34c6fe8ae07 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -486,7 +486,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
fclose (pFile);
}
#endif
-#if HAVE_STDIO_H
+#if HAVE_STDIO_H && \
+ !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#if __NACL__
fflush(stderr);
diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m
index 6c04e3800e8..dbd1d8c09d0 100644
--- a/src/joystick/iphoneos/SDL_mfijoystick.m
+++ b/src/joystick/iphoneos/SDL_mfijoystick.m
@@ -632,18 +632,13 @@ @interface GCMicroGamepad (SDL)
}
#endif /* TARGET_OS_TV */
-#if defined(__MACOSX__)
-static int is_macos11(void)
-{
- return (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_15);
-}
-#endif
-
static int
IOS_JoystickInit(void)
{
#if defined(__MACOSX__)
- if (!is_macos11()) {
+ if (@available(macOS 10.16, *)) {
+ /* Continue with initialization on macOS 11+ */
+ } else {
return 0;
}
#endif
@@ -1654,7 +1649,7 @@ -(void)cleanup
#if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__)
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
{
- if (is_macos11()) {
+ if (@available(macOS 10.16, *)) {
if ([GCController supportsHIDDevice:device]) {
return SDL_TRUE;
}