qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Roman Bolshakov" <r.bolshakov@yadro.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Akihiko Odaki" <akihiko.odaki@gmail.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
Date: Mon, 10 Jan 2022 14:43:09 +0100	[thread overview]
Message-ID: <2320709.qF9rzA1ROV@silver> (raw)
In-Reply-To: <da52a8ca-6132-022a-0b3c-8bcb0d5e4620@amsat.org>

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é <f4bug@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
> > 
> >  };




  reply	other threads:[~2022-01-10 13:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
2022-01-11 17:16   ` Roman Bolshakov
2022-01-12 13:46     ` Philippe Mathieu-Daudé
2022-01-12 14:09       ` Philippe Mathieu-Daudé
2022-01-12 14:47         ` Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
2022-01-10 19:43   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
2022-01-11 16:09   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
2022-01-11 17:51   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:20   ` Philippe Mathieu-Daudé
2022-01-10 13:43     ` Christian Schoenebeck [this message]
2022-01-11 18:36   ` Roman Bolshakov
2022-01-12  6:57   ` Roman Bolshakov
2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
2022-01-10 18:28   ` Akihiko Odaki
2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
2022-01-13  7:39   ` Thomas Huth
2022-01-13 11:41     ` Philippe Mathieu-Daudé
2022-01-18  9:34       ` Thomas Huth
2022-01-10 18:06 ` [RFC PATCH v3 0/7] host: Support macOS 12 Roman Bolshakov

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=2320709.qF9rzA1ROV@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=agraf@csgraf.de \
    --cc=akihiko.odaki@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=dirty@apple.com \
    --cc=f4bug@amsat.org \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.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).