[libcxx] r250507 - Remove a long-standing __has_include hack.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 04:14:33 PDT 2015


Author: d0k
Date: Fri Oct 16 06:14:30 2015
New Revision: 250507

URL: http://llvm.org/viewvc/llvm-project?rev=250507&view=rev
Log:
Remove a long-standing __has_include hack.

This was put in to get libc++ building without libcxxabi. We now have
macros that show that we are building against libcxxabi so use that
instead. This guards against existing but broken cxxabi.h headers on the
system.

Modified:
    libcxx/trunk/src/exception.cpp
    libcxx/trunk/src/new.cpp
    libcxx/trunk/src/stdexcept.cpp
    libcxx/trunk/src/typeinfo.cpp

Modified: libcxx/trunk/src/exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/exception.cpp?rev=250507&r1=250506&r2=250507&view=diff
==============================================================================
--- libcxx/trunk/src/exception.cpp (original)
+++ libcxx/trunk/src/exception.cpp Fri Oct 16 06:14:30 2015
@@ -12,10 +12,6 @@
 #include "exception"
 #include "new"
 
-#ifndef __has_include
-#define __has_include(inc) 0
-#endif
-
 #if defined(__APPLE__) && !defined(LIBCXXRT)
   #include <cxxabi.h>
 
@@ -29,16 +25,16 @@
     #define __terminate_handler  __cxxabiapple::__cxa_terminate_handler
     #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
   #endif  // _LIBCPPABI_VERSION
-#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || __has_include(<cxxabi.h>)
+#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
   #include <cxxabi.h>
   using namespace __cxxabiv1;
   #if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
     #define HAVE_DEPENDENT_EH_ABI 1
   #endif
-#elif !defined(__GLIBCXX__) // __has_include(<cxxabi.h>)
+#elif !defined(__GLIBCXX__) // defined(LIBCXX_BUILDING_LIBCXXABI)
   static std::terminate_handler  __terminate_handler;
   static std::unexpected_handler __unexpected_handler;
-#endif // __has_include(<cxxabi.h>)
+#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
 
 namespace std
 {

Modified: libcxx/trunk/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=250507&r1=250506&r2=250507&view=diff
==============================================================================
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Fri Oct 16 06:14:30 2015
@@ -13,10 +13,6 @@
 
 #include "new"
 
-#ifndef __has_include
-#define __has_include(inc) 0
-#endif
-
 #if defined(__APPLE__) && !defined(LIBCXXRT)
     #include <cxxabi.h>
 
@@ -27,9 +23,9 @@
         #define __new_handler __cxxabiapple::__cxa_new_handler
     #endif
 #else  // __APPLE__
-    #if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+    #if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
         #include <cxxabi.h>
-    #endif  // __has_include(<cxxabi.h>)
+    #endif  // defined(LIBCXX_BUILDING_LIBCXXABI)
     #if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
         static std::new_handler __new_handler;
     #endif  // _LIBCPPABI_VERSION

Modified: libcxx/trunk/src/stdexcept.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=250507&r1=250506&r2=250507&view=diff
==============================================================================
--- libcxx/trunk/src/stdexcept.cpp (original)
+++ libcxx/trunk/src/stdexcept.cpp Fri Oct 16 06:14:30 2015
@@ -13,12 +13,8 @@
 #include "string"
 #include "system_error"
 
-#ifndef __has_include
-#define __has_include(inc) 0
-#endif
-
 /* For _LIBCPPABI_VERSION */
-#if __has_include(<cxxabi.h>) || defined(__APPLE_) || defined(LIBCXXRT)
+#if defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE_) || defined(LIBCXXRT)
 #include <cxxabi.h>
 #endif
 

Modified: libcxx/trunk/src/typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/typeinfo.cpp?rev=250507&r1=250506&r2=250507&view=diff
==============================================================================
--- libcxx/trunk/src/typeinfo.cpp (original)
+++ libcxx/trunk/src/typeinfo.cpp Fri Oct 16 06:14:30 2015
@@ -8,13 +8,8 @@
 //===----------------------------------------------------------------------===//
 #include <stdlib.h>
 
-#ifndef __has_include
-#define __has_include(inc) 0
-#endif
-
-#ifdef __APPLE__
-#include <cxxabi.h>
-#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+#if defined(__APPLE__) || defined(LIBCXXRT) ||                                 \
+    defined(LIBCXX_BUILDING_LIBCXXABI)
 #include <cxxabi.h>
 #endif
 




More information about the cfe-commits mailing list