[Intel-gfx] [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
Chris Wilson
chris at chris-wilson.co.uk
Tue Jul 10 14:09:25 UTC 2018
Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > This commit fixes the GCC warning:
> >
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > ^
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > memset(ptr + offsets[1], 0x80,
> >
> > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > the pointer arithmetic operation.
>
> This will change semantics, as according to GNU C standard[1], void
> pointers have a size of 1 for all arithmetical purposes.
>
> So you should be using uint8_t (or char) pointer instead.
Please just fix the compiler flags, we want close compatibility with the
kernel coding standards which explicitly allow void arithmetic for the
simplicity it lends to writing code.
-Chris
More information about the Intel-gfx
mailing list