On 03/29/2019 12:58 PM, Ian Romanick wrote:
On 3/29/19 9:57 AM, Brian Paul wrote:
__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 *)); \

The way this is GCC builtin is used here, this should be fine.  However,
in case it's begin used elsewhere, we should #undef it afterwards.


That doesn't seem to work. When u_vector_foreach() is instantiated later, __builtin_types_compatible_p is undefined and we error out.

-Brian


  I'd
hate to mask some other kind of bug that may be introduced later.

     for (uint32_t __u_vector_offset = (queue)->tail;                           
     \



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to