Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nodejs4 originally assumed all versions of macOS use tr1. This is not true with libc++, which is the default on Mavericks and later. The original patch was conditionally applied on Mavericks and later. It removed the use of tr1 in one place, but not in another place, so the build failed on Mavericks and later, and presumably on earlier systems configured to use libc++. nodejs6 contains preprocessor directives that avoids using tr1 on Mavericks and later. This would presumably still fail on earlier systems configured to use libc++. This new patch avoids tr1 when libc++ is in use, regardless of macOS version, and is unconditionally applied. Closes: https://trac.macports.org/ticket/53401
- Loading branch information
1 parent
58552b3
commit 5ea23e3
Showing
2 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
--- src/util.h.orig | ||
+++ src/util.h | ||
@@ -8,11 +8,7 @@ | ||
--- src/util.h.orig 2017-01-05 15:05:24.000000000 -0600 | ||
+++ src/util.h 2017-02-11 00:41:28.000000000 -0600 | ||
@@ -8,7 +8,13 @@ | ||
#include <stddef.h> | ||
#include <stdlib.h> | ||
|
||
-#ifdef __APPLE__ | ||
-#include <tr1/type_traits> // NOLINT(build/c++tr1) | ||
-#else | ||
+// libc++ provides a C++11 <type_traits> header. | ||
+#include <ciso646> | ||
+#if defined(__APPLE__) && !defined(_LIBCPP_VERSION) | ||
+#define USE_TR1_TYPE_TRAITS | ||
+#endif | ||
+ | ||
+#ifdef USE_TR1_TYPE_TRAITS | ||
#include <tr1/type_traits> // NOLINT(build/c++tr1) | ||
#else | ||
#include <type_traits> // std::remove_reference | ||
-#endif | ||
|
||
namespace node { | ||
@@ -27,7 +33,7 @@ | ||
inline void* Malloc(size_t size); | ||
inline void* Calloc(size_t n, size_t size); | ||
|
||
-#ifdef __APPLE__ | ||
+#ifdef USE_TR1_TYPE_TRAITS | ||
template <typename T> using remove_reference = std::tr1::remove_reference<T>; | ||
#else | ||
template <typename T> using remove_reference = std::remove_reference<T>; |