qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: Akihiko Odaki <akihiko.odaki@gmail.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org, "Cameron Esfahani" <dirty@apple.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Will Cohen" <wwcohen@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Roman Bolshakov" <r.bolshakov@yadro.com>,
	"Li Zhang" <lizhang@suse.de>,
	"Roman Bolshakov" <roman@roolebo.dev>
Subject: Re: [PATCH v4 10/13] audio/coreaudio: Remove a deprecation warning on macOS 12
Date: Sat, 12 Feb 2022 18:41:22 +0100	[thread overview]
Message-ID: <16783907.PEdtDGfWnU@silver> (raw)
In-Reply-To: <2104509.vKTA94REe0@silver>

On Samstag, 12. Februar 2022 18:27:18 CET Christian Schoenebeck wrote:
> On Samstag, 12. Februar 2022 16:23:49 CET Akihiko Odaki wrote:
> > On 2022/02/12 1:34, Philippe Mathieu-Daudé via 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/Fr
> > >    am
> > >    eworks/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.
> > > 
> > > Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> > > Suggested-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > > Suggested-by: Roman Bolshakov <roman@roolebo.dev>
> > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > > Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > > ---
> > > 
> > >   audio/coreaudio.c | 17 +++++++++++------
> > >   1 file changed, 11 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> > > index d8a21d3e50..5b3aeaced0 100644
> > > --- a/audio/coreaudio.c
> > > +++ b/audio/coreaudio.c
> > > @@ -44,10 +44,15 @@ typedef struct coreaudioVoiceOut {
> > > 
> > >       bool enabled;
> > >   
> > >   } coreaudioVoiceOut;
> > > 
> > > +#if !defined(MAC_OS_VERSION_12_0) \
> > > +    || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)
> > > +#define kAudioObjectPropertyElementMain
> > > kAudioObjectPropertyElementMaster
> > > +#endif
> > > +
> > 
> > Unless I have missed something, we have found
> > MAC_OS_X_VERSION_MIN_REQUIRED is better even for a constant in the
> > following thread:
> > https://lore.kernel.org/all/524515d6-2fb5-15c1-0aaf-bcda3684cd00@gmail.com
> > /
> > 
> > Regards,
> > Akihiko Odaki
> 
> Well, MAC_OS_X_VERSION_MIN_REQUIRED would work as well, note though that it
> would effectively result with older SDKs (Xcode <= 13.0) to this:
> 
> enum {
>   MAIN,
>   MASTER = MAIN
> };
> 
> #define MAIN MASTER
> 
> int main() {
>    int k = MAIN;
> }
> 
> Which compiles and works (as both enums reflect the same value anyway), but
> strictly the defined preprocessor macro would mask (with older SDKs) the
> already existing enum. Not that I would care, just noting.
> 
> On practical side though, your solution (MAC_OS_X_VERSION_MIN_REQUIRED)
> would avoid deprecation warnings in future. So yes, maybe it's a bit
> better.

Correction: it would result in this masking scenario with recent SDK (e.g. 
Xcode 13.2.1) and targeting a minimum deployment target macOs <12.0 (not when 
compiling directly with Xcode <13.1).

Best regards,
Christian Schoenebeck




  reply	other threads:[~2022-02-12 17:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 16:34 [PATCH v4 00/13] host: Support macOS 12 Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 01/13] lcitool: refresh Philippe Mathieu-Daudé via
2022-02-12 15:14   ` Akihiko Odaki
2022-02-14 12:10     ` Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 02/13] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 03/13] tests/fp/berkeley-testfloat-3: Ignore ignored #pragma directives Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 04/13] hvf: Use standard CR0 and CR4 register definitions Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 05/13] hvf: Fix OOB write in RDTSCP instruction decode Philippe Mathieu-Daudé via
2022-02-14 12:49   ` Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 06/13] hvf: Enable RDTSCP support Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 07/13] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 08/13] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 09/13] block/file-posix: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé via
2022-02-12 13:35   ` Christian Schoenebeck
2022-02-14  3:27   ` Cameron Esfahani
2022-02-11 16:34 ` [PATCH v4 10/13] audio/coreaudio: " Philippe Mathieu-Daudé via
2022-02-12 13:15   ` Christian Schoenebeck
2022-02-12 15:23   ` Akihiko Odaki
2022-02-12 17:27     ` Christian Schoenebeck
2022-02-12 17:41       ` Christian Schoenebeck [this message]
2022-02-14 12:43     ` Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 11/13] audio/dbus: Fix building with modules on macOS Philippe Mathieu-Daudé via
2022-02-11 16:34 ` [PATCH v4 12/13] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé via
2022-02-12 13:25   ` Christian Schoenebeck
2022-02-14  3:26   ` Cameron Esfahani
2022-02-11 16:34 ` [PATCH v4 13/13] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé via

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=16783907.PEdtDGfWnU@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=akihiko.odaki@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=dirty@apple.com \
    --cc=f4bug@amsat.org \
    --cc=lizhang@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    --cc=roman@roolebo.dev \
    --cc=wwcohen@gmail.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).