patch by Jesse Towner, and bug fix by Sebastian Redl

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110724 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index a3518d9..4279736 100644
--- a/include/__config
+++ b/include/__config
@@ -73,6 +73,76 @@
 
 #define _LIBCPP_ALWAYS_INLINE  __attribute__((__always_inline__))
 
+#if defined(__clang__)
+
+#if !(__has_feature(cxx_exceptions))
+#define _LIBCPP_NO_EXCEPTIONS
+#endif
+
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_STRONG_USING
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+
+#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_NULLPTR
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_VARIADICS
+
+#else
+
+#if __has_feature(cxx_rvalue_references)
+#define _LIBCPP_MOVE
+#endif
+
+#if !(__has_feature(cxx_decltype))
+#define _LIBCPP_HAS_NO_DECLTYPE
+#endif
+
+#if !(__has_feature(cxx_deleted_functions))
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#endif
+
+#if !(__has_feature(cxx_nullptr))
+#define _LIBCPP_HAS_NO_NULLPTR
+#endif
+
+#if !(__has_feature(cxx_static_assert))
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#endif
+
+#if !(__has_feature(cxx_variadic_templates))
+#define _LIBCPP_HAS_NO_VARIADICS
+#endif
+
+#endif
+
+#elif defined(__GNUC__)
+
+#if !__EXCEPTIONS
+#define _LIBCPP_NO_EXCEPTIONS
+#endif
+
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+
+#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_NULLPTR
+#define _LIBCPP_HAS_NO_STATIC_ASSERT
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_VARIADICS
+
+#else
+
 #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
 #define _LIBCPP_MOVE
 #endif
@@ -81,23 +151,22 @@
 #define _LIBCPP_HAS_NO_STATIC_ASSERT
 #endif
 
-#define _LIBCPP_HAS_NO_NULLPTR
-
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
-#define _LIBCPP_HAS_NO_VARIADICS
-#define _LIBCPP_HAS_NO_DECLTYPE
-#endif
-
 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
-#define _LIBCPP_HAS_NO_UNICODE_CHARS
 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_UNICODE_CHARS
+#define _LIBCPP_HAS_NO_VARIADICS
 #endif
 
-#if defined(__clang__)
-#define _LIBCPP_HAS_NO_STRONG_USING
+#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
+#define _LIBCPP_HAS_NO_NULLPTR
 #endif
 
-#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
+
+#endif
 
 #ifdef _LIBCPP_HAS_NO_STRONG_USING
 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
@@ -106,6 +175,7 @@
 #else
 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
 #define _LIBCPP_END_NAMESPACE_STD  } }
+#define _STD std::_LIBCPP_NAMESPACE
 
 namespace std {
 namespace _LIBCPP_NAMESPACE {
@@ -113,12 +183,11 @@
 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
 }
 
-#define _STD std::_LIBCPP_NAMESPACE
 #endif
 
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
-    typedef unsigned short char16_t;
-    typedef unsigned int   char32_t;
+typedef unsigned short char16_t;
+typedef unsigned int   char32_t;
 #endif
 
 #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
@@ -133,13 +202,7 @@
 #endif
 
 #ifdef _LIBCPP_HAS_NO_DECLTYPE
-
 #define decltype(x) __typeof__(x)
-
-#endif
-
-#if !__EXCEPTIONS
-#define _LIBCPP_NO_EXCEPTIONS
 #endif
 
 #endif  // _LIBCPP_CONFIG