Message ID | 20240708181709.27410-1-rkir@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iov: don't use void* in pointer arithmetic in headers | expand |
On Mon, 8 Jul 2024 at 19:18, Roman Kiryanov <rkir@google.com> wrote: > > void* pointer arithmetic is a GCC extentension > which could not be available in other build tools > (e.g. C++). This changes removes this assumption. > > Signed-off-by: Roman Kiryanov <rkir@google.com> We had the question on a previous "make this C++ compatible" patch of "how much of this stuff is there?". https://lore.kernel.org/qemu-devel/ZnqPpqfBxlk9tEdX@redhat.com/ Please can you give us an idea of how much of this stuff there is that you're planning to send out and what its scope is, rather than just sending one "well this looks small on its own" patch a week? thanks -- PMM
Hi Peter, thank you for looking into this. On Tue, Jul 9, 2024 at 2:39 AM Peter Maydell <peter.maydell@linaro.org> wrote: > We had the question on a previous "make this C++ > compatible" patch of "how much of this stuff is there?". Unfortunately, we don't know yet (we are still upgrading to QEMU8). If this is a burden for QEMU, we can keep the changes on our end and send them once we have a bigger picture (e.g. when upgrading to QEMU9). Regards, Roman.
diff --git a/include/qemu/iov.h b/include/qemu/iov.h index 63a1c01965..57afab370c 100644 --- a/include/qemu/iov.h +++ b/include/qemu/iov.h @@ -43,7 +43,7 @@ iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, { if (__builtin_constant_p(bytes) && iov_cnt && offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) { - memcpy(iov[0].iov_base + offset, buf, bytes); + memcpy((char *)iov[0].iov_base + offset, buf, bytes); return bytes; } else { return iov_from_buf_full(iov, iov_cnt, offset, buf, bytes); @@ -56,7 +56,7 @@ iov_to_buf(const struct iovec *iov, const unsigned int iov_cnt, { if (__builtin_constant_p(bytes) && iov_cnt && offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) { - memcpy(buf, iov[0].iov_base + offset, bytes); + memcpy(buf, (const char *)iov[0].iov_base + offset, bytes); return bytes; } else { return iov_to_buf_full(iov, iov_cnt, offset, buf, bytes);
void* pointer arithmetic is a GCC extentension which could not be available in other build tools (e.g. C++). This changes removes this assumption. Signed-off-by: Roman Kiryanov <rkir@google.com> --- include/qemu/iov.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)