From: Samuel Pitoiset Date: Tue, 30 May 2017 15:41:32 +0000 (+0200) Subject: mesa/util: fix arithmetic use of 'void *' in u_vector_foreach X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d8debc6aad85094baeba2014b46b6613c4a35ee7;p=mesa.git mesa/util: fix arithmetic use of 'void *' in u_vector_foreach 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 Reviewed-by: Kenneth Graunke --- diff --git a/src/util/u_vector.h b/src/util/u_vector.h index c7fcb37a052..c0e199cfa5a 100644 --- a/src/util/u_vector.h +++ b/src/util/u_vector.h @@ -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)