util: add MSVC HAS_TRIVIAL_DESTRUCTOR implementation
authorBrian Paul <brianp@vmware.com>
Wed, 9 Nov 2016 21:48:45 +0000 (14:48 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 9 Nov 2016 21:55:10 +0000 (14:55 -0700)
Based on a patch by George Kyriazis but changed to test for
_MSC_VER >= 1800 (Visual Studio 2015).

This fixes the failed CANARY assertion in src/util/ralloc.c:get_header()
on Windows.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98595
Tested-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
src/util/macros.h

index 27d1b6292fa8095458a39a91a7bdb843da2532b9..0563fa59b595d63c06afb2f5709d415e8cdd588e 100644 (file)
@@ -175,6 +175,11 @@ do {                       \
 #      if __has_feature(has_trivial_destructor)
 #         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
 #      endif
+#   elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
+#      if _MSC_VER >= 1800
+#         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+#      else
+#      endif
 #   endif
 #   ifndef HAS_TRIVIAL_DESTRUCTOR
        /* It's always safe (if inefficient) to assume that a