[libcxx] r232379 - Make *abs() and *div() work on CloudABI.

Ed Schouten ed at nuxi.nl
Mon Mar 16 07:27:44 PDT 2015


Author: ed
Date: Mon Mar 16 09:27:44 2015
New Revision: 232379

URL: http://llvm.org/viewvc/llvm-project?rev=232379&view=rev
Log:
Make *abs() and *div() work on CloudABI.

According to POSIX, *abs() and *div() are allowed to be macros (in
addition to being functions). Make sure we undefine these, so that
std::*abs() and std::*div() work as expected.

Modified:
    libcxx/trunk/include/cinttypes
    libcxx/trunk/include/cstdlib

Modified: libcxx/trunk/include/cinttypes
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cinttypes?rev=232379&r1=232378&r2=232379&view=diff
==============================================================================
--- libcxx/trunk/include/cinttypes (original)
+++ libcxx/trunk/include/cinttypes Mon Mar 16 09:27:44 2015
@@ -247,7 +247,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 using::imaxdiv_t;
 
+#undef imaxabs
 using::imaxabs;
+#undef imaxdiv
 using::imaxdiv;
 using::strtoimax;
 using::strtoumax;

Modified: libcxx/trunk/include/cstdlib
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=232379&r1=232378&r2=232379&view=diff
==============================================================================
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Mon Mar 16 09:27:44 2015
@@ -131,14 +131,20 @@ using ::getenv;
 using ::system;
 using ::bsearch;
 using ::qsort;
+#undef abs
 using ::abs;
+#undef labs
 using ::labs;
 #ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef llabs
 using ::llabs;
 #endif // _LIBCPP_HAS_NO_LONG_LONG
+#undef div
 using ::div;
+#undef ldiv
 using ::ldiv;
 #ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef lldiv
 using ::lldiv;
 #endif // _LIBCPP_HAS_NO_LONG_LONG
 using ::mblen;





More information about the cfe-commits mailing list