[libcxx] r191981 - 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.

Howard Hinnant hhinnant at apple.com
Fri Oct 4 14:24:21 PDT 2013


Author: hhinnant
Date: Fri Oct  4 16:24:21 2013
New Revision: 191981

URL: http://llvm.org/viewvc/llvm-project?rev=191981&view=rev
Log:
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.

Modified:
    libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=191981&r1=191980&r2=191981&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Oct  4 16:24:21 2013
@@ -590,4 +590,16 @@ template <unsigned> struct __static_asse
 #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





More information about the cfe-commits mailing list