mesa/util: fix arithmetic use of 'void *' in u_vector_foreach
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 30 May 2017 15:41:32 +0000 (17:41 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 31 May 2017 07:19:54 +0000 (09:19 +0200)
u_vector_foreach is currently only used by the Intel Vulkan
driver but when this macro is used in mesa core, GCC reports
a compile-time error. Probably because some compiler options
are different.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/util/u_vector.h

index c7fcb37a052a548db27bdce9e71bc014965e2cf1..c0e199cfa5adda74bacb8bd5b738c3b26beb414a 100644 (file)
@@ -84,7 +84,7 @@ u_vector_finish(struct u_vector *queue)
 #define u_vector_foreach(elem, queue)                                  \
    STATIC_ASSERT(__builtin_types_compatible_p(__typeof__(queue), struct u_vector *)); \
    for (uint32_t __u_vector_offset = (queue)->tail;                                \
-        elem = (queue)->data + (__u_vector_offset & ((queue)->size - 1)), __u_vector_offset < (queue)->head; \
+        elem = (void *)((char *)(queue)->data + (__u_vector_offset & ((queue)->size - 1))), __u_vector_offset < (queue)->head; \
         __u_vector_offset += (queue)->element_size)