]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/buffer: use homebrew BUF_OFFSETOF to replace offsetof() 37097/head
authorKefu Chai <kchai@redhat.com>
Fri, 11 Sep 2020 04:53:28 +0000 (12:53 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 11 Sep 2020 04:56:22 +0000 (12:56 +0800)
commit3eed2d595ee5d1577b272a238ab018b1addf77a5
treef4038e8dd0dd1ec8347b35862d259ada1cf33270
parent371364532445ad5dd68559133c855b1bc2c98002
common/buffer: use homebrew BUF_OFFSETOF to replace offsetof()

because buffer::raw is not a standard layout type. so `offsetof()`
does not always work. let's use a homebrew macro to calculate the
address of `bptr_storage`.

this change silences the warning like:

src/common/buffer.cc:2156:15: warning: ‘offsetof’ within non-standard-layout type ‘ceph::buffer::v15_2_0::raw’ is conditionally-supported [-Winvalid-offsetof]
 2156 |      offsetof(buffer::raw, bptr_storage));

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/buffer.cc