G M: Fix libcxx's detection of rtti disablement for g++.exe and cl.exe. When RTTI is NOT enabled, _LIBCPP_NO_RTTI is defined.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191981 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index b0d4a7b..893dd80 100644
--- a/include/__config
+++ b/include/__config
@@ -590,4 +590,16 @@
 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
 #endif
 
+// Try to find out if RTTI is disabled.
+// g++ and cl.exe have RTTI on by default and define a macro when it is.
+// g++ only defines the macro in 4.3.2 and onwards.
+#if !defined(_LIBCPP_NO_RTTI)
+#  if defined(__GNUG__) && (__GNUC__ >= 4 && \
+   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
+#    define _LIBCPP_NO_RTTI
+#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
+#    define _LIBCPP_NO_RTTI
+#  endif
+#endif
+
 #endif  // _LIBCPP_CONFIG