From patchwork Tue Feb 15 12:06:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12746984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F247C433EF for ; Tue, 15 Feb 2022 12:09:00 +0000 (UTC) Received: from localhost ([::1]:41122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJwdf-0002Uw-74 for qemu-devel@archiver.kernel.org; Tue, 15 Feb 2022 07:08:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJwbT-00014Z-7X for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:06:43 -0500 Received: from [2607:f8b0:4864:20::1035] (port=44688 helo=mail-pj1-x1035.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJwbQ-0001TS-HN for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:06:42 -0500 Received: by mail-pj1-x1035.google.com with SMTP id d9-20020a17090a498900b001b8bb1d00e7so1939794pjh.3 for ; Tue, 15 Feb 2022 04:06:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=42qBX2F42ju9AYB7enVveSzKv42NjYzI623y0XxCx+U=; b=bj6yu4HidzCGKRLnecteaJpR9woexFyHVp+72m2pwzpwW21jJ6XCaP7KbEASIqXKTx XnYYNUhey4FCTVp6i/wsmCkzfb8XyqBjSy7eL8yxEb+9yaKdkv1gWmgYw47vdgsOEXaO gn1wz78VEhimBJXiz0yEDGqCZx0693sbW4gvfagdF8hsHAfP6tiO2MporCmvs+vq3W1A wNPaQMLGp1qI7einsHRS4r/z/YL1pbq/CanZOpsCLw3UrR6GjtkzPujZ1ksxnLuhum92 ru9QXnTfzsSSG++wAl5vrHQxVPW+EqKQJt3gLLi9QZD7EP9UQ2I41bz1lUoO44tSCJot atJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=42qBX2F42ju9AYB7enVveSzKv42NjYzI623y0XxCx+U=; b=sVNUUZMLfO8iz7Mr73zEJEEsN4dPiW86WAENKo9zUVsWOHImLT883fQb0gPxpb+zEG dJyJ+bN7A+ZWAjld3Ny4oDwdlrlZIE+ojIzOvYcl/Vob7S3KBfYpt6AjGFKQm9WAokTO 46WL8dplAEcFtK/7AH/0fNfLkol0zXjhhDTORxBpp+3/ssbThf2omBIwC8ROAcJNuvrA BbV3lBfhrzVJZ7i661HGwql3ytFvSl3Q/nHGEPfBWLzl8FjQUH3OeFQ7Nn9EQ4Th/Di3 DGpF0Tly0X66D2vVX9+GOmpbZbLxD4Dz+LdYYyn05OaapUwBxGXwVn2Vheq4zWzjOIMa eAeA== X-Gm-Message-State: AOAM531LtHjNUX3guE8/nUcfK/cQlI3Hmj2v3rT14IU7m1B5yrqFsBs5 SBCAyXYEJtb4a+wXwCxLUd9onfVMd1Y= X-Google-Smtp-Source: ABdhPJx306ybpviD37r13H86T6VF7EFoI9HwboITHN1Y/SZff70rA8JUFghyFFfEfs2kYvZFJZcMcQ== X-Received: by 2002:a17:90b:4f43:: with SMTP id pj3mr4018067pjb.9.1644926798992; Tue, 15 Feb 2022 04:06:38 -0800 (PST) Received: from localhost.localdomain (71.red-83-50-68.dynamicip.rima-tde.net. [83.50.68.71]) by smtp.gmail.com with ESMTPSA id nn1sm13365032pjb.47.2022.02.15.04.06.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Feb 2022 04:06:38 -0800 (PST) To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Roman Bolshakov , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [RFC PATCH 1/4] osdep: Avoid using Clang-specific __builtin_available() Date: Tue, 15 Feb 2022 13:06:22 +0100 Message-Id: <20220215120625.64711-2-f4bug@amsat.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org> References: <20220215120625.64711-1-f4bug@amsat.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1035 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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é --- 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) {} From patchwork Tue Feb 15 12:06:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12746985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAC0BC433EF for ; Tue, 15 Feb 2022 12:12:37 +0000 (UTC) Received: from localhost ([::1]:45484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJwhA-0005hT-NF for qemu-devel@archiver.kernel.org; Tue, 15 Feb 2022 07:12:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJwbr-00019p-J2 for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:11 -0500 Received: from [2607:f8b0:4864:20::431] (port=36475 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJwbo-0001Ut-Ft for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:06 -0500 Received: by mail-pf1-x431.google.com with SMTP id z16so12635431pfh.3 for ; Tue, 15 Feb 2022 04:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J1kz5UUqyzdZGMp/mxnljjWHI+CVxZCoiLHlEt1WQgM=; b=cqhr4/KyecY11PmtETsA7qjYn2v28QQWpyt0DYbAXBL/8XoaWjBkIg9crbaDgwfLds KDRVDBfJSB6//3Gx++M6EPoqOGy9dB43lssoFfIiprKBHPxNrDUZC8HVG18RqdY+mV87 OzFPUa1cT8MYP88VqhBREfG4nuGFLWXFqj+LFG0KnJSFwZN1WX8VNw3VpS+iYKW77hix xPxjQ6JdjfIaz+HomPvuKxtg08+/TdvcPe8MrOXhTikcouSkh+o4ZzPMkQ3HzMJMpYBI r8MEZLpy/Wy46G0qeDsp3/NSzXfORhqyvga60f30vp4fcEdOTLbd6xMXEs53EsWjvG+s mo5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=J1kz5UUqyzdZGMp/mxnljjWHI+CVxZCoiLHlEt1WQgM=; b=L7KFdxda+A5LAWEysbOox8Y0sX/JNjF5YorsGG6mv6WvpLLCv35lY67FsZFD2c5GoO H6PDET0CDV42nZM55kgYv7GYjvOn8Kt6ZCkQegA/w/oly3wRozqise/bKsmHM0TGBKzx HlECbxQyGGvFweviSa65vSm+dTSiIuQoP7ZUn51vVdodcU3gkm7FM7yfQkqeGypBopZY U4b/17DoDEnc30Vk9/QmuyMvq6PUrsN3LXhbo8+MRsO5bTMyEJj/kkpBdlhE+erOuplq p8rIASmAarMxD/NkeSg6uKpL75ekYvczzw9l0r6kTh6yGU5eBmoSioV8VO7nmYFytGfG yegw== X-Gm-Message-State: AOAM530gjfr/QJbZI16hOuoAeZHRQcSbAnKCsFRCx6sfr7+jfzEEwf0b bnTP1C5cRqzYdrDmi9zp51lGgqY1e98= X-Google-Smtp-Source: ABdhPJzGRFiQTmwsQPLUbdP4y3VUucYywiQMFB9vZLLmqjhxzU1HsFYtK/T74pEQJX3nOSsG1nXO/g== X-Received: by 2002:a63:6a89:: with SMTP id f131mr3310988pgc.108.1644926807288; Tue, 15 Feb 2022 04:06:47 -0800 (PST) Received: from localhost.localdomain (71.red-83-50-68.dynamicip.rima-tde.net. [83.50.68.71]) by smtp.gmail.com with ESMTPSA id y20sm40402889pfi.78.2022.02.15.04.06.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Feb 2022 04:06:47 -0800 (PST) To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Roman Bolshakov , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PATCH 2/4] osdep: Un-inline qemu_thread_jit_execute/write Date: Tue, 15 Feb 2022 13:06:23 +0100 Message-Id: <20220215120625.64711-3-f4bug@amsat.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org> References: <20220215120625.64711-1-f4bug@amsat.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= qemu_thread_jit_execute() and qemu_thread_jit_write() call pthread_jit_write_protect_np() which is declared in "pthread.h". Since we don't want all C files to preprocess unused headers, avoid adding yet another header here and move the function definitions to osdep.c, un-inlining them. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/osdep.h | 17 ++--------------- util/osdep.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 1e7a002339..785884728b 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -773,21 +773,8 @@ size_t qemu_get_host_physmem(void); * Toggle write/execute on the pages marked MAP_JIT * for the current thread. */ -#if defined(MAC_OS_VERSION_11_0) && \ - MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 -static inline void qemu_thread_jit_execute(void) -{ - pthread_jit_write_protect_np(true); -} - -static inline void qemu_thread_jit_write(void) -{ - pthread_jit_write_protect_np(false); -} -#else -static inline void qemu_thread_jit_write(void) {} -static inline void qemu_thread_jit_execute(void) {} -#endif +void qemu_thread_jit_execute(void); +void qemu_thread_jit_write(void); /** * Platforms which do not support system() return ENOSYS diff --git a/util/osdep.c b/util/osdep.c index 42a0a4986a..b228a53612 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -124,6 +124,26 @@ int qemu_mprotect_none(void *addr, size_t size) #endif } +static void qemu_pthread_jit_write_protect(bool enabled) +{ +#if defined(MAC_OS_VERSION_11_0) \ + && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 + if (__builtin_available(macOS 11.0, *)) { + pthread_jit_write_protect_np(enabled); + } +#endif +} + +void qemu_thread_jit_execute(void) +{ + qemu_pthread_jit_write_protect(true); +} + +void qemu_thread_jit_write(void) +{ + qemu_pthread_jit_write_protect(false); +} + #ifndef _WIN32 static int fcntl_op_setlk = -1; From patchwork Tue Feb 15 12:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12746987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 013FFC433EF for ; Tue, 15 Feb 2022 12:16:02 +0000 (UTC) Received: from localhost ([::1]:49510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJwkT-0008Sk-QA for qemu-devel@archiver.kernel.org; Tue, 15 Feb 2022 07:16:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJwbs-00019s-9B for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:10 -0500 Received: from [2607:f8b0:4864:20::42f] (port=39934 helo=mail-pf1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJwbp-0001YF-Mo for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:07 -0500 Received: by mail-pf1-x42f.google.com with SMTP id m22so15307770pfk.6 for ; Tue, 15 Feb 2022 04:06:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RNomxsOaTbrDgUf1dgePEps7teU/595zSAXkTRYLDj8=; b=ckvNCcK6aCdtc4YTe4N/Yw/fCMcfNIlFDbSyY2HZp3qXUe68lC1ZlHBQImo8aafPqh 9TmlHQkzUik54gkO3PfkDLvxiLNW3/Lbr3FqTBt3RqWWMgu+5avotutH8dbQCdy1/2JR QAXiUEj7rxCj5xH07kphzGiS/iPECrhmSOTrWOKCYJsmUVUlqdUYql/43z4PCSRLZS4L IDjGdkLi4QHXKio/dfnyaX9eLuA5PqEoZI3VOZTndQxBANd86Atdn9bXNjF9eCGwhPKD PUYV8dlfHl1KFM8cGreibwVg8eQBRAUcC6GbKt6853V9N1BaxDvY31VMbUaFkPcR4/3V 6dMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RNomxsOaTbrDgUf1dgePEps7teU/595zSAXkTRYLDj8=; b=nAh5qW3GhHowU7zbetf+SJWCNRiLFREvbGL1zOLvR9IF1Aujs9YE9XTMKAAxXZCS5e 8DRQJNQT4gGuQScfSro+CWvodMRkSJtnWn4nzl4Ec4mOB7OpTtlEMELK7Ub1cfIcSZ9u oyuwycm/q9xJKuVXAYuRpJ7kb15tiKwje5qK3bzIPKYCKHS7Ttj6OQda3UT+sTvJWdAI SiEnlYYANhVcW7SV74B2MXbO2cH0VwflklVHwL878l8H1VaEsAZPK+XrRvELlB6QM6tP 6/VPa41UaeSIYYMvCJlnkWnSlKiAfmxkdMUjq9sEHUXqDjcL/L/SiJIztNFcNeiyG5EB FMgQ== X-Gm-Message-State: AOAM530pylzRQIGwcabeiM8+A8QtS3XVkkqDYSCOLVC9ejO4lmqmoPYP afVQaSMjeZkinGfpD36Xa9FwiaXvrq4= X-Google-Smtp-Source: ABdhPJxcZg8ui/9+OuIRnnkYYpkpTtoYrHw+tBy7fPjO0BA8X+kBOfijrTdAHFMLdCEjlgfpWeMJ2Q== X-Received: by 2002:a63:5662:: with SMTP id g34mr3152051pgm.569.1644926815368; Tue, 15 Feb 2022 04:06:55 -0800 (PST) Received: from localhost.localdomain (71.red-83-50-68.dynamicip.rima-tde.net. [83.50.68.71]) by smtp.gmail.com with ESMTPSA id ot10sm14776256pjb.3.2022.02.15.04.06.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Feb 2022 04:06:55 -0800 (PST) To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Roman Bolshakov , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [RFC PATCH 3/4] audio: Rename coreaudio extension to use Objective-C compiler Date: Tue, 15 Feb 2022 13:06:24 +0100 Message-Id: <20220215120625.64711-4-f4bug@amsat.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org> References: <20220215120625.64711-1-f4bug@amsat.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= The coreaudio library includes Objective-C declarations (using the caret '^' symbol to declare block references [*]). When building with a C compiler we get: [175/839] Compiling C object libcommon.fa.p/audio_coreaudio.c.o In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h:18, from ../../audio/coreaudio.c:26: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardware.h:162:2: error: expected identifier or '(' before '^' token 162 | (^AudioObjectPropertyListenerBlock)( UInt32 inNumberAddresses, | ^ FAILED: libcommon.fa.p/audio_coreaudio.c.o Rename the file to use the Objective-C default extension (.m) so meson calls the correct compiler. [*] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Christian Schoenebeck --- audio/{coreaudio.c => coreaudio.m} | 0 audio/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename audio/{coreaudio.c => coreaudio.m} (100%) diff --git a/audio/coreaudio.c b/audio/coreaudio.m similarity index 100% rename from audio/coreaudio.c rename to audio/coreaudio.m diff --git a/audio/meson.build b/audio/meson.build index d9b295514f..94dab16891 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -7,7 +7,7 @@ softmmu_ss.add(files( 'wavcapture.c', )) -softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.c')) +softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.m')) softmmu_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_int.c')) audio_modules = {} From patchwork Tue Feb 15 12:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12746986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEE78C433EF for ; Tue, 15 Feb 2022 12:12:40 +0000 (UTC) Received: from localhost ([::1]:45516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJwhD-0005io-PZ for qemu-devel@archiver.kernel.org; Tue, 15 Feb 2022 07:12:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJwbs-00019q-80 for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:11 -0500 Received: from [2607:f8b0:4864:20::42b] (port=37729 helo=mail-pf1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJwbp-0001Zj-MD for qemu-devel@nongnu.org; Tue, 15 Feb 2022 07:07:07 -0500 Received: by mail-pf1-x42b.google.com with SMTP id y5so34530518pfe.4 for ; Tue, 15 Feb 2022 04:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NDlzhTd2cBTGXIahkORLBFSkJiYIgBcr8T5aNMdx3sA=; b=L9qtZn8hO3ozsMSGGZdD4zHo39uJlq2/d6XpeS8H5btcKUe5J126EZxEgr/ZUUDBxr oyQetBXWRvQBkuIBd+YPU5crkelD+AOwvkjZmbfi8Ui8LkWxEFqjMmxjVX7SDU5wXdAA Ud1zI7d83ifPFJM9t0cPtgB23Bc8MRyxv9PcoeupgySf03sB94epktfLdzV738SK1JM2 WfDD0EO124vuXFr0wWn8oeKMdSJweTokmVEoZ9dW7OGi9uKLFnmNNB/YBI8rc0KpgqEY Mrg3Rd20Nkl+0jjto1Vn66g0kRQZ8KCiAnSRDWGS2zav0ivWzUCQTcTrmhbR6dFis9uh Kv3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NDlzhTd2cBTGXIahkORLBFSkJiYIgBcr8T5aNMdx3sA=; b=uPPNHT/gtE/Wm77+o4lM6ggP7RjsAfhl1rhfVsi6FpyAP54oPAcampKKn8//wf3CBk ot2BWN55og7LiDoVdjsWUYikTO+DMg1/S9UBiT8Ls0YjPI8qohAGP1h3SYR8hoVyCTwi B79E/xak4T/e7S5kDC/GckyhDxIqD8b35jb1k+9lDIZ3aUSkbhbbza1lHB0MwVhThne6 93VSXoqkhfewf/Lp+EvHPhKi5KTcbADrAtu+o9tje1kjVRc6MRcA3mKtuxnAqkRSgbNs TfRuhX9L6e3bh6BQMm88+Pp86459pA8NiEr942ZWolbNGK6J9Y3bHi88A6w2oTUz1Rhv /c0g== X-Gm-Message-State: AOAM530nuc1H4W34pD1JIPkPnXHS4km+52gdhUOMR4ju25fvT5pIqmzm RLGm8sjcZ3s19U0FxewEV7Mj9gETqdA= X-Google-Smtp-Source: ABdhPJwlsY1PDCrMosyOoOByl50t6qlF3cNGTs9cGY3clXDgJKdQ25PgPKcbN14kp1PfMlsdp24dpg== X-Received: by 2002:a63:4813:: with SMTP id v19mr3284548pga.115.1644926823663; Tue, 15 Feb 2022 04:07:03 -0800 (PST) Received: from localhost.localdomain (71.red-83-50-68.dynamicip.rima-tde.net. [83.50.68.71]) by smtp.gmail.com with ESMTPSA id y7sm2949004pfa.213.2022.02.15.04.07.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Feb 2022 04:07:03 -0800 (PST) To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Roman Bolshakov , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [RFC PATCH 4/4] ui/cocoa: Ignore 'initializer overrides' warnings Date: Tue, 15 Feb 2022 13:06:25 +0100 Message-Id: <20220215120625.64711-5-f4bug@amsat.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220215120625.64711-1-f4bug@amsat.org> References: <20220215120625.64711-1-f4bug@amsat.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= We globally ignore the 'initializer overrides' warnings in C code since commit c1556a812a ("configure: Disable (clang) initializer-overrides warnings"). Unfortunately the ${gcc_flags} variable is not propagated to Objective-C flags ($OBJCFLAGS). Instead of reworking the configure script to test all supported C flags in Objective-C and sanitize them, ignore the warning locally with the GCC diagnostic #pragma (Clang ignores it). Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/cocoa.m b/ui/cocoa.m index 30702d31a5..8956694447 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -638,6 +638,9 @@ QemuCocoaView *cocoaView; qkbd_state_key_event(kbd, keycode, !qkbd_state_key_get(kbd, keycode)); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winitializer-overrides" + // Does the work of sending input to the monitor - (void) handleMonitorInput:(NSEvent *)event { @@ -702,6 +705,8 @@ QemuCocoaView *cocoaView; } } +#pragma GCC diagnostic pop + - (bool) handleEvent:(NSEvent *)event { if(!allow_events) {