[libcxx] r199494 - Build fix for gcc builtin

Alp Toker alp at nuanti.com
Fri Jan 17 06:24:23 PST 2014


Author: alp
Date: Fri Jan 17 08:24:23 2014
New Revision: 199494

URL: http://llvm.org/viewvc/llvm-project?rev=199494&view=rev
Log:
Build fix for gcc builtin

The __sync_add_and_fetch() builtin parameter is volatile but clang has
'different' type checking and ends up accepting this code.

Undo the C++ cast from r198505 to get libc++/LLVM building with g++ while this
is investigated.

Modified:
    libcxx/trunk/src/stdexcept.cpp

Modified: libcxx/trunk/src/stdexcept.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=199494&r1=199493&r2=199494&view=diff
==============================================================================
--- libcxx/trunk/src/stdexcept.cpp (original)
+++ libcxx/trunk/src/stdexcept.cpp Fri Jan 17 08:24:23 2014
@@ -79,7 +79,7 @@ __libcpp_nmstr::operator=(const __libcpp
     const char* p = str_;
     str_ = s.str_;
     __sync_add_and_fetch(&count(), 1);
-    if (__sync_add_and_fetch(reinterpret_cast<const count_t*>(p-sizeof(count_t)), count_t(-1)) < 0)
+    if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), count_t(-1)) < 0)
         delete [] (p-offset);
     return *this;
 }





More information about the cfe-commits mailing list