[libcxx] r229162 - Handle function name conflicts in _LIBCPP_MSVCRT mode

David Majnemer david.majnemer at gmail.com
Fri Feb 13 16:29:13 PST 2015


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?

On Fri, Feb 13, 2015 at 2:15 PM, Saleem Abdulrasool <compnerd at compnerd.org>
wrote:

> Author: compnerd
> Date: Fri Feb 13 16:15:32 2015
> New Revision: 229162
>
> URL: http://llvm.org/viewvc/llvm-project?rev=229162&view=rev
> Log:
> Handle function name conflicts in _LIBCPP_MSVCRT mode
>
> Visual Studio's SAL extension uses a macro named __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.
>
> Added:
>     libcxx/trunk/include/__undef___deallocate
> Modified:
>     libcxx/trunk/include/__hash_table
>     libcxx/trunk/include/__sso_allocator
>     libcxx/trunk/include/experimental/dynarray
>     libcxx/trunk/include/memory
>     libcxx/trunk/include/module.modulemap
>     libcxx/trunk/include/new
>     libcxx/trunk/include/valarray
>
> Modified: libcxx/trunk/include/__hash_table
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/__hash_table (original)
> +++ libcxx/trunk/include/__hash_table Fri Feb 13 16:15:32 2015
> @@ -19,6 +19,7 @@
>  #include <cmath>
>
>  #include <__undef_min_max>
> +#include <__undef___deallocate>
>
>  #include <__debug>
>
>
> Modified: libcxx/trunk/include/__sso_allocator
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__sso_allocator?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/__sso_allocator (original)
> +++ libcxx/trunk/include/__sso_allocator Fri Feb 13 16:15:32 2015
> @@ -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
>
> Added: libcxx/trunk/include/__undef___deallocate
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__undef___deallocate?rev=229162&view=auto
>
> ==============================================================================
> --- libcxx/trunk/include/__undef___deallocate (added)
> +++ libcxx/trunk/include/__undef___deallocate Fri Feb 13 16:15:32 2015
> @@ -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
>
> Modified: libcxx/trunk/include/experimental/dynarray
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/experimental/dynarray (original)
> +++ libcxx/trunk/include/experimental/dynarray Fri Feb 13 16:15:32 2015
> @@ -104,6 +104,8 @@ public:
>  #include <new>
>  #include <algorithm>
>
> +#include <__undef___deallocate>
> +
>  #if defined(_LIBCPP_NO_EXCEPTIONS)
>      #include <cassert>
>  #endif
>
> Modified: libcxx/trunk/include/memory
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/memory (original)
> +++ libcxx/trunk/include/memory Fri Feb 13 16:15:32 2015
> @@ -615,6 +615,7 @@ void* align(size_t alignment, size_t siz
>  #endif
>
>  #include <__undef_min_max>
> +#include <__undef___deallocate>
>
>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
>  #pragma GCC system_header
>
> Modified: libcxx/trunk/include/module.modulemap
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/module.modulemap (original)
> +++ libcxx/trunk/include/module.modulemap Fri Feb 13 16:15:32 2015
> @@ -469,4 +469,5 @@ module std [system] {
>    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 * }
>  }
>
> Modified: libcxx/trunk/include/new
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/new (original)
> +++ libcxx/trunk/include/new Fri Feb 13 16:15:32 2015
> @@ -68,6 +68,8 @@ void  operator delete[](void* ptr, void*
>  #include <exception>
>  #include <cstddef>
>
> +#include <__undef___deallocate>
> +
>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
>  #pragma GCC system_header
>  #endif
>
> Modified: libcxx/trunk/include/valarray
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/valarray?rev=229162&r1=229161&r2=229162&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/valarray (original)
> +++ libcxx/trunk/include/valarray Fri Feb 13 16:15:32 2015
> @@ -348,6 +348,7 @@ template <class T> unspecified2 end(cons
>  #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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150213/1acc59d4/attachment.html>


More information about the cfe-commits mailing list