Skip to content

Commit

Permalink
Fix build errors in XCode 15.2.
Browse files Browse the repository at this point in the history
Ignore deprecation warnings in PublicUtility and drop support for macOS
10.12 and earlier.

See #712.
  • Loading branch information
kyleneideck committed Jan 23, 2024
1 parent 4fc776e commit 5000c64
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 15 deletions.
9 changes: 3 additions & 6 deletions BGMApp/BGMApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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 = "";
Expand All @@ -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 = "";
Expand Down
4 changes: 2 additions & 2 deletions BGMApp/PublicUtility/BGMDebugLogging.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// BGMDebugLogging.c
// PublicUtility
//
// Copyright © 2020 Kyle Neideck
// Copyright © 2020, 2024 Kyle Neideck
//

// Self Include
Expand All @@ -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;
}
Expand Down
15 changes: 14 additions & 1 deletion BGMApp/PublicUtility/CAAtomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ full barrier.
#if TARGET_OS_WIN32
#include <windows.h>
#include <intrin.h>
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedAnd)
#else
#include <CoreFoundation/CFBase.h>
#include <libkern/OSAtomic.h>
#endif

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
inline void CAMemoryBarrier()
{
#if TARGET_OS_WIN32
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 )
{
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -301,5 +313,6 @@ inline bool CASpinLockTry( volatile CASpinLock *__lock )
#endif
}

#pragma clang diagnostic pop

#endif // __CAAtomic_h__
3 changes: 3 additions & 0 deletions BGMApp/PublicUtility/CAPropertyAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ struct CAPropertyAddress

// STL Helpers
public:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
struct EqualTo : public std::binary_function<AudioObjectPropertyAddress, AudioObjectPropertyAddress, bool>
{
bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsSameAddress(inAddress1, inAddress2); }
Expand All @@ -120,6 +122,7 @@ struct CAPropertyAddress
{
bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsCongruentLessThanAddress(inAddress1, inAddress2); }
};
#pragma clang diagnostic pop

};

Expand Down
4 changes: 2 additions & 2 deletions BGMDriver/BGMDriver.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
};
Expand Down
4 changes: 2 additions & 2 deletions BGMDriver/BGMDriver/BGM_XPCHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
//

Expand All @@ -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.
Expand Down
14 changes: 13 additions & 1 deletion BGMDriver/PublicUtility/CAAtomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ full barrier.
#if TARGET_OS_WIN32
#include <windows.h>
#include <intrin.h>
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedAnd)
#else
#include <CoreFoundation/CFBase.h>
#include <libkern/OSAtomic.h>
#endif

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
inline void CAMemoryBarrier()
{
#if TARGET_OS_WIN32
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 )
{
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -301,5 +311,7 @@ inline bool CASpinLockTry( volatile CASpinLock *__lock )
#endif
}

#pragma clang diagnostic pop


#endif // __CAAtomic_h__
3 changes: 3 additions & 0 deletions BGMDriver/PublicUtility/CAAtomicStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions BGMDriver/PublicUtility/CAPropertyAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ struct CAPropertyAddress

// STL Helpers
public:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
struct EqualTo : public std::binary_function<AudioObjectPropertyAddress, AudioObjectPropertyAddress, bool>
{
bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsSameAddress(inAddress1, inAddress2); }
Expand All @@ -120,6 +122,7 @@ struct CAPropertyAddress
{
bool operator()(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) const { return IsCongruentLessThanAddress(inAddress1, inAddress2); }
};
#pragma clang diagnostic pop

};

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down

0 comments on commit 5000c64

Please sign in to comment.