qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iov: don't use void* in pointer arithmetic in headers
@ 2024-07-08 18:17 Roman Kiryanov
  2024-07-09  9:39 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Kiryanov @ 2024-07-08 18:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: jansene, mett, jpcottin, pbonzini, Roman Kiryanov

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

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);
-- 
2.45.2.803.g4e1b14247a-goog



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

* Re: [PATCH] iov: don't use void* in pointer arithmetic in headers
  2024-07-08 18:17 [PATCH] iov: don't use void* in pointer arithmetic in headers Roman Kiryanov
@ 2024-07-09  9:39 ` Peter Maydell
  2024-07-10 21:47   ` Roman Kiryanov
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2024-07-09  9:39 UTC (permalink / raw)
  To: Roman Kiryanov; +Cc: qemu-devel, jansene, mett, jpcottin, pbonzini

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


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

* Re: [PATCH] iov: don't use void* in pointer arithmetic in headers
  2024-07-09  9:39 ` Peter Maydell
@ 2024-07-10 21:47   ` Roman Kiryanov
  0 siblings, 0 replies; 3+ messages in thread
From: Roman Kiryanov @ 2024-07-10 21:47 UTC (permalink / raw)
  To: Peter Maydell, jansene; +Cc: qemu-devel, mett, jpcottin, pbonzini

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.


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

end of thread, other threads:[~2024-07-10 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 18:17 [PATCH] iov: don't use void* in pointer arithmetic in headers Roman Kiryanov
2024-07-09  9:39 ` Peter Maydell
2024-07-10 21:47   ` Roman Kiryanov

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