[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 2/3] ppc: Fix duplicated typedefs to be able

From: Cédric Le Goater
Subject: Re: [Qemu-devel] [PATCH v5 2/3] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
Date: Wed, 16 Jan 2019 14:29:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/16/19 12:47 PM, Thomas Huth wrote:
> On 2019-01-16 12:43, Cédric Le Goater wrote:
>> On 1/11/19 9:17 AM, Thomas Huth wrote:
>>> 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.
>> Thomas,
>> After a closer look, I think we should use 'void *' under PowerPCCPU 
>> as it was the case before I introduced the second interrupt presenter.
> If you don't like the #includes, why not simply do anonymous struct
> forward declarations here? I think that would be better than "void *".

>> That's a bigger change reverting bits of already merged patches. I can
>> take care of it if you prefer. 
> Could I keep the current patch in my series so that I can get the
> patches finally merged? You could then do any clean up that you like on
> top of it, ok?


See below the patch I would propose. Compiled tested with clang -std=gnu99.

>> I use a f29 for dev. Which compiler should I install ? 
> Any version of Clang with -std=gnu99 should do the job here, I think.

It does.



>From 0119d5b2f6fa963f5951897bbadd638f94ecdf4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <address@hidden>
Date: Wed, 16 Jan 2019 14:27:25 +0100
Subject: [PATCH] ppc: remove inclusion of hw/ppc header file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

and use struct forward declarations instead.

Signed-off-by: Cédric Le Goater <address@hidden>
 target/ppc/cpu.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index bde4dff1ba80..ca5f7f16a820 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -23,11 +23,6 @@
 #include "qemu-common.h"
 #include "qemu/int128.h"
-#include "hw/ppc/xive.h" /* for XiveTCTX */
-#include "hw/ppc/xics.h" /* for ICPState */
 #if defined (TARGET_PPC64)
@@ -1204,8 +1199,8 @@ struct PowerPCCPU {
     int32_t node_id; /* NUMA node this CPU belongs to */
     PPCHash64Options *hash64_opts;
-    ICPState *icp;
-    XiveTCTX *tctx;
+    struct ICPState *icp;
+    struct XiveTCTX *tctx;
     /* Fields related to migration compatibility hacks */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]