[libcxx] r313377 - [libc++] Account for Microsoft CRT const overloads

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 11:49:35 PDT 2017


Author: smeenai
Date: Fri Sep 15 11:49:34 2017
New Revision: 313377

URL: http://llvm.org/viewvc/llvm-project?rev=313377&view=rev
Log:
[libc++] Account for Microsoft CRT const overloads

Microsoft's CRT already provides the const overloads, and it defines the
`_CRT_CONST_CORRECT_OVERLOADS` macro to indicate their presence. Check
for this macro before attempting to define our own const-correct
overloads, to avoid compiler warnings about casts dropping const
qualifiers.

Modified:
    libcxx/trunk/include/wchar.h

Modified: libcxx/trunk/include/wchar.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/wchar.h?rev=313377&r1=313376&r2=313377&view=diff
==============================================================================
--- libcxx/trunk/include/wchar.h (original)
+++ libcxx/trunk/include/wchar.h Fri Sep 15 11:49:34 2017
@@ -125,6 +125,10 @@ size_t wcsrtombs(char* restrict dst, con
 #  if __GLIBC_PREREQ(2, 10)
 #    define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
 #  endif
+#elif defined(_LIBCPP_MSVCRT)
+#  if defined(_CRT_CONST_CORRECT_OVERLOADS)
+#    define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+#  endif
 #endif
 
 #if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)




More information about the cfe-commits mailing list