<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Eric,<div class=""><br class=""></div><div class="">See the linked discussion in the commit. The commit broke every build on Green Dragon that was built with ToT clang/libc++, so I had to revert while we’re working on the fix. Sorry for that.</div><div class=""><br class=""></div><div class="">As said on Phab, I’ll reland this for you once we have Clang running with this patch.</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 20. Feb 2020, at 05:34, Eric Fiselier <<a href="mailto:eric@efcs.ca" class="">eric@efcs.ca</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class="">Hi Raphael,<div dir="auto" class=""><br class=""></div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Did you communicate your intent to revert before pushing this change?</div><br class=""><br class=""><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon., Feb. 17, 2020, 11:00 a.m. Raphael Isemann via libcxx-commits, <<a href="mailto:libcxx-commits@lists.llvm.org" class="">libcxx-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
Author: Raphael Isemann<br class="">
Date: 2020-02-17T17:59:08+01:00<br class="">
New Revision: 23368bee15356c830d9c315fe2c4fe0c22f29906<br class="">
<br class="">
URL: <a href="https://github.com/llvm/llvm-project/commit/23368bee15356c830d9c315fe2c4fe0c22f29906" rel="noreferrer noreferrer" target="_blank" class="">https://github.com/llvm/llvm-project/commit/23368bee15356c830d9c315fe2c4fe0c22f29906</a><br class="">
DIFF: <a href="https://github.com/llvm/llvm-project/commit/23368bee15356c830d9c315fe2c4fe0c22f29906.diff" rel="noreferrer noreferrer" target="_blank" class="">https://github.com/llvm/llvm-project/commit/23368bee15356c830d9c315fe2c4fe0c22f29906.diff</a><br class="">
<br class="">
LOG: Revert "[libc++] Move abs and div into stdlib.h to fix header cycle."<br class="">
<br class="">
This reverts commit 82b47b2978405f802a33b00d046e6f18ef6a47be.<br class="">
<br class="">
This broke Clang and LLDB module builds without -fmodules-local-submodule-visbility.<br class="">
I'll revert this for now until we have a fix and reland once Clang<br class="">
can properly handle this code.<br class="">
<br class="">
See also the discussion in <a href="https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be" rel="noreferrer noreferrer" target="_blank" class="">https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be</a><br class="">
<br class="">
Added: <br class="">
<br class="">
<br class="">
Modified: <br class="">
    libcxx/include/math.h<br class="">
    libcxx/include/stdlib.h<br class="">
<br class="">
Removed: <br class="">
<br class="">
<br class="">
<br class="">
################################################################################<br class="">
diff  --git a/libcxx/include/math.h b/libcxx/include/math.h<br class="">
index 1603d5748e2d..c9b4733e9c44 100644<br class="">
--- a/libcxx/include/math.h<br class="">
+++ b/libcxx/include/math.h<br class="">
@@ -297,6 +297,9 @@ long double    truncl(long double x);<br class="">
 #pragma GCC system_header<br class="">
 #endif<br class="">
<br class="">
+#define _LIBCPP_STDLIB_INCLUDE_NEXT<br class="">
+#include <stdlib.h><br class="">
+<br class="">
 #include_next <math.h><br class="">
<br class="">
 #ifdef __cplusplus<br class="">
@@ -305,7 +308,6 @@ long double    truncl(long double x);<br class="">
 // back to C++ linkage before including these C++ headers.<br class="">
 extern "C++" {<br class="">
<br class="">
-#include <stdlib.h><br class="">
 #include <type_traits><br class="">
 #include <limits><br class="">
<br class="">
@@ -758,12 +760,61 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT<br class="">
 #endif  // isunordered<br class="">
<br class="">
 // abs<br class="">
-//<br class="">
-// handled in stdlib.h<br class="">
+<br class="">
+#undef abs<br class="">
+#undef labs<br class="">
+#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
+#undef llabs<br class="">
+#endif<br class="">
+<br class="">
+// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined<br class="">
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
+inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {<br class="">
+  return ::labs(__x);<br class="">
+}<br class="">
+#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
+inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {<br class="">
+  return ::llabs(__x);<br class="">
+}<br class="">
+#endif // _LIBCPP_HAS_NO_LONG_LONG<br class="">
+#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
+<br class="">
+<br class="">
+#if !(defined(_AIX) || defined(__sun__))<br class="">
+inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {<br class="">
+  return ::fabsf(__lcpp_x);<br class="">
+}<br class="">
+<br class="">
+inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {<br class="">
+  return ::fabs(__lcpp_x);<br class="">
+}<br class="">
+<br class="">
+inline _LIBCPP_INLINE_VISIBILITY long double<br class="">
+abs(long double __lcpp_x) _NOEXCEPT {<br class="">
+  return ::fabsl(__lcpp_x);<br class="">
+}<br class="">
+#endif // !(defined(_AIX) || defined(__sun__))<br class="">
<br class="">
 // div<br class="">
-//<br class="">
-// handled in stdlib.h<br class="">
+<br class="">
+#undef div<br class="">
+#undef ldiv<br class="">
+#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
+#undef lldiv<br class="">
+#endif<br class="">
+<br class="">
+// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined<br class="">
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
+inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {<br class="">
+  return ::ldiv(__x, __y);<br class="">
+}<br class="">
+#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
+inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,<br class="">
+                                             long long __y) _NOEXCEPT {<br class="">
+  return ::lldiv(__x, __y);<br class="">
+}<br class="">
+#endif // _LIBCPP_HAS_NO_LONG_LONG<br class="">
+#endif // _LIBCPP_MSVCRT / __sun__ / _AIX<br class="">
<br class="">
 // acos<br class="">
<br class="">
<br class="">
diff  --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h<br class="">
index 812ea1024edf..1d6827587037 100644<br class="">
--- a/libcxx/include/stdlib.h<br class="">
+++ b/libcxx/include/stdlib.h<br class="">
@@ -7,12 +7,16 @@<br class="">
 //<br class="">
 //===----------------------------------------------------------------------===//<br class="">
<br class="">
-#if defined(__need_malloc_and_calloc)<br class="">
+#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)<br class="">
<br class="">
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br class="">
 #pragma GCC system_header<br class="">
 #endif<br class="">
<br class="">
+#if defined(_LIBCPP_STDLIB_INCLUDE_NEXT)<br class="">
+#undef _LIBCPP_STDLIB_INCLUDE_NEXT<br class="">
+#endif<br class="">
+<br class="">
 #include_next <stdlib.h><br class="">
<br class="">
 #elif !defined(_LIBCPP_STDLIB_H)<br class="">
@@ -93,63 +97,7 @@ void *aligned_alloc(size_t alignment, size_t size);                       // C11<br class="">
 #include_next <stdlib.h><br class="">
<br class="">
 #ifdef __cplusplus<br class="">
-extern "C++" {<br class="">
-// abs<br class="">
-<br class="">
-#undef abs<br class="">
-#undef labs<br class="">
-#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
-#undef llabs<br class="">
-#endif<br class="">
-<br class="">
-// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined<br class="">
-#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
-inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {<br class="">
-  return __builtin_labs(__x);<br class="">
-}<br class="">
-#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
-inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {<br class="">
-  return __builtin_llabs(__x);<br class="">
-}<br class="">
-#endif // _LIBCPP_HAS_NO_LONG_LONG<br class="">
-#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
-<br class="">
-#if !(defined(_AIX) || defined(__sun__))<br class="">
-inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {<br class="">
-  return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h<br class="">
-}<br class="">
-<br class="">
-inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {<br class="">
-  return __builtin_fabs(__lcpp_x);<br class="">
-}<br class="">
-<br class="">
-inline _LIBCPP_INLINE_VISIBILITY long double<br class="">
-abs(long double __lcpp_x) _NOEXCEPT {<br class="">
-  return __builtin_fabsl(__lcpp_x);<br class="">
-}<br class="">
-#endif // !(defined(_AIX) || defined(__sun__))<br class="">
-<br class="">
-// div<br class="">
-<br class="">
-#undef div<br class="">
-#undef ldiv<br class="">
-#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
-#undef lldiv<br class="">
-#endif<br class="">
-<br class="">
-// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined<br class="">
-#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)<br class="">
-inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {<br class="">
-  return ::ldiv(__x, __y);<br class="">
-}<br class="">
-#ifndef _LIBCPP_HAS_NO_LONG_LONG<br class="">
-inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,<br class="">
-                                             long long __y) _NOEXCEPT {<br class="">
-  return ::lldiv(__x, __y);<br class="">
-}<br class="">
-#endif // _LIBCPP_HAS_NO_LONG_LONG<br class="">
-#endif // _LIBCPP_MSVCRT / __sun__ / _AIX<br class="">
-} // extern "C++"<br class="">
+#include <math.h><br class="">
 #endif  // __cplusplus<br class="">
<br class="">
 #endif  // _LIBCPP_STDLIB_H<br class="">
<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
libcxx-commits mailing list<br class="">
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank" rel="noreferrer" class="">libcxx-commits@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" rel="noreferrer noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a><br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></body></html>