<div dir="ltr">Any reason why you chose not to push/pop_macro("__deallocate")?  That way you could undefine the macro while still allowing SAL to work, no?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 13, 2015 at 2:15 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: compnerd<br>
Date: Fri Feb 13 16:15:32 2015<br>
New Revision: 229162<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=229162&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=229162&view=rev</a><br>
Log:<br>
Handle function name conflicts in _LIBCPP_MSVCRT mode<br>
<br>
Visual Studio's SAL extension uses a macro named __deallocate. This macro is<br>
used pervasively, and gets included through various different ways. This<br>
conflicts with the similarly named interfaces in libc++. Introduce a undef<br>
header similar to __undef_min_max to handle this. This fixes a number of errors<br>
due to the macro replacing the function name.<br>
<br>
Added:<br>
    libcxx/trunk/include/__undef___deallocate<br>
Modified:<br>
    libcxx/trunk/include/__hash_table<br>
    libcxx/trunk/include/__sso_allocator<br>
    libcxx/trunk/include/experimental/dynarray<br>
    libcxx/trunk/include/memory<br>
    libcxx/trunk/include/module.modulemap<br>
    libcxx/trunk/include/new<br>
    libcxx/trunk/include/valarray<br>
<br>
Modified: libcxx/trunk/include/__hash_table<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/__hash_table (original)<br>
+++ libcxx/trunk/include/__hash_table Fri Feb 13 16:15:32 2015<br>
@@ -19,6 +19,7 @@<br>
 #include <cmath><br>
<br>
 #include <__undef_min_max><br>
+#include <__undef___deallocate><br>
<br>
 #include <__debug><br>
<br>
<br>
Modified: libcxx/trunk/include/__sso_allocator<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__sso_allocator?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__sso_allocator?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/__sso_allocator (original)<br>
+++ libcxx/trunk/include/__sso_allocator Fri Feb 13 16:15:32 2015<br>
@@ -15,6 +15,8 @@<br>
 #include <type_traits><br>
 #include <new><br>
<br>
+#include <__undef___deallocate><br>
+<br>
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
 #pragma GCC system_header<br>
 #endif<br>
<br>
Added: libcxx/trunk/include/__undef___deallocate<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__undef___deallocate?rev=229162&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__undef___deallocate?rev=229162&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/include/__undef___deallocate (added)<br>
+++ libcxx/trunk/include/__undef___deallocate Fri Feb 13 16:15:32 2015<br>
@@ -0,0 +1,18 @@<br>
+// -*- C++ -*-<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifdef __deallocate<br>
+#if defined(_MSC_VER) && !defined(__clang__)<br>
+_LIBCPP_WARNING("macro __deallocate is incompatible with C++.  #undefining __deallocate")<br>
+#else<br>
+#warning: macro __deallocate is incompatible with C++.  #undefining __deallocate<br>
+#endif<br>
+#undef __deallocate<br>
+#endif<br>
<br>
Modified: libcxx/trunk/include/experimental/dynarray<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/experimental/dynarray (original)<br>
+++ libcxx/trunk/include/experimental/dynarray Fri Feb 13 16:15:32 2015<br>
@@ -104,6 +104,8 @@ public:<br>
 #include <new><br>
 #include <algorithm><br>
<br>
+#include <__undef___deallocate><br>
+<br>
 #if defined(_LIBCPP_NO_EXCEPTIONS)<br>
     #include <cassert><br>
 #endif<br>
<br>
Modified: libcxx/trunk/include/memory<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/memory (original)<br>
+++ libcxx/trunk/include/memory Fri Feb 13 16:15:32 2015<br>
@@ -615,6 +615,7 @@ void* align(size_t alignment, size_t siz<br>
 #endif<br>
<br>
 #include <__undef_min_max><br>
+#include <__undef___deallocate><br>
<br>
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
 #pragma GCC system_header<br>
<br>
Modified: libcxx/trunk/include/module.modulemap<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/module.modulemap (original)<br>
+++ libcxx/trunk/include/module.modulemap Fri Feb 13 16:15:32 2015<br>
@@ -469,4 +469,5 @@ module std [system] {<br>
   module __tree { header "__tree" export * }<br>
   module __tuple { header "__tuple" export * }<br>
   module __undef_min_max { header "__undef_min_max" export * }<br>
+  module __undef___deallocate { header "__undef___deallocate" export * }<br>
 }<br>
<br>
Modified: libcxx/trunk/include/new<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/new (original)<br>
+++ libcxx/trunk/include/new Fri Feb 13 16:15:32 2015<br>
@@ -68,6 +68,8 @@ void  operator delete[](void* ptr, void*<br>
 #include <exception><br>
 #include <cstddef><br>
<br>
+#include <__undef___deallocate><br>
+<br>
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
 #pragma GCC system_header<br>
 #endif<br>
<br>
Modified: libcxx/trunk/include/valarray<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/valarray?rev=229162&r1=229161&r2=229162&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/valarray?rev=229162&r1=229161&r2=229162&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/valarray (original)<br>
+++ libcxx/trunk/include/valarray Fri Feb 13 16:15:32 2015<br>
@@ -348,6 +348,7 @@ template <class T> unspecified2 end(cons<br>
 #include <new><br>
<br>
 #include <__undef_min_max><br>
+#include <__undef___deallocate><br>
<br>
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
 #pragma GCC system_header<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>