From e2f623a4cff59a95b221322bf1b8de217fd12966 Mon Sep 17 00:00:00 2001 From: Howard Hellyer Date: Wed, 8 Feb 2017 15:43:12 +0000 Subject: [PATCH 1/2] mac: Fix compilation errors against Node > v5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only use libc++ on Mac when Node itself supports it. (Node 6 and higher.) Don’t use std::prev as that requires libc++ --- binding.gyp | 5 ++++- src/node_report.cc | 27 +++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/binding.gyp b/binding.gyp index 17c3b64..b0dd407 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,4 +1,7 @@ { + 'variables': { + 'node_major_version': ' 5", { "xcode_settings": { 'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', diff --git a/src/node_report.cc b/src/node_report.cc index 5dba780..864b24b 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -264,26 +264,21 @@ void SetVersionString(Isolate* isolate) { // (ares: 1.10.1-DEV, http_parser: 2.7.0, icu: 57.1, modules: 48, // openssl: 1.0.2j, uv: 1.9.1, v8: 5.1.281.84, zlib: 1.2.8) const size_t wrap = 80; - size_t line_length = 1; version_string += "("; + const char* separator = ""; + std::string versions = ""; for (auto it : comp_versions) { - std::string component_name = it.first; - std::string component_version = it.second; - size_t length = component_name.length() + component_version.length() + 2; - if (line_length + length + 1 >= wrap) { - version_string += "\n "; - line_length = 1; - } - version_string += component_name; - version_string += ": "; - version_string += component_version; - line_length += length; - if (it != *std::prev(comp_versions.end())) { - version_string += ", "; - line_length += 2; + std::string comp_version_string = it.first; + comp_version_string += ": "; + comp_version_string += it.second; + versions += separator; + if (wrap - (versions.length() % wrap) < comp_version_string.length()) { + versions += "\n "; } + separator = ", "; + versions += comp_version_string; } - version_string += ")\n"; + version_string += versions + ")\n"; } /******************************************************************************* From 8c046aafafbfe60f4684bd64ac64cc5e035b53e0 Mon Sep 17 00:00:00 2001 From: Howard Hellyer Date: Thu, 9 Feb 2017 10:29:07 +0000 Subject: [PATCH 2/2] mac: Fix compilation errors against Node > v5 Remove the change to binding.gyp and pick up Node.js defaults. --- binding.gyp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/binding.gyp b/binding.gyp index b0dd407..b3d05ac 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,7 +1,4 @@ { - 'variables': { - 'node_major_version': ' 5", { - "xcode_settings": { - 'CLANG_CXX_LIBRARY': 'libc++', - 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', - } - }], ], "defines": [ 'NODEREPORT_VERSION="