From 5000c640840553a66d8aeda6f707fe8cbc67ce0a Mon Sep 17 00:00:00 2001 From: Kyle Neideck Date: Tue, 23 Jan 2024 23:27:59 +1100 Subject: [PATCH] Fix build errors in XCode 15.2. Ignore deprecation warnings in PublicUtility and drop support for macOS 10.12 and earlier. See #712. --- BGMApp/BGMApp.xcodeproj/project.pbxproj | 9 +++------ BGMApp/PublicUtility/BGMDebugLogging.c | 4 ++-- BGMApp/PublicUtility/CAAtomic.h | 15 ++++++++++++++- BGMApp/PublicUtility/CAPropertyAddress.h | 3 +++ BGMDriver/BGMDriver.xcodeproj/project.pbxproj | 4 ++-- BGMDriver/BGMDriver/BGM_XPCHelper.m | 4 ++-- BGMDriver/PublicUtility/CAAtomic.h | 14 +++++++++++++- BGMDriver/PublicUtility/CAAtomicStack.h | 3 +++ BGMDriver/PublicUtility/CAPropertyAddress.h | 3 +++ README.md | 2 +- 10 files changed, 46 insertions(+), 15 deletions(-) diff --git a/BGMApp/BGMApp.xcodeproj/project.pbxproj b/BGMApp/BGMApp.xcodeproj/project.pbxproj index 8e64ece5..f0a5a752 100644 --- a/BGMApp/BGMApp.xcodeproj/project.pbxproj +++ b/BGMApp/BGMApp.xcodeproj/project.pbxproj @@ -1443,7 +1443,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-fno-omit-frame-pointer"; @@ -1553,7 +1553,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-fno-omit-frame-pointer"; @@ -1635,7 +1635,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; OTHER_CFLAGS = ""; RUN_CLANG_STATIC_ANALYZER = YES; @@ -1715,7 +1715,6 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "BGMAppTests/UITests/BGMAppUITests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = com.bearisdriving.BGM.AppUITests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1733,7 +1732,6 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "BGMAppTests/UITests/BGMAppUITests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = com.bearisdriving.BGM.AppUITests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1752,7 +1750,6 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "BGMAppTests/UITests/BGMAppUITests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = com.bearisdriving.BGM.AppUITests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/BGMApp/PublicUtility/BGMDebugLogging.c b/BGMApp/PublicUtility/BGMDebugLogging.c index 7537c8b2..ac872864 100644 --- a/BGMApp/PublicUtility/BGMDebugLogging.c +++ b/BGMApp/PublicUtility/BGMDebugLogging.c @@ -17,7 +17,7 @@ // BGMDebugLogging.c // PublicUtility // -// Copyright © 2020 Kyle Neideck +// Copyright © 2020, 2024 Kyle Neideck // // Self Include @@ -36,7 +36,7 @@ // We don't bother synchronising accesses of gDebugLoggingIsEnabled because it isn't really // necessary and would complicate code that accesses it on realtime threads. -int BGMDebugLoggingIsEnabled() +int BGMDebugLoggingIsEnabled(void) { return gDebugLoggingIsEnabled; } diff --git a/BGMApp/PublicUtility/CAAtomic.h b/BGMApp/PublicUtility/CAAtomic.h index c9a611bf..9eabc066 100644 --- a/BGMApp/PublicUtility/CAAtomic.h +++ b/BGMApp/PublicUtility/CAAtomic.h @@ -59,13 +59,15 @@ full barrier. #if TARGET_OS_WIN32 #include #include - #pragma intrinsic(_InterlockedOr) + #pragma intrinsic(_InterlockedOr) #pragma intrinsic(_InterlockedAnd) #else #include #include #endif +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" inline void CAMemoryBarrier() { #if TARGET_OS_WIN32 @@ -196,6 +198,8 @@ inline bool CAAtomicTestAndSetBarrier(int bitToSet, void* theAddress) #endif } +#pragma clang diagnostic pop + // int32_t flavors -- for C++ only since we can't overload in C // CFBase.h defines SInt32 as signed int which is similar to int32_t. If CFBase.h is included, then // this will generate redefinition error. But on Mac, CFBase.h, still includes MacTypes.h where @@ -243,6 +247,9 @@ inline int32_t CAAtomicDecrement32Barrier(volatile int32_t* theValue) } #endif // __cplusplus && !__LP64__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" + #if __LP64__ inline bool CAAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ) { @@ -259,6 +266,8 @@ inline bool CAAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, #endif } +#pragma clang diagnostic pop + /* Spinlocks. These use memory barriers as required to synchronize access to shared * memory protected by the lock. The lock operation spins, but employs various strategies * to back off if the lock is held, making it immune to most priority-inversion livelocks. @@ -273,6 +282,9 @@ bool CASpinLockTry( volatile CASpinLock *__lock ); void CASpinLockLock( volatile CASpinLock *__lock ); void CASpinLockUnlock( volatile CASpinLock *__lock ); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" + inline void CASpinLockLock( volatile CASpinLock *__lock ) { #if TARGET_OS_MAC @@ -301,5 +313,6 @@ inline bool CASpinLockTry( volatile CASpinLock *__lock ) #endif } +#pragma clang diagnostic pop #endif // __CAAtomic_h__ diff --git a/BGMApp/PublicUtility/CAPropertyAddress.h b/BGMApp/PublicUtility/CAPropertyAddress.h index 39b01cf2..c311214b 100644 --- a/BGMApp/PublicUtility/CAPropertyAddress.h +++ b/BGMApp/PublicUtility/CAPropertyAddress.h @@ -101,6 +101,8 @@ struct CAPropertyAddress // STL Helpers public: +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" struct EqualTo : public std::binary_function { bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsSameAddress(inAddress1, inAddress2); } @@ -120,6 +122,7 @@ struct CAPropertyAddress { bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsCongruentLessThanAddress(inAddress1, inAddress2); } }; +#pragma clang diagnostic pop }; diff --git a/BGMDriver/BGMDriver.xcodeproj/project.pbxproj b/BGMDriver/BGMDriver.xcodeproj/project.pbxproj index 083a989d..e91a757f 100644 --- a/BGMDriver/BGMDriver.xcodeproj/project.pbxproj +++ b/BGMDriver/BGMDriver.xcodeproj/project.pbxproj @@ -712,7 +712,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH = YES; RUN_CLANG_STATIC_ANALYZER = YES; WARNING_CFLAGS = "-Wpartial-availability"; @@ -780,7 +780,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; RUN_CLANG_STATIC_ANALYZER = YES; WARNING_CFLAGS = "-Wpartial-availability"; }; diff --git a/BGMDriver/BGMDriver/BGM_XPCHelper.m b/BGMDriver/BGMDriver/BGM_XPCHelper.m index 9538a626..0e831123 100644 --- a/BGMDriver/BGMDriver/BGM_XPCHelper.m +++ b/BGMDriver/BGMDriver/BGM_XPCHelper.m @@ -17,7 +17,7 @@ // BGM_XPCHelper.m // BGMDriver // -// Copyright © 2016, 2017, 2020 Kyle Neideck +// Copyright © 2016, 2017, 2020, 2024 Kyle Neideck // Copyright © 2020 Aleksey Yurkevich // @@ -38,7 +38,7 @@ static const UInt64 REMOTE_CALL_DEFAULT_TIMEOUT_SECS = 30; -static NSXPCConnection* CreateXPCHelperConnection() +static NSXPCConnection* CreateXPCHelperConnection(void) { // Create a connection to BGMXPCHelper's Mach service. If it isn't already running, launchd will start BGMXPCHelper when we send // a message to this connection. diff --git a/BGMDriver/PublicUtility/CAAtomic.h b/BGMDriver/PublicUtility/CAAtomic.h index c9a611bf..99907ba5 100644 --- a/BGMDriver/PublicUtility/CAAtomic.h +++ b/BGMDriver/PublicUtility/CAAtomic.h @@ -59,13 +59,15 @@ full barrier. #if TARGET_OS_WIN32 #include #include - #pragma intrinsic(_InterlockedOr) + #pragma intrinsic(_InterlockedOr) #pragma intrinsic(_InterlockedAnd) #else #include #include #endif +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" inline void CAMemoryBarrier() { #if TARGET_OS_WIN32 @@ -195,6 +197,7 @@ inline bool CAAtomicTestAndSetBarrier(int bitToSet, void* theAddress) return OSAtomicTestAndSetBarrier(bitToSet, (volatile void *)theAddress); #endif } +#pragma clang diagnostic pop // int32_t flavors -- for C++ only since we can't overload in C // CFBase.h defines SInt32 as signed int which is similar to int32_t. If CFBase.h is included, then @@ -243,6 +246,9 @@ inline int32_t CAAtomicDecrement32Barrier(volatile int32_t* theValue) } #endif // __cplusplus && !__LP64__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" + #if __LP64__ inline bool CAAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ) { @@ -258,6 +264,7 @@ inline bool CAAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, return CAAtomicCompareAndSwap32Barrier((int32_t)__oldValue, (int32_t)__newValue, (int32_t *)__theValue); #endif } +#pragma clang diagnostic pop /* Spinlocks. These use memory barriers as required to synchronize access to shared * memory protected by the lock. The lock operation spins, but employs various strategies @@ -273,6 +280,9 @@ bool CASpinLockTry( volatile CASpinLock *__lock ); void CASpinLockLock( volatile CASpinLock *__lock ); void CASpinLockUnlock( volatile CASpinLock *__lock ); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" + inline void CASpinLockLock( volatile CASpinLock *__lock ) { #if TARGET_OS_MAC @@ -301,5 +311,7 @@ inline bool CASpinLockTry( volatile CASpinLock *__lock ) #endif } +#pragma clang diagnostic pop + #endif // __CAAtomic_h__ diff --git a/BGMDriver/PublicUtility/CAAtomicStack.h b/BGMDriver/PublicUtility/CAAtomicStack.h index 8d40fc5d..6cb2d389 100644 --- a/BGMDriver/PublicUtility/CAAtomicStack.h +++ b/BGMDriver/PublicUtility/CAAtomicStack.h @@ -160,6 +160,8 @@ class TAtomicStack { static bool compare_and_swap(T *oldvalue, T *newvalue, T **pvalue) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" #if TARGET_OS_MAC #if __LP64__ return ::OSAtomicCompareAndSwap64Barrier(int64_t(oldvalue), int64_t(newvalue), (int64_t *)pvalue); @@ -172,6 +174,7 @@ class TAtomicStack { //return ::CompareAndSwap(UInt32(oldvalue), UInt32(newvalue), (UInt32 *)pvalue); return CAAtomicCompareAndSwap32Barrier(SInt32(oldvalue), SInt32(newvalue), (SInt32*)pvalue); #endif +#pragma clang diagnostic pop } protected: diff --git a/BGMDriver/PublicUtility/CAPropertyAddress.h b/BGMDriver/PublicUtility/CAPropertyAddress.h index 39b01cf2..c311214b 100644 --- a/BGMDriver/PublicUtility/CAPropertyAddress.h +++ b/BGMDriver/PublicUtility/CAPropertyAddress.h @@ -101,6 +101,8 @@ struct CAPropertyAddress // STL Helpers public: +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" struct EqualTo : public std::binary_function { bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsSameAddress(inAddress1, inAddress2); } @@ -120,6 +122,7 @@ struct CAPropertyAddress { bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsCongruentLessThanAddress(inAddress1, inAddress2); } }; +#pragma clang diagnostic pop }; diff --git a/README.md b/README.md index 990683fa..4dace565 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ the **Background Music** device. You can create the aggregate device using the * # Download -**Requires macOS 10.10+**. +**Requires macOS 10.13+**. You can download the current version of **Background Music** using the following options. We also have [snapshot builds](https://github.com/kyleneideck/BackgroundMusic/releases).