Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.

llvm-svn: 222794
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 53deb607d9b3e47035d71f336b64f02253c46286
diff --git a/include/__config b/include/__config
index d34bb7c..e1e2359 100644
--- a/include/__config
+++ b/include/__config
@@ -644,6 +644,8 @@
 #define _LIBCPP_ELAST __ELASTERROR
 #elif defined(__APPLE__)
 // Not _LIBCPP_ELAST needed on Apple
+#elif defined(__sun__)
+#define _LIBCPP_ELAST ESTALE
 #else
 // Warn here so that the person doing the libcxx port has an easier time:
 #warning This platform's ELAST hasn't been ported yet
diff --git a/include/__locale b/include/__locale
index 5ccd795..4711620 100644
--- a/include/__locale
+++ b/include/__locale
@@ -29,8 +29,10 @@
 # if __ANDROID_API__ <= 20
 #  include <support/android/locale_bionic.h>
 # endif
+#elif defined(__sun__)
+# include <support/solaris/xlocale.h>
 #elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-    || defined(__sun__)   || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
+    || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
 # include <xlocale.h>
 #endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
 
diff --git a/include/support/solaris/xlocale.h b/include/support/solaris/xlocale.h
index 875a39a..6b5b544 100644
--- a/include/support/solaris/xlocale.h
+++ b/include/support/solaris/xlocale.h
@@ -14,6 +14,8 @@
 #ifndef __XLOCALE_H_INCLUDED
 #define __XLOCALE_H_INCLUDED
 
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/tuple b/include/tuple
index aa7185c..5fc27f9 100644
--- a/include/tuple
+++ b/include/tuple
@@ -376,9 +376,9 @@
 _LIBCPP_INLINE_VISIBILITY
 void __swallow(_Tp&&...) _NOEXCEPT {}
 
-template <bool ..._B>
+template <bool ..._Pred>
 struct __all
-    : is_same<__all<_B...>, __all<(_B, true)...>>
+    : is_same<__all<_Pred...>, __all<(_Pred, true)...>>
 { };
 
 template <class _Tp>