summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-04-05 16:25:02 (GMT)
committerNico Weber <nicolasweber@gmx.de>2018-04-05 16:25:02 (GMT)
commitdfed28c3073947cf6b77a53a6bab06285ff04a11 (patch)
treee83a90a843d6a0dc38de90fc1cedef4129b248d3 /src
parent5d43e7457162c74bab25ada64a5bf87489ca5896 (diff)
downloadNinja-dfed28c3073947cf6b77a53a6bab06285ff04a11.zip
Ninja-dfed28c3073947cf6b77a53a6bab06285ff04a11.tar.gz
Ninja-dfed28c3073947cf6b77a53a6bab06285ff04a11.tar.bz2
make ninja build with -std=c++17
Ninja is supposed to be able to build as C++98 so it can run on old systems, but it should also be possible to optionally build it with newer dialects.
Diffstat (limited to 'src')
-rw-r--r--src/build.cc7
-rw-r--r--src/build.h4
2 files changed, 10 insertions, 1 deletions
diff --git a/src/build.cc b/src/build.cc
index 61ef0e8..5239637 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -441,7 +441,12 @@ bool Plan::CleanNode(DependencyScan* scan, Node* node, string* err) {
vector<Node*>::iterator
begin = (*oe)->inputs_.begin(),
end = (*oe)->inputs_.end() - (*oe)->order_only_deps_;
- if (find_if(begin, end, mem_fun(&Node::dirty)) == end) {
+#if __cplusplus < 201703L
+#define MEM_FN mem_fun
+#else
+#define MEM_FN mem_fn // mem_fun was removed in C++17.
+#endif
+ if (find_if(begin, end, MEM_FN(&Node::dirty)) == end) {
// Recompute most_recent_input.
Node* most_recent_input = NULL;
for (vector<Node*>::iterator i = begin; i != end; ++i) {
diff --git a/src/build.h b/src/build.h
index 43786f1..e38719c 100644
--- a/src/build.h
+++ b/src/build.h
@@ -178,7 +178,11 @@ struct Builder {
State* state_;
const BuildConfig& config_;
Plan plan_;
+#if __cplusplus < 201703L
auto_ptr<CommandRunner> command_runner_;
+#else
+ unique_ptr<CommandRunner> command_runner_; // auto_ptr was removed in C++17.
+#endif
BuildStatus* status_;
private: