diff options
-rw-r--r-- | ponymix.cc | 2 | ||||
-rw-r--r-- | pulse.cc | 6 | ||||
-rw-r--r-- | pulse.h | 10 |
3 files changed, 18 insertions, 0 deletions
@@ -83,6 +83,8 @@ static const char* type_to_string(enum DeviceType t) { case DEVTYPE_SOURCE_OUTPUT: return "source-output"; } + + throw unreachable(); } static enum DeviceType string_to_devtype_or_die(const char* str) { @@ -192,6 +192,8 @@ Device* PulseClient::GetDevice(const uint32_t index, enum DeviceType type) { case DEVTYPE_SOURCE_OUTPUT: return GetSourceOutput(index); } + + throw unreachable(); } Device* PulseClient::GetDevice(const string& name, enum DeviceType type) { @@ -205,6 +207,8 @@ Device* PulseClient::GetDevice(const string& name, enum DeviceType type) { case DEVTYPE_SOURCE_OUTPUT: return GetSourceOutput(name); } + + throw unreachable(); } const vector<Device>& PulseClient::GetDevices(enum DeviceType type) const { @@ -218,6 +222,8 @@ const vector<Device>& PulseClient::GetDevices(enum DeviceType type) const { case DEVTYPE_SOURCE_OUTPUT: return GetSourceOutputs(); } + + throw unreachable(); } Device* PulseClient::GetSink(const uint32_t index) { @@ -7,6 +7,7 @@ // C++ #include <memory> +#include <stdexcept> #include <string> #include <vector> @@ -260,4 +261,13 @@ class PulseClient { unique_ptr<Notifier> notifier_; }; +class unreachable : public std::runtime_error { + public: + unreachable() throw() : + std::runtime_error("unreachable code path encountered") {} + + unreachable(const std::string& message) throw() : + std::runtime_error(message) {} +}; + // vim: set et ts=2 sw=2: |