From f677bc4165b05a3c7e7e193734cd92e722de75a0 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 4 Oct 2013 21:24:21 +0000 Subject: [PATCH] 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 --- include/__config | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/__config b/include/__config index b0d4a7bc..893dd805 100644 --- a/include/__config +++ b/include/__config @@ -590,4 +590,16 @@ template struct __static_assert_check {}; #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