[Mesa-dev] [PATCH] mesa/util: fix arithmetic use of 'void *' in u_vector_foreach
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue May 30 15:41:32 UTC 2017
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 at gmail.com>
---
src/util/u_vector.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/u_vector.h b/src/util/u_vector.h
index c7fcb37a05..c0e199cfa5 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)
--
2.13.0
More information about the mesa-dev
mailing list