From patchwork Fri Apr 21 09:32:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 675852 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp757096wrs; Fri, 21 Apr 2023 02:34:17 -0700 (PDT) X-Google-Smtp-Source: AKy350Zq1rTP5781Q+zIQkKe+UHHXdsIyk2x0uarMnCXN60DZztFLtMulpx/WRGS0EsMrfs91zwD X-Received: by 2002:a05:6214:1255:b0:5ef:33af:762 with SMTP id r21-20020a056214125500b005ef33af0762mr7399365qvv.37.1682069656922; Fri, 21 Apr 2023 02:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682069656; cv=none; d=google.com; s=arc-20160816; b=v3gubxomTofLlNTdd11dh6ARgfijJrxgcXIa+T90tBINJzEvDRLH90f7IPjfbBXFmF GasU/33UTI0G1nJuGwxSRgVgwt55QVxQua3eXYhXcqUwHN9mYMBErGDgMETkjRBGM8g+ lTL11RZafBXPQJ9qZH1/1NGmAXrlz5aorF7zPWqXZwUUfiD6cMIhS9omXOyC7qQR2VtG hY9/jCTQ9qEvbbfHbmBkmtWIFqSxE2Vx1RPcO5Wydk2TzhhXMZHaicC8L2vhZUkbCTVT runCLsXIB9q2HEtqgGeqq31EGi+5PvXitqvSS1Np1mLOr1dONYoJsuEWP2bZmW91Hje/ uNww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/J2UWc60zpZAoalQ9qoSYz4mkciDC6lH/O28J3u9T3I=; b=pG5Kzc8LZh+O23iLJq+kz8xRWSlyAnsvRxhCeJn7ylI6M1l5Z4so7i9ejYhWEr8mbw DvTwAVhUraHEZ128jP0uynXaEax1sMGtT4XPz7W6fQGS2pLcku9PC95euAQZwVaMPatv SVFA20W5pK0tppkNyNpEEH655kivgLhKpGyq6Z0e4d7h8TXm1npb6QjvHMDQryZjEPsJ SNqZ9N3NqNybQ2ZIXYvGvKC2zzu4QYKwJl9vmmtuI8TBeEcTgfBzJAz3Gc+LWdW0EQyO wAYVFrRksvLWYQbZhTcAGjzKkAbQL+CZ9eegZBGjLLTCOZWYszOBMxtA8pZRAXbwPYIm i5Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GYnwkO52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c140-20020a379a92000000b0074e0f023ec2si2663620qke.290.2023.04.21.02.34.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Apr 2023 02:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GYnwkO52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppn98-0008Eh-O7; Fri, 21 Apr 2023 05:33:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppn94-0008Dt-7H for qemu-devel@nongnu.org; Fri, 21 Apr 2023 05:33:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppn92-00032P-Qp for qemu-devel@nongnu.org; Fri, 21 Apr 2023 05:33:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682069612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/J2UWc60zpZAoalQ9qoSYz4mkciDC6lH/O28J3u9T3I=; b=GYnwkO523EAXZmqcOxTTwFlTJsmyHVFhuDLySht983dTva6bwvTMNvsF6muMF2OkKQc141 YrdqDp8EsgUhFFgjZx+wm07c3Bz8FoUmomyjrXqm2+zTBL098GOWO/RsH4uXRS7gPvZ54Z IgHNMjU2syNOhW7EzTAXoAjF469OW1g= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-4sfXuyOMN1S2owA3Hz700w-1; Fri, 21 Apr 2023 05:33:30 -0400 X-MC-Unique: 4sfXuyOMN1S2owA3Hz700w-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5069f2ae8eeso7117200a12.0 for ; Fri, 21 Apr 2023 02:33:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682069609; x=1684661609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/J2UWc60zpZAoalQ9qoSYz4mkciDC6lH/O28J3u9T3I=; b=hXi2B9J8j7IqGJ2UMn3qaWg+8Enbrx4gfv1TUSzzZ2ErLiDIamuHRK9KoymvxWa1Sz PFCWkSK3hYXXsXXwQS6Nz1Z3pvjKsuJXHpZHYoJVnGUyIh+ji+hWoASpkCCC6wkw+Nib T6oA5UJ5oaLwdjwSA7LYboSxl8q4Uig+tCPvgPJTsCTUuCjqInT/Im9oTpfLxBipvi7w m5NmftDp1ZxouZp9inPZI9Gze5zY7yoVI6GqZRWY0oCgkoI4jkYd/JVS1JH2TEHgD8Yl 3zC4wJGtf9HflrE0QSqspx/1Immn442CvpWadmF9JajsIy93M6H7K+eINozTgoEp6Ss0 9bxg== X-Gm-Message-State: AAQBX9f0oG9Uh0j9Y386IXn5FfHmSd7jNEryQp7LZZqRfkC84nxUWhLl 1umsmp6hFT3T4rrxom2nFG+98ZJsJFirtKYydqCs3sZGg3pSifnUDSRhgPrnklSzlvOX4Nfbztr 96QvAhex1ekd6kz0xPx3LPNHOKjJi479uAGpDIv5oL8vAvdrgdINthjAHfGqrQDIhKDGAwMKTxA NV4g== X-Received: by 2002:a17:906:a007:b0:933:4d47:55b7 with SMTP id p7-20020a170906a00700b009334d4755b7mr1777269ejy.2.1682069609057; Fri, 21 Apr 2023 02:33:29 -0700 (PDT) X-Received: by 2002:a17:906:a007:b0:933:4d47:55b7 with SMTP id p7-20020a170906a00700b009334d4755b7mr1777258ejy.2.1682069608735; Fri, 21 Apr 2023 02:33:28 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id i15-20020a1709061e4f00b0094f3d700868sm1826389ejj.80.2023.04.21.02.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 02:33:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 08/25] target/i386: Avoid unreachable variable declaration in mmu_translate() Date: Fri, 21 Apr 2023 11:32:59 +0200 Message-Id: <20230421093316.17941-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230421093316.17941-1-pbonzini@redhat.com> References: <20230421093316.17941-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Coverity complains (CID 1507880) that the declaration "int error_code;" in mmu_translate() is unreachable code. Since this is only a declaration, this isn't actually a bug, but: * it's a bear-trap for future changes, because if it was changed to include an initialization 'int error_code = foo;' then the initialization wouldn't actually happen (being dead code) * it's against our coding style, which wants declarations to be at the start of blocks * it means that anybody reading the code has to go and look up exactly what the C rules are for skipping over variable declarations using a goto Move the declaration to the top of the function. Signed-off-by: Peter Maydell Message-Id: <20230406155946.3362077-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- target/i386/tcg/sysemu/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index e87f90dbe3c7..b5f0abffa3de 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -147,6 +147,7 @@ static bool mmu_translate(CPUX86State *env, const TranslateParams *in, hwaddr pte_addr, paddr; uint32_t pkr; int page_size; + int error_code; restart_all: rsvd_mask = ~MAKE_64BIT_MASK(0, env_archcpu(env)->phys_bits); @@ -467,7 +468,6 @@ do_check_protect_pse36: out->page_size = page_size; return true; - int error_code; do_fault_rsvd: error_code = PG_ERROR_RSVD_MASK; goto do_fault_cont; From patchwork Fri Apr 21 09:33:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 675853 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp758400wrs; Fri, 21 Apr 2023 02:38:17 -0700 (PDT) X-Google-Smtp-Source: AKy350a6cIP1Mr4NhMjlupP4l//iMEXhLkzf3SbZ1Zsbs/MWJLFcphEa6N2innYXuA59ohb4FqGC X-Received: by 2002:ac8:5f14:0:b0:3d8:2352:a661 with SMTP id x20-20020ac85f14000000b003d82352a661mr996873qta.3.1682069897725; Fri, 21 Apr 2023 02:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682069897; cv=none; d=google.com; s=arc-20160816; b=IVoeoaKNPJKCtRWcnUbwlihMeawgxO/V1iPi4yV7qrM+/zeQSmLUnv8+z3E2owGBbe V9mRj2OORKzthg1bKVqEhkT4g37HtC+7n6GptFHYrZKyHD2WkP3iU4Zv3qeqzv1TPYbm udKPDwu0LEabC6FASJ197gnw0egTfwX7WNlEtFZkrF03fA2gFY2hHf+xZTa6jbMEw8I3 3HD8duv7l4LIIf2m5FgRX5HoPxeVRpIoLy8TlgUeV5f7sDeLcXI7AyreYCyzaEXdlSJl LXVRJHZvB42p3OChnmNCzqQV08OxmL93mpH6Bxb/s9i1LEB7PuO+kARXox1G279wZZlb sq3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gJKGv83T2S7mG0eDuSjytY2fJO/y/FRyf9NVrDOvjxE=; b=DkNe5xY8Yvr8SeiZhI/h8Nr6KAWP4Eg3AufnrpJ/TN4BxjeVZN/Vj0BEqNLSbzOLXp yr2CcvCKgjSsPuJNMVv669e4nxCy74xpDePWjY1zm/DPv+Ln9K14pb7RjuvUuZI+/Q0Q qmLugVKHv8L3U3UyrnDhwKIx7yLIp/I/Y09r81MD6/XLTPJG0K0De/7ebBflBAWUBVq/ Xga17k87+BDrl9Vjw6dmXl7BL9eLe9NMxpH9zS/YSuTY27KPAdUMOXMfxvMiNgDb3oo0 6HjagPodTEHl6d5TimEic2CECBs2VJ0WfcJTn2sOze4qlh68SL9fRe0iWURl0/LKCKSl idZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="A/OWeHPx"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g12-20020ac87f4c000000b003ed330f5d3dsi3001923qtk.678.2023.04.21.02.38.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Apr 2023 02:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="A/OWeHPx"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppn9R-0008WP-NO; Fri, 21 Apr 2023 05:33:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppn9Q-0008VF-1y for qemu-devel@nongnu.org; Fri, 21 Apr 2023 05:33:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppn9N-00035m-JS for qemu-devel@nongnu.org; Fri, 21 Apr 2023 05:33:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682069633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJKGv83T2S7mG0eDuSjytY2fJO/y/FRyf9NVrDOvjxE=; b=A/OWeHPx2OpudQ8gf/ApT26AfpmgNpRA0bxU0yIEJKzPMC3XWw5ctXh/kG3AkaVP1lAcKk +TtETjadfKmmXbWf3ImCsZ6yx6FlePId/AM57GBK1xQbHrLk4OKxJkUPE9F5rA0ieEO8qT FQJq1rHF2R9uABmz0mAV9Vmk7O3iq+s= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-F4vNWVX6O1yN12oDbydqEA-1; Fri, 21 Apr 2023 05:33:51 -0400 X-MC-Unique: F4vNWVX6O1yN12oDbydqEA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94f271ebbc2so148724766b.2 for ; Fri, 21 Apr 2023 02:33:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682069630; x=1684661630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gJKGv83T2S7mG0eDuSjytY2fJO/y/FRyf9NVrDOvjxE=; b=VlEts0HWywG54MVfLCEw6B/43yKygtY2b266Od/UA+ejQ3Tl8HGE7F5u20cmsTDP83 jBErgPpSs0g59bAeeqEw23TEW92z7GD2eqweqbPgK2hqs8W99Gyf6CYfOSc33ZJBfJyb nm/TWRNkqYwtzRddlwpQ8SrSW7A+snDbAS31iGjlGgF7GnQClGP1oddhz/9PI3jwSvox ww/BFtI8p2ZiYJtWXx8QmyTUYlmiykcHFm+nDQYVYlwFRV+ezkM1YtoW0mhuYZ24g5SY Y6R3MYPR7Gz1nNpffiIffA8dA4phd80BcjP8pK/iVww/VfRZg3urmQqONgpZZjBq4gqS VXSA== X-Gm-Message-State: AAQBX9eauwW2sFctDW4d91WmhDuRdhDyLzRIkltZvAAYvEmXEvbcamU8 VFEjR6YV8gR5jlBrQkgwXzhrDCA7CQzNytVyhp/IOIfapKleqFGl6l53XVh/JMsB8lUw4gwfTEL ILKaenist2JX0BriU8HImNc6ieMyWEYGB/trmkwWbK0Ok73+FxRBdBHw7gi0as6NMy+yujX5+aF dUgQ== X-Received: by 2002:a17:906:40f:b0:94f:a8fd:b69f with SMTP id d15-20020a170906040f00b0094fa8fdb69fmr1851182eja.18.1682069629855; Fri, 21 Apr 2023 02:33:49 -0700 (PDT) X-Received: by 2002:a17:906:40f:b0:94f:a8fd:b69f with SMTP id d15-20020a170906040f00b0094fa8fdb69fmr1851170eja.18.1682069629555; Fri, 21 Apr 2023 02:33:49 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id r2-20020a1709063d6200b00949691d3183sm1830140ejf.36.2023.04.21.02.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 02:33:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler Date: Fri, 21 Apr 2023 11:33:14 +0200 Message-Id: <20230421093316.17941-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230421093316.17941-1-pbonzini@redhat.com> References: <20230421093316.17941-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Currently when configure picks an ObjectiveC compiler it doesn't pay attention to the cross-prefix. This isn't a big deal in practice, because we only use ObjC on macos and you can't cross-compile to macos. But it's a bit inconsistent. Rearrange the handling of objcc in configure so that we do the same thing that we do with cc and cxx. This means that the logic for picking the ObjC compiler goes from: if --objcc is specified, use that otherwise if clang is available, use that otherwise use $cc to: if --objcc is specified, use that otherwise if --cross-prefix is specified, use ${cross_prefix}clang otherwise if clang is available, use that otherwise use $cc Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1185 Signed-off-by: Peter Maydell Message-Id: <20230418161554.744834-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- configure | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 22b8553b8d70..77c03315f820 100755 --- a/configure +++ b/configure @@ -316,6 +316,8 @@ for opt do ;; --cxx=*) CXX="$optarg" ;; + --objcc=*) objcc="$optarg" + ;; --cpu=*) cpu="$optarg" ;; --extra-cflags=*) @@ -361,6 +363,21 @@ else cxx="${CXX-${cross_prefix}g++}" fi +# Preferred ObjC compiler: +# $objcc (if set, i.e. via --objcc option) +# ${cross_prefix}clang (if cross-prefix specified) +# clang (if available) +# $cc +if test -z "${objcc}${cross_prefix}"; then + if has clang; then + objcc=clang + else + objcc="$cc" + fi +else + objcc="${objcc-${cross_prefix}clang}" +fi + ar="${AR-${cross_prefix}ar}" as="${AS-${cross_prefix}as}" ccas="${CCAS-$cc}" @@ -647,13 +664,6 @@ do fi done -# Default objcc to clang if available, otherwise use CC -if has clang; then - objcc=clang -else - objcc="$cc" -fi - if test "$mingw32" = "yes" ; then EXESUF=".exe" # MinGW needs -mthreads for TLS and macro _MT. @@ -713,7 +723,7 @@ for opt do ;; --cxx=*) ;; - --objcc=*) objcc="$optarg" + --objcc=*) ;; --make=*) make="$optarg" ;;