aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ponymix.cc2
-rw-r--r--pulse.cc6
-rw-r--r--pulse.h10
3 files changed, 18 insertions, 0 deletions
diff --git a/ponymix.cc b/ponymix.cc
index 37dec3f..a07059d 100644
--- a/ponymix.cc
+++ b/ponymix.cc
@@ -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) {
diff --git a/pulse.cc b/pulse.cc
index 5bae79a..64bef66 100644
--- a/pulse.cc
+++ b/pulse.cc
@@ -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) {
diff --git a/pulse.h b/pulse.h
index 55b07c3..32dfe25 100644
--- a/pulse.h
+++ b/pulse.h
@@ -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: