summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-07-26 17:42:39 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-07-26 17:42:39 +0000
commitdce0696a3601d73fddd216a4092c287ede0ac9a7 (patch)
tree3428309648f7b89b5ad4b6aa0cfdafebc01238ca /libcxx/src
parenta5fc75f4f561a5a82c9c0d097ff880a6074698e6 (diff)
downloadbcm5719-llvm-dce0696a3601d73fddd216a4092c287ede0ac9a7.tar.gz
bcm5719-llvm-dce0696a3601d73fddd216a4092c287ede0ac9a7.zip
Patch by Andrew C. Morrow: Conditionally include cxxabi.h in new.cpp and typeinfo.cpp. Both new.cpp and typeinfo.cpp have code that is conditionally compiled
based on the LIBCXXRT and _LIBCPPABI_VERSION defines, but those files do not currently include <cxxabi.h> in the non __APPLE__ case. The attached patch updates those files so that for non __APPLE__ builds <cxxabi.h> is included if available or if LIBCXXRT is set. I'm modeling this on the recent updates to exception.cpp. llvm-svn: 160790
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/new.cpp11
-rw-r--r--libcxx/src/typeinfo.cpp7
2 files changed, 17 insertions, 1 deletions
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 1fb4b2da40d..3ad593a3c0e 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -11,6 +11,10 @@
#include "new"
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
#if __APPLE__
#include <cxxabi.h>
@@ -21,7 +25,12 @@
#define __new_handler __cxxabiapple::__cxa_new_handler
#endif
#else // __APPLE__
- static std::new_handler __new_handler;
+ #if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+ #include <cxxabi.h>
+ #endif // __has_include(<cxxabi.h>)
+ #ifndef _LIBCPPABI_VERSION
+ static std::new_handler __new_handler;
+ #endif // _LIBCPPABI_VERSION
#endif
// Implement all new and delete operators as weak definitions
diff --git a/libcxx/src/typeinfo.cpp b/libcxx/src/typeinfo.cpp
index cfc64ef57a6..6bab0771f42 100644
--- a/libcxx/src/typeinfo.cpp
+++ b/libcxx/src/typeinfo.cpp
@@ -7,8 +7,15 @@
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
+
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
#if __APPLE__
#include <cxxabi.h>
+#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+#include <cxxabi.h>
#endif
#include "typeinfo"
OpenPOWER on IntegriCloud