From 19694aa213961daa5cbe2263bfaca53dc068a40c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 14 May 2020 12:28:18 -0600 Subject: [PATCH] fix compile errors --- src/libutil/error.cc | 16 ++++++++++++++++ src/libutil/error.hh | 16 ++-------------- src/libutil/types.hh | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 0765a2945..59628d875 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -3,6 +3,7 @@ #include #include #include "serialise.hh" +#include namespace nix { @@ -16,6 +17,21 @@ BaseError & BaseError::addPrefix(const FormatOrString & fs) return *this; } +const string& BaseError::calcWhat() const +{ + if (what_.has_value()) + return *what_; + else { + err.name = sname(); + + std::ostringstream oss; + oss << err; + what_ = oss.str(); + + return *what_; + } +} + std::optional ErrorInfo::programName = std::nullopt; std::ostream& operator<<(std::ostream &os, const hintformat &hf) diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 19c6e35a1..b374c2780 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -88,20 +88,8 @@ protected: mutable ErrorInfo err; mutable std::optional what_; - const string& calcWhat() const - { - if (what_.has_value()) - return *what_; - else { - err.name = sname(); - - std::ostringstream oss; - oss << err; - what_ = oss.str(); - - return *what_; - } - } + const string& calcWhat() const; + public: unsigned int status = 1; // exit status diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 66072e8f7..89ae108f9 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -6,7 +6,7 @@ #include #include #include - +#include namespace nix {