From 4fc1126a282254ab4bef5ca529bdb9625e7d1473 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 12 Dec 2016 01:18:19 +0100 Subject: [PATCH] clean-up: mark subsystem implementations with noexcept and override throw() is deprecated noexcept behaves similar, but allows for optimisations and will be promoted to a part of the signature type in C++17 --- src/backend/enginefacade.cpp | 8 +++---- src/backend/netnodefacade.cpp | 8 +++---- src/backend/scriptrunnerfacade.cpp | 8 +++---- src/common/guifacade.cpp | 14 +++++------ src/common/subsys.cpp | 2 +- src/common/subsys.hpp | 6 ++--- src/proc/facade.cpp | 24 +++++++++---------- src/proc/play/dummy-player-service.cpp | 8 +++---- .../application/subsystem-runner-test.cpp | 8 +++---- 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/backend/enginefacade.cpp b/src/backend/enginefacade.cpp index f93e309fe..b261a5d8b 100644 --- a/src/backend/enginefacade.cpp +++ b/src/backend/enginefacade.cpp @@ -38,27 +38,27 @@ namespace backend { operator string () const { return "Engine"; } bool - shouldStart (lumiera::Option&) + shouldStart (lumiera::Option&) override { TODO ("determine, if renderengine should be started"); return false; } bool - start (lumiera::Option&, Subsys::SigTerm termination) + start (lumiera::Option&, Subsys::SigTerm termination) override { UNIMPLEMENTED ("pull up renderengine and register shutdown hook"); return false; } void - triggerShutdown () throw() + triggerShutdown () noexcept override { UNIMPLEMENTED ("initiate halting the engine"); } bool - checkRunningState () throw() + checkRunningState () noexcept override { //Lock guard (*this); TODO ("implement detecting running state"); diff --git a/src/backend/netnodefacade.cpp b/src/backend/netnodefacade.cpp index e084958ed..4a8673e8b 100644 --- a/src/backend/netnodefacade.cpp +++ b/src/backend/netnodefacade.cpp @@ -37,27 +37,27 @@ namespace backend { operator string () const { return "Renderfarm node"; } bool - shouldStart (lumiera::Option&) + shouldStart (lumiera::Option&) override { TODO ("determine, if render node service should be provided"); return false; } bool - start (lumiera::Option&, SigTerm termination) + start (lumiera::Option&, SigTerm termination) override { UNIMPLEMENTED ("open a render node server port and register shutdown hook"); return false; } void - triggerShutdown () throw() + triggerShutdown () noexcept override { UNIMPLEMENTED ("initiate shutting down the render node"); } bool - checkRunningState () throw() + checkRunningState () noexcept override { //Lock guard (*this); TODO ("implement detecting running state"); diff --git a/src/backend/scriptrunnerfacade.cpp b/src/backend/scriptrunnerfacade.cpp index 118d79061..d01bb588c 100644 --- a/src/backend/scriptrunnerfacade.cpp +++ b/src/backend/scriptrunnerfacade.cpp @@ -38,27 +38,27 @@ namespace backend { operator string () const { return "Script runner"; } bool - shouldStart (lumiera::Option&) + shouldStart (lumiera::Option&) override { TODO ("determine, if a script should be executed"); return false; } bool - start (lumiera::Option&, SigTerm termination) + start (lumiera::Option&, SigTerm termination) override { UNIMPLEMENTED ("start the script as defined by the options and register script abort/exit hook"); return false; } void - triggerShutdown () throw() + triggerShutdown () noexcept override { UNIMPLEMENTED ("halt any running script"); } bool - checkRunningState () throw() + checkRunningState () noexcept override { //Lock guard (*this); TODO ("implement detecting running state"); diff --git a/src/common/guifacade.cpp b/src/common/guifacade.cpp index 333b32a69..ff044e927 100644 --- a/src/common/guifacade.cpp +++ b/src/common/guifacade.cpp @@ -91,7 +91,7 @@ namespace gui { operator string () const { return "Lumiera GTK GUI"; } bool - shouldStart (lumiera::Option& opts) + shouldStart (lumiera::Option& opts) override { if (opts.isHeadless() || 0 < opts.getPort()) { @@ -103,7 +103,7 @@ namespace gui { } bool - start (lumiera::Option&, Subsys::SigTerm termination) + start (lumiera::Option&, Subsys::SigTerm termination) override { Lock guard (this); if (facade) return false; // already started @@ -116,15 +116,15 @@ namespace gui { } void - triggerShutdown () throw() + triggerShutdown () noexcept override { try { GuiNotification::facade().triggerGuiShutdown ("Application shutdown"); } - catch (...){} + ERROR_LOG_AND_IGNORE (guifacade, "trigger shutdown of the GUI"); } bool - checkRunningState () throw() + checkRunningState () noexcept override { return bool(facade); } @@ -158,8 +158,8 @@ namespace gui { WARN (guifacade, "GUI subsystem terminates, but GuiFacade isn't properly closed. " "Closing it forcedly; this indicates broken startup logic and should be fixed."); try { facade.reset (0); } - catch(...) { WARN_IF (lumiera_error_peek(), guifacade, "Ignoring error: %s", lumiera_error()); } - lumiera_error(); // clear any remaining error state... + ERROR_LOG_AND_IGNORE (guifacade, "forcibly closing the GUI"); + ENSURE (not lumiera_error_peek()); } } }; diff --git a/src/common/subsys.cpp b/src/common/subsys.cpp index 2a9b2446c..10d419b4f 100644 --- a/src/common/subsys.cpp +++ b/src/common/subsys.cpp @@ -43,7 +43,7 @@ namespace lumiera { bool - Subsys::isRunning() + Subsys::isRunning() noexcept { return checkRunningState(); } diff --git a/src/common/subsys.hpp b/src/common/subsys.hpp index 8a136a2a2..f7544e066 100644 --- a/src/common/subsys.hpp +++ b/src/common/subsys.hpp @@ -85,7 +85,7 @@ namespace lumiera { /** @return true if Up * @warning must not block nor throw. */ - bool isRunning(); + bool isRunning() noexcept; /** query application option state to determine @@ -109,7 +109,7 @@ namespace lumiera { * the SigTerm passed to #start must be invoked. * @note called within a locked context (barrier) * @warning must not block nor throw. */ - virtual void triggerShutdown () throw() =0; + virtual void triggerShutdown () noexcept =0; const std::vector @@ -122,7 +122,7 @@ namespace lumiera { * terminate at any point without further notice * Note further, that a subsystem must not be in * running state when signalling termination. */ - virtual bool checkRunningState() throw() =0; + virtual bool checkRunningState() noexcept =0; std::vector prereq_; }; diff --git a/src/proc/facade.cpp b/src/proc/facade.cpp index a2a1d02a5..203a5097a 100644 --- a/src/proc/facade.cpp +++ b/src/proc/facade.cpp @@ -41,27 +41,27 @@ namespace proc { operator string () const { return "Builder"; } bool - shouldStart (Option&) + shouldStart (Option&) override { TODO ("determine, if we need a Builder Thread"); return false; } bool - start (Option&, Subsys::SigTerm termination) + start (Option&, Subsys::SigTerm termination) override { UNIMPLEMENTED ("fire up a Builder in a separate Thread, and register shutdown hook"); return false; } void - triggerShutdown () throw() + triggerShutdown () noexcept override { UNIMPLEMENTED ("halt the Builder and cancel any build process"); /////TODO really cancel?? } bool - checkRunningState () throw() + checkRunningState () noexcept override { //Lock guard (*this); TODO ("implement detecting running state"); @@ -77,27 +77,27 @@ namespace proc { operator string () const { return "Session"; } bool - shouldStart (Option&) + shouldStart (Option&) override { TODO ("determine, if an existing Session should be loaded"); return false; } bool - start (Option&, Subsys::SigTerm termination) + start (Option&, Subsys::SigTerm termination) override { UNIMPLEMENTED ("load an existing session as denoted by the options and register shutdown hook"); return false; } void - triggerShutdown () throw() + triggerShutdown () noexcept override { UNIMPLEMENTED ("initiate closing this Session"); } bool - checkRunningState () throw() + checkRunningState () noexcept override { //Lock guard (*this); TODO ("implement detecting running state"); @@ -120,14 +120,14 @@ namespace proc { * @todo actually define cmdline options and parse/decide here! */ bool - shouldStart (Option&) + shouldStart (Option&) override { TODO ("extract options about specific output systems to be brought up"); return false; } bool - start (Option&, Subsys::SigTerm termination) + start (Option&, Subsys::SigTerm termination) override { this->completedSignal_ = termination; return play::OutputDirector::instance().connectUp(); @@ -137,14 +137,14 @@ namespace proc { void - triggerShutdown () throw() + triggerShutdown () noexcept override { play::OutputDirector::instance().triggerDisconnect (completedSignal_); } bool - checkRunningState () throw() + checkRunningState () noexcept override { return play::OutputDirector::instance().isOperational(); } diff --git a/src/proc/play/dummy-player-service.cpp b/src/proc/play/dummy-player-service.cpp index aafb29433..c59043745 100644 --- a/src/proc/play/dummy-player-service.cpp +++ b/src/proc/play/dummy-player-service.cpp @@ -59,13 +59,13 @@ namespace proc { bool - shouldStart (lumiera::Option&) + shouldStart (lumiera::Option&) override { return false; // for now the DummyPlayerService only comes "up" as dependency, } // but doesn't start as a subsystem on it's own. bool - start (lumiera::Option&, Subsys::SigTerm terminationHandle) + start (lumiera::Option&, Subsys::SigTerm terminationHandle) override { ASSERT (!thePlayer_); @@ -78,7 +78,7 @@ namespace proc { void - triggerShutdown () throw() + triggerShutdown () noexcept override { thePlayer_.reset(0); // note: shutdown of the DummyPlayerService instance may block @@ -86,7 +86,7 @@ namespace proc { } bool - checkRunningState () throw() + checkRunningState () noexcept override { return bool(thePlayer_); } diff --git a/tests/core/application/subsystem-runner-test.cpp b/tests/core/application/subsystem-runner-test.cpp index e838d7e9c..6b3594c8a 100644 --- a/tests/core/application/subsystem-runner-test.cpp +++ b/tests/core/application/subsystem-runner-test.cpp @@ -102,7 +102,7 @@ namespace test { bool - shouldStart (lumiera::Option&) + shouldStart (lumiera::Option&) override { string startSpec (extractID ("start",spec_)); return "true" ==startSpec @@ -112,7 +112,7 @@ namespace test { bool - start (lumiera::Option&, Subsys::SigTerm termination) + start (lumiera::Option&, Subsys::SigTerm termination) override { CHECK (!(isUp_|started_|didRun_), "attempt to start %s twice!", cStr(*this)); @@ -139,7 +139,7 @@ namespace test { } void - triggerShutdown () throw() + triggerShutdown () noexcept override { // note: *not* locking here... termRequest_ = true; @@ -148,7 +148,7 @@ namespace test { } bool - checkRunningState () throw() + checkRunningState () noexcept override { // note: *not* locking here... return isUp_;