Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Roman Kiryanov
Hi Peter, thank you for looking. On Thu, Jun 20, 2024 at 12:09 PM Peter Maydell wrote: > I think this is the point where I would say "you're making the > code worse for upstream and the only benefit is to your out-of-tree > downstream code". If you want to build QEMU, use one of the compilers > t

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Peter Maydell
On Thu, 20 Jun 2024 at 17:24, Roman Kiryanov wrote: > > Hi Daniel and Alex, > > On Thu, Jun 20, 2024 at 8:10 AM Alex Bennée wrote: > > > > Daniel P. Berrangé writes: > > > NB, QEMU is explicitly *NOT* targetting the C standard, we are > > > targetting the C dialect supported by GCC and CLang onl

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Roman Kiryanov
On Thu, Jun 20, 2024 at 11:16 AM Paolo Bonzini wrote: > > > Would it work instead to declare MemoryRegionCache's ptr field as char*? > > > > I prefer to use char* only where there are strings. For unstructured data > > such as > > MemoryRegionCache, void* is more appropriate. > > Or uint8_t*...

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Paolo Bonzini
On Thu, Jun 20, 2024 at 8:14 PM Richard Henderson wrote: > > On 6/20/24 11:06, Paolo Bonzini wrote: > > On 6/19/24 00:46, Roman Kiryanov wrote: > >> void* pointer arithmetic is not in the > >> C standard. This change allows using > >> the QEMU headers with a C++ compiler. > >> > >> Google-Bug-Id:

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Richard Henderson
On 6/20/24 11:06, Paolo Bonzini wrote: On 6/19/24 00:46, Roman Kiryanov wrote: void* pointer arithmetic is not in the C standard. This change allows using the QEMU headers with a C++ compiler. Google-Bug-Id: 331190993 Change-Id: I5a064853429f627c17a9213910811dea4ced6174 Signed-off-by: Roman Kir

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Paolo Bonzini
On 6/19/24 00:46, Roman Kiryanov wrote: void* pointer arithmetic is not in the C standard. This change allows using the QEMU headers with a C++ compiler. Google-Bug-Id: 331190993 Change-Id: I5a064853429f627c17a9213910811dea4ced6174 Signed-off-by: Roman Kiryanov Would it work instead to declar

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Roman Kiryanov
Hi Daniel and Alex, On Thu, Jun 20, 2024 at 8:10 AM Alex Bennée wrote: > > Daniel P. Berrangé writes: > > NB, QEMU is explicitly *NOT* targetting the C standard, we are > > targetting the C dialect supported by GCC and CLang only. IOW, > > if they have well defined behaviour for arithmetic on vo

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-20 Thread Alex Bennée
Daniel P. Berrangé writes: > On Tue, Jun 18, 2024 at 04:05:36PM -0700, Richard Henderson wrote: >> On 6/18/24 15:46, Roman Kiryanov wrote: >> > @@ -2839,7 +2839,7 @@ static inline uint8_t >> > address_space_ldub_cached(MemoryRegionCache *cache, >> > { >> > assert(addr < cache->len); >> >

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-19 Thread Daniel P . Berrangé
On Tue, Jun 18, 2024 at 04:05:36PM -0700, Richard Henderson wrote: > On 6/18/24 15:46, Roman Kiryanov wrote: > > @@ -2839,7 +2839,7 @@ static inline uint8_t > > address_space_ldub_cached(MemoryRegionCache *cache, > > { > > assert(addr < cache->len); > > if (likely(cache->ptr)) { > >

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-18 Thread Roman Kiryanov
Hi Richard, On Tue, Jun 18, 2024 at 4:05 PM Richard Henderson wrote: > We require "char *" with a space. thank you for looking into this. I sent v2 for this one.

Re: [PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-18 Thread Richard Henderson
On 6/18/24 15:46, Roman Kiryanov wrote: @@ -2839,7 +2839,7 @@ static inline uint8_t address_space_ldub_cached(MemoryRegionCache *cache, { assert(addr < cache->len); if (likely(cache->ptr)) { -return ldub_p(cache->ptr + addr); +return ldub_p((char*)cache->ptr + addr)

[PATCH 3/3] exec: use char* for pointer arithmetic

2024-06-18 Thread Roman Kiryanov
void* pointer arithmetic is not in the C standard. This change allows using the QEMU headers with a C++ compiler. Google-Bug-Id: 331190993 Change-Id: I5a064853429f627c17a9213910811dea4ced6174 Signed-off-by: Roman Kiryanov --- include/exec/memory.h | 8 include/exec/memo