[Mesa-dev] [PATCH] util: no-op __builtin_types_compatible_p() for non-GCC compilers
Jose Fonseca
jfonseca at vmware.com
Fri Mar 29 17:51:31 UTC 2019
Looks good
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Friday, March 29, 2019 16:57
To: mesa-dev at lists.freedesktop.org
Cc: Ian Romanick; Jose Fonseca; Neha Bhende
Subject: [PATCH] util: no-op __builtin_types_compatible_p() for non-GCC compilers
__builtin_types_compatible_p() is GCC-specific and breaks the
MSVC build.
This intrinsic has been in u_vector_foreach() for a long time, but
that macro has only recently been used in code
(nir/nir_opt_comparison_pre.c) that's built with MSVC.
Fixes: 2cf59861a ("nir: Add partial redundancy elimination for compares")
---
src/util/u_vector.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/util/u_vector.h b/src/util/u_vector.h
index cd8a95d..6807748 100644
--- a/src/util/u_vector.h
+++ b/src/util/u_vector.h
@@ -80,6 +80,10 @@ u_vector_finish(struct u_vector *queue)
free(queue->data);
}
+#ifndef __GNUC__
+#define __builtin_types_compatible_p(x) 1
+#endif
+
#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; \
--
1.8.5.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190329/05354bc9/attachment.html>
More information about the mesa-dev
mailing list