From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Akihiko Odaki" <akihiko.odaki@gmail.com>,
qemu-block@nongnu.org, "Cameron Esfahani" <dirty@apple.com>,
"Roman Bolshakov" <r.bolshakov@yadro.com>,
"Alexander Graf" <agraf@csgraf.de>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [RFC PATCH v2 2/6] audio/coreaudio: Remove a deprecation warning on macOS 12
Date: Mon, 10 Jan 2022 14:07:24 +0100 [thread overview]
Message-ID: <2147921.xlN1UyrzLN@silver> (raw)
In-Reply-To: <4993ab11-570b-2bd7-a9b9-c6ddc9af5802@amsat.org>
On Montag, 10. Januar 2022 13:24:06 CET Philippe Mathieu-Daudé wrote:
> On 1/10/22 09:44, Philippe Mathieu-Daudé wrote:
> > On 1/10/22 09:17, Akihiko Odaki wrote:
> >> On 2022/01/10 2:06, 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
> >>> ^
> >>>
> >>> Use kAudioObjectPropertyElementMain (define it to
> >>> kAudioObjectPropertyElementMaster on macOS < 12).
> >>>
> >>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >>> ---
> >>> audio/coreaudio.c | 16 ++++++++++------
> >>> 1 file changed, 10 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> >>> index d8a21d3e507..c836bc9dd37 100644
> >>> --- a/audio/coreaudio.c
> >>> +++ b/audio/coreaudio.c
> >>> @@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
> >>> bool enabled;
> >>> } coreaudioVoiceOut;
> >>> +#if !defined(MAC_OS_VERSION_12_0)
> >>> +#define kAudioObjectPropertyElementMain
> >>> kAudioObjectPropertyElementMaster
> >>> +#endif
> >>> +
> >>
> >> Semantically MAC_OS_VERSION_12_0 defines the numeric value of version
> >> 12.0 and its existence does not mean that
> >> kAudioObjectPropertyElementMain is defined. I suggest the following:
> >> #if !__is_identifier(kAudioObjectPropertyElementMain)
> >> #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
> >> #endif
>
> Apparently __is_identifier() is Clang specific. It might be acceptable
> since this file is restricted to macOS. Similarly for the other
> block/file-posix.c patch, the section is conditional to __APPLE__
> being defined.
Correct, __is_identifier() is a clang extension and does not work with GCC
(tested). I would not use it. People on Mac usually use clang, but there are
also cross compilers for macOS binaries.
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
Best regards,
Christian Schoenebeck
next prev parent reply other threads:[~2022-01-10 13:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-09 17:06 [RFC PATCH v2 0/6] host: Support macOS 12 Philippe Mathieu-Daudé
2022-01-09 17:06 ` [PATCH v2 1/6] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
2022-01-09 17:06 ` [RFC PATCH v2 2/6] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
2022-01-10 8:17 ` Akihiko Odaki
2022-01-10 8:44 ` Philippe Mathieu-Daudé
2022-01-10 12:24 ` Philippe Mathieu-Daudé
2022-01-10 13:07 ` Christian Schoenebeck [this message]
2022-01-10 13:14 ` Philippe Mathieu-Daudé
2022-01-10 13:22 ` Peter Maydell
2022-01-10 18:20 ` Akihiko Odaki
2022-01-10 18:46 ` Christian Schoenebeck
2022-01-10 19:01 ` Akihiko Odaki
2022-01-10 19:07 ` Peter Maydell
2022-01-10 20:22 ` Christian Schoenebeck
2022-01-10 20:39 ` Akihiko Odaki
2022-01-10 21:05 ` Christian Schoenebeck
2022-01-10 21:38 ` Akihiko Odaki
2022-01-11 12:35 ` Christian Schoenebeck
2022-01-11 12:51 ` Christian Schoenebeck
2022-01-09 17:06 ` [RFC PATCH v2 3/6] block/file-posix: " Philippe Mathieu-Daudé
2022-01-09 17:06 ` [RFC PATCH v2 4/6] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
2022-01-09 17:06 ` [RFC PATCH v2 5/6] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
2022-01-09 17:06 ` [PATCH v2 6/6] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
2022-01-10 8:50 ` Akihiko Odaki
2022-01-10 9:14 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2147921.xlN1UyrzLN@silver \
--to=qemu_oss@crudebyte.com \
--cc=agraf@csgraf.de \
--cc=akihiko.odaki@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=dirty@apple.com \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).