From nobody Sat Apr 27 11:27:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 154705285742171.83169069265477; Wed, 9 Jan 2019 08:54:17 -0800 (PST) Received: from localhost ([127.0.0.1]:36791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghH7Q-0002jH-Cu for importer@patchew.org; Wed, 09 Jan 2019 11:54:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghGtV-0000Im-9B for qemu-devel@nongnu.org; Wed, 09 Jan 2019 11:39:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghGtT-0005A0-A3 for qemu-devel@nongnu.org; Wed, 09 Jan 2019 11:39:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghGtR-00058c-BL; Wed, 09 Jan 2019 11:39:50 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47F50A7883; Wed, 9 Jan 2019 16:39:47 +0000 (UTC) Received: from thuth.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA9BB5D76B; Wed, 9 Jan 2019 16:39:45 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 17:39:35 +0100 Message-Id: <1547051976-13982-2-git-send-email-thuth@redhat.com> In-Reply-To: <1547051976-13982-1-git-send-email-thuth@redhat.com> References: <1547051976-13982-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 09 Jan 2019 16:39:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] include/hw/ppc: Fix compilation with clang -std=gnu99 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, Markus Armbruster , qemu-ppc@nongnu.org, pbonzini@redhat.com, Richard Henderson 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" When compiling with Clang and -std=3Dgnu99, I get the following errors: CC ppc64-softmmu/hw/intc/xics_spapr.o In file included from hw/intc/xics_spapr.c:34: include/hw/ppc/xics.h:46:25: error: redefinition of typedef 'ICSState' is a= C11 feature [-Werror,-Wtypedef-redefinition] typedef struct ICSState ICSState; ^ include/hw/ppc/spapr.h:18:25: note: previous definition is here typedef struct ICSState ICSState; ^ In file included from hw/intc/xics_spapr.c:34: include/hw/ppc/xics.h:203:34: error: redefinition of typedef 'sPAPRMachineS= tate' is a C11 feature [-Werror,-Wtypedef-redefinition] typedef struct sPAPRMachineState sPAPRMachineState; ^ include/hw/ppc/spapr_irq.h:25:34: note: previous definition is here typedef struct sPAPRMachineState sPAPRMachineState; ^ CC ppc64-softmmu/hw/intc/spapr_xive.o In file included from hw/intc/spapr_xive.c:19: include/hw/ppc/spapr_xive.h:38:3: error: redefinition of typedef 'sPAPRXive= ' is a C11 feature [-Werror,-Wtypedef-redefinition] } sPAPRXive; ^ include/hw/ppc/spapr.h:20:26: note: previous definition is here typedef struct sPAPRXive sPAPRXive; ^ In file included from hw/intc/spapr_xive.c:19: include/hw/ppc/spapr_xive.h:45:34: error: redefinition of typedef 'sPAPRMac= hineState' is a C11 feature [-Werror,-Wtypedef-redefinition] typedef struct sPAPRMachineState sPAPRMachineState; ^ include/hw/ppc/spapr_irq.h:25:34: note: previous definition is here typedef struct sPAPRMachineState sPAPRMachineState; ^ CC ppc64-softmmu/hw/char/spapr_vty.o In file included from hw/char/spapr_vty.c:8: In file included from include/hw/ppc/spapr.h:12: include/hw/ppc/spapr_xive.h:45:34: error: redefinition of typedef 'sPAPRMac= hineState' is a C11 feature [-Werror,-Wtypedef-redefinition] typedef struct sPAPRMachineState sPAPRMachineState; ^ include/hw/ppc/spapr_irq.h:25:34: note: previous definition is here typedef struct sPAPRMachineState sPAPRMachineState; ^ Since we're going to make -std=3Dgnu99 mandatory, fix these issues by including the right header files indead of typedeffing stuff twice. Signed-off-by: Thomas Huth Reviewed-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr.h | 4 ++-- include/hw/ppc/spapr_xive.h | 2 +- include/hw/ppc/xics.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 2c77a8b..6a5ae4f 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -8,6 +8,8 @@ #include "hw/mem/pc-dimm.h" #include "hw/ppc/spapr_ovec.h" #include "hw/ppc/spapr_irq.h" +#include "hw/ppc/xics.h" +#include "hw/ppc/spapr_xive.h" =20 struct VIOsPAPRBus; struct sPAPRPHBState; @@ -15,8 +17,6 @@ struct sPAPRNVRAM; typedef struct sPAPREventLogEntry sPAPREventLogEntry; typedef struct sPAPREventSource sPAPREventSource; typedef struct sPAPRPendingHPT sPAPRPendingHPT; -typedef struct ICSState ICSState; -typedef struct sPAPRXive sPAPRXive; =20 #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL #define SPAPR_ENTRY_POINT 0x100 diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 728735d..aff4366 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -42,7 +42,7 @@ bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn); void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon); qemu_irq spapr_xive_qirq(sPAPRXive *xive, uint32_t lisn); =20 -typedef struct sPAPRMachineState sPAPRMachineState; +#include "hw/ppc/spapr.h" /* for sPAPRMachineState */ =20 void spapr_xive_hcall_init(sPAPRMachineState *spapr); void spapr_dt_xive(sPAPRMachineState *spapr, uint32_t nr_servers, void *fd= t, diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 14afda1..a7f49a4 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -47,6 +47,8 @@ typedef struct ICSState ICSState; typedef struct ICSIRQState ICSIRQState; typedef struct XICSFabric XICSFabric; =20 +#include "hw/ppc/spapr.h" + #define TYPE_ICP "icp" #define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) =20 @@ -200,8 +202,6 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon); void ics_resend(ICSState *ics); void icp_resend(ICPState *ss); =20 -typedef struct sPAPRMachineState sPAPRMachineState; - void spapr_dt_xics(sPAPRMachineState *spapr, uint32_t nr_servers, void *fd= t, uint32_t phandle); int xics_kvm_init(sPAPRMachineState *spapr, Error **errp); --=20 1.8.3.1 From nobody Sat Apr 27 11:27:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 15470527292201010.5355436533453; Wed, 9 Jan 2019 08:52:09 -0800 (PST) Received: from localhost ([127.0.0.1]:36274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghH5M-0001KS-8D for importer@patchew.org; Wed, 09 Jan 2019 11:52:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghGtW-0000Jr-9Y for qemu-devel@nongnu.org; Wed, 09 Jan 2019 11:39:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghGtV-0005B7-Fm for qemu-devel@nongnu.org; Wed, 09 Jan 2019 11:39:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49942) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghGtV-00059s-9N; Wed, 09 Jan 2019 11:39:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D227FA96F7; Wed, 9 Jan 2019 16:39:50 +0000 (UTC) Received: from thuth.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id E81735D75D; Wed, 9 Jan 2019 16:39:47 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 17:39:36 +0100 Message-Id: <1547051976-13982-3-git-send-email-thuth@redhat.com> In-Reply-To: <1547051976-13982-1-git-send-email-thuth@redhat.com> References: <1547051976-13982-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 09 Jan 2019 16:39:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/2] configure: Force the C standard to gnu99 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, Markus Armbruster , qemu-ppc@nongnu.org, pbonzini@redhat.com, Richard Henderson 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" Different versions of GCC and Clang use different versions of the C standar= d. This repeatedly caused problems already, e.g. with duplicated typedefs: https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg05829.html or with for-loop variable initializers: https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00237.html To avoid these problems, we should enforce the C language version to the same level for all compilers. Since our minimum compiler versions is GCC v4.8, our best option is "gnu99" for C code right now ("gnu17" is not available there yet, and "gnu11" is marked as "experimental"), and "gnu++98" for the few C++ code that we have in the repository. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- v3: Compile C++ code with -std=3Dgnu++98 configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b9f34af..448dbc8 100755 --- a/configure +++ b/configure @@ -107,6 +107,9 @@ update_cxxflags() { -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ -Wold-style-declaration|-Wold-style-definition|-Wredundant-dec= ls) ;; + -std=3Dgnu99) + QEMU_CXXFLAGS=3D${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=3Dg= nu++98" + ;; *) QEMU_CXXFLAGS=3D${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg ;; @@ -585,7 +588,7 @@ ARFLAGS=3D"${ARFLAGS-rv}" # left shift of signed integers is well defined and has the expected # 2s-complement style results. (Both clang and gcc agree that it # provides these semantics.) -QEMU_CFLAGS=3D"-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" +QEMU_CFLAGS=3D"-fno-strict-aliasing -fno-common -fwrapv -std=3Dgnu99 $QEMU= _CFLAGS" QEMU_CFLAGS=3D"-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CF= LAGS" QEMU_CFLAGS=3D"-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS=3D"-D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE = $QEMU_CFLAGS" --=20 1.8.3.1