qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé via" <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: "Akihiko Odaki" <akihiko.odaki@gmail.com>,
	"Roman Bolshakov" <r.bolshakov@yadro.com>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [RFC PATCH 1/4] osdep: Avoid using Clang-specific __builtin_available()
Date: Tue, 15 Feb 2022 13:06:22 +0100	[thread overview]
Message-ID: <20220215120625.64711-2-f4bug@amsat.org> (raw)
In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org>

Replace MAC_OS_X_VERSION_MAX_ALLOWED upper check by the lower
one (MAC_OS_X_VERSION_MIN_REQUIRED) and remove the Clang specific
__builtin_available() to allow building with GCC.

Remove the Clang specific __builtin_available() to allow building
with GCC, otherwise we get:

  include/qemu/osdep.h: In function 'qemu_thread_jit_write':
  include/qemu/osdep.h:787:9: warning: implicit declaration of function '__builtin_available'; did you mean '__builtin_scalbl'? [-Wimplicit-function-declaration]
    787 |     if (__builtin_available(macOS 11.0, *)) {
        |         ^~~~~~~~~~~~~~~~~~~
        |         __builtin_scalbl
  include/qemu/osdep.h:787:9: warning: nested extern declaration of '__builtin_available' [-Wnested-externs]
  include/qemu/osdep.h:787:29: error: 'macOS' undeclared (first use in this function)
    787 |     if (__builtin_available(macOS 11.0, *)) {
        |                             ^~~~~
  include/qemu/osdep.h:787:29: note: each undeclared identifier is reported only once for each function it appears in
  include/qemu/osdep.h:787:34: error: expected ')' before numeric constant
    787 |     if (__builtin_available(macOS 11.0, *)) {
        |                            ~     ^~~~~
        |                                  )

Replace the MAC_OS_X_VERSION_MAX_ALLOWED upper check by a lower
one (with MAC_OS_X_VERSION_MIN_REQUIRED) to avoid on Catalina:

  include/qemu/osdep.h:780:5: warning: 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer [-Wunguarded-availability-new]
      pthread_jit_write_protect_np(true);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:561:6: note: 'pthread_jit_write_protect_np' has been marked as being introduced in macOS 11.0 here, but the deployment target is macOS 10.15.0
  void pthread_jit_write_protect_np(int enabled);
       ^

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu/osdep.h | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index d1660d67fa..1e7a002339 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -774,19 +774,15 @@ size_t qemu_get_host_physmem(void);
  * for the current thread.
  */
 #if defined(MAC_OS_VERSION_11_0) && \
-    MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
+    MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
 static inline void qemu_thread_jit_execute(void)
 {
-    if (__builtin_available(macOS 11.0, *)) {
-        pthread_jit_write_protect_np(true);
-    }
+    pthread_jit_write_protect_np(true);
 }
 
 static inline void qemu_thread_jit_write(void)
 {
-    if (__builtin_available(macOS 11.0, *)) {
-        pthread_jit_write_protect_np(false);
-    }
+    pthread_jit_write_protect_np(false);
 }
 #else
 static inline void qemu_thread_jit_write(void) {}
-- 
2.34.1



  reply	other threads:[~2022-02-15 12:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 12:06 [RFC PATCH 0/4] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
2022-02-15 12:06 ` Philippe Mathieu-Daudé via [this message]
2022-02-15 12:06 ` [PATCH 2/4] osdep: Un-inline qemu_thread_jit_execute/write Philippe Mathieu-Daudé via
2022-02-15 13:09   ` Akihiko Odaki
2022-02-15 13:29     ` Philippe Mathieu-Daudé via
2022-02-15 12:06 ` [RFC PATCH 3/4] audio: Rename coreaudio extension to use Objective-C compiler Philippe Mathieu-Daudé via
2022-02-15 13:37   ` Christian Schoenebeck
2022-02-15 12:06 ` [RFC PATCH 4/4] ui/cocoa: Ignore 'initializer overrides' warnings Philippe Mathieu-Daudé via
2022-02-15 12:34   ` Peter Maydell
2022-02-15 13:19     ` Akihiko Odaki
2022-02-15 13:23       ` Philippe Mathieu-Daudé via
2022-02-15 13:18   ` Christian Schoenebeck
2022-02-15 13:45     ` Peter Maydell
2022-02-15 14:06       ` Philippe Mathieu-Daudé via
2022-02-15 14:11       ` Christian Schoenebeck
2022-02-15 14:17         ` Peter Maydell
2022-02-15 13:06 ` [RFC PATCH 0/4] buildsys: More fixes to use GCC on macOS Akihiko Odaki
2022-02-15 13:25   ` Philippe Mathieu-Daudé via
2022-02-16  2:28     ` Akihiko Odaki

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=20220215120625.64711-2-f4bug@amsat.org \
    --to=qemu-devel@nongnu.org \
    --cc=akihiko.odaki@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=qemu_oss@crudebyte.com \
    --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).