qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 2/6] audio/coreaudio: Remove a deprecation warning on


From: Christian Schoenebeck
Subject: Re: [RFC PATCH v2 2/6] audio/coreaudio: Remove a deprecation warning on macOS 12
Date: Mon, 10 Jan 2022 19:46:35 +0100

On Montag, 10. Januar 2022 19:20:15 CET Akihiko Odaki wrote:
> On 2022/01/10 22:22, Peter Maydell wrote:
> > On Mon, 10 Jan 2022 at 13:14, Christian Schoenebeck
> > 
> > <qemu_oss@crudebyte.com> wrote:
> >> I'd suggest to use:
> >> 
> >> #if !defined(MAC_OS_VERSION_12_0) ||
> >> 
> >>      (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)
> >> 
> >> #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
> >> #endif
> > 
> > This is also how we do this for existing checks of this sort,
> > like the one in osdep.h for qemu_thread_jit_execute().
> > 
> > -- PMM
> 
> If I understand correctly, Many macOS-specific codes already no longer
> complies with GCC because they depend on modern features GCC doesn't
> provide. The most problematic construction is block; it is extensively
> used by Apple's ABI and API and you cannot avoid using it even if you try.

You mean Obj-C blocks? That's working with GCC for decades. I am not aware 
about any recent changes to Obj-C block mechanisms by Apple.

> Also, note that MAC_OS_X_VERSION_MAX_ALLOWED defines the upper bound of
> the supported version. The lower bound should be preferred here because
> the usage of the new identifier is applied regardless of the version of
> the host system. It is in contrary to the usage of
> MAC_OS_X_VERSION_MAX_ALLOWED in osdep.h where the new interfaces are
> used only for the newer versions. The lower bound is defined as
> MAC_OS_X_VERSION_MIN_REQUIRED. Practically there is no difference of the
> two macros because they have the same value in QEMU and
> kAudioObjectPropertyElementMain is a constant resolved compile-time, but
> it is still nice to have the code semantically correct.

For this particular enum: no, MAC_OS_X_VERSION_MAX_ALLOWED is the correct one. 
This is about whether enum kAudioObjectPropertyElementMain is defined in the 
SDK header files. That's all. And the new enum kAudioObjectPropertyElementMain 
is pure refactoring of the enum's old name due to social reasons ("Master"). 
The actual reflected numeric value and semantic of the enum is unchanged and 
the resulting binary and behaviour are identical.

There are other cases where MAC_OS_X_VERSION_MIN_REQUIRED (a.k.a. "minimum 
deployment target") would be used instead: macOS APIs that might be available 
to only some, but not to the entire macOS version range officially supported 
by the rolled out binary. Did you see any particular case where this is 
incorrectly used in QEMU?

Best regards,
Christian Schoenebeck





reply via email to

[Prev in Thread] Current Thread [Next in Thread]