From nobody Fri Nov 7 00:49:08 2025 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; dkim=fail; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544629782251684.4979795469433; Wed, 12 Dec 2018 07:49:42 -0800 (PST) Received: from localhost ([::1]:45694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6lZ-0005GR-6R for importer@patchew.org; Wed, 12 Dec 2018 10:49:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mv-0001Ev-FI for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mm-0000VX-CK for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:09 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:53232) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mi-0000SW-I0 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: by mail-wm1-x32b.google.com with SMTP id m1so5558969wml.2 for ; Wed, 12 Dec 2018 07:24:00 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jRDJh6n72NiOdDg9JNmVEjwMxX8xkhSqlAWWMWaV7YE=; b=VJQlunQmp0XD/TLeni7UWh67PmrgaOwY9bY1avgxkkCcUMHYRDKGh/lRileY99RYsx bC9/FrJqkvMd1bhTa/5ycAR2Ql4KljpYxbE3qBeR7TDO2AsEZlJ7aNEKv5oBReYW3NUn 4BEjJQFc1dSsFSLY17M6fqrX0ubu4C9/zNW380FnhtmZvjMhNzvFu/tcRnfBr0Tg7gVo sPzJgJ3AW32fB1RBqgvZ/Vn+DBgK6SBNaoCfnsfY2+cI7mLsAGIxkozNBfvT48JBMNwi f8BNJuj3MO5ieDwWTNa3d+upwN7/PJAAxMj9/YBcRaepV6Byt/1t8uHaIVPKeZY0Brg1 e+Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jRDJh6n72NiOdDg9JNmVEjwMxX8xkhSqlAWWMWaV7YE=; b=X40XW3A5m/Z1ocyn3WjYdHei7/Mh09BI2R79IwBsIFQGERmiOrhk/gHVP7eISQZJ1z jyGr50oUgJQ8mG25kqZOKBK6zE4FEGPG9AfxKJzU845HCRoRRuxI6uInU6OdebvcKMzL EU9F6+7Vb611o6+Hp2kuxWgGpx/LmvjqOYFAlBeTzz2TxDyJqSu2YnDya8WleeORfhlY bGhyn3kLw3blMzpD47rVxcX+j8ojJpJwXo6GX9+l3Lc784GG0xUV5bVKtJgrAGb8u16L 2vmWheHWftCc/j+Z4M5t0KRdoYaqcMd4pwpAc5J2j7+rNvqnK85mr5A4AxRwpKsdw08U s8kQ== X-Gm-Message-State: AA+aEWYJgZDPLNcnrSgehUnz8rW60ZZswbD5a7n1AR9WFQZ6OYdA7dk4 IShGcPQRaFX+jIUDW/RWi97XWxh/ X-Google-Smtp-Source: AFSGD/VArznD4Skh4cLjPqxBS117jAeEiGrV4bctCl836Vrwy6AR3SKO6BDlwTz1yEQyeTq29do9MA== X-Received: by 2002:a7b:c397:: with SMTP id s23mr4619281wmj.127.1544628239105; Wed, 12 Dec 2018 07:23:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:59 +0100 Message-Id: <1544628195-37728-39-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [PULL 38/54] includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)" 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: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since we require GCC version 4.8 or newer now, we can be sure that the builtin functions are always available on GCC. And for Clang, we can check the availablility with __has_builtin instead. Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1543937577-28256-7-git-send-email-thuth@redhat.com> --- include/qemu/compiler.h | 2 +- include/qemu/host-utils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 6f32ec2..a1e50ed 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -135,7 +135,7 @@ #define __has_builtin(x) 0 /* compatibility with non-clang compilers */ #endif =20 -#if __has_builtin(__builtin_assume_aligned) || QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_assume_aligned) || !defined(__clang__) #define HAS_ASSUME_ALIGNED #endif =20 diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 38da849..4cd170e 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -207,7 +207,7 @@ static inline int cto64(uint64_t val) */ static inline int clrsb32(uint32_t val) { -#if QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_clrsb) || !defined(__clang__) return __builtin_clrsb(val); #else return clz32(val ^ ((int32_t)val >> 1)) - 1; @@ -223,7 +223,7 @@ static inline int clrsb32(uint32_t val) */ static inline int clrsb64(uint64_t val) { -#if QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_clrsbll) || !defined(__clang__) return __builtin_clrsbll(val); #else return clz64(val ^ ((int64_t)val >> 1)) - 1; --=20 1.8.3.1