From nobody Sun May 5 22:05:08 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543574739109994.20802464696; Fri, 30 Nov 2018 02:45:39 -0800 (PST) Received: from localhost ([::1]:59296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSgIk-0001TH-1g for importer@patchew.org; Fri, 30 Nov 2018 05:45:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSgGy-0000WL-Kh for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:43:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSgGv-0004q6-El for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:43:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43056) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSgGv-0004pu-8U for qemu-devel@nongnu.org; Fri, 30 Nov 2018 05:43:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B78F40F06; Fri, 30 Nov 2018 10:43:44 +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 26B1E600CC; Fri, 30 Nov 2018 10:43:42 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 11:43:40 +0100 Message-Id: <1543574620-17506-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 30 Nov 2018 10:43:44 +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 for-4.0] compiler.h: Add an explicit check for the compiler version 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: pbonzini@redhat.com, Richard Henderson , peter.maydell@linaro.org 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" The questions about our minimum compiler requirement pops up every couple of months, and we then have to recall the details each time. So let's document this in a proper way, by adding a comment and check for the right compiler version to our compiler.h header. Signed-off-by: Thomas Huth --- include/qemu/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index ca9bc85..775446b 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -22,6 +22,14 @@ # define QEMU_GNUC_PREREQ(maj, min) 0 #endif =20 +/* + * We need at least GCC 4.1 for atomics support. Clang also supports these, + * and reports itself as GCC 4.2, so it passes this check, too. + */ +#if !QEMU_GNUC_PREREQ(4, 1) +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer +#endif + #define QEMU_NORETURN __attribute__ ((__noreturn__)) =20 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) --=20 1.8.3.1