Fixes for macOS

Building on macOS with the latest nixpkgs master and NixOS/nixpkgs#77147
fails.  It seems some `std::experimental` (optional) for instance are
not available as `experimental`, but are in `std`.  Also `toJSON` is
missing for `atomic< unsigned long long >`.
This commit is contained in:
Hamish Mackenzie 2020-01-07 12:38:06 +13:00
parent d0f1bda0b8
commit c40c887e50
No known key found for this signature in database
GPG key ID: 538A4CC29D74DADF
3 changed files with 6 additions and 5 deletions

View file

@ -6,7 +6,7 @@
#include <algorithm>
#include <thread>
#include <cstring>
#include <experimental/optional>
#include <optional>
#include <sys/types.h>
#include <sys/wait.h>
@ -31,7 +31,7 @@ struct Evaluator
typedef std::map<JobsetName, Jobset> Jobsets;
std::experimental::optional<JobsetName> evalOne;
std::optional<JobsetName> evalOne;
const size_t maxEvals;

View file

@ -23,6 +23,7 @@ namespace nix {
template<> void toJSON<std::atomic<long>>(std::ostream & str, const std::atomic<long> & n) { str << n; }
template<> void toJSON<std::atomic<unsigned long>>(std::ostream & str, const std::atomic<unsigned long> & n) { str << n; }
template<> void toJSON<std::atomic<unsigned long long>>(std::ostream & str, const std::atomic<unsigned long long> & n) { str << n; }
template<> void toJSON<double>(std::ostream & str, const double & n) { str << n; }
}

View file

@ -23,7 +23,7 @@ struct Connection : pqxx::connection
class receiver : public pqxx::notification_receiver
{
std::experimental::optional<std::string> status;
std::optional<std::string> status;
public:
@ -35,9 +35,9 @@ public:
status = payload;
};
std::experimental::optional<std::string> get() {
std::optional<std::string> get() {
auto s = status;
status = std::experimental::nullopt;
status = std::nullopt;
return s;
}
};