From nobody Sat Apr 27 07:05:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1591089392; cv=none; d=zohomail.com; s=zohoarc; b=Q8J14/QRg4ghWJi7CDXuVyNvDON9CvxVA2+2AWNM8MOF3d0HnUank5jBwS6hQlVzQs6hs8V/cYlmqgbE9jmkroGCqsd0PmSr8GtTdQ05e5XBkahiJoeWPsqRunvgQo0GDkQlrNmz0BAMDB6CHD3vnlem96PjQBhJwpZFJhofS3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591089392; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=I108qWnifZ7wEuqYnIztwGUyZLJq9NEKkcR5sNBfAB0=; b=J3kO3hNI5F+5tuTM6KznYiM+ySereWu8ARD+qxNxr21BNMUIRnZ0PIO9ze8RvTEMKdnu+MNgdIcA6RYbmk2fUd0XdEzJLsvonsLfYdAqkXh0oKU4886mGBMtWPCxcgUiNWS8+nbm8BgrMqDtcN05+KL7qYKIrnT5qtzNznyzLmw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1591089392489190.30826814526665; Tue, 2 Jun 2020 02:16:32 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jg31t-0004eW-NM; Tue, 02 Jun 2020 09:16:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jg31s-0004eM-KX for xen-devel@lists.xenproject.org; Tue, 02 Jun 2020 09:16:16 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b5c946c0-a4b1-11ea-81bc-bc764e2007e4; Tue, 02 Jun 2020 09:16:15 +0000 (UTC) X-Inumbo-ID: b5c946c0-a4b1-11ea-81bc-bc764e2007e4 Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: ObfmshO7MUpzAWv2u8Tp58LY3B3Q9QKxgtTNAyWosXS7LDQCkbivotRG3MRGwc+YNaAvaZvWTQ 5Sx0/JXs6y6vG60NaqS8glmGLtcyhleJSLD+//uB3jYxqM4rBfgwQPsZXyn/coQAs2X+Qs75DU QwaqDRnYYvMjbFBSG6Rw4YDXOlNAg0Hj9At2jCVA31Y9EApJaLXm+i6HqkrNa/6mzVHrVNzYDu +W3G5BpR6V/0uXSZJM3KLUYlopxLX/YmBKMOq//9QX9K/M5U9ZRt6FfL60/D56WrtVyjatdI6N HI8= X-SBRS: 2.7 X-MesageID: 19254563 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,463,1583211600"; d="scan'208";a="19254563" From: Roger Pau Monne To: Subject: [PATCH for-4.14] compilers/clang: always use _Static_assert with clang Date: Tue, 2 Jun 2020 11:16:02 +0200 Message-ID: <20200602091602.38422-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , paul@xen.org, Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" All versions of clang used by Xen support _Static_assert, so use it unconditionally when building Xen with clang. No functional change expected. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Andrew Cooper Reviewed-by: Wei Liu --- Not sure whether this fully qualifies as a bugfix, as the current behavior should also work fine under clang. Note that all versions of clang from 3.5 to trunk (11) seem to return __GNUC__ =3D=3D 4 and __GNUC_MINOR__ =3D=3D 2. --- xen/include/xen/lib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index e5b0a007b8..076bcfb67d 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -25,7 +25,9 @@ #define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0) #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0) =20 -#if __GNUC__ > 4 || (__GNUC__ =3D=3D 4 && __GNUC_MINOR__ >=3D 6) +/* All clang versions supported by Xen have _Static_assert. */ +#if defined(__clang__) || \ + (__GNUC__ > 4 || (__GNUC__ =3D=3D 4 && __GNUC_MINOR__ >=3D 6)) /* Force a compilation error if condition is true */ #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); }) =20 --=20 2.26.2