From nobody Mon Apr 29 13:31:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543574106619689.7930057993315; Fri, 30 Nov 2018 02:35:06 -0800 (PST) Received: from localhost ([::1]:59255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSg8R-0004Xk-FB for importer@patchew.org; Fri, 30 Nov 2018 05:34:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSg75-0003Wf-Ea for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:33:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSg70-0007MR-Ta for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:33:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39164) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSg6z-0007Je-7s for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:33:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC0A73004406; Fri, 30 Nov 2018 10:33:27 +0000 (UTC) Received: from thuth.com (ovpn-116-167.ams2.redhat.com [10.36.116.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82AFA19743; Fri, 30 Nov 2018 10:33:26 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 11:33:23 +0100 Message-Id: <1543574003-25845-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 30 Nov 2018 10:33:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH maybe-for-3.1?] linux-user: Fix compilation with clang 3.4 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Clang version 3.4.2 does not know the -Wpragmas option yet and bails out with an error when we try to disable it in linux-user/qemu.h. Fortunately, clang has a __has_warning() macro which allows us to add an explicit check for this option to fix this issue. Fixes: 850d5e330a9c68cc998cecc02caf8a3c8d1ee8a3 Signed-off-by: Thomas Huth --- Today, I noticed that building the linux-user targets is currently also not working with Clang 3.4 anymore ... so in case we will roll out 3.1-rc4, I think this patch should be considered, too. Otherwise, this certainly does not justify another rc, so it can also be added later via stable. include/qemu/compiler.h | 4 ++++ linux-user/qemu.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 6b92710..ca9bc85 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -119,6 +119,10 @@ #define GCC_FMT_ATTR(n, m) #endif =20 +#ifndef __has_warning +#define __has_warning(x) 0 /* compatibility with non-clang compilers */ +#endif + #ifndef __has_feature #define __has_feature(x) 0 /* compatibility with non-clang compilers */ #endif diff --git a/linux-user/qemu.h b/linux-user/qemu.h index dd5771c..c7b3c37 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -481,7 +481,7 @@ static inline int access_ok(int type, abi_ulong addr, a= bi_ulong size) * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83256 -- so we only * include the warning-suppression pragmas for clang */ -#ifdef __clang__ +#if defined(__clang__) && __has_warning("-Wpragmas") #define PRAGMA_DISABLE_PACKED_WARNING \ _Pragma("GCC diagnostic push"); \ _Pragma("GCC diagnostic ignored \"-Wpragmas\""); \ --=20 1.8.3.1