<div dir="ltr"><div>On Thu, Sep 24, 2015 at 4:20 AM, Yaron Keren via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Visual C++ 2013 update 5 (latest) does not appear to compile this, mainly due to missing support for constexpr.</div><div dir="ltr"><br></div><div dir="ltr">  <a href="https://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx</a><br></div><div dir="ltr"><br></div><div dir="ltr">Visual C++ 2013 CTP has constexpr, but MS did not further update this branch since Nov 2013. </div><div dir="ltr">The "regular" branch of 2013 update 5 is from Jul 2015.</div><div dir="ltr"><br></div><div dir="ltr">Worth mentioning that either 2013 CTP or 2015 is required.</div></div></blockquote><div><br></div><div>Right the commit message hints at this with "clang-cl/MSVC2013's STL" – with this change, _clang-cl_ can compile this file with the MSVC2013 headers. cl.exe can't. cl.exe 2015 can, except for that one __attribute__((visibiliiy("default"))) line. If that's changed to go `#ifdef _MSC_VER __declspec(dllexport) #else __attr... #endif` then it compiles with 2015. (I want to send out something for this soon too.)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="rtl"><div dir="ltr"><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-09-20 21:10 GMT+03:00 Nico Weber via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span>:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: nico<br>
Date: Sun Sep 20 13:10:46 2015<br>
New Revision: 248129<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=248129&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=248129&view=rev</a><br>
Log:<br>
Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.<br>
<br>
libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs rebind(),<br>
construct(), destroy().  MSVC2013 also has no snprintf, but it exists in 2015.<br>
<br>
Modified:<br>
    libcxxabi/trunk/src/cxa_demangle.cpp<br>
<br>
Modified: libcxxabi/trunk/src/cxa_demangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=248129&r1=248128&r2=248129&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=248129&r1=248128&r2=248129&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)<br>
+++ libcxxabi/trunk/src/cxa_demangle.cpp Sun Sep 20 13:10:46 2015<br>
@@ -18,6 +18,13 @@<br>
 #include <cstring><br>
 #include <cctype><br>
<br>
+#ifdef _MSC_VER<br>
+// snprintf is implemented in VS 2015<br>
+#if _MSC_VER < 1900<br>
+#define snprintf _snprintf_s<br>
+#endif<br>
+#endif<br>
+<br>
 namespace __cxxabiv1<br>
 {<br>
<br>
@@ -4818,6 +4825,12 @@ class malloc_alloc<br>
 {<br>
 public:<br>
     typedef T value_type;<br>
+    typedef T& reference;<br>
+    typedef const T& const_reference;<br>
+    typedef T* pointer;<br>
+    typedef const T* const_pointer;<br>
+    typedef std::size_t size_type;<br>
+    typedef std::ptrdiff_t difference_type;<br>
<br>
     malloc_alloc() = default;<br>
     template <class U> malloc_alloc(const malloc_alloc<U>&) noexcept {}<br>
@@ -4830,6 +4843,17 @@ public:<br>
     {<br>
         std::free(p);<br>
     }<br>
+<br>
+    template <class U> struct rebind { using other = malloc_alloc<U>; };<br>
+    template <class U, class... Args><br>
+    void construct(U* p, Args&&... args)<br>
+    {<br>
+        ::new ((void*)p) U(std::forward<Args>(args)...);<br>
+    }<br>
+    void destroy(T* p)<br>
+    {<br>
+        p->~T();<br>
+    }<br>
 };<br>
<br>
 template <class T, class U><br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>