summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/PortID.hpp3
-rw-r--r--src/event_to_string.cpp6
-rw-r--r--src/warnings.hpp6
3 files changed, 15 insertions, 0 deletions
diff --git a/src/PortID.hpp b/src/PortID.hpp
index e399220..d92f08e 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -19,6 +19,7 @@
#include "ClientID.hpp"
#include "ClientType.hpp"
+#include "warnings.hpp"
#include <cassert>
#include <iostream>
@@ -68,6 +69,8 @@ struct PortID
case Type::alsa:
return ClientID::alsa(_alsa_client);
}
+
+ PATCHAGE_UNREACHABLE();
}
Type type() const { return _type; }
diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp
index 503144c..cdfeee4 100644
--- a/src/event_to_string.cpp
+++ b/src/event_to_string.cpp
@@ -43,6 +43,8 @@ struct EventPrinter
case ClientType::alsa:
return "ALSA";
}
+
+ PATCHAGE_UNREACHABLE();
}
std::string operator()(const DriverAttachmentEvent& event)
@@ -80,6 +82,8 @@ struct EventPrinter
case PortType::jack_cv:
return "JACK CV";
}
+
+ PATCHAGE_UNREACHABLE();
}
std::string operator()(const SignalDirection direction)
@@ -92,6 +96,8 @@ struct EventPrinter
case SignalDirection::duplex:
return "duplex";
}
+
+ PATCHAGE_UNREACHABLE();
}
std::string operator()(const PortCreationEvent& event)
diff --git a/src/warnings.hpp b/src/warnings.hpp
index 31cdf42..6931bee 100644
--- a/src/warnings.hpp
+++ b/src/warnings.hpp
@@ -54,4 +54,10 @@
#endif
+#if defined(__GNUC__)
+# define PATCHAGE_UNREACHABLE() __builtin_unreachable()
+#else
+# define PATCHAGE_UNREACHABLE()
+#endif
+
#endif // PATCHAGE_WARNINGS_HPP