Skip to contentSkip to conversation

hw/rdma: another clang compilation fix

PATCH In review Marcel Apfelbaum 3 participants 5 messages Feb 14, 2019 – Feb 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/rdma: another clang compilation fix

Configuring QEMU with:
configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]

   } RdmaDeviceResources;
     ^

qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

---
 hw/rdma/rdma_rm_defs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +2 -2
index 0ba61d1838..5e877c1fd9 100644
@@ -96,7 +96,7 @@ typedef struct RdmaRmPort {
     enum ibv_port_state state;
 } RdmaRmPort;
 
-typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
     RdmaRmPort port;
     RdmaRmResTbl pd_tbl;
     RdmaRmResTbl mr_tbl;
@@ -105,6 +105,6 @@ typedef struct RdmaDeviceResources {
     RdmaRmResTbl cq_tbl;
     RdmaRmResTbl cqe_ctx_tbl;
     GHashTable *qp_hash; /* Keeps mapping between real and emulated */
-} RdmaDeviceResources;
+};
 
 #endif
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 31 lines · Marcel Apfelbaum

Configuring QEMU with:

   configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
   qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]
   } RdmaDeviceResources;
     ^
   qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here
   typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

---
 hw/rdma/rdma_rm_defs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +1 -1
index 0ba61d1838..5e877c1fd9 100644
@@ -96,7 +96,7 @@ typedef struct RdmaRmPort {
     enum ibv_port_state state;
 } RdmaRmPort;
 
-typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
     RdmaRmPort port;
     RdmaRmResTbl pd_tbl;
     RdmaRmResTbl mr_tbl;

hw/rdma/rdma_rm_defs.h typedef struct RdmaDeviceResources { · line 110

Quoted 7 lines
hw/rdma/rdma_rm_defs.h +1 -1
@@ -105,6 +105,6 @@ typedef struct RdmaDeviceResources {
     RdmaRmResTbl cq_tbl;
     RdmaRmResTbl cqe_ctx_tbl;
     GHashTable *qp_hash; /* Keeps mapping between real and emulated */
-} RdmaDeviceResources;
+};
 
 #endif
#2 lore raw
In reply to Marcel Apfelbaum

Thanks,
Marcel

Quoted 37 lines · Marcel Apfelbaum

Configuring QEMU with:

    configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
    qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]
    } RdmaDeviceResources;
      ^
    qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here
    typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

---
  hw/rdma/rdma_rm_defs.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +2 -2
index 0ba61d1838..5e877c1fd9 100644
@@ -96,7 +96,7 @@ typedef struct RdmaRmPort {
      enum ibv_port_state state;
  } RdmaRmPort;
 
-typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
      RdmaRmPort port;
      RdmaRmResTbl pd_tbl;
      RdmaRmResTbl mr_tbl;
@@ -105,6 +105,6 @@ typedef struct RdmaDeviceResources {
      RdmaRmResTbl cq_tbl;
      RdmaRmResTbl cqe_ctx_tbl;
      GHashTable *qp_hash; /* Keeps mapping between real and emulated */
-} RdmaDeviceResources;
+};
 
  #endif
#3 lore raw
Quoted 2 lines · Marcel Apfelbaum

I doubt this is a security issue worth Cc'ing qemu-stable :)

Quoted 18 lines

Thanks,
Marcel

Quoted 14 lines · Marcel Apfelbaum

Configuring QEMU with:
    configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma Results in:
    qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition] } RdmaDeviceResources;
      ^
    qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here
    typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

Quoted 25 lines
Quoted 23 lines

---
  hw/rdma/rdma_rm_defs.h | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +1 -0
index 0ba61d1838..5e877c1fd9 100644
@@ -96,7 +96,7 @@ typedef struct RdmaRmPort {
       enum ibv_port_state state;
   } RdmaRmPort;
   -typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
       RdmaRmPort port;
       RdmaRmResTbl pd_tbl;
       RdmaRmResTbl mr_tbl;
@@ -105,6 +105,6 @@ typedef struct RdmaDeviceResources {
       RdmaRmResTbl cq_tbl;
       RdmaRmResTbl cqe_ctx_tbl;

      GHashTable *qp_hash; /* Keeps mapping between real and emulated */

hw/rdma/rdma_rm_defs.h +1 -1
-} RdmaDeviceResources;
+};

    #endif

#4 lore raw

Hi Philippe,

Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line · Marcel Apfelbaum

I doubt this is a security issue worth Cc'ing qemu-stable :)

I thought it worth adding a compilation fix to the stable branch.

Thanks,
Marcel

Quoted 44 lines
Quoted 18 lines

Thanks,
Marcel

Quoted 14 lines · Marcel Apfelbaum

Configuring QEMU with:
    configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
    qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef
'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]
    } RdmaDeviceResources;
      ^
    qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition
is here
    typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

Quoted 24 lines
Quoted 23 lines
---
   hw/rdma/rdma_rm_defs.h | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +2 -1
index 0ba61d1838..5e877c1fd9 100644
@@ -96,7 +96,7 @@ typedef struct RdmaRmPort {
       enum ibv_port_state state;
   } RdmaRmPort;
   -typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
       RdmaRmPort port;
       RdmaRmResTbl pd_tbl;
       RdmaRmResTbl mr_tbl;
@@ -105,6 +105,6 @@ typedef struct RdmaDeviceResources {
       RdmaRmResTbl cq_tbl;
       RdmaRmResTbl cqe_ctx_tbl;
       GHashTable *qp_hash; /* Keeps mapping between real and emulated */
-} RdmaDeviceResources;
+};
     #endif