Explorar o código

Provide MSVC-friendly wrapper for this==nullptr

MSVC neither supports the attribute we've used, nor deletes the check.
Petr Penzin hai 1 ano
pai
achega
2a574fa591
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      lib/Common/DataStructures/ImmutableList.h

+ 6 - 2
lib/Common/DataStructures/ImmutableList.h

@@ -749,12 +749,16 @@ namespace regex
             return result;
         }
 
-       bool __attribute__((noinline)) CheckNull( void* obj ) { return obj == nullptr; }
+#ifndef _MSC_VER
+       bool __attribute__((noinline)) CheckEq(void* obj1, void *obj2) { return obj1 == obj2; }
+#else
+#define CheckEq(a, b) (a) == (b)
+#endif
 
         // Info:        Return true if the list is empty.
         bool IsEmpty()
         {
-            return CheckNull(this);
+            return CheckEq(this, Empty());
         }
 
         // Info:        Return a list containing the given single value