qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel]  [PATCH] migration/rdma: clang compilation fix
@ 2019-03-04  8:42 Marcel Apfelbaum
  2019-03-04 18:11 ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Apfelbaum @ 2019-03-04  8:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, quintela

Configuring QEMU with:
        ../configure --cc=clang --enable-rdma

Leads to compilation error:

  CC      migration/rdma.o
  CC      migration/block.o
  qemu/migration/rdma.c:3615:58: error: taking address of packed member 'rkey' of class or structure
      'RDMARegisterResult' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
                            (uintptr_t)host_addr, NULL, &reg_result->rkey,
                                                         ^~~~~~~~~~~~~~~~

This is a false warning; even if RDMARegisterResult is "packed", rkey
is the first field so is guaranteed to be aligned.

Fix it by disabling the warning only for this instance.

Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
---
 migration/rdma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/migration/rdma.c b/migration/rdma.c
index 54a3c11540..e0f66a4717 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3611,6 +3611,8 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
                 }
                 chunk_start = ram_chunk_start(block, chunk);
                 chunk_end = ram_chunk_end(block, chunk + reg->chunks);
+                #pragma clang diagnostic push
+                #pragma clang diagnostic ignored "-Waddress-of-packed-member"
                 if (qemu_rdma_register_and_get_keys(rdma, block,
                             (uintptr_t)host_addr, NULL, &reg_result->rkey,
                             chunk, chunk_start, chunk_end)) {
@@ -3618,6 +3620,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
                     ret = -EINVAL;
                     goto out;
                 }
+                #pragma clang diagnostic pop
 
                 reg_result->host_addr = (uintptr_t)block->local_host_addr;
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-04 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04  8:42 [Qemu-devel] [PATCH] migration/rdma: clang compilation fix Marcel Apfelbaum
2019-03-04 18:11 ` Eric Blake
2019-03-04 18:18   ` Dr. David Alan Gilbert
2019-03-04 18:27     ` Marcel Apfelbaum
2019-03-04 18:30   ` Marcel Apfelbaum

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).