From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
pbonzini@redhat.com, qemu-ppc@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>, "Greg Kurz" <groug@kaod.org>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH v5 2/3] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
Date: Fri, 11 Jan 2019 09:17:51 +0100 [thread overview]
Message-ID: <1547194672-24169-3-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1547194672-24169-1-git-send-email-thuth@redhat.com>
When compiling the ppc code with clang and -std=gnu99, there are a
couple of warnings/errors like this one:
CC ppc64-softmmu/hw/intc/xics.o
In file included from hw/intc/xics.c:35:
include/hw/ppc/xics.h:43:25: error: redefinition of typedef 'ICPState' is a C11 feature
[-Werror,-Wtypedef-redefinition]
typedef struct ICPState ICPState;
^
target/ppc/cpu.h:1181:25: note: previous definition is here
typedef struct ICPState ICPState;
^
Work around the problems by including the proper headers instead.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
include/hw/ppc/spapr.h | 5 +++--
include/hw/ppc/spapr_xive.h | 2 --
target/ppc/cpu.h | 13 +++++++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 9e01a5a..a947a0a 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -8,15 +8,16 @@
#include "hw/mem/pc-dimm.h"
#include "hw/ppc/spapr_ovec.h"
#include "hw/ppc/spapr_irq.h"
+#include "hw/ppc/spapr_xive.h" /* For sPAPRXive */
+#include "hw/ppc/xics.h" /* For ICSState */
struct VIOsPAPRBus;
struct sPAPRPHBState;
struct sPAPRNVRAM;
+
typedef struct sPAPREventLogEntry sPAPREventLogEntry;
typedef struct sPAPREventSource sPAPREventSource;
typedef struct sPAPRPendingHPT sPAPRPendingHPT;
-typedef struct ICSState ICSState;
-typedef struct sPAPRXive sPAPRXive;
#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 7fdc250..9bec919 100644
--- a/include/hw/ppc/spapr_xive.h
+++ b/include/hw/ppc/spapr_xive.h
@@ -41,8 +41,6 @@ bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi);
bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn);
void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
-typedef struct sPAPRMachineState sPAPRMachineState;
-
void spapr_xive_hcall_init(sPAPRMachineState *spapr);
void spapr_dt_xive(sPAPRMachineState *spapr, uint32_t nr_servers, void *fdt,
uint32_t phandle);
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 486abaf..bde4dff 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -23,6 +23,11 @@
#include "qemu-common.h"
#include "qemu/int128.h"
+#ifndef CONFIG_USER_ONLY
+#include "hw/ppc/xive.h" /* for XiveTCTX */
+#include "hw/ppc/xics.h" /* for ICPState */
+#endif
+
//#define PPC_EMULATE_32BITS_HYPV
#if defined (TARGET_PPC64)
@@ -1177,8 +1182,6 @@ do { \
typedef struct PPCVirtualHypervisor PPCVirtualHypervisor;
typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
-typedef struct XiveTCTX XiveTCTX;
-typedef struct ICPState ICPState;
/**
* PowerPCCPU:
@@ -1197,11 +1200,13 @@ struct PowerPCCPU {
int vcpu_id;
uint32_t compat_pvr;
PPCVirtualHypervisor *vhyp;
- ICPState *icp;
- XiveTCTX *tctx;
void *machine_data;
int32_t node_id; /* NUMA node this CPU belongs to */
PPCHash64Options *hash64_opts;
+#ifndef CONFIG_USER_ONLY
+ ICPState *icp;
+ XiveTCTX *tctx;
+#endif
/* Fields related to migration compatibility hacks */
bool pre_2_8_migration;
--
1.8.3.1
next prev parent reply other threads:[~2019-01-11 8:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 8:17 [Qemu-devel] [PATCH v5 0/3] Force the C standard to gnu99 Thomas Huth
2019-01-11 8:17 ` [Qemu-devel] [PATCH v5 1/3] ppc: Move spapr-related prototypes from xics.h into a seperate header file Thomas Huth
2019-01-11 9:22 ` Daniel P. Berrangé
2019-01-11 12:58 ` Philippe Mathieu-Daudé
2019-01-11 8:17 ` Thomas Huth [this message]
2019-01-11 8:30 ` [Qemu-devel] [PATCH v5 2/3] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Cédric Le Goater
2019-01-11 8:40 ` Greg Kurz
2019-01-11 9:22 ` Daniel P. Berrangé
2019-01-11 12:59 ` Philippe Mathieu-Daudé
2019-01-16 11:43 ` Cédric Le Goater
2019-01-16 11:47 ` Thomas Huth
2019-01-16 13:23 ` Greg Kurz
2019-01-16 13:44 ` Thomas Huth
2019-01-16 15:11 ` Greg Kurz
2019-01-16 17:26 ` Cédric Le Goater
2019-01-16 13:29 ` Cédric Le Goater
2019-01-17 7:01 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2019-01-17 7:58 ` Greg Kurz
2019-01-17 8:02 ` Cédric Le Goater
2019-01-11 8:17 ` [Qemu-devel] [PATCH v5 3/3] configure: Force the C standard to gnu99 Thomas Huth
2019-01-11 8:44 ` Greg Kurz
2019-01-11 9:23 ` Daniel P. Berrangé
2019-01-11 10:55 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1547194672-24169-3-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).