From 194a1b91af6d8848e4cc0dfbdcc153ee2dbed140 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 29 Mar 2024 20:26:38 -0700 Subject: [PATCH] Make things that can throw not noexcept anymore This does involve making a large number of destructors able to throw, because we had to change it high in the class hierarchy. Oh well. Change-Id: Ib62d3d6895b755f20322bb8acc9bf43daf0174b2 --- src/libstore/build/derivation-goal.cc | 2 +- src/libstore/build/derivation-goal.hh | 2 +- src/libstore/build/goal.hh | 2 +- src/libstore/build/local-derivation-goal.cc | 2 +- src/libstore/build/local-derivation-goal.hh | 2 +- src/libstore/store-api.hh | 4 ++-- src/libutil/util.cc | 2 +- src/libutil/util.hh | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 5e0795115..f879a580e 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -108,7 +108,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, const BasicDerivation } -DerivationGoal::~DerivationGoal() +DerivationGoal::~DerivationGoal() noexcept(false) { /* Careful: we should never ever throw an exception from a destructor. */ diff --git a/src/libstore/build/derivation-goal.hh b/src/libstore/build/derivation-goal.hh index ddb5ee1e3..28aa6afbe 100644 --- a/src/libstore/build/derivation-goal.hh +++ b/src/libstore/build/derivation-goal.hh @@ -215,7 +215,7 @@ struct DerivationGoal : public Goal DerivationGoal(const StorePath & drvPath, const BasicDerivation & drv, const OutputsSpec & wantedOutputs, Worker & worker, BuildMode buildMode = bmNormal); - virtual ~DerivationGoal(); + virtual ~DerivationGoal() noexcept(false); void timedOut(Error && ex) override; diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index 9af083230..5b755c275 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -127,7 +127,7 @@ public: : worker(worker) { } - virtual ~Goal() + virtual ~Goal() noexcept(false) { trace("goal destroyed"); } diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index ef170d815..0709dcbcb 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -96,7 +96,7 @@ void handleDiffHook( const Path LocalDerivationGoal::homeDir = "/homeless-shelter"; -LocalDerivationGoal::~LocalDerivationGoal() +LocalDerivationGoal::~LocalDerivationGoal() noexcept(false) { /* Careful: we should never ever throw an exception from a destructor. */ diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh index 05c2c3a56..b7f317fb6 100644 --- a/src/libstore/build/local-derivation-goal.hh +++ b/src/libstore/build/local-derivation-goal.hh @@ -179,7 +179,7 @@ struct LocalDerivationGoal : public DerivationGoal using DerivationGoal::DerivationGoal; - virtual ~LocalDerivationGoal() override; + virtual ~LocalDerivationGoal() noexcept(false) override; /** * Whether we need to perform hash rewriting if there are valid output paths. diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 88c182b94..cb9f8e4a6 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -108,7 +108,7 @@ struct StoreConfig : public Config static StringSet getDefaultSystemFeatures(); - virtual ~StoreConfig() { } + virtual ~StoreConfig() noexcept(false) { } /** * The name of this type of store. @@ -220,7 +220,7 @@ public: */ virtual void init() {}; - virtual ~Store() { } + virtual ~Store() noexcept(false) { } virtual std::string getUri() = 0; diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 9b65bd77f..5cd4df8e6 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -947,7 +947,7 @@ Pid::Pid(pid_t pid) } -Pid::~Pid() +Pid::~Pid() noexcept(false) { if (pid != -1) kill(); } diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 860ddae06..29a70447e 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -335,7 +335,7 @@ public: AutoCloseFD(AutoCloseFD&& fd); ~AutoCloseFD(); AutoCloseFD& operator =(const AutoCloseFD & fd) = delete; - AutoCloseFD& operator =(AutoCloseFD&& fd); + AutoCloseFD& operator =(AutoCloseFD&& fd) noexcept(false); int get() const; explicit operator bool() const; int release(); @@ -384,7 +384,7 @@ class Pid public: Pid(); Pid(pid_t pid); - ~Pid(); + ~Pid() noexcept(false); void operator =(pid_t pid); operator pid_t(); int kill();