On Montag, 10. Januar 2022 14:20:56 CET Philippe Mathieu-Daudé wrote: > On 1/10/22 14:09, Philippe Mathieu-Daudé wrote: > > When building on macOS 12 we get: > > audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is > > deprecated: first deprecated in macOS 12.0 > > [-Werror,-Wdeprecated-declarations]> > > kAudioObjectPropertyElementMaster > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > kAudioObjectPropertyElementMain > > > > /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frame > > works/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: > > 'kAudioObjectPropertyElementMaster' has been explicitly marked > > deprecated here> > > kAudioObjectPropertyElementMaster > > API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", > > macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, > > 15.0)) = kAudioObjectPropertyElementMain ^ > > > > Replace by kAudioObjectPropertyElementMain, redefining it to > > kAudioObjectPropertyElementMaster if not available, using > > Clang __is_identifier() feature (coreaudio is restricted to > > macOS). > > > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > > --- > > > > Checkpatch: > > WARNING: architecture specific defines should be avoided > > #10: FILE: audio/coreaudio.c:47: > > +#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 > > */ > > > > Should we define __is_identifier() to 0 for GCC on macOS? > > So apparently yes: > https://lore.kernel.org/qemu-devel/2147921.xlN1UyrzLN@silver/ > > Christian Schoenebeck suggests: > > #if !defined(MAC_OS_VERSION_12_0) || > (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0) > #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster > #endif
Note: line wrap. So don't forget a backslash at the end: #if !defined(MAC_OS_VERSION_12_0) || \ (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0) #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster #endif I guess you would have seen it in the editor anyway, but just to be sure. > > > --- > > > > audio/coreaudio.c | 16 ++++++++++------ > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/audio/coreaudio.c b/audio/coreaudio.c > > index d8a21d3e507..73cbfd479ac 100644 > > --- a/audio/coreaudio.c > > +++ b/audio/coreaudio.c > > @@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut { > > > > bool enabled; > > > > } coreaudioVoiceOut; > > > > +#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */ > > +#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster > > +#endif > > + > > > > static const AudioObjectPropertyAddress voice_addr = { > > > > kAudioHardwarePropertyDefaultOutputDevice, > > kAudioObjectPropertyScopeGlobal, > > > > - kAudioObjectPropertyElementMaster > > + kAudioObjectPropertyElementMain > > > > };