Hi mclow.lists,

Visual Studio's SAL extension uses a macro for __deallocate.  This macro is used
pervasively, and gets included through various different ways.  This conflicts
with the similarly named interfaces in libc++.  Introduce a __undef header
similar to __undef_min_max to handle this.  This fixes a number of errors due to
the macro replacing the function name.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7420

Files:
  include/__hash_table
  include/__sso_allocator
  include/__undef___deallocate
  include/experimental/dynarray
  include/memory
  include/module.modulemap
  include/new
  include/valarray

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/__hash_table
===================================================================
--- include/__hash_table
+++ include/__hash_table
@@ -19,6 +19,7 @@
 #include <cmath>
 
 #include <__undef_min_max>
+#include <__undef___deallocate>
 
 #include <__debug>
 
Index: include/__sso_allocator
===================================================================
--- include/__sso_allocator
+++ include/__sso_allocator
@@ -15,6 +15,8 @@
 #include <type_traits>
 #include <new>
 
+#include <__undef___deallocate>
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
Index: include/__undef___deallocate
===================================================================
--- /dev/null
+++ include/__undef___deallocate
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef __deallocate
+#if defined(_MSC_VER) && !defined(__clang__)
+_LIBCPP_WARNING("macro __deallocate is incompatible with C++.  #undefining __deallocate")
+#else
+#warning: macro __deallocate is incompatible with C++.  #undefining __deallocate
+#endif
+#undef __deallocate
+#endif
Index: include/experimental/dynarray
===================================================================
--- include/experimental/dynarray
+++ include/experimental/dynarray
@@ -104,6 +104,8 @@
 #include <new>
 #include <algorithm>
 
+#include <__undef___deallocate>
+
 #if defined(_LIBCPP_NO_EXCEPTIONS)
     #include <cassert>
 #endif
Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -615,6 +615,7 @@
 #endif
 
 #include <__undef_min_max>
+#include <__undef___deallocate>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
Index: include/module.modulemap
===================================================================
--- include/module.modulemap
+++ include/module.modulemap
@@ -469,4 +469,5 @@
   module __tree { header "__tree" export * }
   module __tuple { header "__tuple" export * }
   module __undef_min_max { header "__undef_min_max" export * }
+  module __undef___deallocate { header "__undef___deallocate" export * }
 }
Index: include/new
===================================================================
--- include/new
+++ include/new
@@ -68,6 +68,8 @@
 #include <exception>
 #include <cstddef>
 
+#include <__undef___deallocate>
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
Index: include/valarray
===================================================================
--- include/valarray
+++ include/valarray
@@ -348,6 +348,7 @@
 #include <new>
 
 #include <__undef_min_max>
+#include <__undef___deallocate>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to